summaryrefslogtreecommitdiff
path: root/gfx/graphite2/src/inc/locale2lcid.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/graphite2/src/inc/locale2lcid.h')
-rw-r--r--gfx/graphite2/src/inc/locale2lcid.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/gfx/graphite2/src/inc/locale2lcid.h b/gfx/graphite2/src/inc/locale2lcid.h
index fc2d384b4..bc3e3d830 100644
--- a/gfx/graphite2/src/inc/locale2lcid.h
+++ b/gfx/graphite2/src/inc/locale2lcid.h
@@ -273,6 +273,11 @@ public:
while (old[len]) len++;
len += 2;
mLangLookup[a][b] = gralloc<const IsoLangEntry *>(len);
+ if (!mLangLookup[a][b])
+ {
+ mLangLookup[a][b] = old;
+ continue;
+ }
mLangLookup[a][b][--len] = NULL;
mLangLookup[a][b][--len] = &LANG_ENTRIES[i];
while (--len >= 0)
@@ -285,6 +290,7 @@ public:
else
{
mLangLookup[a][b] = gralloc<const IsoLangEntry *>(2);
+ if (!mLangLookup[a][b]) continue;
mLangLookup[a][b][1] = NULL;
mLangLookup[a][b][0] = &LANG_ENTRIES[i];
}
@@ -295,8 +301,8 @@ public:
~Locale2Lang()
{
for (int i = 0; i != 26; ++i)
- for (int j = 0; j != 26; ++j)
- free(mLangLookup[i][j]);
+ for (int j = 0; j != 26; ++j)
+ free(mLangLookup[i][j]);
}
unsigned short getMsId(const char * locale) const
{
@@ -393,7 +399,7 @@ public:
++i;
continue;
}
- if (strcmp(mLangLookup[a][b][i]->maCountry, region) == 0)
+ if (region && (strncmp(mLangLookup[a][b][i]->maCountry, region, regionLength) == 0))
{
langId = mLangLookup[a][b][i]->mnLang;
break;