From 024168def914d6275c88079882324b74d33420aa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 16 Jun 2014 10:58:33 -0600 Subject: hex2bin: Fix un-necessary seeks because expected address was not being updated --- apps/system/hex2bin/hex2bin.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/system') diff --git a/apps/system/hex2bin/hex2bin.c b/apps/system/hex2bin/hex2bin.c index 1de5763f1..95634fcc8 100644 --- a/apps/system/hex2bin/hex2bin.c +++ b/apps/system/hex2bin/hex2bin.c @@ -589,7 +589,9 @@ int hex2bin(FAR struct lib_instream_s *instream, goto errout_with_einval; } - /* Seek to the correct position in the OUT stream */ + /* Seek to the correct position in the OUT stream if we have + * made an unexpected jump in the data address. + */ if (address != expected) { @@ -606,6 +608,10 @@ int hex2bin(FAR struct lib_instream_s *instream, /* Transfer data to the OUT stream */ writedata(outstream, &bin[DATA_BINNDX], bytecount); + + /* This is the next data address that we expect to see */ + + expected = address + bytecount; } break; -- cgit v1.2.3