1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/bigdecimal] Explicitly cast size_t to int

https://github.com/ruby/bigdecimal/commit/b1f1ed26c9
This commit is contained in:
Kenta Murata 2021-01-14 09:26:15 +09:00
parent b4ade73974
commit 4d13f3e9da

View file

@ -2830,7 +2830,7 @@ rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
int decpt, negative_p; int decpt, negative_p;
char *e; char *e;
const int mode = digs == 0 ? 0 : 2; const int mode = digs == 0 ? 0 : 2;
char *p = BigDecimal_dtoa(d, mode, digs, &decpt, &negative_p, &e); char *p = BigDecimal_dtoa(d, mode, (int)digs, &decpt, &negative_p, &e);
int len10 = (int)(e - p); int len10 = (int)(e - p);
if (len10 >= (int)sizeof(buf)) if (len10 >= (int)sizeof(buf))
len10 = (int)sizeof(buf) - 1; len10 = (int)sizeof(buf) - 1;