Fix handling of strings that do not finish with "||".

Fix the indentation of the while loop in TOOLBAR_AddStringW.
This commit is contained in:
François Gouget 2002-06-13 22:04:45 +00:00 committed by Alexandre Julliard
parent 29853a9025
commit 9e82510ec8
1 changed files with 32 additions and 22 deletions

View File

@ -2477,31 +2477,38 @@ TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PWSTR p = szString + 1; PWSTR p = szString + 1;
nIndex = infoPtr->nNumStrings; nIndex = infoPtr->nNumStrings;
while (*p != L'|') { while (*p != L'|' && *p != L'\0') {
PWSTR np;
if (infoPtr->nNumStrings == 0) { if (infoPtr->nNumStrings == 0) {
infoPtr->strings = infoPtr->strings = COMCTL32_Alloc (sizeof(LPWSTR));
COMCTL32_Alloc (sizeof(LPWSTR)); }
} else
else { {
LPWSTR *oldStrings = infoPtr->strings; LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings = infoPtr->strings = COMCTL32_Alloc(sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); memcpy(&infoPtr->strings[0], &oldStrings[0],
memcpy (&infoPtr->strings[0], &oldStrings[0], sizeof(LPWSTR) * infoPtr->nNumStrings);
sizeof(LPWSTR) * infoPtr->nNumStrings); COMCTL32_Free(oldStrings);
COMCTL32_Free (oldStrings); }
}
len = COMCTL32_StrChrW (p, L'|') - p; np=COMCTL32_StrChrW (p, L'|');
TRACE("len=%d %s\n", len, debugstr_w(p)); if (np!=NULL) {
infoPtr->strings[infoPtr->nNumStrings] = len = np - p;
COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); np++;
lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1); } else {
infoPtr->nNumStrings++; len = strlenW(p);
np = p + len;
}
TRACE("len=%d %s\n", len, debugstr_w(p));
infoPtr->strings[infoPtr->nNumStrings] =
COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1);
infoPtr->nNumStrings++;
p += (len+1); p = np;
} }
} }
else else
{ {
@ -2983,6 +2990,9 @@ TOOLBAR_GetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
if(!btnPtr)
return -1;
if (lpTbInfo->dwMask & TBIF_COMMAND) if (lpTbInfo->dwMask & TBIF_COMMAND)
lpTbInfo->idCommand = btnPtr->idCommand; lpTbInfo->idCommand = btnPtr->idCommand;
if (lpTbInfo->dwMask & TBIF_IMAGE) if (lpTbInfo->dwMask & TBIF_IMAGE)