mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
wrong iseq conversion flag
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
+14
-12
@@ -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; i<sizeof(ident); i++) {
|
||||
ident<<=8;
|
||||
ident|=RITE_BINARY_IDENTIFIER[i];
|
||||
}
|
||||
if (ident == *(uint32_t*)header->binary_identify) {
|
||||
*byteorder = TRUE;
|
||||
}
|
||||
else {
|
||||
return MRB_DUMP_INVALID_FILE_HEADER;
|
||||
for(i=0; i<sizeof(ident); i++) {
|
||||
ident<<=8;
|
||||
ident|=RITE_BINARY_IDENTIFIER[i];
|
||||
}
|
||||
if (ident == *(uint32_t*)header->binary_identify) {
|
||||
*byteorder = TRUE;
|
||||
}
|
||||
else {
|
||||
return MRB_DUMP_INVALID_FILE_HEADER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user