--- embedaddon/libxml2/trio.c 2012/02/21 23:37:57 1.1.1.1 +++ embedaddon/libxml2/trio.c 2014/06/15 19:53:28 1.1.1.2 @@ -1,6 +1,6 @@ /************************************************************************* * - * $Id: trio.c,v 1.1.1.1 2012/02/21 23:37:57 misho Exp $ + * $Id: trio.c,v 1.1.1.2 2014/06/15 19:53:28 misho Exp $ * * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. * @@ -307,6 +307,10 @@ typedef trio_longlong_t trio_int64_t; #define NAN_LOWER "nan" #define NAN_UPPER "NAN" +#if !defined(HAVE_ISASCII) && !defined(isascii) +# define isascii(x) ((unsigned int)(x) < 128) +#endif + /* Various constants */ enum { TYPE_PRINT = 1, @@ -376,7 +380,7 @@ enum { /* Maximal string lengths for user-defined specifiers */ MAX_USER_NAME = 64, MAX_USER_DATA = 256, - + /* Maximal length of locale separator strings */ MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX, /* Maximal number of integers in grouping */ @@ -733,7 +737,7 @@ typedef struct _trio_userdef_t { * *************************************************************************/ -static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.1.1.1 2012/02/21 23:37:57 misho Exp $"; +static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.1.1.2 2014/06/15 19:53:28 misho Exp $"; /* * Need this to workaround a parser bug in HP C/iX compiler that fails @@ -1020,23 +1024,23 @@ TRIO_ARGS2((name, prev), trio_userdef_t **prev) { trio_userdef_t *def; - + if (internalEnterCriticalRegion) (void)internalEnterCriticalRegion(NULL); - + for (def = internalUserDef; def; def = def->next) { /* Case-sensitive string comparison */ if (trio_equal_case(def->name, name)) break; - + if (prev) *prev = def; } - + if (internalLeaveCriticalRegion) (void)internalLeaveCriticalRegion(NULL); - + return def; } #endif @@ -1200,7 +1204,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra /* One and only one of arglist and argarray must be used */ assert((arglist != NULL) ^ (argarray != NULL)); - + /* * The 'parameters' array is not initialized, but we need to * know which entries we have used. @@ -1213,7 +1217,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) (void)mblen(NULL, 0); #endif - + while (format[index]) { #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) @@ -1291,7 +1295,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra /* Skip if no precision */ if (QUALIFIER_DOT == format[index]) break; - + /* After the first dot we have the precision */ flags |= FLAGS_PRECISION; if ((QUALIFIER_STAR == format[index]) @@ -1336,7 +1340,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra else if (dots == 1) /* Base */ { dots++; - + /* After the second dot we have the base */ flags |= FLAGS_BASE; if ((QUALIFIER_STAR == format[index]) @@ -1535,7 +1539,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra } else return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - + flags |= FLAGS_FIXED_SIZE; break; #endif @@ -1563,7 +1567,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra gotSticky = TRUE; break; #endif - + #if defined(QUALIFIER_VARSIZE) case QUALIFIER_VARSIZE: flags |= FLAGS_VARSIZE_PARAMETER; @@ -1628,9 +1632,9 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra indices[varsize] = pos; varsize = pos++; } - + indices[currentParam] = pos; - + switch (format[index++]) { #if defined(SPECIFIER_CHAR_UPPER) @@ -1689,11 +1693,11 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra } } break; - + case SPECIFIER_INTEGER: parameters[pos].type = FORMAT_INT; break; - + case SPECIFIER_UNSIGNED: flags |= FLAGS_UNSIGNED; parameters[pos].type = FORMAT_INT; @@ -1793,11 +1797,11 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra { unsigned int max; int without_namespace = TRUE; - + parameters[pos].type = FORMAT_USER_DEFINED; parameters[pos].user_name[0] = NIL; tmpformat = (char *)&format[index]; - + while ((ch = format[index])) { index++; @@ -1845,7 +1849,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra } break; #endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */ - + default: /* Bail out completely to make the error more obvious */ return TRIO_ERROR_RETURN(TRIO_EINVAL, index); @@ -1853,7 +1857,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra /* Count the number of times this entry has been used */ usedEntries[currentParam] += 1; - + /* Find last sticky parameters */ if (gotSticky && !(flags & FLAGS_STICKY)) { @@ -1876,7 +1880,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra } } } - + parameters[pos].indexAfterSpecifier = index; parameters[pos].flags = flags; parameters[pos].width = width; @@ -1884,12 +1888,12 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base; parameters[pos].varsize = varsize; pos++; - + if (! positional) parameterPosition++; - + } /* if identifier */ - + } /* while format characters left */ for (num = 0; num <= maxParam; num++) @@ -1901,7 +1905,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra else /* double references detected */ return TRIO_ERROR_RETURN(TRIO_EDBLREF, num); } - + i = indices[num]; /* @@ -1969,7 +1973,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra if (TYPE_SCAN == type) { if (argarray == NULL) - parameters[i].data.pointer = + parameters[i].data.pointer = (trio_pointer_t)va_arg(*arglist, trio_pointer_t); else { @@ -2009,7 +2013,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarra varsize = parameters[i].varsize; } parameters[i].flags &= ~FLAGS_ALL_VARSIZES; - + if (varsize <= (int)sizeof(int)) ; else if (varsize <= (int)sizeof(long)) @@ -2213,7 +2217,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas number &= (unsigned long)-1; else number &= (unsigned int)-1; - + /* Build number */ pointer = bufferend = &buffer[sizeof(buffer) - 1]; *pointer-- = NIL; @@ -2260,7 +2264,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas count = (! ((flags & FLAGS_LEFTADJUST) || (precision == NO_PRECISION))) ? precision : 0; - + /* Adjust width further */ if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE)) width--; @@ -2495,7 +2499,7 @@ TRIO_ARGS4((self, wch, flags, width), if (width == NO_WIDTH) width = sizeof(buffer); - + size = wctomb(buffer, wch); if ((size <= 0) || (size > width) || (buffer[0] == NIL)) return 0; @@ -2537,13 +2541,13 @@ TRIO_ARGS5((self, wstring, flags, width, precision), #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) (void)mblen(NULL, 0); #endif - + if (wstring == NULL) { TrioWriteString(self, NULL, flags, width, precision); return; } - + if (NO_PRECISION == precision) { length = INT_MAX; @@ -2638,7 +2642,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas BOOLEAN_T keepTrailingZeroes; BOOLEAN_T keepDecimalPoint; trio_long_double_t epsilon; - + assert(VALID(self)); assert(VALID(self->OutStream)); assert(((base >= MIN_BASE) && (base <= MAX_BASE)) || (base == NO_BASE)); @@ -2653,7 +2657,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas : NAN_LOWER, flags, width, precision); return; - + case TRIO_FP_INFINITE: if (isNegative) { @@ -2680,7 +2684,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas /* Finitude */ break; } - + /* Normal numbers */ if (flags & FLAGS_LONGDOUBLE) { @@ -2728,13 +2732,13 @@ TRIO_ARGS6((self, number, flags, width, precision, bas precision = FLT_DIG; } } - + if (isNegative) number = -number; if (isHex) flags |= FLAGS_FLOAT_E; - + if (flags & FLAGS_FLOAT_G) { if (precision == 0) @@ -2787,7 +2791,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas integerNumber = floorl(number); fractionNumber = number - integerNumber; - + /* * Truncated number. * @@ -2802,7 +2806,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas : zeroes + precision; dblFractionBase = TrioPower(base, fractionDigits); - + workNumber = number + 0.5 / dblFractionBase; if (floorl(number) != floorl(workNumber)) { @@ -2855,7 +2859,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas integerThreshold = INT_MAX; fractionThreshold = INT_MAX; } - + /* * Calculate expected width. * sign + integer part + thousands separators + decimal point @@ -2891,7 +2895,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas ((requireTwoDigitExponent ? sizeof("E+0") : sizeof("E+")) - 1); if (isHex) expectedWidth += sizeof("0X") - 1; - + /* Output prefixing */ if (flags & FLAGS_NILPADDING) { @@ -2937,7 +2941,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); } } - + /* Output the integer part and thousand separators */ dblIntegerBase = 1.0 / TrioPower(base, integerDigits - 1); for (i = 0; i < integerDigits; i++) @@ -2953,7 +2957,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas self->OutStream(self, digits[(int)fmodl(workNumber, dblBase)]); } dblIntegerBase *= dblBase; - + if (((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE) && TrioFollowedBySeparator(integerDigits - i)) { @@ -2965,7 +2969,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas } } } - + /* Insert decimal point and build the fraction part */ trailingZeroes = 0; @@ -3014,7 +3018,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas } } } - + if (keepTrailingZeroes) { while (trailingZeroes > 0) @@ -3023,7 +3027,7 @@ TRIO_ARGS6((self, number, flags, width, precision, bas trailingZeroes--; } } - + /* Output exponent */ if (exponentDigits > 0) { @@ -3080,13 +3084,13 @@ TRIO_ARGS3((data, format, parameters), int precision; int base; int index; - + index = 0; i = 0; #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) (void)mblen(NULL, 0); #endif - + while (format[index]) { #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) @@ -3120,7 +3124,7 @@ TRIO_ARGS3((data, format, parameters), /* Skip the parameter entries */ while (parameters[i].type == FORMAT_PARAMETER) i++; - + flags = parameters[i].flags; /* Find width */ @@ -3140,7 +3144,7 @@ TRIO_ARGS3((data, format, parameters), width = -width; } } - + /* Find precision */ if (flags & FLAGS_PRECISION) { @@ -3171,7 +3175,7 @@ TRIO_ARGS3((data, format, parameters), /* Get base from parameter list */ base = (int)parameters[base].data.number.as_signed; } - + switch (parameters[i].type) { case FORMAT_CHAR: @@ -3251,7 +3255,7 @@ TRIO_ARGS3((data, format, parameters), case FORMAT_POINTER: { trio_reference_t reference; - + reference.data = data; reference.parameter = ¶meters[i]; trio_print_pointer(&reference, parameters[i].data.pointer); @@ -3354,7 +3358,7 @@ TRIO_ARGS3((data, format, parameters), } break; #endif /* defined(FORMAT_USER_DEFINED) */ - + default: break; } /* switch parameter type */ @@ -3564,7 +3568,7 @@ TRIO_ARGS2((self, output), assert(VALID(self)); assert(VALID(self->location)); - + buffer = (char **)self->location; if (self->processed < self->max) @@ -3632,7 +3636,7 @@ TRIO_VARGS2((format, va_alist), va_list args; assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL); TRIO_VA_END(args); @@ -3699,7 +3703,7 @@ TRIO_VARGS3((file, format, va_alist), assert(VALID(file)); assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL); TRIO_VA_END(args); @@ -3723,7 +3727,7 @@ TRIO_ARGS3((file, format, args), { assert(VALID(file)); assert(VALID(format)); - + return TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL); } @@ -3744,7 +3748,7 @@ TRIO_ARGS3((file, format, args), { assert(VALID(file)); assert(VALID(format)); - + return TrioFormat(file, 0, TrioOutStreamFile, format, NULL, args); } @@ -3771,7 +3775,7 @@ TRIO_VARGS3((fd, format, va_alist), va_list args; assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL); TRIO_VA_END(args); @@ -3794,7 +3798,7 @@ TRIO_ARGS3((fd, format, args), va_list args) { assert(VALID(format)); - + return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL); } @@ -3814,7 +3818,7 @@ TRIO_ARGS3((fd, format, args), trio_pointer_t *args) { assert(VALID(format)); - + return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, NULL, args); } @@ -3904,7 +3908,7 @@ TRIO_VARGS3((buffer, format, va_alist), assert(VALID(buffer)); assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL); *buffer = NIL; /* Terminate with NIL character */ @@ -4098,7 +4102,7 @@ TRIO_ARGS4((buffer, max, format, args), { int status; size_t buf_len; - + assert(VALID(buffer)); assert(VALID(format)); @@ -4126,7 +4130,7 @@ TRIO_VARGS2((format, va_alist), char *result = NULL; assert(VALID(format)); - + info = trio_xstring_duplicate(""); if (info) { @@ -4151,9 +4155,9 @@ TRIO_ARGS2((format, args), { trio_string_t *info; char *result = NULL; - + assert(VALID(format)); - + info = trio_xstring_duplicate(""); if (info) { @@ -4180,7 +4184,7 @@ TRIO_VARGS3((result, format, va_alist), assert(VALID(format)); *result = NULL; - + info = trio_xstring_duplicate(""); if (info == NULL) { @@ -4211,11 +4215,11 @@ TRIO_ARGS3((result, format, args), { int status; trio_string_t *info; - + assert(VALID(format)); *result = NULL; - + info = trio_xstring_duplicate(""); if (info == NULL) { @@ -4264,7 +4268,7 @@ TRIO_ARGS3((result, format, args), @param name @return Handle. */ -TRIO_PUBLIC trio_pointer_t +TRIO_PUBLIC trio_pointer_t trio_register TRIO_ARGS2((callback, name), trio_callback_t callback, @@ -4291,23 +4295,23 @@ TRIO_ARGS2((callback, name), } return NULL; } - + /* Bail out if namespace is too long */ if (trio_length(name) >= MAX_USER_NAME) return NULL; - + /* Bail out if namespace already is registered */ def = TrioFindNamespace(name, &prev); if (def) return NULL; } - + def = (trio_userdef_t *)TRIO_MALLOC(sizeof(trio_userdef_t)); if (def) { if (internalEnterCriticalRegion) (void)internalEnterCriticalRegion(NULL); - + if (name) { /* Link into internal list */ @@ -4352,12 +4356,12 @@ TRIO_ARGS1((handle), { if (internalEnterCriticalRegion) (void)internalEnterCriticalRegion(NULL); - + if (prev == NULL) internalUserDef = NULL; else prev->next = def->next; - + if (internalLeaveCriticalRegion) (void)internalLeaveCriticalRegion(NULL); } @@ -4377,14 +4381,14 @@ TRIO_ARGS1((ref), #if defined(FORMAT_USER_DEFINED) assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED); #endif - + return (((trio_reference_t *)ref)->parameter->user_data); } /************************************************************************* * trio_get_argument [public] */ -trio_pointer_t +trio_pointer_t trio_get_argument TRIO_ARGS1((ref), trio_pointer_t ref) @@ -4392,7 +4396,7 @@ TRIO_ARGS1((ref), #if defined(FORMAT_USER_DEFINED) assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED); #endif - + return ((trio_reference_t *)ref)->parameter->data.pointer; } @@ -4924,7 +4928,7 @@ TRIO_VARGS3((ref, format, va_alist), va_list arglist; assert(VALID(format)); - + TRIO_VA_START(arglist, format); status = TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL); TRIO_VA_END(arglist); @@ -4942,7 +4946,7 @@ TRIO_ARGS3((ref, format, arglist), va_list arglist) { assert(VALID(format)); - + return TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL); } @@ -4957,7 +4961,7 @@ TRIO_ARGS3((ref, format, argarray), trio_pointer_t *argarray) { assert(VALID(format)); - + return TrioFormatRef((trio_reference_t *)ref, format, NULL, argarray); } @@ -5206,7 +5210,7 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, charac switch (ch) { case QUALIFIER_MINUS: /* Scanlist ranges */ - + /* * Both C99 and UNIX98 describes ranges as implementation- * defined. @@ -5233,17 +5237,17 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, charac return TRIO_ERROR_RETURN(TRIO_EINVAL, index); if (range_begin > range_end) return TRIO_ERROR_RETURN(TRIO_ERANGE, index); - + for (i = (int)range_begin; i <= (int)range_end; i++) characterclass[i]++; - + ch = range_end; break; - + #if TRIO_EXTENSION case SPECIFIER_GROUP: - + switch (format[index + 1]) { case QUALIFIER_DOT: /* Collating symbol */ @@ -5262,15 +5266,15 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, charac } if (format[++i] != SPECIFIER_UNGROUP) return -1; - + index = i; break; - + case QUALIFIER_EQUAL: /* Equivalence class expressions */ { unsigned int j; unsigned int k; - + if (internalCollationUnconverted) { /* Lazy evaluation of collation array */ @@ -5294,13 +5298,13 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, charac } if (format[++i] != SPECIFIER_UNGROUP) return -1; - + index = i; } break; - + case QUALIFIER_COLON: /* Character class expressions */ - + if (trio_equal_max(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1, &format[index])) { @@ -5400,9 +5404,9 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, charac break; } break; - + #endif /* TRIO_EXTENSION */ - + default: characterclass[(int)ch]++; break; @@ -5448,9 +5452,9 @@ TRIO_ARGS5((self, target, flags, width, base), } internalDigitsUnconverted = FALSE; } - + TrioSkipWhitespaces(self); - + if (!(flags & FLAGS_UNSIGNED)) { /* Leading sign */ @@ -5464,9 +5468,9 @@ TRIO_ARGS5((self, target, flags, width, base), isNegative = TRUE; } } - + count = self->processed; - + if (flags & FLAGS_ALTERNATIVE) { switch (base) @@ -5527,7 +5531,7 @@ TRIO_ARGS5((self, target, flags, width, base), } else break; - + number *= base; number += digit; gotNumber = TRUE; /* we need at least one digit */ @@ -5538,7 +5542,7 @@ TRIO_ARGS5((self, target, flags, width, base), /* Was anything read at all? */ if (!gotNumber) return FALSE; - + if (target) *target = (isNegative) ? -((trio_intmax_t)number) : number; return TRUE; @@ -5558,7 +5562,7 @@ TRIO_ARGS4((self, target, flags, width), int i; char ch; trio_uintmax_t number; - + assert(VALID(self)); assert(VALID(self->InStream)); @@ -5603,7 +5607,7 @@ TRIO_ARGS4((self, target, flags, width), break; } } - + if (target) target[i] = ch; } @@ -5622,12 +5626,12 @@ TRIO_ARGS4((self, target, flags, width), int width) { int i; - + assert(VALID(self)); assert(VALID(self->InStream)); TrioSkipWhitespaces(self); - + /* * Continue until end of string is reached, a whitespace is encountered, * or width is exceeded @@ -5663,7 +5667,7 @@ TRIO_ARGS4((self, target, flags, width), int amount = 0; trio_wchar_t wch; char buffer[MB_LEN_MAX + 1]; - + assert(VALID(self)); assert(VALID(self->InStream)); @@ -5720,7 +5724,7 @@ TRIO_ARGS4((self, target, flags, width), { int i; int size; - + assert(VALID(self)); assert(VALID(self->InStream)); @@ -5729,7 +5733,7 @@ TRIO_ARGS4((self, target, flags, width), #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) (void)mblen(NULL, 0); #endif - + /* * Continue until end of string is reached, a whitespace is encountered, * or width is exceeded @@ -5767,7 +5771,7 @@ TRIO_ARGS5((self, target, characterclass, flags, width { int ch; int i; - + assert(VALID(self)); assert(VALID(self->InStream)); @@ -5782,7 +5786,7 @@ TRIO_ARGS5((self, target, characterclass, flags, width target[i] = (char)ch; self->InStream(self, &ch); } - + if (target) target[i] = NIL; return TRUE; @@ -5811,12 +5815,12 @@ TRIO_ARGS4((self, target, flags, width), BOOLEAN_T isHex = FALSE; doubleString[0] = 0; - + if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1)) width = sizeof(doubleString) - 1; - + TrioSkipWhitespaces(self); - + /* * Read entire double number from stream. trio_to_double requires * a string as input, but InStream can be anything, so we have to @@ -5902,11 +5906,11 @@ TRIO_ARGS4((self, target, flags, width), self->InStream(self, &ch); } break; - + default: break; } - + while ((ch != EOF) && (index - start < width)) { /* Integer part */ @@ -5966,7 +5970,7 @@ TRIO_ARGS4((self, target, flags, width), return FALSE; doubleString[index] = 0; - + if (flags & FLAGS_LONGDOUBLE) { *((trio_long_double_t *)target) = trio_to_long_double(doubleString, NULL); @@ -5992,7 +5996,7 @@ TRIO_ARGS3((self, target, flags), char buffer[sizeof(internalNullString)]; flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING); - + if (TrioReadNumber(self, &number, flags, @@ -6013,7 +6017,7 @@ TRIO_ARGS3((self, target, flags), : buffer, 0, sizeof(internalNullString) - 1)) - { + { if (trio_equal_case(buffer, internalNullString)) { if (target) @@ -6077,12 +6081,12 @@ TRIO_ARGS3((data, format, parameters), } } #endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - + if ((EOF == ch) && (parameters[i].type != FORMAT_COUNT)) { return (assignment > 0) ? assignment : EOF; } - + if (CHAR_IDENTIFIER == format[index]) { if (CHAR_IDENTIFIER == format[index + 1]) @@ -6101,7 +6105,7 @@ TRIO_ARGS3((data, format, parameters), /* Skip the parameter entries */ while (parameters[i].type == FORMAT_PARAMETER) i++; - + flags = parameters[i].flags; /* Find width */ width = parameters[i].width; @@ -6117,7 +6121,7 @@ TRIO_ARGS3((data, format, parameters), /* Get base from parameter list */ base = (int)parameters[base].data.number.as_signed; } - + switch (parameters[i].type) { case FORMAT_INT: @@ -6165,7 +6169,7 @@ TRIO_ARGS3((data, format, parameters), } } break; /* FORMAT_INT */ - + case FORMAT_STRING: #if TRIO_WIDECHAR if (flags & FLAGS_WIDECHAR) @@ -6229,7 +6233,7 @@ TRIO_ARGS3((data, format, parameters), } /* Skip over group specifier */ index++; - + memset(characterclass, 0, sizeof(characterclass)); rc = TrioGetCharacterClass(format, &index, @@ -6291,7 +6295,7 @@ TRIO_ARGS3((data, format, parameters), } } break; /* FORMAT_COUNT */ - + case FORMAT_CHAR: #if TRIO_WIDECHAR if (flags & FLAGS_WIDECHAR) @@ -6353,7 +6357,7 @@ TRIO_ARGS3((data, format, parameters), } else return assignment; - + index++; } } @@ -6392,7 +6396,7 @@ TRIO_ARGS6((source, sourceSize, InStream, format, argl TrioSetLocale(); } #endif - + status = TrioParse(TYPE_SCAN, format, parameters, arglist, argarray); if (status < 0) return status; @@ -6431,7 +6435,7 @@ TRIO_ARGS2((self, intPointer), self->processed++; self->committed++; } - + if (VALID(intPointer)) { *intPointer = self->current; @@ -6468,7 +6472,7 @@ TRIO_ARGS2((self, intPointer), self->committed++; self->processed++; } - + if (VALID(intPointer)) { *intPointer = self->current; @@ -6485,7 +6489,7 @@ TRIO_ARGS2((self, intPointer), int *intPointer) { trio_custom_t *data; - + assert(VALID(self)); assert(VALID(self->location)); @@ -6494,7 +6498,7 @@ TRIO_ARGS2((self, intPointer), self->current = (data->stream.in == NULL) ? NIL : (data->stream.in)(data->closure); - + if (self->current == NIL) { self->current = EOF; @@ -6504,7 +6508,7 @@ TRIO_ARGS2((self, intPointer), self->processed++; self->committed++; } - + if (VALID(intPointer)) { *intPointer = self->current; @@ -6537,7 +6541,7 @@ TRIO_ARGS2((self, intPointer), self->processed++; self->committed++; } - + if (VALID(intPointer)) { *intPointer = self->current; @@ -6578,7 +6582,7 @@ TRIO_VARGS2((format, va_alist), va_list args; assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioScan((trio_pointer_t)stdin, 0, TrioInStreamFile, @@ -6594,7 +6598,7 @@ TRIO_ARGS2((format, args), va_list args) { assert(VALID(format)); - + return TrioScan((trio_pointer_t)stdin, 0, TrioInStreamFile, format, &args, NULL); @@ -6607,7 +6611,7 @@ TRIO_ARGS2((format, args), trio_pointer_t *args) { assert(VALID(format)); - + return TrioScan((trio_pointer_t)stdin, 0, TrioInStreamFile, format, NULL, args); @@ -6628,7 +6632,7 @@ TRIO_VARGS3((file, format, va_alist), assert(VALID(file)); assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioScan((trio_pointer_t)file, 0, TrioInStreamFile, @@ -6646,7 +6650,7 @@ TRIO_ARGS3((file, format, args), { assert(VALID(file)); assert(VALID(format)); - + return TrioScan((trio_pointer_t)file, 0, TrioInStreamFile, format, &args, NULL); @@ -6661,7 +6665,7 @@ TRIO_ARGS3((file, format, args), { assert(VALID(file)); assert(VALID(format)); - + return TrioScan((trio_pointer_t)file, 0, TrioInStreamFile, format, NULL, args); @@ -6681,7 +6685,7 @@ TRIO_VARGS3((fd, format, va_alist), va_list args; assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioScan((trio_pointer_t)&fd, 0, TrioInStreamFileDescriptor, @@ -6698,7 +6702,7 @@ TRIO_ARGS3((fd, format, args), va_list args) { assert(VALID(format)); - + return TrioScan((trio_pointer_t)&fd, 0, TrioInStreamFileDescriptor, format, &args, NULL); @@ -6712,7 +6716,7 @@ TRIO_ARGS3((fd, format, args), trio_pointer_t *args) { assert(VALID(format)); - + return TrioScan((trio_pointer_t)&fd, 0, TrioInStreamFileDescriptor, format, NULL, args); @@ -6735,7 +6739,7 @@ TRIO_VARGS4((stream, closure, format, va_alist), assert(VALID(stream)); assert(VALID(format)); - + TRIO_VA_START(args, format); data.stream.in = stream; data.closure = closure; @@ -6753,7 +6757,7 @@ TRIO_ARGS4((stream, closure, format, args), va_list args) { trio_custom_t data; - + assert(VALID(stream)); assert(VALID(format)); @@ -6771,7 +6775,7 @@ TRIO_ARGS4((stream, closure, format, args), trio_pointer_t *args) { trio_custom_t data; - + assert(VALID(stream)); assert(VALID(format)); @@ -6795,7 +6799,7 @@ TRIO_VARGS3((buffer, format, va_alist), assert(VALID(buffer)); assert(VALID(format)); - + TRIO_VA_START(args, format); status = TrioScan((trio_pointer_t)&buffer, 0, TrioInStreamString, @@ -6813,7 +6817,7 @@ TRIO_ARGS3((buffer, format, args), { assert(VALID(buffer)); assert(VALID(format)); - + return TrioScan((trio_pointer_t)&buffer, 0, TrioInStreamString, format, &args, NULL); @@ -6828,7 +6832,7 @@ TRIO_ARGS3((buffer, format, args), { assert(VALID(buffer)); assert(VALID(format)); - + return TrioScan((trio_pointer_t)&buffer, 0, TrioInStreamString, format, NULL, args);