diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-06-15 14:06:46 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-06-15 14:06:46 -0600 |
commit | 03b41638779fc9e76ca37d3637194ae470a526be (patch) | |
tree | 0657d08798b2a83dafb34fd6ed48df414ebac514 /apps | |
parent | 47670d9c2a85c767e675498bed522d4586aeefa1 (diff) | |
download | nuttx-03b41638779fc9e76ca37d3637194ae470a526be.tar.gz nuttx-03b41638779fc9e76ca37d3637194ae470a526be.tar.bz2 nuttx-03b41638779fc9e76ca37d3637194ae470a526be.zip |
hex2dump: Needs to read new character at end of the loop
Diffstat (limited to 'apps')
-rw-r--r-- | apps/include/hex2bin.h | 4 | ||||
-rw-r--r-- | apps/system/hex2bin/hex2bin.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/apps/include/hex2bin.h b/apps/include/hex2bin.h index 13fcfc8f4..aafcd10b6 100644 --- a/apps/include/hex2bin.h +++ b/apps/include/hex2bin.h @@ -43,7 +43,6 @@ #include <nuttx/config.h> #include <stdint.h> -#include <debug.h> #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/apps/system/hex2bin/hex2bin.c b/apps/system/hex2bin/hex2bin.c index 463de27e6..e92879a34 100644 --- a/apps/system/hex2bin/hex2bin.c +++ b/apps/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 |