diff --git a/bin2ihex.c b/bin2ihex.c index 8fa8c4e..9d5a2c8 100644 --- a/bin2ihex.c +++ b/bin2ihex.c @@ -103,7 +103,7 @@ argument_error: } ihex.flags |= IHEX_FLAG_ADDRESS_OVERFLOW; } - while ((count = fread(buf, 1, sizeof(buf), infile))) { + while ((count = (unsigned int) fread(buf, 1, sizeof(buf), infile))) { ihex_write_bytes(&ihex, buf, count); } ihex_end_write(&ihex); diff --git a/ihex2bin.c b/ihex2bin.c index 06e5580..15a2825 100644 --- a/ihex2bin.c +++ b/ihex2bin.c @@ -107,7 +107,7 @@ argument_error: ihex_read_at_address(&ihex, (ihex_address_t) address_offset); while (fgets(buf, sizeof(buf), infile)) { - count = strlen(buf); + count = (unsigned int) strlen(buf); ihex_read_bytes(&ihex, buf, count); line_number += (count && buf[count - 1] == '\n') ? 1 : 0; } @@ -154,7 +154,7 @@ ihex_data_read (struct ihex_state *ihex, enum ihex_record_type type, "Seeking from 0x%lx to 0x%lx on line %lu\n", file_position, address, line_number); } - if (outfile == stdout || fseek(outfile, address, SEEK_SET)) { + if (outfile == stdout || fseek(outfile, (long) address, SEEK_SET)) { if (file_position < address) { // "seek" forward in stdout by writing NUL bytes do { diff --git a/kk_ihex_read.c b/kk_ihex_read.c index 88f9d50..4194a3d 100644 --- a/kk_ihex_read.c +++ b/kk_ihex_read.c @@ -3,7 +3,7 @@ * * See the header `kk_ihex.h` for instructions. * - * Copyright (c) 2013 Kimmo Kulovesi, http://arkku.com/ + * Copyright (c) 2013-2014 Kimmo Kulovesi, http://arkku.com/ * Provided with absolutely no warranty, use at your own risk only. * Use and distribute freely, mark modified copies as such. */ @@ -82,7 +82,7 @@ ihex_end_read (struct ihex_state * const ihex) { ihex->address |= ((ihex_address_t) ihex->data[1]) << 16; #ifndef IHEX_DISABLE_SEGMENTS } else if (type == IHEX_EXTENDED_SEGMENT_ADDRESS_RECORD) { - ihex->segment = (ihex->data[0] << 8) | ihex->data[1]; + ihex->segment = (ihex_segment_t) ((ihex->data[0] << 8) | ihex->data[1]); #endif } } @@ -138,7 +138,7 @@ ihex_read_byte (struct ihex_state *ihex, int b) { b <<= 8; case (READ_ADDRESS_LSB_LOW >> 1): // low byte of 16-bit address - ihex->address |= b; + ihex->address |= (unsigned) b; break; case (READ_RECORD_TYPE_LOW >> 1): // record type diff --git a/kk_ihex_write.c b/kk_ihex_write.c index bf9ae6c..34a3756 100644 --- a/kk_ihex_write.c +++ b/kk_ihex_write.c @@ -3,7 +3,7 @@ * * See the header `kk_ihex.h` for instructions. * - * Copyright (c) 2013 Kimmo Kulovesi, http://arkku.com/ + * Copyright (c) 2013-2014 Kimmo Kulovesi, http://arkku.com/ * Provided with absolutely no warranty, use at your own risk only. * Use and distribute freely, mark modified copies as such. */ @@ -80,7 +80,7 @@ ihex_write_end_of_file (struct ihex_state * const ihex) { w = ihex_buffer_byte(w, 0); // address msb w = ihex_buffer_byte(w, 0); // address lsb w = ihex_buffer_byte(w, IHEX_END_OF_FILE_RECORD); // record type - w = ihex_buffer_byte(w, ~IHEX_END_OF_FILE_RECORD + 1); // checksum + w = ihex_buffer_byte(w, ~((unsigned int)IHEX_END_OF_FILE_RECORD) + 1U); // checksum #endif w = ihex_buffer_newline(w); ihex_flush_buffer(ihex, line_buffer, w);