mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-22 06:43:27 +00:00
Use correct types for lj_strscan_num_base
This commit is contained in:
parent
9ea9e9403a
commit
31d3cb1ac3
@ -552,7 +552,7 @@ int LJ_FASTCALL lj_strscan_number(GCstr *str, TValue *o)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int strscan_base(GCstr *str, TValue *o, int base, int dualnum)
|
static int32_t strscan_base(GCstr *str, TValue *o, int32_t base, int dualnum)
|
||||||
{
|
{
|
||||||
const char *p = strdata(str);
|
const char *p = strdata(str);
|
||||||
char *ep;
|
char *ep;
|
||||||
@ -561,7 +561,7 @@ static int strscan_base(GCstr *str, TValue *o, int base, int dualnum)
|
|||||||
while (lj_char_isspace((unsigned char)(*p))) p++;
|
while (lj_char_isspace((unsigned char)(*p))) p++;
|
||||||
if (*p == '-') { p++; neg = 1; } else if (*p == '+') { p++; }
|
if (*p == '-') { p++; neg = 1; } else if (*p == '+') { p++; }
|
||||||
if (lj_char_isalnum((unsigned char)(*p))) {
|
if (lj_char_isalnum((unsigned char)(*p))) {
|
||||||
ul = strtoul(p, &ep, base);
|
ul = strtoul(p, &ep, (int)base);
|
||||||
if (p != ep) {
|
if (p != ep) {
|
||||||
while (lj_char_isspace((unsigned char)(*ep))) ep++;
|
while (lj_char_isspace((unsigned char)(*ep))) ep++;
|
||||||
if (*ep == '\0') {
|
if (*ep == '\0') {
|
||||||
@ -580,13 +580,13 @@ static int strscan_base(GCstr *str, TValue *o, int base, int dualnum)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LJ_FUNC int lj_strscan_num_base(GCstr *str, TValue *o, int base)
|
LJ_FUNC int32_t lj_strscan_num_base(GCstr *str, TValue *o, int32_t base)
|
||||||
{
|
{
|
||||||
return strscan_base(str, o, base, 0);
|
return strscan_base(str, o, base, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LJ_DUALNUM
|
#if LJ_DUALNUM
|
||||||
LJ_FUNC int lj_strscan_number_base(GCstr *str, TValue *o, int base)
|
LJ_FUNC int32_t lj_strscan_number_base(GCstr *str, TValue *o, int32_t base)
|
||||||
{
|
{
|
||||||
return strscan_base(str, o, base, 1);
|
return strscan_base(str, o, base, 1);
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ static LJ_AINLINE int lj_strscan_numberobj(TValue *o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The base must be between 2 and 36. */
|
/* The base must be between 2 and 36. */
|
||||||
LJ_FUNC int lj_strscan_num_base(GCstr *str, TValue *o, int base);
|
LJ_FUNC int32_t lj_strscan_num_base(GCstr *str, TValue *o, int32_t base);
|
||||||
#if LJ_DUALNUM
|
#if LJ_DUALNUM
|
||||||
LJ_FUNC int lj_strscan_number_base(GCstr *str, TValue *o, int base);
|
LJ_FUNC int32_t lj_strscan_number_base(GCstr *str, TValue *o, int32_t base);
|
||||||
#else
|
#else
|
||||||
#define lj_strscan_number_base(s, o, base) \
|
#define lj_strscan_number_base(s, o, base) \
|
||||||
lj_strscan_num_base((s), (o), (base))
|
lj_strscan_num_base((s), (o), (base))
|
||||||
|
Loading…
Reference in New Issue
Block a user