From c79172dfd5a7600300ac215cce1ccc766ec9aa98 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 20 Apr 2013 23:11:43 +0900 Subject: put spaces after if/while --- src/load.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/load.c') diff --git a/src/load.c b/src/load.c index c350cb1a3..27feea37f 100644 --- a/src/load.c +++ b/src/load.c @@ -271,11 +271,11 @@ read_rite_binary_header(const uint8_t *bin, size_t *bin_size, uint16_t *crc) { const struct rite_binary_header *header = (const struct rite_binary_header *)bin; - if(memcmp(header->binary_identify, RITE_BINARY_IDENFIFIER, sizeof(header->binary_identify)) != 0) { + if (memcmp(header->binary_identify, RITE_BINARY_IDENFIFIER, sizeof(header->binary_identify)) != 0) { return MRB_DUMP_INVALID_FILE_HEADER; } - if(memcmp(header->binary_version, RITE_BINARY_FORMAT_VER, sizeof(header->binary_version)) != 0) { + if (memcmp(header->binary_version, RITE_BINARY_FORMAT_VER, sizeof(header->binary_version)) != 0) { return MRB_DUMP_INVALID_FILE_HEADER; } @@ -303,12 +303,12 @@ mrb_read_irep(mrb_state *mrb, const uint8_t *bin) } result = read_rite_binary_header(bin, &bin_size, &crc); - if(result != MRB_DUMP_OK) { + if (result != MRB_DUMP_OK) { return result; } n = offset_crc_body(); - if(crc != calc_crc_16_ccitt(bin + n, bin_size - n, 0)) { + if (crc != calc_crc_16_ccitt(bin + n, bin_size - n, 0)) { return MRB_DUMP_INVALID_FILE_HEADER; } @@ -317,21 +317,21 @@ mrb_read_irep(mrb_state *mrb, const uint8_t *bin) do { section_header = (const struct rite_section_header *)bin; - if(memcmp(section_header->section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header->section_identify)) == 0) { + if (memcmp(section_header->section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header->section_identify)) == 0) { result = read_rite_section_irep(mrb, bin); - if(result < MRB_DUMP_OK) { + if (result < MRB_DUMP_OK) { return result; } total_nirep += result; } - else if(memcmp(section_header->section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header->section_identify)) == 0) { + else if (memcmp(section_header->section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header->section_identify)) == 0) { result = read_rite_section_lineno(mrb, bin, sirep); - if(result < MRB_DUMP_OK) { + if (result < MRB_DUMP_OK) { return result; } } bin += bin_to_uint32(section_header->section_size); - } while(memcmp(section_header->section_identify, RITE_BINARY_EOF, sizeof(section_header->section_identify)) != 0); + } while (memcmp(section_header->section_identify, RITE_BINARY_EOF, sizeof(section_header->section_identify)) != 0); return total_nirep; } @@ -509,7 +509,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) } result = read_rite_binary_header(buf, NULL, &crc); mrb_free(mrb, buf); - if(result != MRB_DUMP_OK) { + if (result != MRB_DUMP_OK) { return result; } @@ -517,14 +517,14 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) fpos = ftell(fp); buf = mrb_malloc(mrb, block_size); fseek(fp, offset_crc_body(), SEEK_SET); - while((nbytes = fread(buf, 1, block_size, fp)) > 0) { + while ((nbytes = fread(buf, 1, block_size, fp)) > 0) { crcwk = calc_crc_16_ccitt(buf, nbytes, crcwk); } mrb_free(mrb, buf); if (nbytes == 0 && ferror(fp)) { return MRB_DUMP_READ_FAULT; } - if(crcwk != crc) { + if (crcwk != crc) { return MRB_DUMP_INVALID_FILE_HEADER; } fseek(fp, fpos + section_size, SEEK_SET); @@ -538,24 +538,24 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) } section_size = bin_to_uint32(section_header.section_size); - if(memcmp(section_header.section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header.section_identify)) == 0) { + if (memcmp(section_header.section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header.section_identify)) == 0) { fseek(fp, fpos, SEEK_SET); result = read_rite_section_irep_file(mrb, fp); - if(result < MRB_DUMP_OK) { + if (result < MRB_DUMP_OK) { return result; } total_nirep += result; } - else if(memcmp(section_header.section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header.section_identify)) == 0) { + else if (memcmp(section_header.section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header.section_identify)) == 0) { fseek(fp, fpos, SEEK_SET); result = read_rite_section_lineno_file(mrb, fp, sirep); - if(result < MRB_DUMP_OK) { + if (result < MRB_DUMP_OK) { return result; } } fseek(fp, fpos + section_size, SEEK_SET); - } while(memcmp(section_header.section_identify, RITE_BINARY_EOF, sizeof(section_header.section_identify)) != 0); + } while (memcmp(section_header.section_identify, RITE_BINARY_EOF, sizeof(section_header.section_identify)) != 0); return total_nirep; } -- cgit v1.2.3