From 5953e2ce95dc0cb809d529c4103ae6b80f0248c0 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 4 Apr 2014 10:47:58 +0200 Subject: Remove some compilation warnings --- src/DabMux.cpp | 24 +++++++++---------- src/DabMux.cpp.patch | 58 +++++++++++++++++++++++++++++++++++++++++++++ src/Log.h | 9 +++---- src/MuxElements.h | 3 +++ src/ParserConfigfile.cpp | 2 +- src/RemoteControl.cpp | 2 +- src/RemoteControl.h | 14 +++++++---- src/dabInput.h | 4 ++-- src/dabInputDabplusFifo.cpp | 2 +- src/dabInputDabplusFile.cpp | 4 ++-- src/dabInputRawFifo.cpp | 4 ++-- src/dabInputZmq.cpp | 4 ++-- src/dabInputZmq.h | 6 ++--- src/dabOutput/dabOutput.h | 4 ++-- 14 files changed, 103 insertions(+), 37 deletions(-) create mode 100644 src/DabMux.cpp.patch (limited to 'src') diff --git a/src/DabMux.cpp b/src/DabMux.cpp index 5baad39..275175b 100644 --- a/src/DabMux.cpp +++ b/src/DabMux.cpp @@ -273,14 +273,14 @@ int main(int argc, char *argv[]) vector::iterator component = ensemble->components.end(); vector::iterator componentProgFIG0_8; vector::iterator componentFIG0_13; - bool transmitFIG0_13programme; // Alternate between programme and data + bool transmitFIG0_13programme = false; // Alternate between programme and data vector::iterator componentDataFIG0_8; vector::iterator subchannel = ensemble->subchannels.end(); vector::iterator subchannelFIG0_1; vector::iterator output; dabProtection* protection = NULL; - BaseRemoteController* rc; + BaseRemoteController* rc = NULL; unsigned int currentFrame; int returnCode = 0; @@ -291,7 +291,7 @@ int main(int argc, char *argv[]) //FIC Length, DAB Mode I, II, IV -> FICL = 24, DAB Mode III -> FICL = 32 unsigned FICL = (ensemble->mode == 3 ? 32 : 24); - unsigned long sync = 0x49C5F8; + uint32_t sync = 0x49C5F8; unsigned short FLtmp = 0; unsigned short nbBytesCRC = 0; unsigned short CRCtmp = 0xFFFF; @@ -1333,8 +1333,8 @@ int main(int argc, char *argv[]) if (figSize > 30 - 5) { break; } - *((uint16_t*)&etiFrame[index]) = - htons((*componentProgFIG0_8)->serviceId); + etiFrame[index] = ((*componentProgFIG0_8)->serviceId >> 8) & 0xFF; + etiFrame[index+1] = ((*componentProgFIG0_8)->serviceId) & 0xFF; fig0->Length += 2; index += 2; figSize += 2; @@ -1353,8 +1353,8 @@ int main(int argc, char *argv[]) if (figSize > 30 - 4) { break; } - *((uint16_t*)&etiFrame[index]) = - htons((*componentProgFIG0_8)->serviceId); + etiFrame[index] = ((*componentProgFIG0_8)->serviceId >> 8) & 0xFF; + etiFrame[index+1] = ((*componentProgFIG0_8)->serviceId) & 0xFF; fig0->Length += 2; index += 2; figSize += 2; @@ -1414,8 +1414,8 @@ int main(int argc, char *argv[]) if (figSize > 30 - 7) { break; } - *((uint32_t*)&etiFrame[index]) = - htonl((*componentDataFIG0_8)->serviceId); + etiFrame[index] = ((*componentDataFIG0_8)->serviceId >> 8) & 0xFF; + etiFrame[index+1] = ((*componentDataFIG0_8)->serviceId) & 0xFF; fig0->Length += 4; index += 4; figSize += 4; @@ -1434,8 +1434,8 @@ int main(int argc, char *argv[]) if (figSize > 30 - 6) { break; } - *((uint32_t*)&etiFrame[index]) = - htonl((*componentDataFIG0_8)->serviceId); + etiFrame[index] = ((*componentDataFIG0_8)->serviceId >> 8) & 0xFF; + etiFrame[index+1] = ((*componentDataFIG0_8)->serviceId) & 0xFF; fig0->Length += 4; index += 4; figSize += 4; @@ -1626,7 +1626,7 @@ int main(int argc, char *argv[]) fig0_9->Extension = 9; fig0_9->ext = 0; - fig0_9->lto = 0; + fig0_9->lto = 0; // Unique LTO for ensemble fig0_9->ensembleLto = ensemble->lto; fig0_9->ensembleEcc = ensemble->ecc; fig0_9->tableId = ensemble->international_table; diff --git a/src/DabMux.cpp.patch b/src/DabMux.cpp.patch new file mode 100644 index 0000000..a6057c9 --- /dev/null +++ b/src/DabMux.cpp.patch @@ -0,0 +1,58 @@ ++++ DabMux.cpp 2014-02-27 17:56:41.108646157 +0100 +--- DabMux.cpp.orig 2014-02-27 17:56:01.080447673 +0100 +@@ -616,8 +616,6 @@ + typeHigh = type >> 3; + typeLow = type & 0x1f; + } ++ //CSP - SERGIO ++ uint32_t xpad; + } PACKED; + + +@@ -2060,14 +2058,12 @@ + returnCode = -1; + goto EXIT; + } ++ /* CSP - SERGIO + if (!(*component)->isPacketComponent(ensemble->subchannels)) { + etiLog.printHeader(TcpLog::ERR, "application type\n"); + printUsage(progName); + returnCode = -1; + goto EXIT; + } ++ */ + (*component)->packet.appType = strtoul(optarg, NULL, 0); + break; + case 'g': +@@ -3210,7 +3206,7 @@ + goto EXIT; + } + ++ // CSP - SERGIO if ((*subchannel)->type != 3) continue; +- if ((*subchannel)->type != 3) continue; + + if ((*component)->packet.appType != 0xffff) { + if (fig0 == NULL) { +@@ -3236,18 +3232,10 @@ + + FIG0_13_app* app = (FIG0_13_app*)&etiFrame[index]; + app->setType((*component)->packet.appType); ++ // CSP - SERGIO app->length = 0; ++ app->length = 4; ++ app->xpad = 0x0cbc0000; ++ ++ ++ //index += 2; ++ //figSize += 2; ++ //fig0->Length += 2; ++ ++ index += 6; ++ figSize += 6; ++ fig0->Length += 6; +- app->length = 0; +- index += 2; +- figSize += 2; +- fig0->Length += 2; + + if (figSize > 30) { + etiLog.printHeader(TcpLog::ERR, diff --git a/src/Log.h b/src/Log.h index c766e6e..85a2f75 100644 --- a/src/Log.h +++ b/src/Log.h @@ -45,12 +45,13 @@ enum log_level_t {debug = 0, info, warn, error, alert, emerg}; -const std::string levels_as_str[] = +static const std::string levels_as_str[] = { " ", " ", "WARN ", "ERROR", "ALERT", "EMERG"} ; /** Abstract class all backends must inherit from */ class LogBackend { public: + virtual ~LogBackend() {} virtual void log(log_level_t level, std::string message) = 0; virtual std::string get_name() = 0; }; @@ -82,7 +83,7 @@ class LogToSyslog : public LogBackend { syslog(syslog_level, SYSLOG_IDENT " %s", message.c_str()); } - std::string get_name() { return name; }; + std::string get_name() { return name; } private: std::string name; @@ -117,7 +118,7 @@ class LogToFile : public LogBackend { fflush(log_file); } - std::string get_name() { return name; }; + std::string get_name() { return name; } private: std::string name; @@ -128,7 +129,7 @@ class LogLine; class Logger { public: - Logger() {}; + Logger() {} void register_backend(LogBackend* backend); diff --git a/src/MuxElements.h b/src/MuxElements.h index aa4f602..3bcc903 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -202,6 +202,7 @@ class DabComponent : public RemoteControllable /* Getting a parameter always returns a string. */ virtual const string get_parameter(const string& parameter) const; + virtual ~DabComponent() {} private: const DabComponent& operator=(const DabComponent& other); @@ -236,6 +237,8 @@ class DabService : public RemoteControllable /* Getting a parameter always returns a string. */ virtual const string get_parameter(const string& parameter) const; + virtual ~DabService() {} + private: const DabService& operator=(const DabService& other); DabService(const DabService& other); diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp index 4a67186..d699ed0 100644 --- a/src/ParserConfigfile.cpp +++ b/src/ParserConfigfile.cpp @@ -483,7 +483,7 @@ void parse_configfile(string configuration_file, string outputuid = it->first; string uri = pt_outputs.get(outputuid); - int proto_pos = uri.find("://"); + size_t proto_pos = uri.find("://"); if (proto_pos == std::string::npos) { stringstream ss; ss << "Output with uid " << outputuid << " no protocol defined!"; diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp index 3ce3310..62527bd 100644 --- a/src/RemoteControl.cpp +++ b/src/RemoteControl.cpp @@ -205,7 +205,7 @@ void RemoteControllerTelnet::dispatch_command(tcp::socket& socket, string comman if (cmd.size() >= 4) { try { stringstream new_param_value; - for (int i = 3; i < cmd.size(); i++) { + for (size_t i = 3; i < cmd.size(); i++) { new_param_value << cmd[i]; if (i+1 < cmd.size()) { diff --git a/src/RemoteControl.h b/src/RemoteControl.h index fd8d025..a9da7d7 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -58,7 +58,7 @@ class ParameterError : public std::exception { public: ParameterError(string message) : m_message(message) {} - ~ParameterError() throw() {}; + ~ParameterError() throw() {} const char* what() const throw() { return m_message.c_str(); } private: @@ -84,6 +84,8 @@ class BaseRemoteController { * restarted. */ virtual void restart() = 0; + + virtual ~BaseRemoteController() {} }; /* Objects that support remote control must implement the following class */ @@ -92,6 +94,8 @@ class RemoteControllable { RemoteControllable(string name) : m_name(name) {} + virtual ~RemoteControllable() {} + /* return a short name used to identify the controllable. * It might be used in the commands the user has to type, so keep * it short @@ -159,7 +163,7 @@ class RemoteControllerTelnet : public BaseRemoteController { m_cohort.push_back(controllable); } - virtual bool fault_detected() { return m_fault; }; + virtual bool fault_detected() { return m_fault; } virtual void restart(); @@ -255,11 +259,11 @@ class RemoteControllerTelnet : public BaseRemoteController { */ class RemoteControllerDummy : public BaseRemoteController { public: - void enrol(RemoteControllable* controllable) {}; + void enrol(RemoteControllable*) {} - bool fault_detected() { return false; }; + bool fault_detected() { return false; } - virtual void restart() {}; + virtual void restart() {} }; #endif diff --git a/src/dabInput.h b/src/dabInput.h index e6cea8c..fb64459 100644 --- a/src/dabInput.h +++ b/src/dabInput.h @@ -54,9 +54,9 @@ class DabInputBase { virtual int setBitrate(int bitrate) = 0; virtual int close() = 0; - virtual ~DabInputBase() {}; + virtual ~DabInputBase() {} protected: - DabInputBase() {}; + DabInputBase() {} }; /* Wrapper class for old-style dabInputOperations inputs */ diff --git a/src/dabInputDabplusFifo.cpp b/src/dabInputDabplusFifo.cpp index d1369c5..81f373b 100644 --- a/src/dabInputDabplusFifo.cpp +++ b/src/dabInputDabplusFifo.cpp @@ -99,7 +99,7 @@ int dabInputDabplusFifoRead(void* args, void* buffer, int size) { dabInputDabplusFifoData* data = (dabInputDabplusFifoData*)args; - if (data->bufferSize != size * 5) { + if (data->bufferSize != (size_t)size * 5) { if (data->buffer != NULL) { delete[] data->buffer; } diff --git a/src/dabInputDabplusFile.cpp b/src/dabInputDabplusFile.cpp index bd968ef..c435aba 100644 --- a/src/dabInputDabplusFile.cpp +++ b/src/dabInputDabplusFile.cpp @@ -79,7 +79,7 @@ int dabInputDabplusFileOpen(void* args, const char* filename) int dabInputDabplusFileRead(void* args, void* buffer, int size) { dabInputDabplusFileData* data = (dabInputDabplusFileData*)args; - if (data->bufferSize != size * 5) { + if (data->bufferSize != (size_t)size * 5) { if (data->buffer == NULL) { delete[] data->buffer; } @@ -90,7 +90,7 @@ int dabInputDabplusFileRead(void* args, void* buffer, int size) if (data->bufferIndex + size > data->bufferSize) { int ret = read(data->file, data->buffer, data->bufferSize); - if (ret != data->bufferSize) { + if (ret != (int)data->bufferSize) { if (ret != 0) { etiLog.log(alert, "ERROR: Incomplete DAB+ frame!\n"); } diff --git a/src/dabInputRawFifo.cpp b/src/dabInputRawFifo.cpp index 3a77be3..0da9727 100644 --- a/src/dabInputRawFifo.cpp +++ b/src/dabInputRawFifo.cpp @@ -96,7 +96,7 @@ int dabInputRawFifoSetbuf(void* args, int size) return size; } - if (data->bufferSize != size) { + if (data->bufferSize != (size_t)size) { if (data->buffer != NULL) { delete[] data->buffer; } @@ -130,7 +130,7 @@ int dabInputRawFifoReadFrame(dabInputOperations* ops, void* args, return -1; } - if (result + data->bufferOffset < size) { + if (result + data->bufferOffset < (size_t)size) { data->bufferOffset += result; etiLog.log(info, "reach end of fifo -> rewinding\n"); diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp index 95446d1..ffe1e6b 100644 --- a/src/dabInputZmq.cpp +++ b/src/dabInputZmq.cpp @@ -196,7 +196,7 @@ int DabInputZmqBase::readFrame(void* buffer, int size) /******** MPEG input *******/ // Read a MPEG frame from the socket, and push to list -int DabInputZmqMPEG::readFromSocket(int framesize) +int DabInputZmqMPEG::readFromSocket(size_t framesize) { bool messageReceived; zmq::message_t msg; @@ -249,7 +249,7 @@ int DabInputZmqMPEG::readFromSocket(int framesize) // Read a AAC+ superframe from the socket, cut it into five frames, // and push to list -int DabInputZmqAAC::readFromSocket(int framesize) +int DabInputZmqAAC::readFromSocket(size_t framesize) { bool messageReceived; zmq::message_t msg; diff --git a/src/dabInputZmq.h b/src/dabInputZmq.h index 5c88316..9f7fba2 100644 --- a/src/dabInputZmq.h +++ b/src/dabInputZmq.h @@ -97,7 +97,7 @@ class DabInputZmqBase : public DabInputBase, public RemoteControllable { virtual const string get_parameter(const string& parameter) const; protected: - virtual int readFromSocket(int framesize) = 0; + virtual int readFromSocket(size_t framesize) = 0; zmq::context_t m_zmq_context; zmq::socket_t m_zmq_sock; // handle for the zmq socket @@ -122,7 +122,7 @@ class DabInputZmqMPEG : public DabInputZmqBase { } private: - virtual int readFromSocket(int framesize); + virtual int readFromSocket(size_t framesize); }; class DabInputZmqAAC : public DabInputZmqBase { @@ -136,7 +136,7 @@ class DabInputZmqAAC : public DabInputZmqBase { } private: - virtual int readFromSocket(int framesize); + virtual int readFromSocket(size_t framesize); }; #endif // HAVE_INPUT_ZMQ diff --git a/src/dabOutput/dabOutput.h b/src/dabOutput/dabOutput.h index 1050de1..72a15d4 100644 --- a/src/dabOutput/dabOutput.h +++ b/src/dabOutput/dabOutput.h @@ -65,7 +65,7 @@ class DabOutput virtual int Write(void* buffer, int size) = 0; virtual int Close() = 0; - virtual ~DabOutput() {}; + virtual ~DabOutput() {} }; // ----- used in File and Fifo outputs @@ -277,7 +277,7 @@ struct zmq_dab_message_t version = 1; } uint32_t version; - uint16_t buflen[NUM_FRAMES_PER_ZMQ_MESSAGE]; + int16_t buflen[NUM_FRAMES_PER_ZMQ_MESSAGE]; uint8_t buf[NUM_FRAMES_PER_ZMQ_MESSAGE*6144]; }; -- cgit v1.2.3