Alpha-3 code space for language names

This commit is contained in:
Shorokhov Sergey 2019-08-07 23:08:52 +03:00
parent 3efdad36b0
commit 6583767d7e
2 changed files with 5 additions and 3 deletions

View File

@ -145,8 +145,8 @@ CLangMngr::CLang::CLang(const char *lang)
{ {
m_LookUpTable.clear(); m_LookUpTable.clear();
m_entries = 0; m_entries = 0;
strncpy(m_LanguageName, lang, 2); strncpy(m_LanguageName, lang, LANGNAME_LEN - 1);
m_LanguageName[2] = 0; m_LanguageName[LANGNAME_LEN - 1] = 0;
} }
void CLangMngr::CLang::AddEntry(int key, const char *definition) void CLangMngr::CLang::AddEntry(int key, const char *definition)

View File

@ -20,6 +20,8 @@
#define ERR_BADKEY 1 // Lang key not found #define ERR_BADKEY 1 // Lang key not found
#define ERR_BADLANG 2 // Invalid lang #define ERR_BADLANG 2 // Invalid lang
#define LANGNAME_LEN 4
struct sKeyDef struct sKeyDef
{ {
ke::AutoString* definition; ke::AutoString* definition;
@ -92,7 +94,7 @@ class CLangMngr : public ITextListener_INI
typedef THash<int, defentry> LookUpVec; typedef THash<int, defentry> LookUpVec;
typedef LookUpVec::iterator LookUpVecIter; typedef LookUpVec::iterator LookUpVecIter;
char m_LanguageName[3]; char m_LanguageName[LANGNAME_LEN];
// our lookup table // our lookup table
LookUpVec m_LookUpTable; LookUpVec m_LookUpTable;