+ IO works with new SetStaticBkColor
+ IO doesn't crash when a label has empty text + LangStrings now really start as "" when not defined git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2055 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
ac449dae62
commit
dba09fcf5e
4 changed files with 17 additions and 19 deletions
|
@ -542,7 +542,7 @@ bool ReadSettings(void) {
|
|||
pFields[nIdx].nFlags |= LookupToken(FlagTable, szResult);
|
||||
|
||||
pFields[nIdx].pszText = myGetProfileStringDup(szField, "TEXT");
|
||||
if (pFields[nIdx].nType == FIELD_LABEL) {
|
||||
if (pFields[nIdx].nType == FIELD_LABEL && pFields[nIdx].pszText) {
|
||||
char *p1, *p2;
|
||||
for (p1=p2=pFields[nIdx].pszText; *p1; p1++, p2++) {
|
||||
if (*p1 == '\\') {
|
||||
|
@ -722,14 +722,7 @@ BOOL CALLBACK cfgDlgProc(HWND hwndDlg,
|
|||
break;
|
||||
case WM_CTLCOLORSTATIC:
|
||||
case WM_CTLCOLORDLG:
|
||||
{
|
||||
COLORREF color = GetWindowLong((HWND)lParam, GWL_USERDATA);
|
||||
if (color) {
|
||||
LOGBRUSH b={BS_SOLID, color-1, 0};
|
||||
SetBkColor((HDC)wParam, b.lbColor);
|
||||
return (BOOL)CreateBrushIndirect(&b);
|
||||
}
|
||||
}
|
||||
return (BOOL)GetWindowLong((HWND)lParam, GWL_USERDATA);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -86,8 +86,11 @@ StringTable* CEXEBuild::GetTable(LANGID &lang) {
|
|||
memset(table, 0, sizeof(StringTable)-sizeof(GrowBuf)*2);
|
||||
table->lang_id = lang;
|
||||
|
||||
table->user_strings.resize(build_userlangstrings.getnum()*sizeof(int), 1);
|
||||
table->user_ustrings.resize(ubuild_userlangstrings.getnum()*sizeof(int), 1);
|
||||
table->user_strings.set_zeroing(1);
|
||||
table->user_ustrings.set_zeroing(1);
|
||||
|
||||
table->user_strings.resize(build_userlangstrings.getnum()*sizeof(int));
|
||||
table->user_ustrings.resize(ubuild_userlangstrings.getnum()*sizeof(int));
|
||||
|
||||
string_tables.push_back(table);
|
||||
}
|
||||
|
@ -236,8 +239,8 @@ int CEXEBuild::SetUserString(char *name, LANGID lang, char *string, int process/
|
|||
if (string) user_strings_list->find(name, 0, &idx);
|
||||
unsigned int new_size = user_strings_list->getnum() * sizeof(int);
|
||||
for (unsigned int i = 0; i < string_tables.size(); i++) {
|
||||
if (uninst) string_tables[i]->user_ustrings.resize(new_size, 1);
|
||||
else string_tables[i]->user_strings.resize(new_size, 1);
|
||||
if (uninst) string_tables[i]->user_ustrings.resize(new_size);
|
||||
else string_tables[i]->user_strings.resize(new_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class IGrowBuf
|
|||
{
|
||||
public:
|
||||
virtual int add(const void *data, int len)=0;
|
||||
virtual void resize(int newlen, int zero=0)=0;
|
||||
virtual void resize(int newlen)=0;
|
||||
virtual int getlen()=0;
|
||||
virtual void *get()=0;
|
||||
};
|
||||
|
@ -15,9 +15,11 @@ class IGrowBuf
|
|||
class GrowBuf : public IGrowBuf
|
||||
{
|
||||
public:
|
||||
GrowBuf() { m_alloc=m_used=0; m_s=NULL; }
|
||||
GrowBuf() { m_alloc=m_used=m_zero=0; m_s=NULL; }
|
||||
~GrowBuf() { free(m_s); }
|
||||
|
||||
void set_zeroing(int zero) { m_zero=zero; }
|
||||
|
||||
int add(const void *data, int len)
|
||||
{
|
||||
if (len<=0) return 0;
|
||||
|
@ -26,7 +28,7 @@ class GrowBuf : public IGrowBuf
|
|||
return m_used-len;
|
||||
}
|
||||
|
||||
void resize(int newlen, int zero=0)
|
||||
void resize(int newlen)
|
||||
{
|
||||
int os=m_alloc;
|
||||
int ou=m_used;
|
||||
|
@ -61,7 +63,7 @@ class GrowBuf : public IGrowBuf
|
|||
free(m_s);
|
||||
}
|
||||
m_s=n;
|
||||
if (zero) memset((char*)m_s+ou,0,m_used-ou);
|
||||
if (m_zero) memset((char*)m_s+ou,0,m_alloc-ou);
|
||||
}
|
||||
if (!m_used && m_alloc > 65535) // only free if you resize to 0 and we're > 64k
|
||||
{
|
||||
|
@ -78,7 +80,7 @@ class GrowBuf : public IGrowBuf
|
|||
void *m_s;
|
||||
int m_alloc;
|
||||
int m_used;
|
||||
|
||||
int m_zero;
|
||||
};
|
||||
|
||||
class StringList
|
||||
|
@ -229,7 +231,7 @@ class MMapBuf : public IGrowBuf
|
|||
return getlen()-len;
|
||||
}
|
||||
|
||||
void resize(int newlen, int zero=0)
|
||||
void resize(int newlen)
|
||||
{
|
||||
if (!m_gb_u && newlen < (16<<20)) // still in db mode
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue