aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-18 16:07:46 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-18 16:07:46 +0100
commit6681beca6444a48d6e939cb1acdae8332ef548ad (patch)
treea9dfab646d40935374d1b7c297309a568eff7f85
parentbff36b3ca821b82994da72c385b13a76eec14e9f (diff)
downloaddabmux-6681beca6444a48d6e939cb1acdae8332ef548ad.tar.gz
dabmux-6681beca6444a48d6e939cb1acdae8332ef548ad.tar.bz2
dabmux-6681beca6444a48d6e939cb1acdae8332ef548ad.zip
Fix potentially wrong write in file output
-rw-r--r--.travis.yml1
-rw-r--r--src/dabOutput/dabOutputFile.cpp5
2 files changed, 4 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml
index 2de0449..8c75fc7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,7 @@ script:
make
sudo make install
popd
+ - |
./bootstrap.sh
./configure --enable-input-prbs --enable-input-test --enable-input-udp --enable-output-raw
make
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;