From 05b78cf925c5453440112e2fc628e648e02b5c96 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Fri, 22 May 2015 13:34:59 +0100 Subject: [PATCH] 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 --- src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index e8a78c47..f62ba5bc 100644 --- a/src/main.c +++ b/src/main.c @@ -1299,7 +1299,7 @@ static int get_password(const char *user, 12, "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); @@ -1519,7 +1519,7 @@ static void show_settings_dialog() ""); 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); @@ -1585,7 +1585,7 @@ static void show_settings_dialog() 12, 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; DialogBoxIndirectParam(NULL, dia, NULL, SettingsDlgProc, (LPARAM)NULL); @@ -1724,7 +1724,7 @@ static void change_password_file() u); nelems++; - assert(((int)p - (int)mem) < (int)sizeof(mem)); + assert(((intptr_t)p - (intptr_t)mem) < (intptr_t)sizeof(mem)); } fclose(f); @@ -1786,7 +1786,7 @@ static void change_password_file() 12, 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; } while ((IDOK == DialogBoxIndirectParam(