diff options
| author | Yasuhiro Matsumoto <[email protected]> | 2015-12-22 17:29:10 +0900 |
|---|---|---|
| committer | Yasuhiro Matsumoto <[email protected]> | 2015-12-22 17:46:20 +0900 |
| commit | 7cc33af2dc1137ef819b589e51e3756bdaa222e1 (patch) | |
| tree | 16f444f586b644175032c34253a14e1e2cb403c2 /src/string.c | |
| parent | d0727be6eb22932aaf67447d09c9b3751516e891 (diff) | |
| download | mruby-7cc33af2dc1137ef819b589e51e3756bdaa222e1.tar.gz mruby-7cc33af2dc1137ef819b589e51e3756bdaa222e1.zip | |
fix build on VS2012
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c index 2638fa04e..6664eabd6 100644 --- a/src/string.c +++ b/src/string.c @@ -4,6 +4,10 @@ ** See Copyright Notice in mruby.h */ +#ifdef _MSC_VER +# define _CRT_NONSTDC_NO_DEPRECATE +#endif + #include <float.h> #include <limits.h> #include <stddef.h> @@ -2170,12 +2174,12 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, int base, int b } n *= base; n += c; - if (n > (int64_t)MRB_INT_MAX + (sign ? 0 : 1)) { + if (n > (uint64_t)MRB_INT_MAX + (sign ? 0 : 1)) { mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new(mrb, str, pend-str)); } } - val = n; + val = (mrb_int)n; if (badcheck) { if (p == str) goto bad; /* no number */ while (p<pend && ISSPACE(*p)) p++; |
