From 6681beca6444a48d6e939cb1acdae8332ef548ad Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 18 Dec 2015 16:07:46 +0100 Subject: Fix potentially wrong write in file output --- src/dabOutput/dabOutputFile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dabOutput/dabOutputFile.cpp b/src/dabOutput/dabOutputFile.cpp index d7fd5c7..5b7543c 100644 --- a/src/dabOutput/dabOutputFile.cpp +++ b/src/dabOutput/dabOutputFile.cpp @@ -82,6 +82,7 @@ int DabOutputFile::Open(const char* filename) int DabOutputFile::Write(void* buffer, int size) { uint8_t padding[6144]; + const uint16_t frame_size = size; ++nbFrames_; switch (this->type_) { @@ -92,14 +93,14 @@ int DabOutputFile::Write(void* buffer, int size) // Writting nb frame length at end of file if (lseek(this->file_, 0, SEEK_END) == -1) goto FILE_WRITE_ERROR; - if (write(this->file_, &size, 2) == -1) goto FILE_WRITE_ERROR; + if (write(this->file_, &frame_size, 2) == -1) goto FILE_WRITE_ERROR; // Appending data if (write(this->file_, buffer, size) == -1) goto FILE_WRITE_ERROR; break; case ETI_FILE_TYPE_STREAMED: // Writting nb frame length at end of file - if (write(this->file_, &size, 2) == -1) goto FILE_WRITE_ERROR; + if (write(this->file_, &frame_size, 2) == -1) goto FILE_WRITE_ERROR; // Appending data if (write(this->file_, buffer, size) == -1) goto FILE_WRITE_ERROR; -- cgit v1.2.3