diff options
| author | Masaki Muranaka <[email protected]> | 2013-03-09 00:23:08 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-03-09 00:23:08 +0900 |
| commit | 6ff50568e1e5fb20f7d1e542bf23b25892515fcb (patch) | |
| tree | 534add50aa97f5631aa04140a0998530fb0b1336 | |
| parent | 07017a4188db3c21dc79bb4d83ae38aacb4af788 (diff) | |
| download | mruby-6ff50568e1e5fb20f7d1e542bf23b25892515fcb.tar.gz mruby-6ff50568e1e5fb20f7d1e542bf23b25892515fcb.zip | |
Store to *bin_size if bin_size != NULL.
| -rw-r--r-- | src/load.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/load.c b/src/load.c index 7e58614a7..eaa98a206 100644 --- a/src/load.c +++ b/src/load.c @@ -219,7 +219,9 @@ read_rite_binary_header(const uint8_t *bin, uint32_t *bin_size, uint16_t *crc) } *crc = bin_to_uint16(header->binary_crc); - *bin_size = bin_to_uint32(header->binary_size); + if (bin_size) { + *bin_size = bin_to_uint32(header->binary_size); + } return MRB_DUMP_OK; } @@ -355,7 +357,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) buf_size = sizeof(struct rite_binary_header); buf = mrb_malloc(mrb, buf_size); fread(buf, sizeof(struct rite_binary_header), 1, fp); - result = read_rite_binary_header(buf, &bin_size, &crc); + result = read_rite_binary_header(buf, NULL, &crc); mrb_free(mrb, buf); if(result != MRB_DUMP_OK) { return result; |
