summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-06-15 15:56:42 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:21:12 +0900
commitd2f267a13dcce67e45ef358e1f133362b0a1c12e (patch)
treec6583467439c7943a16f68707da589da8baa7292 /mrbgems/mruby-compiler/core
parenta4a1e01e8123928057dff9b43e034c1dd137af81 (diff)
downloadmruby-d2f267a13dcce67e45ef358e1f133362b0a1c12e.tar.gz
mruby-d2f267a13dcce67e45ef358e1f133362b0a1c12e.zip
Add casts to silence warnings.
Diffstat (limited to 'mrbgems/mruby-compiler/core')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 25e157736..14b53d073 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -6,6 +6,7 @@
#include <ctype.h>
#include <limits.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -612,13 +613,13 @@ new_lit(codegen_scope *s, mrb_value val)
switch (mrb_type(val)) {
case MRB_TT_STRING:
if (RSTR_NOFREE_P(RSTRING(val))) {
- pv->tt = (RSTRING_LEN(val)<<2) | IREP_TT_SSTR;
+ pv->tt = (uint32_t)(RSTRING_LEN(val)<<2) | IREP_TT_SSTR;
pv->u.str = RSTRING_PTR(val);
}
else {
char *p;
mrb_int len = RSTRING_LEN(val);
- pv->tt = (len<<2) | IREP_TT_STR;
+ pv->tt = (uint32_t)(len<<2) | IREP_TT_STR;
p = (char*)codegen_realloc(s, NULL, len+1);
memcpy(p, RSTRING_PTR(val), len);
p[len] = '\0';