Commit 3a195139 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Fix scanf to correctly parse pointers on 64-bit.

parent 4b9bba16
...@@ -151,6 +151,8 @@ _FUNCTION_ { ...@@ -151,6 +151,8 @@ _FUNCTION_ {
switch(*format) { switch(*format) {
case 'p': case 'p':
case 'P': /* pointer. */ case 'P': /* pointer. */
if (sizeof(void *) == sizeof(LONGLONG)) I64_prefix = 1;
/* fall through */
case 'x': case 'x':
case 'X': /* hexadecimal integer. */ case 'X': /* hexadecimal integer. */
base = 16; base = 16;
...@@ -224,7 +226,7 @@ _FUNCTION_ { ...@@ -224,7 +226,7 @@ _FUNCTION_ {
if (!suppress) { if (!suppress) {
#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur #define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur
if (I64_prefix) _SET_NUMBER_(LONGLONG); if (I64_prefix) _SET_NUMBER_(LONGLONG);
else if (l_prefix) _SET_NUMBER_(long int); else if (l_prefix) _SET_NUMBER_(LONG);
else if (h_prefix) _SET_NUMBER_(short int); else if (h_prefix) _SET_NUMBER_(short int);
else _SET_NUMBER_(int); else _SET_NUMBER_(int);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment