diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-09-03 00:14:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-09-03 00:14:37 +0900 |
| commit | e35c3aff83d400dfe27fe105b7e282ac81b1197a (patch) | |
| tree | 3b7de0cdd204c7898d5abc60cedd19deae79744a /src | |
| parent | 3a462fe4687fa2a52d2c9c20d10ae46901292b99 (diff) | |
| download | mruby-e35c3aff83d400dfe27fe105b7e282ac81b1197a.tar.gz mruby-e35c3aff83d400dfe27fe105b7e282ac81b1197a.zip | |
unsigned long may be smaller than mrb_int; use uint64_t instead; fix #2935
Diffstat (limited to 'src')
| -rw-r--r-- | src/string.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/string.c b/src/string.c index 73ef341bb..08caf3bae 100644 --- a/src/string.c +++ b/src/string.c @@ -1863,7 +1863,7 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck) const char *p; char sign = 1; int c, uscore; - unsigned long n = 0; + uint64_t n = 0; mrb_int val; #define conv_digit(c) \ @@ -1983,9 +1983,9 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck) } n *= base; n += c; - } - if (n > MRB_INT_MAX) { - mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new_cstr(mrb, str)); + if (n > MRB_INT_MAX) { + mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new_cstr(mrb, str)); + } } val = n; if (badcheck) { |
