OK, LangStrings can now really be defined after they are used
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1984 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
61bd36d346
commit
88cfbb4702
3 changed files with 25 additions and 7 deletions
|
@ -441,11 +441,10 @@ int CEXEBuild::add_string_main(const char *string, int process) // returns offse
|
|||
free(cp);
|
||||
return 0;
|
||||
}
|
||||
if (build_userlangstrings.find(cp, 0, &idx) < 0) idx = -1;
|
||||
idx = GetUserString(cp);
|
||||
}
|
||||
free(cp);
|
||||
if (idx < 0) SetUserString(cp, 0, 0, process);
|
||||
return -((int)(idx+1+(sizeof(common_strings)+sizeof(installer_strings))/sizeof(int)));
|
||||
if (idx >= 0) return -((int)(idx+1+(sizeof(common_strings)+sizeof(installer_strings))/sizeof(int)));
|
||||
}
|
||||
|
||||
if (!process) return build_strlist.add(string,2);
|
||||
|
@ -470,11 +469,10 @@ int CEXEBuild::add_string_uninst(const char *string, int process) // returns off
|
|||
free(cp);
|
||||
return 0;
|
||||
}
|
||||
if (ubuild_userlangstrings.find(cp, 0, &idx) < 0) idx = -1;
|
||||
idx = GetUserString(cp);
|
||||
}
|
||||
free(cp);
|
||||
if (idx < 0) SetUserString(cp, 0, 0, process);
|
||||
return -((int)(idx+1+(sizeof(common_strings)+sizeof(uninstall_strings))/sizeof(int)));
|
||||
if (idx >= 0) return -((int)(idx+1+(sizeof(common_strings)+sizeof(uninstall_strings))/sizeof(int)));
|
||||
}
|
||||
|
||||
if (!process) return ubuild_strlist.add(string,2);
|
||||
|
|
|
@ -141,6 +141,7 @@ class CEXEBuild {
|
|||
StringTable *GetTable(LANGID &lang);
|
||||
int SetString(char *string, int id, int process, LANGID lang=0);
|
||||
int SetString(char *string, int id, int process, StringTable *table);
|
||||
int GetUserString(char *name);
|
||||
int SetUserString(char *name, LANGID lang, char *string, int process=1);
|
||||
int WriteStringTables();
|
||||
void FillDefaultsIfNeeded(StringTable *table, NLF *nlf=0);
|
||||
|
|
|
@ -191,6 +191,25 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table)
|
|||
return PS_OK;
|
||||
}
|
||||
|
||||
int CEXEBuild::GetUserString(char *name) {
|
||||
StringList *user_strings_list = 0;
|
||||
bool uninst;
|
||||
|
||||
if (!(uninst = !strnicmp(name,"un.",3))) {
|
||||
user_strings_list=&build_userlangstrings;
|
||||
}
|
||||
else {
|
||||
user_strings_list=&ubuild_userlangstrings;
|
||||
}
|
||||
|
||||
SetUserString(name, 0, 0, 0);
|
||||
|
||||
int idx = -1;
|
||||
user_strings_list->find(name, 0, &idx);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
int CEXEBuild::SetUserString(char *name, LANGID lang, char *string, int process/*=1*/) {
|
||||
StringTable *table = 0;
|
||||
if (string) {
|
||||
|
@ -214,7 +233,7 @@ int CEXEBuild::SetUserString(char *name, LANGID lang, char *string, int process/
|
|||
if (user_strings_list->find(name, 0, &idx) < 0) {
|
||||
// if lang string doesn't exist yet
|
||||
user_strings_list->add(name, 0);
|
||||
user_strings_list->find(name, 0, &idx);
|
||||
if (string) user_strings_list->find(name, 0, &idx);
|
||||
unsigned int new_size = user_strings_list->getnum() * sizeof(int);
|
||||
for (int i = 0; i < string_tables.size(); i++) {
|
||||
if (uninst) string_tables[i]->user_ustrings.resize(new_size, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue