Commit 9e82510e authored by François Gouget's avatar François Gouget Committed by Alexandre Julliard

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

Fix the indentation of the while loop in TOOLBAR_AddStringW.
parent 29853a90
......@@ -2477,31 +2477,38 @@ TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
PWSTR p = szString + 1;
nIndex = infoPtr->nNumStrings;
while (*p != L'|') {
if (infoPtr->nNumStrings == 0) {
infoPtr->strings =
COMCTL32_Alloc (sizeof(LPWSTR));
}
else {
LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings =
COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
memcpy (&infoPtr->strings[0], &oldStrings[0],
sizeof(LPWSTR) * infoPtr->nNumStrings);
COMCTL32_Free (oldStrings);
}
len = COMCTL32_StrChrW (p, L'|') - p;
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++;
nIndex = infoPtr->nNumStrings;
while (*p != L'|' && *p != L'\0') {
PWSTR np;
p += (len+1);
}
if (infoPtr->nNumStrings == 0) {
infoPtr->strings = COMCTL32_Alloc (sizeof(LPWSTR));
}
else
{
LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings = COMCTL32_Alloc(sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
memcpy(&infoPtr->strings[0], &oldStrings[0],
sizeof(LPWSTR) * infoPtr->nNumStrings);
COMCTL32_Free(oldStrings);
}
np=COMCTL32_StrChrW (p, L'|');
if (np!=NULL) {
len = np - p;
np++;
} else {
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 = np;
}
}
else
{
......@@ -2983,6 +2990,9 @@ TOOLBAR_GetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr = &infoPtr->buttons[nIndex];
if(!btnPtr)
return -1;
if (lpTbInfo->dwMask & TBIF_COMMAND)
lpTbInfo->idCommand = btnPtr->idCommand;
if (lpTbInfo->dwMask & TBIF_IMAGE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment