diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index 092edbec6a..8594bc03f5 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -56,35 +56,6 @@ const uint8 DefaultCatalog::kDefaultCatalogAddOnPriority = 1; // give highest priority to our embedded catalog-add-on -void DefaultCatalog::SetSignature(const entry_ref &catalogOwner) -{ - // figure out mimetype from image - BFile objectFile(&catalogOwner, B_READ_ONLY); - BAppFileInfo objectInfo(&objectFile); - char objectSignature[B_MIME_TYPE_LENGTH]; - if (objectInfo.GetSignature(objectSignature) != B_OK) { - log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" - " localization.", catalogOwner.name); - fSignature = ""; - return; - } - - // drop supertype from mimetype (should be "application/"): - char* stripSignature = objectSignature; - while (*stripSignature != '/' && *stripSignature != '\0') - stripSignature ++; - - if (*stripSignature == '\0') - stripSignature = objectSignature; - else - stripSignature ++; - - log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", - catalogOwner.name, stripSignature); - fSignature = stripSignature; -} - - /*! Constructs a DefaultCatalog with given signature and language and reads the catalog from disk. InitCheck() will be B_OK if catalog could be loaded successfully, it will @@ -187,6 +158,36 @@ DefaultCatalog::~DefaultCatalog() } +void +DefaultCatalog::SetSignature(const entry_ref &catalogOwner) +{ + // figure out mimetype from image + BFile objectFile(&catalogOwner, B_READ_ONLY); + BAppFileInfo objectInfo(&objectFile); + char objectSignature[B_MIME_TYPE_LENGTH]; + if (objectInfo.GetSignature(objectSignature) != B_OK) { + log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" + " localization.", catalogOwner.name); + fSignature = ""; + return; + } + + // drop supertype from mimetype (should be "application/"): + char* stripSignature = objectSignature; + while (*stripSignature != '/' && *stripSignature != '\0') + stripSignature ++; + + if (*stripSignature == '\0') + stripSignature = objectSignature; + else + stripSignature ++; + + log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", + catalogOwner.name, stripSignature); + fSignature = stripSignature; +} + + status_t DefaultCatalog::SetRawString(const CatKey& key, const char *translated) { diff --git a/src/tools/locale/DefaultCatalog.cpp b/src/tools/locale/DefaultCatalog.cpp index 0bc1e219c2..86acdc6c84 100644 --- a/src/tools/locale/DefaultCatalog.cpp +++ b/src/tools/locale/DefaultCatalog.cpp @@ -56,45 +56,20 @@ static int16 kCatArchiveVersion = 1; // version of the catalog archive structure, bump this if you change it! -const char* getCatalogSignature(const entry_ref &catalogOwner) -{ - // figure out mimetype from image - BFile objectFile(&catalogOwner, B_READ_ONLY); - BAppFileInfo objectInfo(&objectFile); - char objectSignature[B_MIME_TYPE_LENGTH]; - if (objectInfo.GetSignature(objectSignature) != B_OK) { - log_team(LOG_ERR, "File %s has no mimesignature, so it can't use" - " localization.", catalogOwner.name); - return NULL; - } - - // drop supertype from mimetype (should be "application/"): - char* stripSignature = objectSignature; - while (*stripSignature != '/') - stripSignature ++; - stripSignature ++; - - log_team(LOG_DEBUG, "Image %s requested catalog with mimetype %s", - catalogOwner.name, stripSignature); - - return stripSignature; -} - - /*! Constructs a DefaultCatalog with given signature and language and reads the catalog from disk. InitCheck() will be B_OK if catalog could be loaded successfully, it will give an appropriate error-code otherwise. */ -DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *language, - uint32 fingerprint) +DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, + const char *language, uint32 fingerprint) : - BHashMapCatalog(getCatalogSignature(catalogOwner), language, fingerprint) + BHashMapCatalog("", language, fingerprint) { fInitCheck = B_NOT_SUPPORTED; fprintf(stderr, "trying to load default-catalog(sig=%s, lang=%s) results in %s", - getCatalogSignature(catalogOwner), language, strerror(fInitCheck)); + "", language, strerror(fInitCheck)); } @@ -133,6 +108,14 @@ DefaultCatalog::~DefaultCatalog() } +void +DefaultCatalog::SetSignature(const entry_ref &catalogOwner) +{ + // Not allowed for the build-tool version. + return; +} + + status_t DefaultCatalog::SetRawString(const CatKey& key, const char *translated) {