diff options
author | Kenneth Mortensen <mortensenit@users.noreply.github.com> | 2014-11-13 10:44:33 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-12-22 18:19:02 +0100 |
commit | 9ffaa58ba47f5211cce25483e7408dbaf9a6cbfc (patch) | |
tree | 521d6b1a9a30a657d84c80ca9660c24c4db8ee86 | |
parent | 94c1f63b6fd07d74f3325274dd19fd6beaf53965 (diff) | |
download | dabmod-9ffaa58ba47f5211cce25483e7408dbaf9a6cbfc.tar.gz dabmod-9ffaa58ba47f5211cce25483e7408dbaf9a6cbfc.tar.bz2 dabmod-9ffaa58ba47f5211cce25483e7408dbaf9a6cbfc.zip |
No error termination in case of zero read bytes
-rw-r--r-- | src/InputFileReader.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/InputFileReader.cpp b/src/InputFileReader.cpp index 52fbb99..4a7e050 100644 --- a/src/InputFileReader.cpp +++ b/src/InputFileReader.cpp @@ -284,13 +284,18 @@ int InputFileReader::GetNextFrame(void* buffer) if (read_bytes != frameSize) { // A short read of a frame (i.e. reading an incomplete frame) // is not tolerated. Input files must not contain incomplete frames - fprintf(stderr, - "Unable to read a complete frame of %u data bytes from input file!\n", - frameSize); - - perror(filename_.c_str()); - logger_.level(error) << "Unable to read from input file!"; - return -1; + if (read_bytes != 0){ + fprintf(stderr, + "Unable to read a complete frame of %u data bytes from input file!\n", + frameSize); + + perror(filename_.c_str()); + logger_.level(error) << "Unable to read from input file!"; + return -1; + } + else { + return 0; + } } memset(&((uint8_t*)buffer)[frameSize], 0x55, 6144 - frameSize); |