Skip to content

Commit e25c070

Browse files
slonopotamusgitster
authored andcommitted
MSVC: fix t0040-parse-options crash
On 64-bit MSVC, pointers are 64 bit but `long` is only 32. Thus, casting string to `unsigned long`, which is redundand on other platforms, throws away important bits and when later cast to `intptr_t` results in corrupt pointer. This patch fixes test-parse-options by replacing harming cast with correct one. Signed-off-by: Marat Radchenko <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f95c9f commit e25c070

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test-parse-options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
6060
OPT_STRING('o', NULL, &string, "str", "get another string"),
6161
OPT_NOOP_NOARG(0, "obsolete"),
6262
OPT_SET_PTR(0, "default-string", &string,
63-
"set string to default", (unsigned long)"default"),
63+
"set string to default", (intptr_t)"default"),
6464
OPT_STRING_LIST(0, "list", &list, "str", "add str to list"),
6565
OPT_GROUP("Magic arguments"),
6666
OPT_ARGUMENT("quux", "means --quux"),

0 commit comments

Comments
 (0)