1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-09-04 12:42:09 +03:00

Correct casting of pointers

Casting pointers to intgers for arithmetic should be done with intptr_t
as that is corrected for pointer widths on 32bit and 64bit systems
This commit is contained in:
Matt Clarkson
2015-05-22 13:34:59 +01:00
parent a13cd6e0dd
commit 05b78cf925

View File

@@ -1299,7 +1299,7 @@ static int get_password(const char *user,
12, 12,
"Cancel"); "Cancel");
assert((int)p - (int)mem < (int)sizeof(mem)); assert((intptr_t)p - (intptr_t)mem < (intptr_t)sizeof(mem));
dia->cy = y + (WORD)(HEIGHT * 1.5); dia->cy = y + (WORD)(HEIGHT * 1.5);
@@ -1519,7 +1519,7 @@ static void show_settings_dialog()
""); "");
nelems++; nelems++;
assert(((int)p - (int)mem) < (int)sizeof(mem)); assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem));
} }
y = (WORD)(((nelems + 1) / 2 + 1) * HEIGHT + 5); y = (WORD)(((nelems + 1) / 2 + 1) * HEIGHT + 5);
@@ -1585,7 +1585,7 @@ static void show_settings_dialog()
12, 12,
g_server_base_name); g_server_base_name);
assert(((int)p - (int)mem) < (int)sizeof(mem)); assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem));
dia->cy = ((nelems + 1) / 2 + 1) * HEIGHT + 30; dia->cy = ((nelems + 1) / 2 + 1) * HEIGHT + 30;
DialogBoxIndirectParam(NULL, dia, NULL, SettingsDlgProc, (LPARAM)NULL); DialogBoxIndirectParam(NULL, dia, NULL, SettingsDlgProc, (LPARAM)NULL);
@@ -1724,7 +1724,7 @@ static void change_password_file()
u); u);
nelems++; nelems++;
assert(((int)p - (int)mem) < (int)sizeof(mem)); assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem));
} }
fclose(f); fclose(f);
@@ -1786,7 +1786,7 @@ static void change_password_file()
12, 12,
g_server_base_name); g_server_base_name);
assert(((int)p - (int)mem) < (int)sizeof(mem)); assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem));
dia->cy = y + 20; dia->cy = y + 20;
} while ((IDOK == DialogBoxIndirectParam( } while ((IDOK == DialogBoxIndirectParam(