8223146: [TESTBUG] new test vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/ fails on Windows
Keep it simple and handle INT32_MIN separately Reviewed-by: dholmes, sspitsyn
This commit is contained in:
parent
5c928d29fb
commit
95b5fba3d7
@ -22,6 +22,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ class JNIVerifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DecimalToAsciiRec(char *str, long line) {
|
int DecimalToAsciiRec(char *str, int line) {
|
||||||
if (line == 0) {
|
if (line == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -112,21 +113,27 @@ class JNIVerifier {
|
|||||||
|
|
||||||
// Implementing a simple version of sprintf for "%d"...
|
// Implementing a simple version of sprintf for "%d"...
|
||||||
void DecimalToAscii(char *str, int line) {
|
void DecimalToAscii(char *str, int line) {
|
||||||
// Go to long so that the INT_MIN case can be handled seemlessly.
|
if (line == 0) {
|
||||||
long internal_line = line;
|
|
||||||
if (internal_line == 0) {
|
|
||||||
str[0] = '0';
|
str[0] = '0';
|
||||||
str[1] = '\0';
|
str[1] = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internal_line < 0) {
|
// Special case for INT32_MIN because otherwise the *1 below will overflow
|
||||||
|
// and it won't work. Let us just be simple here due to this being for
|
||||||
|
// tests.
|
||||||
|
if (line == INT32_MIN) {
|
||||||
|
strcat(str, "-2147483648");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line < 0) {
|
||||||
*str = '-';
|
*str = '-';
|
||||||
internal_line *= -1;
|
line *= -1;
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
str[DecimalToAsciiRec(str, internal_line)] = '\0';
|
str[DecimalToAsciiRec(str, line)] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateErrorMessage() {
|
void GenerateErrorMessage() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user