Some Windows gcc fixes
This commit is contained in:
@@ -1022,7 +1022,8 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
pFile = _tfopen(filename, TEXT("wt+,ccs=UTF-8"));
|
||||
if (!pFile) {
|
||||
TCHAR buf[4096];
|
||||
_stprintf(buf, TEXT("Cannot open %s for writing!"), filename);
|
||||
nh_stprintf(buf, sizeof buf,
|
||||
TEXT("Cannot open %s for writing!"), filename);
|
||||
NHMessageBox(hWnd, buf, MB_OK | MB_ICONERROR);
|
||||
if (text)
|
||||
free(text);
|
||||
|
||||
@@ -1188,10 +1188,12 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
&& data->menui.menu.items[lpdis->itemID].count != 0
|
||||
&& item->glyphinfo.glyph != NO_GLYPH) {
|
||||
if (data->menui.menu.items[lpdis->itemID].count == -1) {
|
||||
_stprintf(wbuf, TEXT("Count: All"));
|
||||
nh_stprintf(wbuf, sizeof wbuf,
|
||||
TEXT("Count: All"));
|
||||
} else {
|
||||
_stprintf(wbuf, TEXT("Count: %d"),
|
||||
data->menui.menu.items[lpdis->itemID].count);
|
||||
nh_stprintf(wbuf, sizeof wbuf,
|
||||
TEXT("Count: %d"),
|
||||
data->menui.menu.items[lpdis->itemID].count);
|
||||
}
|
||||
|
||||
/* TODO: add blinking for blink text */
|
||||
|
||||
@@ -1061,8 +1061,9 @@ mswin_display_file(const char *filename, boolean must_exist)
|
||||
if (!f) {
|
||||
if (must_exist) {
|
||||
TCHAR message[90];
|
||||
_stprintf(message, TEXT("Warning! Could not find file: %s\n"),
|
||||
NH_A2W(filename, wbuf, sizeof(wbuf)));
|
||||
nh_stprintf(message, sizeof message,
|
||||
TEXT("Warning! Could not find file: %s\n"),
|
||||
NH_A2W(filename, wbuf, sizeof(wbuf)));
|
||||
NHMessageBox(GetNHApp()->hMainWnd, message,
|
||||
MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
@@ -249,12 +249,14 @@ extern COLORREF message_fg_color;
|
||||
/* unicode stuff */
|
||||
#define NH_CODEPAGE (SYMHANDLING(H_IBM) ? GetOEMCP() : GetACP())
|
||||
#ifdef _UNICODE
|
||||
#define nh_stprintf swprintf
|
||||
#define NH_W2A(w, a, cb) \
|
||||
(WideCharToMultiByte(NH_CODEPAGE, 0, (w), -1, (a), (cb), NULL, NULL), (a))
|
||||
|
||||
#define NH_A2W(a, w, cb) \
|
||||
(MultiByteToWideChar(NH_CODEPAGE, 0, (a), -1, (w), (cb)), (w))
|
||||
#else
|
||||
#define nh_stprintf snprintf
|
||||
#define NH_W2A(w, a, cb) (strncpy((a), (w), (cb)))
|
||||
|
||||
#define NH_A2W(a, w, cb) (strncpy((w), (a), (cb)))
|
||||
|
||||
Reference in New Issue
Block a user