diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-12-18 16:07:46 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-12-18 16:07:46 +0100 |
commit | 6681beca6444a48d6e939cb1acdae8332ef548ad (patch) | |
tree | a9dfab646d40935374d1b7c297309a568eff7f85 /src | |
parent | bff36b3ca821b82994da72c385b13a76eec14e9f (diff) | |
download | dabmux-6681beca6444a48d6e939cb1acdae8332ef548ad.tar.gz dabmux-6681beca6444a48d6e939cb1acdae8332ef548ad.tar.bz2 dabmux-6681beca6444a48d6e939cb1acdae8332ef548ad.zip |
Fix potentially wrong write in file output
Diffstat (limited to 'src')
-rw-r--r-- | src/dabOutput/dabOutputFile.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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; |