hex2dump: Needs to read new character at end of the loop
This commit is contained in:
parent
0bb3b49cc2
commit
0487f8fbf4
@ -43,7 +43,6 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#ifdef CONFIG_SYSTEM_HEX2BIN
|
#ifdef CONFIG_SYSTEM_HEX2BIN
|
||||||
|
|
||||||
@ -96,8 +95,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_SYSTEM_HEX2BIN_DEBUG
|
# ifdef CONFIG_SYSTEM_HEX2BIN_DEBUG
|
||||||
# define hex2bin_debug(format, ...) \
|
# define hex2bin_debug(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||||
fprintf(stderr, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
|
||||||
# else
|
# else
|
||||||
# define lldbg(x...)
|
# define lldbg(x...)
|
||||||
# endif
|
# endif
|
||||||
|
@ -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,
|
static int readstream(FAR struct lib_instream_s *instream,
|
||||||
FAR uint8_t *line, unsigned int lineno)
|
FAR uint8_t *line, unsigned int lineno)
|
||||||
{
|
{
|
||||||
int ch = instream->get(instream);
|
|
||||||
int nbytes = 0;
|
int nbytes = 0;
|
||||||
|
int ch;
|
||||||
|
|
||||||
/* Skip until the beginning of line start code is encountered */
|
/* Skip until the beginning of line start code is encountered */
|
||||||
|
|
||||||
|
ch = instream->get(instream);
|
||||||
while (ch != RECORD_STARTCODE && ch != EOF)
|
while (ch != RECORD_STARTCODE && ch != EOF)
|
||||||
{
|
{
|
||||||
ch = instream->get(instream);
|
ch = instream->get(instream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip over the start code */
|
/* Skip over the startcode */
|
||||||
|
|
||||||
if (ch != EOF)
|
if (ch != EOF)
|
||||||
{
|
{
|
||||||
@ -313,6 +314,10 @@ static int readstream(FAR struct lib_instream_s *instream,
|
|||||||
lineno, isprint(ch) ? ch : '.', ch);
|
lineno, isprint(ch) ? ch : '.', ch);
|
||||||
break;
|
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
|
/* Some error occurred: Unexpected EOF, line too long, or bad character in
|
||||||
|
Loading…
Reference in New Issue
Block a user