[Opalvoip-svn] SF.net SVN: opalvoip:[34823] ptlib/trunk
Brought to you by:
csoutheren,
rjongbloed
From: <cso...@us...> - 2016-05-11 07:03:01
|
Revision: 34823 http://sourceforge.net/p/opalvoip/code/34823 Author: csoutheren Date: 2016-05-11 07:02:59 +0000 (Wed, 11 May 2016) Log Message: ----------- Fix compilation warnings on Ubuntu g++ 4.8.4 and Apple LLVM version 7.3.0 Modified Paths: -------------- ptlib/trunk/include/ptlib/object.h ptlib/trunk/src/ptclib/pstun.cxx ptlib/trunk/src/ptclib/xmpp.cxx ptlib/trunk/src/ptlib/unix/svcproc.cxx Modified: ptlib/trunk/include/ptlib/object.h =================================================================== --- ptlib/trunk/include/ptlib/object.h 2016-05-10 09:55:15 UTC (rev 34822) +++ ptlib/trunk/include/ptlib/object.h 2016-05-11 07:02:59 UTC (rev 34823) @@ -125,6 +125,11 @@ #endif // _MSC_VER #define P_DISABLE_MSVC_WARNINGS(warnings, statement) P_PUSH_MSVC_WARNINGS(warnings) statement P_POP_MSVC_WARNINGS() +#ifdef _MSC_VER + #define PIGNORE_RETURN(t,e) (void)(e) +#else + #define PIGNORE_RETURN(t,e) do { t unused __attribute__((unused)) = (e); } while(0) +#endif // We are gradually converting over to standard C++ names, these // are for backward compatibility only Modified: ptlib/trunk/src/ptclib/pstun.cxx =================================================================== --- ptlib/trunk/src/ptclib/pstun.cxx 2016-05-10 09:55:15 UTC (rev 34822) +++ ptlib/trunk/src/ptclib/pstun.cxx 2016-05-11 07:02:59 UTC (rev 34823) @@ -463,7 +463,9 @@ if (GetSize() < (PINDEX)sizeof(PSTUNMessageHeader)) return false; - return *(PUInt32b *)&((*this)->transactionId) == RFC5389_MAGIC_COOKIE; + const BYTE * ptr = (*this)->transactionId; + + return *((const PUInt32b *)ptr) == RFC5389_MAGIC_COOKIE; } @@ -539,7 +541,8 @@ return false; // do checks for RFC5389: magic cookie and top two bits of type must be 00 - if (*(PUInt32b *)&(header->transactionId) == RFC5389_MAGIC_COOKIE && ((header->msgType & 0x00c0) != 0x00)) { + const BYTE * ptr = header->transactionId; + if (*(PUInt32b *)ptr == RFC5389_MAGIC_COOKIE && ((header->msgType & 0x00c0) != 0x00)) { PTRACE(3, "STUN\tPacket received with magic cookie, but type bits are incorrect."); return false; } Modified: ptlib/trunk/src/ptclib/xmpp.cxx =================================================================== --- ptlib/trunk/src/ptclib/xmpp.cxx 2016-05-10 09:55:15 UTC (rev 34822) +++ ptlib/trunk/src/ptclib/xmpp.cxx 2016-05-11 07:02:59 UTC (rev 34823) @@ -453,7 +453,7 @@ PXMLElement * XMPP::Stanza::GetElement(const PString& name, PINDEX i) { - return GetElement(name, i); + return PXML::GetElement(name, i); } Modified: ptlib/trunk/src/ptlib/unix/svcproc.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/svcproc.cxx 2016-05-10 09:55:15 UTC (rev 34822) +++ ptlib/trunk/src/ptlib/unix/svcproc.cxx 2016-05-11 07:02:59 UTC (rev 34823) @@ -405,9 +405,9 @@ if (args.HasOption('H')) { int uid = geteuid(); - (void)seteuid(getuid()); // Switch back to starting uid for next call + PIGNORE_RETURN(int,seteuid(getuid())); // Switch back to starting uid for next call SetMaxHandles(args.GetOptionString('H').AsInteger()); - (void)seteuid(uid); + PIGNORE_RETURN(int,seteuid(uid)); } #ifdef P_LINUX @@ -418,7 +418,7 @@ cout << "Could not get current core file size : error = " << errno << endl; else { int uid = geteuid(); - (void)seteuid(getuid()); // Switch back to starting uid for next call + PIGNORE_RETURN(int,seteuid(getuid())); // Switch back to starting uid for next call int v = args.GetOptionString('C').AsInteger(); rlim.rlim_cur = v; if (setrlimit(RLIMIT_CORE, &rlim) != 0) @@ -427,7 +427,7 @@ getrlimit(RLIMIT_CORE, &rlim); cout << "Core file size set to " << rlim.rlim_cur << "/" << rlim.rlim_max << endl; } - (void)seteuid(uid); + PIGNORE_RETURN(int,seteuid(uid)); } } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |