if (nch == _EOF_) return _EOF_RET;\r
\r
while (*format) {\r
- /* a whitespace character in the format string causes scanf to read,\r
- * but not store, all consecutive white-space characters in the input\r
- * up to the next non-white-space character. One white space character\r
- * in the input matches any number (including zero) and combination of\r
- * white-space characters in the input. */\r
- if (_ISSPACE_(*format)) {\r
+ /* a whitespace character in the format string causes scanf to read,\r
+ * but not store, all consecutive white-space characters in the input\r
+ * up to the next non-white-space character. One white space character\r
+ * in the input matches any number (including zero) and combination of\r
+ * white-space characters in the input. */\r
+ if (_ISSPACE_(*format)) {\r
/* skip whitespace */\r
while ((nch!=_EOF_) && _ISSPACE_(nch))\r
nch = _GETC_(file);\r
}\r
- /* a format specification causes scanf to read and convert characters\r
- * in the input into values of a specified type. The value is assigned\r
- * to an argument in the argument list. Format specifications have\r
- * the form %[*][width][{h | l | I64 | L}]type */\r
+ /* a format specification causes scanf to read and convert characters\r
+ * in the input into values of a specified type. The value is assigned\r
+ * to an argument in the argument list. Format specifications have\r
+ * the form %[*][width][{h | l | I64 | L}]type */\r
else if (*format == '%') {\r
int st = 0; int suppress = 0; int width = 0;\r
- int base, number_signed;\r
- int h_prefix = 0;\r
- int l_prefix = 0;\r
- int L_prefix = 0;\r
- int w_prefix = 0;\r
- int prefix_finished = 0;\r
- int I64_prefix = 0;\r
+ int base, number_signed;\r
+ int h_prefix = 0;\r
+ int l_prefix = 0;\r
+ int L_prefix = 0;\r
+ int w_prefix = 0;\r
+ int prefix_finished = 0;\r
+ int I64_prefix = 0;\r
format++;\r
- /* look for leading asterisk, which means 'suppress assignment of\r
- * this field'. */\r
- if (*format=='*') {\r
- format++;\r
- suppress=1;\r
- }\r
- /* look for width specification */\r
- while (_ISDIGIT_(*format)) {\r
- width*=10;\r
- width+=*format++ - '0';\r
- }\r
- if (width==0) width=-1; /* no width spec seen */\r
- /* read prefix (if any) */\r
- while (!prefix_finished) {\r
- switch(*format) {\r
- case 'h': h_prefix = 1; break;\r
- case 'l': l_prefix = 1; break;\r
- case 'w': w_prefix = 1; break;\r
- case 'L': L_prefix = 1; break;\r
- case 'I':\r
- if (*(format + 1) == '6' &&\r
- *(format + 2) == '4') {\r
- I64_prefix = 1;\r
- format += 2;\r
- }\r
- break;\r
- default:\r
- prefix_finished = 1;\r
- }\r
- if (!prefix_finished) format++;\r
- }\r
- /* read type */\r
+ /* look for leading asterisk, which means 'suppress assignment of\r
+ * this field'. */\r
+ if (*format=='*') {\r
+ format++;\r
+ suppress=1;\r
+ }\r
+ /* look for width specification */\r
+ while (_ISDIGIT_(*format)) {\r
+ width*=10;\r
+ width+=*format++ - '0';\r
+ }\r
+ if (width==0) width=-1; /* no width spec seen */\r
+ /* read prefix (if any) */\r
+ while (!prefix_finished) {\r
+ switch(*format) {\r
+ case 'h': h_prefix = 1; break;\r
+ case 'l': l_prefix = 1; break;\r
+ case 'w': w_prefix = 1; break;\r
+ case 'L': L_prefix = 1; break;\r
+ case 'I':\r
+ if (*(format + 1) == '6' &&\r
+ *(format + 2) == '4') {\r
+ I64_prefix = 1;\r
+ format += 2;\r
+ }\r
+ break;\r
+ default:\r
+ prefix_finished = 1;\r
+ }\r
+ if (!prefix_finished) format++;\r
+ }\r
+ /* read type */\r
switch(*format) {\r
- case 'x':\r
- case 'X': /* hexadecimal integer. */\r
- base = 16; number_signed = 0;\r
- goto number;\r
- case 'o': /* octal integer */\r
- base = 8; number_signed = 0;\r
- goto number;\r
- case 'u': /* unsigned decimal integer */\r
- base = 10; number_signed = 0;\r
- goto number;\r
- case 'd': /* signed decimal integer */\r
- base = 10; number_signed = 1;\r
- goto number;\r
- case 'i': /* generic integer */\r
- base = 10; number_signed = 1;\r
- number: {\r
- /* read an integer */\r
- ULONGLONG cur = 0;\r
- int negative = 0;\r
- int seendigit=0;\r
+ case 'x':\r
+ case 'X': /* hexadecimal integer. */\r
+ base = 16; number_signed = 0;\r
+ goto number;\r
+ case 'o': /* octal integer */\r
+ base = 8; number_signed = 0;\r
+ goto number;\r
+ case 'u': /* unsigned decimal integer */\r
+ base = 10; number_signed = 0;\r
+ goto number;\r
+ case 'd': /* signed decimal integer */\r
+ base = 10; number_signed = 1;\r
+ goto number;\r
+ case 'i': /* generic integer */\r
+ base = 10; number_signed = 1;\r
+ number: {\r
+ /* read an integer */\r
+ ULONGLONG cur = 0;\r
+ int negative = 0;\r
+ int seendigit=0;\r
/* skip initial whitespace */\r
while ((nch!=_EOF_) && _ISSPACE_(nch))\r
nch = _GETC_(file);\r
/* get sign */\r
if (number_signed && (nch == '-' ||\r
- nch == '+')) {\r
- negative = (nch=='-');\r
+ nch == '+')) {\r
+ negative = (nch=='-');\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
+ if (width>0) width--;\r
}\r
- /* look for leading indication of base */\r
- if (width!=0 && nch == '0') {\r
+ /* look for leading indication of base */\r
+ if (width!=0 && nch == '0') {\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
- seendigit=1;\r
- if (width!=0 && (nch=='x' || nch=='X')) {\r
- if (base==0)\r
- base=16;\r
- if (base==16) {\r
- nch = _GETC_(file);\r
- if (width>0) width--;\r
- seendigit=0;\r
- }\r
- } else if (base==0)\r
- base = 8;\r
- }\r
- /* throw away leading zeros */\r
- while (width!=0 && nch=='0') {\r
+ if (width>0) width--;\r
+ seendigit=1;\r
+ if (width!=0 && (nch=='x' || nch=='X')) {\r
+ if (base==0)\r
+ base=16;\r
+ if (base==16) {\r
+ nch = _GETC_(file);\r
+ if (width>0) width--;\r
+ seendigit=0;\r
+ }\r
+ } else if (base==0)\r
+ base = 8;\r
+ }\r
+ /* throw away leading zeros */\r
+ while (width!=0 && nch=='0') {\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
- seendigit=1;\r
- }\r
- if (width!=0 && _CHAR2DIGIT_(nch, base)!=-1) {\r
- cur = _CHAR2DIGIT_(nch, base);\r
- nch = _GETC_(file);\r
- if (width>0) width--;\r
- seendigit=1;\r
- }\r
+ if (width>0) width--;\r
+ seendigit=1;\r
+ }\r
+ if (width!=0 && _CHAR2DIGIT_(nch, base)!=-1) {\r
+ cur = _CHAR2DIGIT_(nch, base);\r
+ nch = _GETC_(file);\r
+ if (width>0) width--;\r
+ seendigit=1;\r
+ }\r
/* read until no more digits */\r
while (width!=0 && (nch!=_EOF_) && _CHAR2DIGIT_(nch, base)!=-1) {\r
cur = cur*base + _CHAR2DIGIT_(nch, base);\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
- seendigit=1;\r
+ if (width>0) width--;\r
+ seendigit=1;\r
}\r
- /* okay, done! */\r
- if (!seendigit) break; /* not a valid number */\r
+ /* okay, done! */\r
+ if (!seendigit) break; /* not a valid number */\r
st = 1;\r
if (!suppress) {\r
#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur\r
- if (number_signed) {\r
- if (I64_prefix) _SET_NUMBER_(LONGLONG);\r
- else if (l_prefix) _SET_NUMBER_(long int);\r
- else if (h_prefix) _SET_NUMBER_(short int);\r
- else _SET_NUMBER_(int);\r
- } else {\r
- if (negative) {\r
- WARN("Dropping sign in reading a negative number into an unsigned value");\r
- negative = 0;\r
- }\r
- if (I64_prefix) _SET_NUMBER_(ULONGLONG);\r
- else if (l_prefix) _SET_NUMBER_(unsigned long int);\r
- else if (h_prefix)\r
- _SET_NUMBER_(unsigned short int);\r
- else _SET_NUMBER_(unsigned int);\r
- }\r
- }\r
+ if (number_signed) {\r
+ if (I64_prefix) _SET_NUMBER_(LONGLONG);\r
+ else if (l_prefix) _SET_NUMBER_(long int);\r
+ else if (h_prefix) _SET_NUMBER_(short int);\r
+ else _SET_NUMBER_(int);\r
+ } else {\r
+ if (negative) {\r
+ WARN("Dropping sign in reading a negative number into an unsigned value");\r
+ negative = 0;\r
+ }\r
+ if (I64_prefix) _SET_NUMBER_(ULONGLONG);\r
+ else if (l_prefix) _SET_NUMBER_(unsigned long int);\r
+ else if (h_prefix)\r
+ _SET_NUMBER_(unsigned short int);\r
+ else _SET_NUMBER_(unsigned int);\r
+ }\r
+ }\r
}\r
break;\r
- case 'e':\r
- case 'E':\r
- case 'f':\r
- case 'g':\r
+ case 'e':\r
+ case 'E':\r
+ case 'f':\r
+ case 'g':\r
case 'G': { /* read a float */\r
long double cur = 0;\r
- int negative = 0;\r
+ int negative = 0;\r
/* skip initial whitespace */\r
while ((nch!=_EOF_) && _ISSPACE_(nch))\r
nch = _GETC_(file);\r
- /* get sign. */\r
+ /* get sign. */\r
if (nch == '-' || nch == '+') {\r
- negative = (nch=='-');\r
- if (width>0) width--;\r
- if (width==0) break;\r
+ negative = (nch=='-');\r
+ if (width>0) width--;\r
+ if (width==0) break;\r
nch = _GETC_(file);\r
}\r
- /* get first digit. */\r
- if ('.' != nch) {\r
- if (!_ISDIGIT_(nch)) break;\r
- cur = (nch - '0');\r
- nch = _GETC_(file);\r
- if (width>0) width--;\r
- /* read until no more digits */\r
- while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {\r
+ /* get first digit. */\r
+ if ('.' != nch) {\r
+ if (!_ISDIGIT_(nch)) break;\r
+ cur = (nch - '0');\r
+ nch = _GETC_(file);\r
+ if (width>0) width--;\r
+ /* read until no more digits */\r
+ while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {\r
cur = cur*10 + (nch - '0');\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
- }\r
- } else {\r
- cur = 0; /* MaxPayneDemo Fix: .8 -> 0.8 */\r
- }\r
- /* handle decimals */\r
+ if (width>0) width--;\r
+ }\r
+ } else {\r
+ cur = 0; /* MaxPayneDemo Fix: .8 -> 0.8 */\r
+ }\r
+ /* handle decimals */\r
if (width!=0 && nch == '.') {\r
float dec = 1;\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
+ if (width>0) width--;\r
while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {\r
dec /= 10;\r
cur += dec * (nch - '0');\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
+ if (width>0) width--;\r
}\r
}\r
- /* handle exponent */\r
- if (width!=0 && (nch == 'e' || nch == 'E')) {\r
- int exponent = 0, negexp = 0;\r
- float expcnt;\r
+ /* handle exponent */\r
+ if (width!=0 && (nch == 'e' || nch == 'E')) {\r
+ int exponent = 0, negexp = 0;\r
+ float expcnt;\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
- /* possible sign on the exponent */\r
- if (width!=0 && (nch=='+' || nch=='-')) {\r
- negexp = (nch=='-');\r
+ if (width>0) width--;\r
+ /* possible sign on the exponent */\r
+ if (width!=0 && (nch=='+' || nch=='-')) {\r
+ negexp = (nch=='-');\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
- }\r
- /* exponent digits */\r
- while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {\r
- exponent *= 10;\r
- exponent += (nch - '0');\r
+ if (width>0) width--;\r
+ }\r
+ /* exponent digits */\r
+ while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {\r
+ exponent *= 10;\r
+ exponent += (nch - '0');\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
+ if (width>0) width--;\r
}\r
- /* update 'cur' with this exponent. */\r
- expcnt = negexp ? .1 : 10;\r
- while (exponent!=0) {\r
- if (exponent&1)\r
- cur*=expcnt;\r
- exponent/=2;\r
- expcnt=expcnt*expcnt;\r
- }\r
- }\r
+ /* update 'cur' with this exponent. */\r
+ expcnt = negexp ? .1 : 10;\r
+ while (exponent!=0) {\r
+ if (exponent&1)\r
+ cur*=expcnt;\r
+ exponent/=2;\r
+ expcnt=expcnt*expcnt;\r
+ }\r
+ }\r
st = 1;\r
if (!suppress) {\r
- if (L_prefix) _SET_NUMBER_(long double);\r
- else if (l_prefix) _SET_NUMBER_(double);\r
- else _SET_NUMBER_(float);\r
- }\r
+ if (L_prefix) _SET_NUMBER_(long double);\r
+ else if (l_prefix) _SET_NUMBER_(double);\r
+ else _SET_NUMBER_(float);\r
+ }\r
}\r
break;\r
- /* According to\r
- * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_scanf_type_field_characters.asp\r
- * 's' reads a character string in a call to fscanf\r
- * and 'S' a wide character string and vice versa in a\r
- * call to fwscanf. The 'h', 'w' and 'l' prefixes override\r
- * this behaviour. 'h' forces reading char * but 'l' and 'w'\r
- * force reading WCHAR. */\r
- case 's':\r
- if (w_prefix || l_prefix) goto widecharstring;\r
- else if (h_prefix) goto charstring;\r
+ /* According to\r
+ * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_scanf_type_field_characters.asp\r
+ * 's' reads a character string in a call to fscanf\r
+ * and 'S' a wide character string and vice versa in a\r
+ * call to fwscanf. The 'h', 'w' and 'l' prefixes override\r
+ * this behaviour. 'h' forces reading char * but 'l' and 'w'\r
+ * force reading WCHAR. */\r
+ case 's':\r
+ if (w_prefix || l_prefix) goto widecharstring;\r
+ else if (h_prefix) goto charstring;\r
#ifdef WIDE_SCANF\r
- else goto widecharstring;\r
+ else goto widecharstring;\r
#else /* WIDE_SCANF */\r
- else goto charstring;\r
+ else goto charstring;\r
#endif /* WIDE_SCANF */\r
- case 'S':\r
- if (w_prefix || l_prefix) goto widecharstring;\r
- else if (h_prefix) goto charstring;\r
+ case 'S':\r
+ if (w_prefix || l_prefix) goto widecharstring;\r
+ else if (h_prefix) goto charstring;\r
#ifdef WIDE_SCANF\r
- else goto charstring;\r
+ else goto charstring;\r
#else /* WIDE_SCANF */\r
- else goto widecharstring;\r
+ else goto widecharstring;\r
#endif /* WIDE_SCANF */\r
- charstring: { /* read a word into a char */\r
- char*str = suppress ? NULL : va_arg(ap, char*);\r
+ charstring: { /* read a word into a char */\r
+ char*str = suppress ? NULL : va_arg(ap, char*);\r
char*sptr = str;\r
/* skip initial whitespace */\r
while ((nch!=_EOF_) && _ISSPACE_(nch))\r
/* read until whitespace */\r
while (width!=0 && (nch!=_EOF_) && !_ISSPACE_(nch)) {\r
if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch);\r
- st++;\r
+ st++;\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
+ if (width>0) width--;\r
}\r
/* terminate */\r
if (!suppress) *sptr = 0;\r
}\r
break;\r
- widecharstring: { /* read a word into a wchar_t* */\r
+ widecharstring: { /* read a word into a wchar_t* */\r
wchar_t*str =\r
suppress ? NULL : va_arg(ap, wchar_t*);\r
wchar_t*sptr = str;\r
/* read until whitespace */\r
while (width!=0 && (nch!=_EOF_) && !_ISSPACE_(nch)) {\r
if (!suppress) *sptr++ = _WIDE2SUPPORTED_(nch);\r
- st++;\r
+ st++;\r
nch = _GETC_(file);\r
- if (width>0) width--;\r
+ if (width>0) width--;\r
}\r
/* terminate */\r
if (!suppress) *sptr = 0;\r
}\r
break;\r
/* 'c' and 'C work analogously to 's' and 'S' as described\r
- * above */\r
- case 'c':\r
- if (w_prefix || l_prefix) goto widecharacter;\r
- else if (h_prefix) goto character;\r
+ * above */\r
+ case 'c':\r
+ if (w_prefix || l_prefix) goto widecharacter;\r
+ else if (h_prefix) goto character;\r
#ifdef WIDE_SCANF\r
- else goto widecharacter;\r
+ else goto widecharacter;\r
#else /* WIDE_SCANF */\r
- else goto character;\r
+ else goto character;\r
#endif /* WIDE_SCANF */\r
- case 'C':\r
- if (w_prefix || l_prefix) goto widecharacter;\r
- else if (h_prefix) goto character;\r
+ case 'C':\r
+ if (w_prefix || l_prefix) goto widecharacter;\r
+ else if (h_prefix) goto character;\r
#ifdef WIDE_SCANF\r
- else goto character;\r
+ else goto character;\r
#else /* WIDE_SCANF */\r
- else goto widecharacter;\r
+ else goto widecharacter;\r
#endif /* WIDE_SCANF */\r
- character: { /* read single character into char */\r
+ character: { /* read single character into char */\r
if (nch!=_EOF_) {\r
if (!suppress) {\r
char*c = va_arg(ap, char*);\r
nch = _GETC_(file);\r
}\r
}\r
- break;\r
- widecharacter: { /* read single character into a wchar_t */\r
+ break;\r
+ widecharacter: { /* read single character into a wchar_t */\r
if (nch!=_EOF_) {\r
if (!suppress) {\r
wchar_t*c = va_arg(ap, wchar_t*);\r
nch = _GETC_(file);\r
st = 1;\r
}\r
- }\r
- break;\r
- case 'n': {\r
- if (!suppress) {\r
- int*n = va_arg(ap, int*);\r
- *n = consumed - (nch!=_EOF_);\r
- }\r
- }\r
- break;\r
- case '[': {\r
+ }\r
+ break;\r
+ case 'n': {\r
+ if (!suppress) {\r
+ int*n = va_arg(ap, int*);\r
+\r
+ /* \r
+ *n = consumed - (nch!=_EOF_);\r
+ \r
+ FIXME: The above is the Wine version and it doesnt work in ros\r
+ when %n is at end of input string (return one too many).\r
+ But does it fail in Wine too?? If so wine also needs fixin.\r
+ -Gunnar\r
+ */\r
+\r
+ *n = consumed - 1;\r
+ }\r
+ /* This is an odd one: according to the standard,\r
+ * "Execution of a %n directive does not increment the\r
+ * assignment count returned at the completion of\r
+ * execution" even if it wasn't suppressed with the\r
+ * '*' flag. The Corrigendum to the standard seems\r
+ * to contradict this (comment out the assignment to\r
+ * suppress below if you want to implement these\r
+ * alternate semantics) but the windows program I'm\r
+ * looking at expects the behavior I've coded here\r
+ * (which happens to be what glibc does as well).\r
+ */\r
+ suppress = 1;\r
+ st = 1;\r
+ }\r
+ break;\r
+ case '[': {\r
_CHAR_ *str = suppress ? NULL : va_arg(ap, _CHAR_*);\r
_CHAR_ *sptr = str;\r
- RTL_BITMAP bitMask;\r
+ RTL_BITMAP bitMask;\r
ULONG *Mask;\r
- int invert = 0; /* Set if we are NOT to find the chars */\r
+ int invert = 0; /* Set if we are NOT to find the chars */\r
\r
- /* Init our bitmap */\r
+ /* Init our bitmap */\r
Mask = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _BITMAPSIZE_/8);\r
- RtlInitializeBitMap(&bitMask, Mask, _BITMAPSIZE_);\r
+ RtlInitializeBitMap(&bitMask, Mask, _BITMAPSIZE_);\r
\r
- /* Read the format */\r
- format++;\r
- if(*format == '^') {\r
- invert = 1;\r
- format++;\r
- }\r
- if(*format == ']') {\r
- RtlSetBits(&bitMask, ']', 1);\r
- format++;\r
- }\r
+ /* Read the format */\r
+ format++;\r
+ if(*format == '^') {\r
+ invert = 1;\r
+ format++;\r
+ }\r
+ if(*format == ']') {\r
+ RtlSetBits(&bitMask, ']', 1);\r
+ format++;\r
+ }\r
while(*format && (*format != ']')) {\r
- /* According to:\r
- * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_scanf_width_specification.asp\r
- * "Note that %[a-z] and %[z-a] are interpreted as equivalent to %[abcde...z]." */\r
- if((*format == '-') && (*(format + 1) != ']')) {\r
- if ((*(format - 1)) < *(format + 1))\r
- RtlSetBits(&bitMask, *(format - 1) +1 , *(format + 1) - *(format - 1));\r
- else\r
- RtlSetBits(&bitMask, *(format + 1) , *(format - 1) - *(format + 1)); \r
- format++;\r
- } else\r
- RtlSetBits(&bitMask, *format, 1);\r
- format++;\r
- }\r
+ /* According to:\r
+ * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_scanf_width_specification.asp\r
+ * "Note that %[a-z] and %[z-a] are interpreted as equivalent to %[abcde...z]." */\r
+ if((*format == '-') && (*(format + 1) != ']')) {\r
+ if ((*(format - 1)) < *(format + 1))\r
+ RtlSetBits(&bitMask, *(format - 1) +1 , *(format + 1) - *(format - 1));\r
+ else\r
+ RtlSetBits(&bitMask, *(format + 1) , *(format - 1) - *(format + 1)); \r
+ format++;\r
+ } else\r
+ RtlSetBits(&bitMask, *format, 1);\r
+ format++;\r
+ }\r
/* read until char is not suitable */\r
while ((width != 0) && (nch != _EOF_)) {\r
- if(!invert) {\r
- if(RtlAreBitsSet(&bitMask, nch, 1)) {\r
- if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch);\r
- } else\r
- break;\r
- } else {\r
- if(RtlAreBitsClear(&bitMask, nch, 1)) {\r
- if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch);\r
- } else\r
- break;\r
- }\r
+ if(!invert) {\r
+ if(RtlAreBitsSet(&bitMask, nch, 1)) {\r
+ if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch);\r
+ } else\r
+ break;\r
+ } else {\r
+ if(RtlAreBitsClear(&bitMask, nch, 1)) {\r
+ if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch);\r
+ } else\r
+ break;\r
+ }\r
st++;\r
nch = _GETC_(file);\r
if (width>0) width--;\r
}\r
/* terminate */\r
if (!suppress) *sptr = 0;\r
- HeapFree(GetProcessHeap(), 0, Mask);\r
+ HeapFree(GetProcessHeap(), 0, Mask);\r
}\r
break;\r
default:\r
- /* From spec: "if a percent sign is followed by a character\r
- * that has no meaning as a format-control character, that\r
- * character and the following characters are treated as\r
- * an ordinary sequence of characters, that is, a sequence\r
- * of characters that must match the input. For example,\r
- * to specify that a percent-sign character is to be input,\r
- * use %%." */\r
+ /* From spec: "if a percent sign is followed by a character\r
+ * that has no meaning as a format-control character, that\r
+ * character and the following characters are treated as\r
+ * an ordinary sequence of characters, that is, a sequence\r
+ * of characters that must match the input. For example,\r
+ * to specify that a percent-sign character is to be input,\r
+ * use %%." */\r
while ((nch!=_EOF_) && _ISSPACE_(nch))\r
nch = _GETC_(file);\r
if (nch==*format) {\r
if (st && !suppress) rd++;\r
else if (!st) break;\r
}\r
- /* a non-white-space character causes scanf to read, but not store,\r
- * a matching non-white-space character. */\r
+ /* a non-white-space character causes scanf to read, but not store,\r
+ * a matching non-white-space character. */\r
else {\r
/* check for character match */\r
if (nch == *format) {\r
- nch = _GETC_(file);\r
+ nch = _GETC_(file);\r
} else break;\r
}\r
format++;\r
}\r
if (nch!=_EOF_) {\r
- _UNGETC_(nch, file);\r
+ _UNGETC_(nch, file);\r
}\r
TRACE("returning %d\n", rd);\r
return rd;\r