diff --git a/include/hex2bin.h b/include/hex2bin.h index 13fcfc8f4..aafcd10b6 100644 --- a/include/hex2bin.h +++ b/include/hex2bin.h @@ -43,7 +43,6 @@ #include #include -#include #ifdef CONFIG_SYSTEM_HEX2BIN @@ -96,8 +95,7 @@ #ifdef CONFIG_CPP_HAVE_VARARGS # ifdef CONFIG_SYSTEM_HEX2BIN_DEBUG -# define hex2bin_debug(format, ...) \ - fprintf(stderr, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) +# define hex2bin_debug(format, ...) fprintf(stderr, format, ##__VA_ARGS__) # else # define lldbg(x...) # endif diff --git a/system/hex2bin/hex2bin.c b/system/hex2bin/hex2bin.c index 463de27e6..e92879a34 100644 --- a/system/hex2bin/hex2bin.c +++ b/system/hex2bin/hex2bin.c @@ -249,17 +249,18 @@ int data2bin(FAR uint8_t* dest, FAR const uint8_t *src, int nbytes) static int readstream(FAR struct lib_instream_s *instream, FAR uint8_t *line, unsigned int lineno) { - int ch = instream->get(instream); int nbytes = 0; + int ch; /* Skip until the beginning of line start code is encountered */ + ch = instream->get(instream); while (ch != RECORD_STARTCODE && ch != EOF) { ch = instream->get(instream); } - /* Skip over the start code */ + /* Skip over the startcode */ if (ch != EOF) { @@ -313,6 +314,10 @@ static int readstream(FAR struct lib_instream_s *instream, lineno, isprint(ch) ? ch : '.', ch); break; } + + /* Read the next character from the input stream */ + + ch = instream->get(instream); } /* Some error occurred: Unexpected EOF, line too long, or bad character in