ICU-5029 Fix Purify warning about NaN arguments to wsprintf.

X-SVN-Rev: 19064
This commit is contained in:
Eric Mader 2006-02-04 02:09:01 +00:00
parent fac1811c2e
commit 4ab8eb96d1

View File

@ -40,6 +40,7 @@
# include <windows.h>
# include <stdio.h>
# include <time.h>
# include <float.h>
#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
#define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
@ -85,10 +86,12 @@ static double randomDouble(void)
initialized = TRUE;
}
/* Assume rand has at least 12 bits of precision */
for (i = 0; i < sizeof(ran); i += 1) {
((char*)&ran)[i] = (char)((rand() & 0x0FF0) >> 4);
}
do {
/* Assume rand has at least 12 bits of precision */
for (i = 0; i < sizeof(ran); i += 1) {
((char*)&ran)[i] = (char)((rand() & 0x0FF0) >> 4);
}
} while (_isnan(ran));
return ran;
}