diff --git a/libs/yiax/transaction.cpp b/libs/yiax/transaction.cpp index e2eb88f3..7ff0db9e 100644 --- a/libs/yiax/transaction.cpp +++ b/libs/yiax/transaction.cpp @@ -338,7 +338,7 @@ IAXTransaction* IAXTransaction::sendMedia(const DataBlock& data, u_int32_t forma if (m_trunkFrame) m_trunkFrame->add(localCallNo(),data,m_lastMiniFrameOut); else { - unsigned char b[4] = {localCallNo() >> 8,localCallNo(),m_lastMiniFrameOut >> 8,m_lastMiniFrameOut}; + unsigned char b[4] = {localCallNo() >> 8,localCallNo() & 0xff,m_lastMiniFrameOut >> 8,m_lastMiniFrameOut & 0xff}; DataBlock buf(b,4); buf += data; m_engine->writeSocket(buf.data(),buf.length(),remoteAddr()); diff --git a/libs/yjingle/jbstream.cpp b/libs/yjingle/jbstream.cpp index 9f000b1c..70e01fff 100644 --- a/libs/yjingle/jbstream.cpp +++ b/libs/yjingle/jbstream.cpp @@ -719,7 +719,7 @@ bool JBComponentStream::addEventNotify(JBEvent::Type type, { Lock lock(this); XMLElement* e = 0; - bool raise = (element->id()); + bool raise = !element->id().null(); if (raise) { e = element->release(); JBEvent* ev = new JBEvent(type,this,e,&(element->id())); diff --git a/libs/yjingle/session.cpp b/libs/yjingle/session.cpp index 5a435d31..016409da 100644 --- a/libs/yjingle/session.cpp +++ b/libs/yjingle/session.cpp @@ -454,7 +454,7 @@ JGEvent* JGSession::processEvent(JBEvent* jbev, u_int64_t time) JGEvent* event = 0; // Process state Ending if (state() == Ending) { - bool response = isResponse(jbev); + bool response = isResponse(jbev) != 0; if (response || time > m_timeout) { DDebug(m_engine,DebugAll, "Session. Terminated in state Ending. Reason: '%s'. [%p]", diff --git a/libs/yjingle/yatejabber.h b/libs/yjingle/yatejabber.h index aa78d62e..bb9d07ad 100644 --- a/libs/yjingle/yatejabber.h +++ b/libs/yjingle/yatejabber.h @@ -1443,7 +1443,7 @@ public: * @return True if the resource has the required capability. */ inline bool hasCap(Capability capability) const - { return (m_capability & capability); } + { return (m_capability & capability) != 0; } /** * Update resource from a presence element. @@ -1658,14 +1658,14 @@ public: * @return True if the local user is subscribed to the remote one. */ inline bool subscribedTo() const - { return (m_subscription & To); } + { return (m_subscription & To) != 0; } /** * Check if the remote user is subscribed to the local one. * @return True if the remote user is subscribed to the local one. */ inline bool subscribedFrom() const - { return (m_subscription & From); } + { return (m_subscription & From) != 0; } /** * Process received error elements. diff --git a/libs/ymgcp/message.cpp b/libs/ymgcp/message.cpp index 9c4bf577..397e3e6d 100644 --- a/libs/ymgcp/message.cpp +++ b/libs/ymgcp/message.cpp @@ -178,7 +178,7 @@ static inline bool skipBlanks(const char*& buffer, unsigned int& len) { for (; len && isBlank(*buffer); buffer++, len--) ; - return len; + return (len != 0); } // Get a line from a buffer until the first valid end-of-line or end of buffer was reached, diff --git a/libs/ymgcp/yatemgcp.h b/libs/ymgcp/yatemgcp.h index 97b9a0c2..716c2d70 100644 --- a/libs/ymgcp/yatemgcp.h +++ b/libs/ymgcp/yatemgcp.h @@ -828,7 +828,7 @@ public: * @return True if the given command is known by this engine */ inline bool knownCommand(const char* cmd) - { Lock lock(this); return m_knownCommands.find(cmd); } + { Lock lock(this); return (m_knownCommands.find(cmd) != 0); } /** * Add a command to the list of known commands diff --git a/libs/ysig/engine.cpp b/libs/ysig/engine.cpp index d4243f89..4ab2c61d 100644 --- a/libs/ysig/engine.cpp +++ b/libs/ysig/engine.cpp @@ -172,7 +172,7 @@ bool SignallingEngine::find(const SignallingComponent* component) if (!component) return false; Lock lock(this); - return m_components.find(component); + return m_components.find(component) != 0; } void SignallingEngine::insert(SignallingComponent* component) @@ -445,7 +445,7 @@ bool SignallingUtils::hasFlag(const NamedList& list, const char* param, const ch { String s = list.getValue(param); ObjList* obj = list.split(',',false); - bool found = obj->find(flag); + bool found = (obj->find(flag) != 0); TelEngine::destruct(obj); return found; } diff --git a/libs/ysig/layer3.cpp b/libs/ysig/layer3.cpp index 621736cb..748a62b9 100644 --- a/libs/ysig/layer3.cpp +++ b/libs/ysig/layer3.cpp @@ -302,7 +302,7 @@ void SS7Layer3::removeRoutes(SS7Layer3* network) void SS7Layer3::printRoutes() { String s; - bool router = getObject("SS7Router"); + bool router = getObject("SS7Router") != 0; for (unsigned int i = 0; i < YSS7_PCTYPE_COUNT; i++) { ObjList* o = m_route[i].skipNull(); if (!o) diff --git a/libs/ysig/q931.cpp b/libs/ysig/q931.cpp index 4aced79f..11832772 100644 --- a/libs/ysig/q931.cpp +++ b/libs/ysig/q931.cpp @@ -111,7 +111,7 @@ public: return tmp; } inline bool addBoolParam(NamedList* dest, u_int8_t data, bool toggle) const { - bool result = (bool)(toggle ? !(data & mask) : data & mask); + bool result = (bool)toggle ? !(data & mask) : (data & mask); dest->addParam(name,String::boolText(result)); return result; } @@ -3478,7 +3478,7 @@ ISDNQ931Message* ISDNQ931Message::parse(ISDNQ931ParserData& parserData, #define Q931_MSG_PROTOQ931 0x08 // Q.931 protocol discriminator // Get bit 7 to check if the current byte is extended to the next one // Used to parse message IE -#define Q931_EXT_FINAL(val) ((bool)(val & 0x80)) +#define Q931_EXT_FINAL(val) ((val & 0x80) != 0) // Max values for some IEs #define Q931_MAX_BEARERCAPS_LEN 12 @@ -4310,7 +4310,7 @@ bool Q931Parser::createMessage(u_int8_t* data, u_int32_t len) // Call id length: bits 0-3 of the 2nd byte callRefLen = data[1] & 0x0f; // Initiator flag: bit 7 of the 3rd byte - 0: From initiator. 1: To initiator - initiator = !(bool)(data[2] & 0x80); + initiator = (data[2] & 0x80) == 0; // We should have at least (callRefLen + 3) bytes: // 1 for protocol discriminator, 1 for call reference length, // 1 for message type and the call reference @@ -4651,7 +4651,7 @@ ISDNQ931IE* Q931Parser::decodeChannelID(ISDNQ931IE* ie, const u_int8_t* data, s_ie_ieChannelID[4].addParam(ie,data[0]); // Channel select for PRI interface // Optional Byte 1: Interface identifier if present u_int8_t crt = 1; - bool interfaceIDExplicit = (bool)(data[0] & 0x40); + bool interfaceIDExplicit = (data[0] & 0x40) != 0; if (interfaceIDExplicit) { if (len == 1) return errorParseIE(ie,s_errorWrongData,0,0); diff --git a/modules/server/analog.cpp b/modules/server/analog.cpp index 739c68f4..6393f199 100644 --- a/modules/server/analog.cpp +++ b/modules/server/analog.cpp @@ -1289,7 +1289,7 @@ void ModuleGroup::buildGroup(ModuleGroup* group, ObjList& spanList, String& erro */ // Incoming: msg=0. Outgoing: msg is the call execute message AnalogChannel::AnalogChannel(ModuleLine* line, Message* msg) - : Channel(&plugin,0,msg), + : Channel(&plugin,0,(msg != 0)), m_line(line), m_hungup(false), m_routeOnSecondRing(false), @@ -1904,7 +1904,7 @@ bool AnalogChannel::setAudio(bool in) else Debug(this,DebugNote,"Failed to set data %s%s [%p]", in?"source":"consumer",cic?"":". Circuit is missing",this); - return (bool)res; + return res != 0; } // Set call status diff --git a/modules/server/mysqldb.cpp b/modules/server/mysqldb.cpp index ab2bf1e8..51005385 100644 --- a/modules/server/mysqldb.cpp +++ b/modules/server/mysqldb.cpp @@ -216,10 +216,10 @@ int DbConn::queryDbInternal() do { MYSQL_RES* res = mysql_store_result(m_conn); warns += mysql_warning_count(m_conn); - affected += mysql_affected_rows(m_conn); + affected += (unsigned int)mysql_affected_rows(m_conn); if (res) { unsigned int cols = mysql_num_fields(res); - unsigned int rows = mysql_num_rows(res); + unsigned int rows = (unsigned int)mysql_num_rows(res); Debug(&module,DebugAll,"Got result set %p rows=%u cols=%u",res,rows,cols); total += rows; if (m_msg) { diff --git a/modules/server/ysigchan.cpp b/modules/server/ysigchan.cpp index 2fc278e2..26b577db 100644 --- a/modules/server/ysigchan.cpp +++ b/modules/server/ysigchan.cpp @@ -995,7 +995,7 @@ bool SigDriver::msgExecute(Message& msg, String& dest) } // Create channel SigChannel* sigCh = new SigChannel(msg,msg.getValue("caller"),dest,link); - bool ok = sigCh->call(); + bool ok = sigCh->call() != 0; if (ok) { if (sigCh->connect(peer,msg.getValue("reason"))) { msg.setParam("peerid",sigCh->id()); @@ -2297,7 +2297,7 @@ bool SigIsdnCallRecord::update(SignallingEvent* event) default: ; } SignallingMessage* msg = event->message(); - bool chg = msg->params().getValue("circuit-change"); + bool chg = (msg->params().getValue("circuit-change") != 0); String format = msg->params().getValue("format"); if (format) format = "2*" + format; diff --git a/windows/_heartbeat.vcproj b/windows/_heartbeat.vcproj index da42ae7a..66d658fc 100644 --- a/windows/_heartbeat.vcproj +++ b/windows/_heartbeat.vcproj @@ -50,7 +50,7 @@ Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories=".,.." - PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL" + PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -144,7 +144,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=".,.." - PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL" + PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3"