diff options
| -rw-r--r-- | Makefile.mingw | 4 | ||||
| -rw-r--r-- | alf/alf.cpp | 14 | ||||
| -rw-r--r-- | alf/alf.h | 2 | ||||
| -rw-r--r-- | alf/alfbutton.cpp | 34 | ||||
| -rw-r--r-- | alf/alfcombobox.cpp | 45 | ||||
| -rw-r--r-- | alf/alfcompat.cpp | 4 | ||||
| -rw-r--r-- | alf/alfedit.cpp | 2 | ||||
| -rw-r--r-- | alf/alflabel.cpp | 8 | ||||
| -rw-r--r-- | alf/alflayout.cpp | 14 | ||||
| -rw-r--r-- | alf/alflayout.h | 2 | ||||
| -rw-r--r-- | alf/alfnotebook.cpp | 2 | ||||
| -rw-r--r-- | alf/alfpanel.cpp | 2 | ||||
| -rwxr-xr-x | makemakefile.sh | 4 | ||||
| -rw-r--r-- | widgetfactory.cpp | 4 |
14 files changed, 62 insertions, 79 deletions
diff --git a/Makefile.mingw b/Makefile.mingw index 043bce3..e80648a 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -2,8 +2,8 @@ CC = i686-w64-mingw32-gcc CXX = i686-w64-mingw32-c++ -CFLAGS = -std=c99 -Wall -Wextra -mwindows -municode -DUNICODE -D_UNICODE -gstabs -CXXFLAGS = -std=c++98 -Wall -Wextra -mwindows -municode -DUNICODE -D_UNICODE -fno-exceptions -fno-rtti -gstabs +CFLAGS = -std=c99 -Wall -Wextra -Wconversion -mwindows -municode -DUNICODE -D_UNICODE -gstabs +CXXFLAGS = -std=c++98 -Wall -Wextra -Wconversion -Wsign-conversion -mwindows -municode -DUNICODE -D_UNICODE -fno-exceptions -fno-rtti -gstabs LDFLAGS = -luser32 -lcomctl32 -lshell32 -lversion -static all: out/widgetfactory.exe out/alf/alf.c out/widgetfactory-c.exe diff --git a/alf/alf.cpp b/alf/alf.cpp index de8d9c3..b446b33 100644 --- a/alf/alf.cpp +++ b/alf/alf.cpp @@ -33,7 +33,7 @@ ALF_DestroyWindowPriv(ALFWindowPriv *priv) int ALF_CentipointsToPxPriv(ALFWindowPriv *priv, int cptValue) { - return MulDiv(cptValue, priv->fonts.dpi, 7200); + return MulDiv(cptValue, (int)priv->fonts.dpi, 7200); } void @@ -62,7 +62,7 @@ ALF_UpdateFontsPriv(HWND win, ALFWindowPriv *priv) // FIXME! fallback to default font, 8pt MS Shell Dlg ZeroMemory(&priv->fonts.lfMessageFont, sizeof(priv->fonts.lfMessageFont)); - priv->fonts.lfMessageFont.lfHeight = -MulDiv(8, priv->fonts.dpi, 72); + priv->fonts.lfMessageFont.lfHeight = -MulDiv(8, (int)priv->fonts.dpi, 72); lstrcpy(priv->fonts.lfMessageFont.lfFaceName, TEXT("MS Shell Dlg")); } @@ -246,9 +246,9 @@ ALF_DefWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) if (ALF_Compat_AdjustWindowRectExForDpi( &tmp, - GetWindowLong(hwnd, GWL_STYLE), + (DWORD)GetWindowLong(hwnd, GWL_STYLE), GetMenu(hwnd) != NULL, - GetWindowLong(hwnd, GWL_EXSTYLE), + (DWORD)GetWindowLong(hwnd, GWL_EXSTYLE), priv->fonts.dpi)) { MINMAXINFO *i = (MINMAXINFO *)lparam; i->ptMinTrackSize.x = tmp.right - tmp.left; @@ -454,12 +454,12 @@ void ALF_BuildUniqueName(TCHAR *buf, const TCHAR *prefix, ULONG_PTR uniquifier) { int prefixlen = lstrlen(prefix); - CopyMemory(buf, prefix, prefixlen * sizeof(*prefix)); + CopyMemory(buf, prefix, (SIZE_T)prefixlen * sizeof(*prefix)); int numlen = sizeof(LONG_PTR)*2; int i = numlen - 1; while (i >= 0) { - buf[prefixlen + i] = "0123456789ABCDEF"[uniquifier & 0xf]; + buf[prefixlen + i] = TEXT("0123456789ABCDEF")[uniquifier & 0xf]; uniquifier >>= 4; i--; } @@ -678,7 +678,7 @@ ALF_Text(HWND hwnd) { int len = GetWindowTextLength(hwnd); if (len > 0) { - TCHAR *buf = ALF_New(TCHAR, len+1); + TCHAR *buf = ALF_New(TCHAR, (SIZE_T)len+1); if (GetWindowText(hwnd, buf, len+1)) { return buf; } else { @@ -8,7 +8,7 @@ extern "C" { #endif typedef struct { - int dpi; + UINT dpi; LOGFONT lfMessageFont; HFONT hMessageFont; } ALFWindowFonts; diff --git a/alf/alfbutton.cpp b/alf/alfbutton.cpp index 67a7236..ddf607d 100644 --- a/alf/alfbutton.cpp +++ b/alf/alfbutton.cpp @@ -13,8 +13,8 @@ typedef struct { BOOL isDefault; BOOL isHot; HTHEME hTheme; - UINT uxStatePrev; - UINT uxStateCurrent; + int uxStatePrev; + int uxStateCurrent; UINT itemStatePrev; UINT itemStateCurrent; DWORD uxDefaultAnimationDuration; @@ -48,7 +48,7 @@ ALF__Button_Text_DrawStateProc(HDC hdc, LPARAM lData, WPARAM wData, int cx, int } static void -ALF__Button_RenderUxtheme(HWND hwnd, ALFButtonPriv *priv, UINT uxstate, UINT itemState, HDC hDC, LPRECT pRcItem) +ALF__Button_RenderUxtheme(HWND hwnd, ALFButtonPriv *priv, int uxstate, UINT itemState, HDC hDC, LPRECT pRcItem) { if (ALF_Compat_IsThemeBackgroundPartiallyTransparent(priv->hTheme, BP_PUSHBUTTON, uxstate)) { ALF_Compat_DrawThemeParentBackground(hwnd, hDC, pRcItem); @@ -66,7 +66,7 @@ ALF__Button_RenderUxtheme(HWND hwnd, ALFButtonPriv *priv, UINT uxstate, UINT ite DrawFocusRect(hDC, &content); int textlen = GetWindowTextLengthW(hwnd); - WCHAR *textbuf = ALF_New(WCHAR, textlen + 1); + WCHAR *textbuf = ALF_New(WCHAR, (SIZE_T)textlen + 1); GetWindowTextW(hwnd, textbuf, textlen+1); UINT style = DT_CENTER; @@ -93,9 +93,7 @@ ALF__Button_Render95(HWND hwnd, ALFButtonPriv *priv, LPDRAWITEMSTRUCT dis) { RECT r = dis->rcItem; - int textlen = GetWindowTextLength(hwnd); - TCHAR *textbuf = ALF_New(TCHAR, textlen + 1); - GetWindowText(hwnd, textbuf, textlen+1); + TCHAR *textbuf = ALF_Text(hwnd); if (priv->isDefault) { HBRUSH framecolor = GetSysColorBrush(COLOR_WINDOWFRAME); @@ -179,9 +177,7 @@ ALF__Button_Render3x(HWND hwnd, ALFButtonPriv *priv, LPDRAWITEMSTRUCT dis) ALF_Compat_DrawThemeParentBackground(hwnd, dis->hDC, &r); - int textlen = GetWindowTextLength(hwnd); - TCHAR *textbuf = ALF_New(TCHAR, textlen + 1); - GetWindowText(hwnd, textbuf, textlen+1); + TCHAR *textbuf = ALF_Text(hwnd); HBRUSH framecolor = GetSysColorBrush(COLOR_WINDOWFRAME); HBRUSH facecolor = GetSysColorBrush(COLOR_BTNFACE); @@ -284,25 +280,23 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT oldFont = SelectFont(hdc, font); // calc drawtext style - DWORD style = GetWindowLong(hwnd, GWL_STYLE); + LONG style = GetWindowLong(hwnd, GWL_STYLE); UINT format = DT_LEFT | DT_EXPANDTABS | DT_CALCRECT; if ((style & BS_MULTILINE) == 0) format |= DT_SINGLELINE; RECT r = { 0, 0, 0x7FFFFFFF, 100 }; - int textlen = GetWindowTextLength(hwnd); - TCHAR *textbuf = ALF_New(TCHAR, textlen + 1); - GetWindowText(hwnd, textbuf, textlen+1); + TCHAR *textbuf = ALF_Text(hwnd); DrawText(hdc, textbuf, -1, &r, format); ALF_Free(textbuf); int xpadding = ALF_Compat_GetSystemMetricsForDpi(SM_CXEDGE, - ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 6; + (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 6; int ypadding = ALF_Compat_GetSystemMetricsForDpi(SM_CYEDGE, - ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 4; + (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 4; SIZE *pSize = (SIZE*)(void*)lParam; if (pSize->cx < r.right - r.left + xpadding) { @@ -325,7 +319,7 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT if (!ALF_Compat_BufferedPaintRenderAnimation(hwnd, dis->hDC)) { if (priv->hTheme) { // Draw XP style themed button - UINT stateid = PBS_NORMAL; + int stateid = PBS_NORMAL; if (priv->isDefault && IsChild(GetForegroundWindow(), hwnd)) stateid = priv->uxIsDefaultAnimating ? PBS_DEFAULTED_ANIMATING : PBS_DEFAULTED; @@ -336,7 +330,7 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT if (dis->itemState & ODS_DISABLED) stateid = PBS_DISABLED; - if (priv->uxStatePrev == (UINT)-1) { + if (priv->uxStatePrev == -1) { // initial draw priv->uxStateCurrent = stateid; priv->itemStateCurrent = dis->itemState; @@ -498,8 +492,8 @@ ALF_AddButton(HWND win, WORD id, int x, int y, const TCHAR *text) NULL); ALFButtonPriv *priv = ALF_New(ALFButtonPriv, 1); - priv->uxStateCurrent = (UINT)-1; - priv->uxStatePrev = (UINT)-1; + priv->uxStateCurrent = -1; + priv->uxStatePrev = -1; ALF_Compat_SetWindowSubclass(hwndButton, ALF__ButtonSubclassProc, 0, (DWORD_PTR)priv); diff --git a/alf/alfcombobox.cpp b/alf/alfcombobox.cpp index 33a454c..6d3af5e 100644 --- a/alf/alfcombobox.cpp +++ b/alf/alfcombobox.cpp @@ -23,19 +23,17 @@ ALF__ComboItemHeight(HWND hwnd) int height = 0; HDC hDc = GetDC(hwnd); HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); - if (font) { - HFONT oldfont = SelectFont(hDc, font); + HFONT oldfont = SelectFont(hDc, font); - TEXTMETRIC tm; - ZeroMemory(&tm, sizeof(tm)); + TEXTMETRIC tm; + ZeroMemory(&tm, sizeof(tm)); - if (GetTextMetrics(hDc, &tm)) { - height = tm.tmHeight; - } - - SelectFont(hDc, oldfont); + if (GetTextMetrics(hDc, &tm)) { + height = tm.tmHeight; } + SelectFont(hDc, oldfont); + if (!ALF_Compat_IsMinWindowsVersion(4, 0)) { // baseline alignment for NT3.x/Win32s // ideally, this would only be applied for the ODS_COMOBOXEDIT state, @@ -84,10 +82,7 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } if (uMsg == WM_SETFONT && hwndChild) { SendMessage(hwndChild, WM_SETFONT, wParam, lParam); - - int h = ALF__ComboItemHeight(hwnd); - if (h) - SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)0, h); + SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)0, (LPARAM)ALF__ComboItemHeight(hwnd)); ALF_InvalidateLayout(GetParent(hwnd)); @@ -153,7 +148,7 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (!ps->cy) { ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi( - SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + SM_CYEDGE, (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + 4 /* padding internal to the edit control */; } } @@ -168,9 +163,7 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_MEASUREITEM) { PMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam; - int h = ALF__ComboItemHeight(hwnd); - if (h) - lpmis->itemHeight = h; + lpmis->itemHeight = (UINT)ALF__ComboItemHeight(hwnd); return TRUE; } @@ -208,14 +201,14 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // Get and display the text for the list item. int len = (int)SendMessage(lpdis->hwndItem, CB_GETLBTEXTLEN, (WPARAM)lpdis->itemID, 0); if (len != CB_ERR) { - TCHAR *buf = (TCHAR*)LocalAlloc(LPTR, (len+1) * sizeof(TCHAR)); + TCHAR *buf = (TCHAR*)LocalAlloc(LPTR, (SIZE_T)(len+1) * sizeof(TCHAR)); SendMessage(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, (LPARAM)buf); ExtTextOut(lpdis->hDC, x, y, ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem, - buf, lstrlen(buf), NULL); + buf, (UINT)lstrlen(buf), NULL); LocalFree(buf); } @@ -238,25 +231,21 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // XXX: When resizing the combo box, it will improperly draw a selection. // this appears to be a well-known bug that is still not fixed, even in Win10. // workaround based on https://stackoverflow.com/questions/49603893/how-to-deal-with-invalidly-painted-combobox-control-in-win32-winapi - DWORD sel = SendMessage(hwndChild, CB_GETEDITSEL, 0, 0); + LRESULT sel = SendMessage(hwndChild, CB_GETEDITSEL, 0, 0); SendMessage(hwndChild, CB_SETEDITSEL, 0, -1); // SWP_NOCOPYBITS because NT 3.51 doesn't properly repaint the drop-down button SetWindowPos(hwndChild, NULL, 0, 0, pos->cx, 200, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOCOPYBITS); SendMessage(hwndChild, CB_SETEDITSEL, 0, (LPARAM)sel); - DWORD heightOffset = 0; + int heightOffset = 0; if (ALF_Compat_IsMinWindowsVersion(4, 0)) { heightOffset = - 2*ALF_Compat_GetSystemMetricsForDpi( - SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + SM_CYEDGE, (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)) - 2; } SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)-1, pos->cy + heightOffset); - - int h = ALF__ComboItemHeight(hwnd); - if (h) - SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)0, h); - + SendMessage(hwndChild, CB_SETITEMHEIGHT, (WPARAM)0, (LPARAM)ALF__ComboItemHeight(hwnd)); } } @@ -371,7 +360,7 @@ ALF_ComboBoxStringForIndex(HWND combo, int index) { int len = (int)SendMessage(combo, ALF_CB_GETLBTEXTLEN, (WPARAM)index, 0); if (len > 0) { - TCHAR* buf = ALF_New(TCHAR, len + 1); + TCHAR* buf = ALF_New(TCHAR, (SIZE_T)len + 1); if (SendMessage(combo, ALF_CB_GETLBTEXT, (WPARAM)index, (LPARAM)buf)) { return buf; } else { diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp index 5fa3be7..e3d8b15 100644 --- a/alf/alfcompat.cpp +++ b/alf/alfcompat.cpp @@ -21,7 +21,7 @@ DWORD ALF_DllGetVersion(const char *dll) hr = (*pDllGetVersion)(&dvi); if (SUCCEEDED(hr)) { - return MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion); + return (DWORD)MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion); } } } @@ -58,7 +58,7 @@ ALF_Compat_fallbackGetDpiForWindow(HWND win) HDC hdcScreen = GetDC(NULL); if (hdcScreen) { - dpi = GetDeviceCaps(hdcScreen, LOGPIXELSY); + dpi = (UINT)GetDeviceCaps(hdcScreen, LOGPIXELSY); ReleaseDC(NULL, hdcScreen); } diff --git a/alf/alfedit.cpp b/alf/alfedit.cpp index afd4d08..87ddf80 100644 --- a/alf/alfedit.cpp +++ b/alf/alfedit.cpp @@ -24,7 +24,7 @@ ALF__EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_P if (!ps->cy) { ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi( - SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + SM_CYEDGE, (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + 4 /* padding internal to the edit control */; } } diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp index b0abc4b..59c92fa 100644 --- a/alf/alflabel.cpp +++ b/alf/alflabel.cpp @@ -15,7 +15,7 @@ ALF__LabelTopPadding(HWND hwnd) // some pixels on top to align with the edit control // see also: alfedit.cpp return ALF_Compat_GetSystemMetricsForDpi( - SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + SM_CYEDGE, (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + (!ALF_Compat_IsMinWindowsVersion(4, 0) ? 2 : 1) /* internal padding in edit control */; } @@ -25,7 +25,7 @@ ALF__LabelLeftPadding(HWND hwnd, HDC hdc) // some pixels on the left to align with the edit control // see also: alfedit.cpp int p = ALF_Compat_GetSystemMetricsForDpi( - SM_CXEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)); + SM_CXEDGE, (UINT)ALF_CentipointsToPixels(GetParent(hwnd), 7200)); p += 1; @@ -62,7 +62,7 @@ ALF__LabelWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProc(hwnd, uMsg, wParam, lParam); if (uMsg == ALF_WM_LBL_GETSTYLE) { - return priv->style; + return (LRESULT)priv->style; } else if (uMsg == ALF_WM_LBL_SETSTYLE) { priv->style = (DWORD)lParam; InvalidateRect(hwnd, NULL, TRUE); @@ -181,7 +181,7 @@ ALF__LabelWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) RECT r = { 0, 0, 100, 100 }; - TCHAR *textbuf = ALF_New(TCHAR, textlen + 1); + TCHAR *textbuf = ALF_New(TCHAR, (SIZE_T)textlen + 1); GetWindowText(hwnd, textbuf, textlen+1); DrawText(hdcLabel, textbuf, -1, &r, format); diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp index ce5909f..c05d355 100644 --- a/alf/alflayout.cpp +++ b/alf/alflayout.cpp @@ -70,9 +70,9 @@ ALF_Layout_Init(ALFLayout *layout) ALF_ListInit(&layout->widgets); layout->nRows = 1; - layout->rows = ALF_New(ALFLayoutRowOrColumn, layout->nRows); + layout->rows = ALF_New(ALFLayoutRowOrColumn, (SIZE_T)layout->nRows); layout->nColumns = 1; - layout->columns = ALF_New(ALFLayoutRowOrColumn, layout->nColumns); + layout->columns = ALF_New(ALFLayoutRowOrColumn, (SIZE_T)layout->nColumns); } void @@ -107,7 +107,7 @@ ALF_Layout_EnsureRowExists(ALFLayout *layout, int rowno) { while (rowno >= layout->nRows) { layout->nRows *= 2; - layout->rows = ALF_ReNew(layout->rows, ALFLayoutRowOrColumn, layout->nRows); + layout->rows = ALF_ReNew(layout->rows, ALFLayoutRowOrColumn, (SIZE_T)layout->nRows); } } @@ -116,7 +116,7 @@ ALF_Layout_EnsureColumnExists(ALFLayout *layout, int colno) { while (colno >= layout->nColumns) { layout->nColumns *= 2; - layout->columns = ALF_ReNew(layout->columns, ALFLayoutRowOrColumn, layout->nColumns); + layout->columns = ALF_ReNew(layout->columns, ALFLayoutRowOrColumn, (SIZE_T)layout->nColumns); } } @@ -501,7 +501,7 @@ ALF_Layout_SetWidgetFlags(ALFLayout *layout, HWND window, HWND needle, DWORD fla w->flags = flags; if (flags & ALF_LAYOUT_INHERITFONT) - SendMessage(w->hwnd, WM_SETFONT, (LPARAM)SendMessage(window, WM_GETFONT, 0, 0), 0); + SendMessage(w->hwnd, WM_SETFONT, (WPARAM)SendMessage(window, WM_GETFONT, 0, 0), 0); ALF_InvalidateLayout(window); @@ -747,7 +747,7 @@ ALF_Layout_HandleMessage(ALFLayout *layout, HWND hwnd, UINT msg, WPARAM wparam, } if (msg == ALF_WM_LYT_SETCOLFLAGS) { - *pRet = (LRESULT)ALF_Layout_SetColumnFlags(layout, hwnd, (int)wparam, (int)lparam); + *pRet = (LRESULT)ALF_Layout_SetColumnFlags(layout, hwnd, (int)wparam, (DWORD)lparam); return TRUE; } @@ -777,7 +777,7 @@ ALF_Layout_HandleMessage(ALFLayout *layout, HWND hwnd, UINT msg, WPARAM wparam, } if (msg == ALF_WM_LYT_SETROWFLAGS) { - *pRet = (LRESULT)ALF_Layout_SetRowFlags(layout, hwnd, (int)wparam, (int)lparam); + *pRet = (LRESULT)ALF_Layout_SetRowFlags(layout, hwnd, (int)wparam, (DWORD)lparam); return TRUE; } diff --git a/alf/alflayout.h b/alf/alflayout.h index 10fa09d..ce2350f 100644 --- a/alf/alflayout.h +++ b/alf/alflayout.h @@ -26,7 +26,7 @@ typedef struct { // properties set by user int requestedMinWidth; int requestedExpandNumerator; - int requestedFlags; + DWORD requestedFlags; // calculated properties int calculatedMinWidth; diff --git a/alf/alfnotebook.cpp b/alf/alfnotebook.cpp index 8eaea6b..dc56769 100644 --- a/alf/alfnotebook.cpp +++ b/alf/alfnotebook.cpp @@ -357,7 +357,7 @@ ALF_NotebookTabIndex(HWND notebook, HWND tabPanel); HWND ALF_NotebookTabPanel(HWND notebook, int index) { - return (HWND)SendMessage(notebook, ALF_NB_GETPANEL, 0, (WPARAM)index); + return (HWND)SendMessage(notebook, ALF_NB_GETPANEL, 0, (LPARAM)index); } int diff --git a/alf/alfpanel.cpp b/alf/alfpanel.cpp index bd48721..9496e43 100644 --- a/alf/alfpanel.cpp +++ b/alf/alfpanel.cpp @@ -29,7 +29,7 @@ ALF_Panel_Paint(ALFPanelPriv *priv, HWND hwnd, HDC dc, RECT *r) if (textlen < 1) return; - TCHAR *textbuf = ALF_New(TCHAR, textlen + 1); + TCHAR *textbuf = ALF_New(TCHAR, (SIZE_T)textlen + 1); GetWindowText(hwnd, textbuf, textlen+1); HFONT oldFont = SelectFont(dc, priv->font); diff --git a/makemakefile.sh b/makemakefile.sh index 79bd0d6..e968990 100755 --- a/makemakefile.sh +++ b/makemakefile.sh @@ -13,8 +13,8 @@ ALF_VC6_OBJECTS=$(for i in $ALF_SOURCES; do printf ' out/%s.obj' "$(basename "$i printf '\n' printf 'CC = i686-w64-mingw32-gcc\n' printf 'CXX = i686-w64-mingw32-c++\n' - printf 'CFLAGS = -std=c99 -Wall -Wextra -mwindows -municode -DUNICODE -D_UNICODE -gstabs\n' - printf 'CXXFLAGS = -std=c++98 -Wall -Wextra -mwindows -municode -DUNICODE -D_UNICODE -fno-exceptions -fno-rtti -gstabs\n' + printf 'CFLAGS = -std=c99 -Wall -Wextra -Wconversion -mwindows -municode -DUNICODE -D_UNICODE -gstabs\n' + printf 'CXXFLAGS = -std=c++98 -Wall -Wextra -Wconversion -Wsign-conversion -mwindows -municode -DUNICODE -D_UNICODE -fno-exceptions -fno-rtti -gstabs\n' printf 'LDFLAGS = -luser32 -lcomctl32 -lshell32 -lversion -static\n' printf '\n' printf 'all: out/widgetfactory.exe out/alf/alf.c out/widgetfactory-c.exe\n' diff --git a/widgetfactory.cpp b/widgetfactory.cpp index dc343e6..5ef96f1 100644 --- a/widgetfactory.cpp +++ b/widgetfactory.cpp @@ -34,7 +34,7 @@ handleMessage(void *closure, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) (void)closure; if (msg == WM_CTLCOLORSTATIC) { - DWORD id = GetDlgCtrlID((HWND)lparam); + WORD id = (WORD)GetDlgCtrlID((HWND)lparam); HDC hdcStatic = (HDC)wparam; if (id == ID_LBLHELLO) { SetTextColor(hdcStatic, RGB(0,0,0)); @@ -232,7 +232,7 @@ WinMain void _entry(void) { - ExitProcess( + ExitProcess((UINT) #ifdef UNICODE wWinMain #else |
