Merge pull request #98357 from yeojunh/valid-base-check-num-int64-uint64
Core: Fix String::num_int64(), uint64 for valid base check
This commit is contained in:
commit
33db590947
2 changed files with 21 additions and 1 deletions
|
|
@ -1850,6 +1850,8 @@ String String::num(double p_num, int p_decimals) {
|
|||
}
|
||||
|
||||
String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
||||
ERR_FAIL_COND_V_MSG(base < 2 || base > 36, "", "Cannot convert to base " + itos(base) + ", since the value is " + (base < 2 ? "less than 2." : "greater than 36."));
|
||||
|
||||
bool sign = p_num < 0;
|
||||
|
||||
int64_t n = p_num;
|
||||
|
|
@ -1888,6 +1890,8 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
|||
}
|
||||
|
||||
String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
|
||||
ERR_FAIL_COND_V_MSG(base < 2 || base > 36, "", "Cannot convert to base " + itos(base) + ", since the value is " + (base < 2 ? "less than 2." : "greater than 36."));
|
||||
|
||||
uint64_t n = p_num;
|
||||
|
||||
int chars = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue