1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-09-03 01:21:16 +03:00

add_control uses same types as DLGITEMTEMPLATE

This resolves a lot of sign conversion warnings and avoids hidden
truncation casting inside the function.
This commit is contained in:
Matt Clarkson
2015-05-22 13:40:12 +01:00
parent 05b78cf925
commit d8f7976560

View File

@@ -1150,12 +1150,12 @@ static void suggest_passwd(char *passwd)
static void add_control(unsigned char **mem, static void add_control(unsigned char **mem,
DLGTEMPLATE *dia, DLGTEMPLATE *dia,
WORD type, WORD type,
DWORD id, WORD id,
DWORD style, DWORD style,
WORD x, short x,
WORD y, short y,
WORD cx, short cx,
WORD cy, short cy,
const char *caption); const char *caption);
static int get_password(const char *user, static int get_password(const char *user,
@@ -1385,12 +1385,12 @@ PasswordDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
static void add_control(unsigned char **mem, static void add_control(unsigned char **mem,
DLGTEMPLATE *dia, DLGTEMPLATE *dia,
WORD type, WORD type,
DWORD id, WORD id,
DWORD style, DWORD style,
WORD x, short x,
WORD y, short y,
WORD cx, short cx,
WORD cy, short cy,
const char *caption) const char *caption)
{ {
DLGITEMTEMPLATE *tp; DLGITEMTEMPLATE *tp;
@@ -1401,7 +1401,7 @@ static void add_control(unsigned char **mem,
*mem = align(*mem, 3); *mem = align(*mem, 3);
tp = (DLGITEMTEMPLATE *)*mem; tp = (DLGITEMTEMPLATE *)*mem;
tp->id = (WORD)id; tp->id = id;
tp->style = style; tp->style = style;
tp->dwExtendedStyle = 0; tp->dwExtendedStyle = 0;
tp->x = x; tp->x = x;
@@ -1433,7 +1433,8 @@ static void show_settings_dialog()
const struct mg_option *options; const struct mg_option *options;
DWORD style; DWORD style;
DLGTEMPLATE *dia = (DLGTEMPLATE *)mem; DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
WORD i, cl, x, y, width, nelems = 0; WORD i, cl, nelems = 0;
short width, x, y;
static struct { static struct {
DLGTEMPLATE template; /* 18 bytes */ DLGTEMPLATE template; /* 18 bytes */
@@ -1488,7 +1489,7 @@ static void show_settings_dialog()
0x80, 0x80,
ID_CONTROLS + i + ID_FILE_BUTTONS_DELTA, ID_CONTROLS + i + ID_FILE_BUTTONS_DELTA,
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
(WORD)(x + width + LABEL_WIDTH + 5), x + width + LABEL_WIDTH + 5,
y, y,
15, 15,
12, 12,
@@ -1512,7 +1513,7 @@ static void show_settings_dialog()
cl, cl,
ID_CONTROLS + i, ID_CONTROLS + i,
style, style,
(WORD)(x + LABEL_WIDTH), x + LABEL_WIDTH,
y, y,
width, width,
12, 12,
@@ -1522,7 +1523,7 @@ static void show_settings_dialog()
assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem)); assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem));
} }
y = (WORD)(((nelems + 1) / 2 + 1) * HEIGHT + 5); y = (((nelems + 1) / 2 + 1) * HEIGHT + 5);
add_control(&p, add_control(&p,
dia, dia,
0x80, 0x80,