Fix catalogs stored in resources

We used the hash of the language code as a key for identifying catalogs.
However, hash do collide, and in particular, "en" and "fi" have the same hash.
Identify catalog resources by name instead.
This commit is contained in:
Adrien Destugues - PulkoMandy
2012-11-24 22:05:26 +01:00
parent f1ea2af3e7
commit f139447d0a
+2 -4
View File
@@ -273,10 +273,8 @@ DefaultCatalog::ReadFromResource(const entry_ref &appOrAddOnRef)
if (res != B_OK)
return res;
int mangledLanguage = CatKey::HashFun(fLanguageName.String(), 0);
size_t sz;
const void *buf = rsrc.LoadResource('CADA', mangledLanguage, &sz);
const void *buf = rsrc.LoadResource('CADA', fLanguageName, &sz);
if (!buf)
return B_NAME_NOT_FOUND;
@@ -370,7 +368,7 @@ DefaultCatalog::WriteToResource(const entry_ref &appOrAddOnRef)
if (res == B_OK) {
res = rsrc.AddResource('CADA', mangledLanguage,
mallocIO.Buffer(), mallocIO.BufferLength(),
BString(fLanguageName) << " catalog");
BString(fLanguageName));
}
return res;