src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8042885 Cdiff src/share/vm/runtime/arguments.cpp

src/share/vm/runtime/arguments.cpp

Print this page
8042885: java does not take hexadecimal number as vm option

*** 578,592 **** } // Parses a memory size specification string. static bool atomull(const char *s, julong* result) { julong n = 0; ! int args_read = sscanf(s, JULONG_FORMAT, &n); if (args_read != 1) { return false; } ! while (*s != '\0' && isdigit(*s)) { s++; } // 4705540: illegal if more characters are found after the first non-digit if (strlen(s) > 1) { return false; --- 578,601 ---- } // Parses a memory size specification string. static bool atomull(const char *s, julong* result) { julong n = 0; ! int args_read = 0; ! bool is_hex = false; ! // Skip leading 0[xX] for hexadecimal ! if (*s =='0' && (*(s+1) == 'x' || *(s+1) == 'X')) { ! s += 2; ! is_hex = true; ! args_read = sscanf(s, JULONG_FORMAT_X, &n); ! } else { ! args_read = sscanf(s, JULONG_FORMAT, &n); ! } if (args_read != 1) { return false; } ! while (*s != '\0' && (isdigit(*s) || (is_hex && isxdigit(*s)))) { s++; } // 4705540: illegal if more characters are found after the first non-digit if (strlen(s) > 1) { return false;
*** 776,786 **** if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) { return set_fp_numeric_flag(name, value, origin); } } ! #define VALUE_RANGE "[-kmgtKMGT0123456789]" if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) { return set_numeric_flag(name, value, origin); } return false; --- 785,795 ---- if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) { return set_fp_numeric_flag(name, value, origin); } } ! #define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]" if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) { return set_numeric_flag(name, value, origin); } return false;
src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File