Commit [88653f] Fixed assorted compiler warnings, memory leaks, etc.
branch beta_jdm by Jim Monte
This commit is contained in:
parent
73da8e1cf5
commit
aa68b4f3ff
|
|
@ -694,16 +694,17 @@ int WIN_NewViewport(GRAPH *graph)
|
||||||
0, 0, WinLineWidth, i * 2 - 22, NULL, NULL, hInst, NULL);
|
0, 0, WinLineWidth, i * 2 - 22, NULL, NULL, hInst, NULL);
|
||||||
#else
|
#else
|
||||||
/* UTF-8 support */
|
/* UTF-8 support */
|
||||||
wchar_t *wtext, *wtext2;
|
const int n_byte_wide = 2 * (int)strlen(graph->plotname) + 1;
|
||||||
wtext = TMALLOC(wchar_t, 2 * strlen(graph->plotname) + 1);
|
wchar_t* const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||||
wtext2 = TMALLOC(wchar_t, 2 * strlen(WindowName) + 1);
|
const int n_byte_wide2 = 2 * (int)strlen(WindowName) + 1;
|
||||||
|
wchar_t* const wtext2 = TMALLOC(wchar_t, n_byte_wide2);
|
||||||
/* translate UTF-8 to UTF-16 */
|
/* translate UTF-8 to UTF-16 */
|
||||||
MultiByteToWideChar(CP_UTF8, 0, graph->plotname, -1, wtext, 2 * (int)strlen(graph->plotname) + 1);
|
MultiByteToWideChar(CP_UTF8, 0, graph->plotname, -1, wtext, n_byte_wide);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, WindowName, -1, wtext2, 2 * (int)strlen(WindowName) + 1);
|
MultiByteToWideChar(CP_UTF8, 0, WindowName, -1, wtext2, n_byte_wide2);
|
||||||
window = CreateWindowW(wtext2, wtext, WS_OVERLAPPEDWINDOW,
|
window = CreateWindowW(wtext2, wtext, WS_OVERLAPPEDWINDOW,
|
||||||
0, 0, WinLineWidth, i * 2 - 22, NULL, NULL, hInst, NULL);
|
0, 0, WinLineWidth, i * 2 - 22, NULL, NULL, hInst, NULL);
|
||||||
tfree(wtext);
|
txfree(wtext);
|
||||||
tfree(wtext2);
|
txfree(wtext2);
|
||||||
#endif
|
#endif
|
||||||
if (!window)
|
if (!window)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -734,7 +735,7 @@ int WIN_NewViewport(GRAPH *graph)
|
||||||
wd->PaintFlag = 0;
|
wd->PaintFlag = 0;
|
||||||
wd->FirstFlag = 1;
|
wd->FirstFlag = 1;
|
||||||
|
|
||||||
/* modify system menue */
|
/* modify system menu */
|
||||||
sysmenu = GetSystemMenu(window, FALSE);
|
sysmenu = GetSystemMenu(window, FALSE);
|
||||||
AppendMenu(sysmenu, MF_SEPARATOR, 0, NULL);
|
AppendMenu(sysmenu, MF_SEPARATOR, 0, NULL);
|
||||||
AppendMenu(sysmenu, MF_STRING, ID_DRUCKEN, STR_DRUCKEN);
|
AppendMenu(sysmenu, MF_STRING, ID_DRUCKEN, STR_DRUCKEN);
|
||||||
|
|
@ -1043,11 +1044,12 @@ int WIN_Text(char *text, int x, int y, int angle)
|
||||||
#ifdef EXT_ASC
|
#ifdef EXT_ASC
|
||||||
TextOut(wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, text, (int)strlen(text));
|
TextOut(wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, text, (int)strlen(text));
|
||||||
#else
|
#else
|
||||||
wchar_t *wtext;
|
const int n_byte_wide = 2 * (int)strlen(text) + 1;
|
||||||
wtext = TMALLOC(wchar_t, 2 * strlen(text) + 1);
|
wchar_t* const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, text, -1, wtext, 2 * (int)strlen(text) + 1);
|
MultiByteToWideChar(CP_UTF8, 0, text, -1, wtext, n_byte_wide);
|
||||||
TextOutW(wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, wtext, 2 * (int)strlen(text) + 1);
|
TextOutW(wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight,
|
||||||
tfree(wtext);
|
wtext, n_byte_wide);
|
||||||
|
txfree(wtext);
|
||||||
#endif
|
#endif
|
||||||
DeleteObject(SelectObject(wd->hDC, hfont));
|
DeleteObject(SelectObject(wd->hDC, hfont));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -294,13 +294,15 @@ int WPRINT_NewViewport(GRAPH * graph)
|
||||||
TextOut(PrinterDC, PrinterWidth - graph->fontwidth, 1, graph->plotname,
|
TextOut(PrinterDC, PrinterWidth - graph->fontwidth, 1, graph->plotname,
|
||||||
(int)strlen(graph->plotname));
|
(int)strlen(graph->plotname));
|
||||||
#else
|
#else
|
||||||
wchar_t* wtext;
|
const int n_byte_wide = 2 * (int)strlen(graph->plotname) + 1;
|
||||||
wtext = TMALLOC(wchar_t, 2 * strlen(graph->plotname) + 1);
|
wchar_t* const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, graph->plotname, -1, wtext, 2 * (int)strlen(graph->plotname) + 1);
|
MultiByteToWideChar(CP_UTF8, 0, graph->plotname, -1, wtext,
|
||||||
TextOutW(PrinterDC, PrinterWidth - graph->fontwidth, 1, wtext, 2 * (int)strlen(graph->plotname) + 1);
|
n_byte_wide);
|
||||||
tfree(wtext);
|
TextOutW(PrinterDC, PrinterWidth - graph->fontwidth, 1, wtext,
|
||||||
|
n_byte_wide);
|
||||||
|
txfree(wtext);
|
||||||
#endif
|
#endif
|
||||||
SetTextAlign( PrinterDC, align);
|
SetTextAlign(PrinterDC, align);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fertig */
|
/* fertig */
|
||||||
|
|
@ -431,11 +433,12 @@ int WPRINT_Text(char * text, int x, int y, int degrees)
|
||||||
#ifdef EXT_ASC
|
#ifdef EXT_ASC
|
||||||
TextOut(PrinterDC, x, PrinterHeight - y - currentgraph->fontheight, text, (int)strlen(text));
|
TextOut(PrinterDC, x, PrinterHeight - y - currentgraph->fontheight, text, (int)strlen(text));
|
||||||
#else
|
#else
|
||||||
wchar_t* wtext;
|
const int n_byte_wide = 2 * (int)strlen(text) + 1;
|
||||||
wtext = TMALLOC(wchar_t, 2 * strlen(text) + 1);
|
wchar_t* const wtext = TMALLOC(wchar_t, n_byte_wide);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, text, -1, wtext, 2 * (int)strlen(text) + 1);
|
MultiByteToWideChar(CP_UTF8, 0, text, -1, wtext, n_byte_wide);
|
||||||
TextOutW(PrinterDC, x, PrinterHeight - y - currentgraph->fontheight, wtext, 2 * (int)strlen(text) + 1);
|
TextOutW(PrinterDC, x, PrinterHeight - y - currentgraph->fontheight,
|
||||||
tfree(wtext);
|
wtext, n_byte_wide);
|
||||||
|
txfree(wtext);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue