diff options
| -rw-r--r-- | src/string.c | 2 | ||||
| -rw-r--r-- | tools/mrbc/mrbc.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c index 11990c22d..aef0ac88f 100644 --- a/src/string.c +++ b/src/string.c @@ -431,7 +431,7 @@ mrb_str_times(mrb_state *mrb, mrb_value self) if (times < 0) { mrb_raise(mrb, E_ARGUMENT_ERROR, "negative argument"); } - if (times && INT32_MAX/times < RSTRING_LEN(self)) { + if (times && INT_MAX/times < RSTRING_LEN(self)) { mrb_raise(mrb, E_ARGUMENT_ERROR, "argument too big"); } diff --git a/tools/mrbc/mrbc.c b/tools/mrbc/mrbc.c index 428a3b781..f9810aa4f 100644 --- a/tools/mrbc/mrbc.c +++ b/tools/mrbc/mrbc.c @@ -135,7 +135,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args) if (outfile == NULL) outfile = get_outfilename(infile, args->ext); - if ((args->wfp = fopen(outfile, "wb")) == NULL) { + if (strcmp("-", outfile) == 0) { + args->wfp = stdout; + } + else if ((args->wfp = fopen(outfile, "wb")) == NULL) { printf("%s: Cannot open output file. (%s)\n", *origargv, outfile); return 0; } |
