The MSVC issues parameter validation error in
22.locale.time.put.mt.cpp test.
The parameter checking code below:
---------
int (isspace) (int c)
{
_ASSERTE((unsigned)(c + 1) <= 256);
...
}
---------
The same validation performed in all isxxx() functions. This
validation asserts on all c < -1.
The patch is attached.
ChangeLog:
* time_put.cpp (__rw_get_date_fmat): Convert char argument of
isspace(), isdigit(), ispunct() to unsigned char .
(__rw_get_time_fmat): Ditto.
Farid.
Index: time_put.cpp
===================================================================
--- time_put.cpp (revision 579898)
+++ time_put.cpp (working copy)
@@ -160,6 +160,7 @@
#ifdef _RWSTD_NO_NL_LANGINFO
+typedef unsigned char UChar;
// compute the format string corresponding to the "%x" format specifier
// in the current locale (set by setlocale (LC_ALL, ...))
@@ -197,16 +198,16 @@
for (char *ptmp = tmp; *ptmp; ) {
// store all whitespace as part of format
- for (; (isspace)(*ptmp); ++ptmp)
+ for (; (isspace)(UChar (*ptmp)); ++ptmp)
*pfmt++ = *ptmp;
const char *begin = ptmp;
// skip over all non-digit characters
- for (; *ptmp && !(isdigit)(*ptmp); ++ptmp) {
- if ((ispunct)(*ptmp) || (isspace)(*ptmp)) {
+ for (; *ptmp && !(isdigit)(UChar (*ptmp)); ++ptmp) {
+ if ((ispunct)(UChar (*ptmp)) || (isspace)(UChar (*ptmp))) {
// store all punctuators as part of format
- for ( ; (ispunct)(*ptmp) || (isspace)(*ptmp); ++ptmp)
+ for ( ; (ispunct)(UChar (*ptmp)) || (isspace)(UChar (*ptmp));
++ptmp)
*pfmt++ = *ptmp;
break;
}
@@ -258,9 +259,9 @@
}
}
- if ((isdigit)(*ptmp)) {
+ if ((isdigit)(UChar (*ptmp))) {
- for (begin = ptmp; (isdigit)(*ptmp); ++ptmp);
+ for (begin = ptmp; (isdigit)(UChar (*ptmp)); ++ptmp);
*pfmt++ = '%';
if (ptmp - begin == 1) {
@@ -322,16 +323,16 @@
for (char *ptmp = tmp; *ptmp; ) {
- for (; (isspace)(*ptmp); ++ptmp)
+ for (; (isspace)(UChar (*ptmp)); ++ptmp)
*pfmt++ = *ptmp;
const char *begin = ptmp;
- for (; *ptmp && !(isdigit)(*ptmp); ++ptmp) {
- if ( (ispunct)(*ptmp)
- || (isspace)(*ptmp)) {
- for (; (ispunct)(*ptmp)
- || (isspace)(*ptmp); ++ptmp)
+ for (; *ptmp && !(isdigit)(UChar (*ptmp)); ++ptmp) {
+ if ( (ispunct)(UChar (*ptmp))
+ || (isspace)(UChar (*ptmp))) {
+ for (; (ispunct)(UChar (*ptmp))
+ || (isspace)(UChar (*ptmp)); ++ptmp)
*pfmt++ = *ptmp;
break;
}
@@ -359,9 +360,9 @@
}
}
- if ((isdigit)(*ptmp)) {
+ if ((isdigit)(UChar (*ptmp))) {
- for (begin = ptmp; (isdigit)(*ptmp); ++ptmp);
+ for (begin = ptmp; (isdigit)(UChar (*ptmp)); ++ptmp);
*pfmt++ = '%';