summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-23 09:10:35 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-23 09:10:35 +0200
commit606e22abcf8b9f3c3d63ccc8ccf8ae4020c6ffd3 (patch)
treee067c99ea946ba4877e12e3939c7fe6433d94f6f /src
parent262a43fc5dcc04731a8951ee44555f582f7e8106 (diff)
downloaddabmux-606e22abcf8b9f3c3d63ccc8ccf8ae4020c6ffd3.tar.gz
dabmux-606e22abcf8b9f3c3d63ccc8ccf8ae4020c6ffd3.tar.bz2
dabmux-606e22abcf8b9f3c3d63ccc8ccf8ae4020c6ffd3.zip
Enable and take care of some warnings
Diffstat (limited to 'src')
-rw-r--r--src/ConfigParser.cpp6
-rw-r--r--src/DabMux.cpp2
-rw-r--r--src/Log.h4
-rw-r--r--src/Makefile.am12
-rw-r--r--src/MuxElements.cpp9
-rw-r--r--src/TcpSocket.cpp2
-rw-r--r--src/crc.c6
-rw-r--r--src/dabInputZmq.cpp11
-rw-r--r--src/dabOutput/dabOutputFifo.cpp1
-rw-r--r--src/dabOutput/dabOutputFile.cpp1
-rw-r--r--src/mpeg.c4
11 files changed, 31 insertions, 27 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 8c5cbaa..718946b 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -855,7 +855,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
if (nonblock) {
switch (subchan->type) {
#ifdef HAVE_FORMAT_PACKET
- case 3:
+ case Packet:
if (operations == dabInputPacketFileOperations) {
operations = dabInputFifoOperations;
#ifdef HAVE_FORMAT_EPM
@@ -871,7 +871,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
break;
#endif // defined(HAVE_FORMAT_PACKET)
#ifdef HAVE_FORMAT_MPEG
- case 0:
+ case Audio:
if (operations == dabInputMpegFileOperations) {
operations = dabInputMpegFifoOperations;
} else if (operations == dabInputDabplusFileOperations) {
@@ -884,6 +884,8 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
}
break;
#endif // defined(HAVE_FORMAT_MPEG)
+ case DataDmb:
+ case Fidc:
default:
stringstream ss;
ss << "Subchannel with uid " << subchanuid <<
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 8ef30ba..7f946d5 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -1179,6 +1179,7 @@ int main(int argc, char *argv[])
packet_description->PS = ((curCpnt == 0) ? 1 : 0);
packet_description->CA_flag = 0;
break;
+ case Fidc:
default:
etiLog.log(error,
"Component type not supported\n");
@@ -1296,6 +1297,7 @@ int main(int argc, char *argv[])
packet_description->PS = ((curCpnt == 0) ? 1 : 0);
packet_description->CA_flag = 0;
break;
+ case Fidc:
default:
etiLog.log(error,
"Component type not supported\n");
diff --git a/src/Log.h b/src/Log.h
index 85a2f75..7be6df8 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -73,10 +73,12 @@ class LogToSyslog : public LogBackend {
int syslog_level = LOG_EMERG;
switch (level) {
case debug: syslog_level = LOG_DEBUG; break;
- case alert: syslog_level = LOG_ALERT; break;
case info: syslog_level = LOG_INFO; break;
+ /* we don't have the notice level */
case warn: syslog_level = LOG_WARNING; break;
case error: syslog_level = LOG_ERR; break;
+ default: syslog_level = LOG_CRIT; break;
+ case alert: syslog_level = LOG_ALERT; break;
case emerg: syslog_level = LOG_EMERG; break;
}
diff --git a/src/Makefile.am b/src/Makefile.am
index f3bce5e..6ed0921 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,7 @@
# along with ODR-DabMux. If not, see <http://www.gnu.org/licenses/>.
if IS_GIT_REPO
-GITVERSION_FLAGS = -DGITVERSION="\"`git describe`\""
+GITVERSION_FLAGS = -DGITVERSION="\"`git describe --dirty`\""
else
GITVERSION_FLAGS =
endif
@@ -39,7 +39,15 @@ bin_PROGRAMS=odr-dabmux odr-bridgetest
ZMQ_LIBS =
endif
-odr_dabmux_CPPFLAGS =-Wall -I$(FARSYNC_DIR) $(GITVERSION_FLAGS)
+
+odr_dabmux_CPPFLAGS =-I$(FARSYNC_DIR) $(GITVERSION_FLAGS) \
+ -Wall -Wextra -Wno-unused-parameter \
+ -Wswitch-enum \
+ -Wdisabled-optimization -Wvla \
+ -Wuninitialized \
+ -Wc++11-compat \
+ -Wcast-align -Wcast-qual
+
odr_dabmux_LDADD =$(FEC_LIBS) $(ZMQ_LIBS) -lpthread -lboost_thread -lboost_system
odr_dabmux_SOURCES =DabMux.cpp DabMux.h \
dabInput.h dabInput.cpp \
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index e8871d1..4b40b10 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -224,9 +224,6 @@ bool DabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels)
void DabComponent::set_parameter(const string& parameter,
const string& value)
{
- stringstream ss(value);
- ss.exceptions ( stringstream::failbit | stringstream::badbit );
-
if (parameter == "label") {
vector<string> fields;
boost::split(fields, value, boost::is_any_of(","));
@@ -322,9 +319,6 @@ unsigned char DabService::nbComponent(vector<DabComponent*>& components)
void DabService::set_parameter(const string& parameter,
const string& value)
{
- stringstream ss(value);
- ss.exceptions ( stringstream::failbit | stringstream::badbit );
-
if (parameter == "label") {
vector<string> fields;
boost::split(fields, value, boost::is_any_of(","));
@@ -388,9 +382,6 @@ const string DabService::get_parameter(const string& parameter) const
void dabEnsemble::set_parameter(const string& parameter, const string& value)
{
- stringstream ss(value);
- ss.exceptions ( stringstream::failbit | stringstream::badbit );
-
if (parameter == "localtimeoffset") {
if (value == "auto") {
lto_auto = true;
diff --git a/src/TcpSocket.cpp b/src/TcpSocket.cpp
index 89fefd2..75b320f 100644
--- a/src/TcpSocket.cpp
+++ b/src/TcpSocket.cpp
@@ -266,7 +266,7 @@ int TcpSocket::write(const void* data, int size)
// ignore BROKENPIPE signal (we handle it instead)
// void* old_sigpipe = signal ( SIGPIPE, SIG_IGN );
// try to send data
- int ret = send(listenSocket, (char*)data, size, 0 /*MSG_NOSIGNAL*/ );
+ int ret = send(listenSocket, (const char*)data, size, 0 /*MSG_NOSIGNAL*/ );
// restore the BROKENPIPE handling
// signal ( SIGPIPE, (__sighandler_t)old_sigpipe );
if (ret == SOCKET_ERROR) {
diff --git a/src/crc.c b/src/crc.c
index 2a676d9..cc02473 100644
--- a/src/crc.c
+++ b/src/crc.c
@@ -236,7 +236,7 @@ void init_crc32tab(uint32_t l_code, uint32_t l_init)
uint8_t crc8(uint8_t l_crc, const void *lp_data, unsigned l_nb)
{
- uint8_t* data = (uint8_t*)lp_data;
+ const uint8_t* data = (const uint8_t*)lp_data;
while (l_nb--) {
l_crc = crc8tab[l_crc ^ *(data++)];
}
@@ -246,7 +246,7 @@ uint8_t crc8(uint8_t l_crc, const void *lp_data, unsigned l_nb)
uint16_t crc16(uint16_t l_crc, const void *lp_data, unsigned l_nb)
{
- uint8_t* data = (uint8_t*)lp_data;
+ const uint8_t* data = (const uint8_t*)lp_data;
while (l_nb--) {
l_crc =
(l_crc << 8) ^ crc16tab[(l_crc >> 8) ^ *(data++)];
@@ -257,7 +257,7 @@ uint16_t crc16(uint16_t l_crc, const void *lp_data, unsigned l_nb)
uint32_t crc32(uint32_t l_crc, const void *lp_data, unsigned l_nb)
{
- uint8_t* data = (uint8_t*)lp_data;
+ const uint8_t* data = (const uint8_t*)lp_data;
while (l_nb--) {
l_crc =
(l_crc << 8) ^ crc32tab[((l_crc >> 24) ^ *(data++)) & 0xff];
diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp
index 9d39945..5c20baf 100644
--- a/src/dabInputZmq.cpp
+++ b/src/dabInputZmq.cpp
@@ -386,9 +386,9 @@ int DabInputZmqMPEG::readFromSocket(size_t framesize)
}
else if (m_enable_input) {
// copy the input frame blockwise into the frame_buffer
- uint8_t* frame = new uint8_t[framesize];
- memcpy(frame, data, framesize);
- m_frame_buffer.push_back(frame);
+ uint8_t* framedata = new uint8_t[framesize];
+ memcpy(framedata, data, framesize);
+ m_frame_buffer.push_back(framedata);
}
else {
return 0;
@@ -397,7 +397,7 @@ int DabInputZmqMPEG::readFromSocket(size_t framesize)
else {
etiLog.level(error) <<
"inputZMQ " << m_name <<
- " wrong data size: recv'd " << msg.size() <<
+ " wrong data size: recv'd " << msg.size() << " Bytes" <<
", need " << framesize << ".";
messageReceived = false;
}
@@ -498,9 +498,6 @@ int DabInputZmqAAC::readFromSocket(size_t framesize)
void DabInputZmqBase::set_parameter(const string& parameter,
const string& value)
{
- stringstream ss(value);
- ss.exceptions ( stringstream::failbit | stringstream::badbit );
-
if (parameter == "buffer") {
size_t new_limit = atol(value.c_str());
diff --git a/src/dabOutput/dabOutputFifo.cpp b/src/dabOutput/dabOutputFifo.cpp
index de9579e..6b1c016 100644
--- a/src/dabOutput/dabOutputFifo.cpp
+++ b/src/dabOutput/dabOutputFifo.cpp
@@ -59,6 +59,7 @@ int DabOutputFifo::Write(void* buffer, int size)
if (write(this->file_, padding, 6144 - size) == -1)
goto FIFO_WRITE_ERROR;
break;
+ case ETI_FILE_TYPE_NONE:
default:
etiLog.log(error, "File type is not supported.\n");
return -1;
diff --git a/src/dabOutput/dabOutputFile.cpp b/src/dabOutput/dabOutputFile.cpp
index f26ddfd..d7fd5c7 100644
--- a/src/dabOutput/dabOutputFile.cpp
+++ b/src/dabOutput/dabOutputFile.cpp
@@ -112,6 +112,7 @@ int DabOutputFile::Write(void* buffer, int size)
memset(padding, 0x55, 6144 - size);
if (write(this->file_, padding, 6144 - size) == -1) goto FILE_WRITE_ERROR;
break;
+ case ETI_FILE_TYPE_NONE:
default:
etiLog.log(error, "File type is not supported.\n");
return -1;
diff --git a/src/mpeg.c b/src/mpeg.c
index 16be483..f7aed34 100644
--- a/src/mpeg.c
+++ b/src/mpeg.c
@@ -25,7 +25,7 @@
#include <errno.h>
-const static short bitrateArray[4][4][16] = {
+static const short bitrateArray[4][4][16] = {
{ // MPEG 2.5
{ -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1 }, // layer invalid
@@ -69,7 +69,7 @@ const static short bitrateArray[4][4][16] = {
};
-const static int samplingrateArray[4][4] = {
+static const int samplingrateArray[4][4] = {
{ 11025, 12000, 8000, 0 }, // MPEG 2.5
{ -1, -1, -1, -1 }, // MPEG invalid
{ 22050, 24000, 16000, 0 }, // MPEG 2