|
@@ -69,7 +69,7 @@ static VOID _wmInitDlg(HWND hwnd, MSGBOXDLGDATA *pDlgData)
|
|
|
if (WinQueryClassName(hWndNext, sizeof(acBuf), acBuf) == 0)
|
|
|
continue;
|
|
|
|
|
|
- if (strcmp(acBuf, "#3") == 0) { /* Class name of button. */
|
|
|
+ if (SDL_strcmp(acBuf, "#3") == 0) { /* Class name of button. */
|
|
|
if (cButtons < sizeof(aButtons) / sizeof(struct _BUTTON)) {
|
|
|
aButtons[cButtons].hwnd = hWndNext;
|
|
|
cButtons++;
|
|
@@ -176,7 +176,7 @@ static VOID _wmInitDlg(HWND hwnd, MSGBOXDLGDATA *pDlgData)
|
|
|
SWP_MOVE | SWP_SIZE);
|
|
|
}
|
|
|
|
|
|
-MRESULT EXPENTRY DynDlgProc(HWND hwnd, USHORT message, MPARAM mp1, MPARAM mp2)
|
|
|
+static MRESULT EXPENTRY DynDlgProc(HWND hwnd, USHORT message, MPARAM mp1, MPARAM mp2)
|
|
|
{
|
|
|
switch (message) {
|
|
|
case WM_INITDLG:
|
|
@@ -206,9 +206,9 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
|
|
|
ULONG cSDLBtnData = messageboxdata->numbuttons;
|
|
|
|
|
|
PSZ pszTitle = OS2_UTF8ToSys((PSZ) messageboxdata->title);
|
|
|
- ULONG cbTitle = (pszTitle == NULL)? 0 : strlen(pszTitle);
|
|
|
- PSZ pszText = OS2_UTF8ToSys((PSZ) messageboxdata->message);
|
|
|
- ULONG cbText = (pszText == NULL)? 0 : strlen(pszText);
|
|
|
+ ULONG cbTitle = (pszTitle == NULL)? 1 : (SDL_strlen(pszTitle) + 1);
|
|
|
+ PSZ pszText = OS2_UTF8ToSys((PSZ) messageboxdata->message);
|
|
|
+ ULONG cbText = (pszText == NULL)? 1 : (SDL_strlen(pszText) + 1);
|
|
|
|
|
|
PDLGTEMPLATE pTemplate;
|
|
|
ULONG cbTemplate;
|
|
@@ -218,23 +218,25 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
|
|
|
PSZ pszBtnText;
|
|
|
ULONG cbBtnText;
|
|
|
HWND hwnd;
|
|
|
+
|
|
|
const SDL_MessageBoxColor* pSDLColors = (messageboxdata->colorScheme == NULL)?
|
|
|
NULL : messageboxdata->colorScheme->colors;
|
|
|
const SDL_MessageBoxColor* pSDLColor;
|
|
|
+
|
|
|
MSGBOXDLGDATA stDlgData;
|
|
|
|
|
|
/* Build a dialog tamplate in memory */
|
|
|
|
|
|
- /* Size of template (cbTemplate). */
|
|
|
+ /* Size of template */
|
|
|
cbTemplate = sizeof(DLGTEMPLATE) + ((2 + cSDLBtnData) * sizeof(DLGTITEM)) +
|
|
|
sizeof(ULONG) + /* First item data - frame control data. */
|
|
|
- cbTitle + 1 + /* First item data - frame title + ZERO. */
|
|
|
- cbText + 1 + /* Second item data - ststic text + ZERO.*/
|
|
|
+ cbTitle + /* First item data - frame title + ZERO. */
|
|
|
+ cbText + /* Second item data - ststic text + ZERO.*/
|
|
|
3; /* Third item data - system icon Id. */
|
|
|
/* Button items datas - text for buttons. */
|
|
|
for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) {
|
|
|
pszBtnText = (PSZ)pSDLBtnData[ulIdx].text;
|
|
|
- cbTemplate += (pszBtnText == NULL)? 1 : (strlen(pszBtnText) + 1);
|
|
|
+ cbTemplate += (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1);
|
|
|
}
|
|
|
/* Presentation parameter space. */
|
|
|
if (pSDLColors != NULL)
|
|
@@ -268,11 +270,11 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
|
|
|
pDlgItem->cchClassName = 0;
|
|
|
pDlgItem->offClassName = (USHORT)WC_FRAME;
|
|
|
/* Length of text. */
|
|
|
- pDlgItem->cchText = cbTitle + 1; /* +1 - trailing ZERO. */
|
|
|
+ pDlgItem->cchText = cbTitle;
|
|
|
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to title text. */
|
|
|
/* Copy text for the title into the dialog template. */
|
|
|
if (pszTitle != NULL) {
|
|
|
- strcpy(pcDlgData, pszTitle);
|
|
|
+ SDL_memcpy(pcDlgData, pszTitle, cbTitle);
|
|
|
} else {
|
|
|
*pcDlgData = '\0';
|
|
|
}
|
|
@@ -322,11 +324,11 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
|
|
|
pDlgItem->cchClassName = 0;
|
|
|
pDlgItem->offClassName = (USHORT)WC_STATIC;
|
|
|
|
|
|
- pDlgItem->cchText = cbText + 1;
|
|
|
+ pDlgItem->cchText = cbText;
|
|
|
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */
|
|
|
/* Copy message text into the dialog template. */
|
|
|
if (pszText != NULL) {
|
|
|
- strcpy(pcDlgData, pszText);
|
|
|
+ SDL_memcpy(pcDlgData, pszText, cbText);
|
|
|
} else {
|
|
|
*pcDlgData = '\0';
|
|
|
}
|
|
@@ -401,12 +403,12 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
|
|
|
pDlgItem->offClassName = (USHORT)WC_BUTTON;
|
|
|
|
|
|
pszBtnText = OS2_UTF8ToSys((PSZ)pSDLBtnData[ulIdx].text);
|
|
|
- cbBtnText = (pszBtnText == NULL)? 0 : strlen(pszBtnText);
|
|
|
- pDlgItem->cchText = cbBtnText + 1;
|
|
|
+ cbBtnText = (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1);
|
|
|
+ pDlgItem->cchText = cbBtnText;
|
|
|
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */
|
|
|
/* Copy text for the button into the dialog template. */
|
|
|
if (pszBtnText != NULL) {
|
|
|
- strcpy(pcDlgData, pszBtnText);
|
|
|
+ SDL_memcpy(pcDlgData, pszBtnText, cbBtnText);
|
|
|
} else {
|
|
|
*pcDlgData = '\0';
|
|
|
}
|