From 32aee72d295e2de3c890791b61ab9741b99912b1 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 4 Sep 2014 18:28:56 +0900 Subject: wrong iseq conversion flag --- src/dump.c | 2 +- src/load.c | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/dump.c b/src/dump.c index 905bfc72b..0ea4e5afe 100644 --- a/src/dump.c +++ b/src/dump.c @@ -974,7 +974,7 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, int debug_info, FILE* fp) return MRB_DUMP_INVALID_ARGUMENT; } - result = dump_irep(mrb, irep, debug_info, &bin, &bin_size, FLAG_BYTEORDER_NATIVE); + result = dump_irep(mrb, irep, debug_info, &bin, &bin_size, FLAG_BYTEORDER_NONATIVE); if (result == MRB_DUMP_OK) { if (fwrite(bin, sizeof(bin[0]), bin_size, fp) != bin_size) { result = MRB_DUMP_WRITE_FAULT; diff --git a/src/load.c b/src/load.c index 80fc719c2..bf69fdca1 100644 --- a/src/load.c +++ b/src/load.c @@ -507,20 +507,22 @@ read_binary_header(const uint8_t *bin, size_t *bin_size, uint16_t *crc, mrb_bool { const struct rite_binary_header *header = (const struct rite_binary_header *)bin; - *byteorder = FALSE; + if (byteorder) *byteorder = FALSE; if (memcmp(header->binary_identify, RITE_BINARY_IDENTIFIER, sizeof(header->binary_identify)) != 0) { - uint32_t ident = 0; - size_t i; + if (byteorder) { + uint32_t ident = 0; + size_t i; - for(i=0; ibinary_identify) { - *byteorder = TRUE; - } - else { - return MRB_DUMP_INVALID_FILE_HEADER; + for(i=0; ibinary_identify) { + *byteorder = TRUE; + } + else { + return MRB_DUMP_INVALID_FILE_HEADER; + } } } -- cgit v1.2.3