aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-06-25 16:36:04 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-06-25 16:36:04 +0200
commit8bba5052cf7a3677e8be12315a03959fec33bf17 (patch)
tree14664131c7f5acb1f995176b206aad3dd5ec15b6 /src
parentca9892fc9667951986d25796354592d6f01222d9 (diff)
downloadODR-SourceCompanion-8bba5052cf7a3677e8be12315a03959fec33bf17.tar.gz
ODR-SourceCompanion-8bba5052cf7a3677e8be12315a03959fec33bf17.tar.bz2
ODR-SourceCompanion-8bba5052cf7a3677e8be12315a03959fec33bf17.zip
Cosmetic cleanup
Diffstat (limited to 'src')
-rw-r--r--src/AVTInput.cpp6
-rw-r--r--src/odr-sourcecompanion.cpp18
2 files changed, 10 insertions, 14 deletions
diff --git a/src/AVTInput.cpp b/src/AVTInput.cpp
index f59cddb..48b2de1 100644
--- a/src/AVTInput.cpp
+++ b/src/AVTInput.cpp
@@ -238,7 +238,7 @@ int AVTInput::_openSocketCli()
*/
ssize_t AVTInput::_read(uint8_t* buf, size_t size, bool onlyOnePacket)
{
- ssize_t nbBytes = 0;
+ size_t nbBytes = 0;
uint8_t* data = buf;
UdpPacket _input_packet(2048);
@@ -248,7 +248,7 @@ ssize_t AVTInput::_read(uint8_t* buf, size_t size, bool onlyOnePacket)
}
while (nbBytes < size) {
- unsigned freeSize = size - nbBytes;
+ size_t freeSize = size - nbBytes;
if (_input_packet.getLength() > freeSize) {
// Not enought place in output
memcpy(&data[nbBytes], _input_packet.getData(), freeSize);
@@ -256,7 +256,7 @@ ssize_t AVTInput::_read(uint8_t* buf, size_t size, bool onlyOnePacket)
_input_packet.setOffset(_input_packet.getOffset() + freeSize);
}
else {
- unsigned length = _input_packet.getLength();
+ size_t length = _input_packet.getLength();
memcpy(&data[nbBytes], _input_packet.getData(), length);
nbBytes += length;
_input_packet.setOffset(0);
diff --git a/src/odr-sourcecompanion.cpp b/src/odr-sourcecompanion.cpp
index a37d0a5..c105146 100644
--- a/src/odr-sourcecompanion.cpp
+++ b/src/odr-sourcecompanion.cpp
@@ -1,5 +1,5 @@
/* ------------------------------------------------------------------
- * Copyright (C) 2017 Matthias P. Braendli
+ * Copyright (C) 2019 Matthias P. Braendli
* Copyright (C) 2017 AVT GmbH - Fabien Vercasson
* Copyright (C) 2011 Martin Storsjo
*
@@ -45,7 +45,7 @@ extern "C" {
#include <string>
#include <getopt.h>
#include <cstdio>
-#include <stdint.h>
+#include <cstdint>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
/* For MOT Slideshow and DLS insertion */
const char* pad_fifo = "/tmp/pad.fifo";
- int pad_fd;
+ int pad_fd = -1;
int padlen = 0;
/* Whether to show the 'sox'-like measurement */
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
outbuf.resize(24*120);
zmqframebuf.resize(ZMQ_HEADER_SIZE + 24*120);
- if(outbuf_size % 5 != 0) {
+ if (outbuf_size % 5 != 0) {
fprintf(stderr, "Warning: (outbuf_size mod 5) = %d\n", outbuf_size % 5);
}
@@ -359,16 +359,14 @@ int main(int argc, char *argv[])
const auto timeout_duration = std::chrono::milliseconds(avt_timeout);
bool timedout = false;
- while ( !timedout && numOutBytes == 0 )
- {
+ while (!timedout && numOutBytes == 0) {
// Fill the PAD Frame queue because multiple PAD frame requests
// can come for each DAB+ Frames (up to 6),
- if (padlen != 0) {
+ if (padlen != 0 and pad_fd != -1) {
int ret = 0;
do {
ret = 0;
if (!avtinput.padQueueFull()) {
-
// Non blocking read of the pipe
fd_set read_fd_set;
FD_ZERO(&read_fd_set);
@@ -444,8 +442,7 @@ int main(int argc, char *argv[])
send_error_count ++;
}
- if (send_error_count > 10)
- {
+ if (send_error_count > 10) {
fprintf(stderr, "ZeroMQ send failed ten times, aborting!\n");
retval = 4;
break;
@@ -476,4 +473,3 @@ int main(int argc, char *argv[])
return retval;
}
-