diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-11-04 14:49:11 +0100 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-11-04 14:49:11 +0100 | 
| commit | 8db328c61832a92bf3f7641061b68767141104f3 (patch) | |
| tree | 831510d5b03363ed8a5d0bcb75360ed48f599b33 /src/input/File.cpp | |
| parent | fde78e58eb3c48135b6d96680fca7eb3d617f940 (diff) | |
| download | dabmux-8db328c61832a92bf3f7641061b68767141104f3.tar.gz dabmux-8db328c61832a92bf3f7641061b68767141104f3.tar.bz2 dabmux-8db328c61832a92bf3f7641061b68767141104f3.zip | |
Change readFrame argument types
Diffstat (limited to 'src/input/File.cpp')
| -rw-r--r-- | src/input/File.cpp | 18 | 
1 files changed, 8 insertions, 10 deletions
| diff --git a/src/input/File.cpp b/src/input/File.cpp index 9721b97..eb26136 100644 --- a/src/input/File.cpp +++ b/src/input/File.cpp @@ -64,7 +64,7 @@ int FileBase::rewind()      return ::lseek(m_fd, 0, SEEK_SET);  } -int MPEGFile::readFrame(void* buffer, int size) +int MPEGFile::readFrame(uint8_t* buffer, size_t size)  {      int result;      bool do_rewind = false; @@ -122,7 +122,7 @@ MUTE_SUBCHANNEL:              memset(buffer, 0, size);          }          else { -            if (result < size) { +            if (result < (ssize_t)size) {                  etiLog.log(warn, "bitrate too low from file "                          "-> frame padded\n");                  memset((char*)buffer + result, 0, size - result); @@ -164,7 +164,7 @@ MUTE_SUBCHANNEL:  int MPEGFile::setBitrate(int bitrate)  {      if (bitrate == 0) { -        char buffer[4]; +        uint8_t buffer[4];          if (readFrame(buffer, 4) == 0) {              bitrate = getMpegBitrate(buffer); @@ -178,11 +178,9 @@ int MPEGFile::setBitrate(int bitrate)  } -int DABPlusFile::readFrame(void* buffer, int size) +int DABPlusFile::readFrame(uint8_t* buffer, size_t size)  { -    uint8_t* dataOut = reinterpret_cast<uint8_t*>(buffer); - -    ssize_t ret = read(m_fd, dataOut, size); +    ssize_t ret = read(m_fd, buffer, size);      if (ret == -1) {          etiLog.log(alert, "ERROR: Can't read file\n"); @@ -190,7 +188,7 @@ int DABPlusFile::readFrame(void* buffer, int size)          return -1;      } -    if (ret < size) { +    if (ret < (ssize_t)size) {          ssize_t sizeOut = ret;          etiLog.log(info, "reach end of file -> rewinding\n");          if (rewind() == -1) { @@ -198,14 +196,14 @@ int DABPlusFile::readFrame(void* buffer, int size)              return -1;          } -        ret = read(m_fd, dataOut + sizeOut, size - sizeOut); +        ret = read(m_fd, buffer + sizeOut, size - sizeOut);          if (ret == -1) {              etiLog.log(alert, "ERROR: Can't read file\n");              perror("");              return -1;          } -        if (ret < size) { +        if (ret < (ssize_t)size) {              etiLog.log(alert, "ERROR: Not enough data in file\n");              return -1;          } | 
