diff --git a/include/PacketLibDefinition.h b/include/PacketLibDefinition.h index c802e690a4d904478c6642203a34e9cab1c80a34..591441a6405a569cbbc38570d0d441fa912a7b2b 100644 --- a/include/PacketLibDefinition.h +++ b/include/PacketLibDefinition.h @@ -82,6 +82,15 @@ typedef unsigned int dword; #define CONFIG_MAXNUMBER_OFCONFIGILES 20000 #define CONFIG_MAXNUMBEROFLINES_OFCONFIGILES 100000 +/// utility function to ignore unused function parameters. +#ifdef HAS_MOVE_SEMANTICS +template <typename T> +void UNUSED(T &&) +{ } +#else +#define UNUSED(expr) do { (void)(expr); } while (0) +#endif + /// typedef bool boolean; using namespace std; diff --git a/include/SharedPtr.h b/include/SharedPtr.h index 07363d15f1f9cf31f9982be54d9538e9b49bf6be..f9e6b53c055b361ca0f3027f4023d0a0c20df617 100644 --- a/include/SharedPtr.h +++ b/include/SharedPtr.h @@ -32,7 +32,7 @@ class SharedPtr SharedPtr() : p(0), c(0) {} explicit SharedPtr(T* s) : p(s), c(new unsigned(1)) {} - SharedPtr(void* null) : p(0), c(0) {} + SharedPtr(void*) : p(0), c(0) {} SharedPtr(const SharedPtr& s) : p(s.p), c(s.c) { if(c) ++*c; } diff --git a/src/ByteStream.cpp b/src/ByteStream.cpp index ce95aac9fd1d135cfc281890c502fe8551b83064..491c52bea1a29914c770dd7a0b5ab2f30c0b517a 100644 --- a/src/ByteStream.cpp +++ b/src/ByteStream.cpp @@ -164,6 +164,8 @@ ByteStreamPtr PacketLib::ByteStream::compress(enum CompressionAlgorithms algorit ByteStreamPtr PacketLib::ByteStream::decompress(enum CompressionAlgorithms algorithmType, byte compressionLevel, dword dmax) { ByteStreamPtr b; + UNUSED(compressionLevel); + switch(algorithmType) { case NONE: diff --git a/src/OutputSerial.cpp b/src/OutputSerial.cpp index 8ae2157d41ce63ea578e127946bd37825e33f6a7..8eac50f6aa27aa846da275a41b14f39315f6e108 100644 --- a/src/OutputSerial.cpp +++ b/src/OutputSerial.cpp @@ -79,6 +79,7 @@ bool OutputSerial::writeByteStream(ByteStreamPtr b) throw(PacketExceptionIO*) bool OutputSerial::writeString(const char* str) throw(PacketExceptionIO*) { + UNUSED(str); /* if(!isclosed) file->writeString(str); else diff --git a/src/OutputSocketClient.cpp b/src/OutputSocketClient.cpp index 319510480cab5916b8d592e8f72dcb92c662d249..d3476088e02ac3987a781a53c17ff110ed9251fd 100644 --- a/src/OutputSocketClient.cpp +++ b/src/OutputSocketClient.cpp @@ -72,5 +72,7 @@ bool OutputSocketClient::writeByteStream(ByteStreamPtr b) throw(PacketExceptionI bool OutputSocketClient::writeString(const char* str) throw(PacketExceptionIO*) { + UNUSED(str); + throw new PacketExceptionIO("Method not implemented"); } diff --git a/src/Packet.cpp b/src/Packet.cpp index 1632a8584b835048dcf080ec697dc5ada9fed829..139d510ba415412bb84b067d15cc4f9e3d9660ae 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -582,6 +582,8 @@ void Packet::generateStream() bool Packet::setPacketValueVerify(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField) { + UNUSED(prefix); + /// 1) Checking /// First check: pointers control if(packetHeader == NULL || packetDataField == NULL) diff --git a/src/PacketNotRecognized.cpp b/src/PacketNotRecognized.cpp index 6662f568200bf2c9594dca00aee2e1b06634998b..0e1051660facc97e206c7ce418bff5c3b33ede2e 100644 --- a/src/PacketNotRecognized.cpp +++ b/src/PacketNotRecognized.cpp @@ -30,6 +30,9 @@ void PacketNotRecognized::createPacketType(pugi::xml_node node, int plPhysicalIn bool PacketNotRecognized::createPacketType(char* fileName, bool prefix, word dimprefix) throw (PacketException*) { + UNUSED(prefix); + UNUSED(dimprefix); + packetID = 0; if(header->loadHeader(fileName)) { @@ -60,6 +63,8 @@ PacketNotRecognized::~PacketNotRecognized() bool PacketNotRecognized::setPacketValue(ByteStreamPtr prefix, ByteStreamPtr packetHeader, ByteStreamPtr packetDataField, int decodeType) { + UNUSED(decodeType); + /// It reads and sets the packet header if(!header->setByteStream(packetHeader)) return false; diff --git a/src/SDFBlock.cpp b/src/SDFBlock.cpp index eb327b72c49f839d88a28659cd18dd29cd36aad1..6e7b4530300d64254dd865d6ab8ce43b361a58da 100644 --- a/src/SDFBlock.cpp +++ b/src/SDFBlock.cpp @@ -75,9 +75,9 @@ void SDFBlockType::loadType(pugi::xml_node node, const pugi::xml_document& doc, std::cout << "fixed part: " << variablePresent; std::cout << " variable part: " << variablePresent << std::endl; #endif - numberOfRBlocks = rbNodeSet.size(); - if(numberOfRBlocks > 65535) + if(rbNodeSet.size() > 65535) throw new PacketExceptionFileFormat("Too many number of Rblocks in the packet type."); + numberOfRBlocks = rbNodeSet.size(); rblockFilename = new char*[numberOfRBlocks]; rBlockVariable = new bool[numberOfRBlocks]; maxNumberOfBlock = new word[numberOfRBlocks]; @@ -97,9 +97,9 @@ void SDFBlockType::loadType(pugi::xml_node node, const pugi::xml_document& doc, rBlockVariable[i] = false; const char* nblocks = rbNode.attribute("maxnumberofblocks").value(); - maxNumberOfBlock[i] = atoi(nblocks); - if(maxNumberOfBlock[i] > 65535) + if(atoi(nblocks) > 65535) throw new PacketExceptionFileFormat("Too many number of blocks in the packet type."); + maxNumberOfBlock[i] = atoi(nblocks); if(!idref) {