From: <man...@us...> - 2014-10-26 10:39:22
|
Revision: 4500 http://sourceforge.net/p/modplug/code/4500 Author: manxorist Date: 2014-10-26 10:39:06 +0000 (Sun, 26 Oct 2014) Log Message: ----------- [Ref] SIZE_MAX is only guaranteed in C++11. Replace it with std::numeric_limits<std::size_t>::max(). Modified Paths: -------------- trunk/OpenMPT/common/StringFixer.h trunk/OpenMPT/common/mptString.h trunk/OpenMPT/soundlib/FileReader.h trunk/OpenMPT/soundlib/SampleFormats.cpp Modified: trunk/OpenMPT/common/StringFixer.h =================================================================== --- trunk/OpenMPT/common/StringFixer.h 2014-10-25 19:29:55 UTC (rev 4499) +++ trunk/OpenMPT/common/StringFixer.h 2014-10-26 10:39:06 UTC (rev 4500) @@ -368,8 +368,8 @@ // Copy from a char array to a fixed size char array. template <size_t destSize> - void CopyN(char (&destBuffer)[destSize], const char *srcBuffer, const size_t srcSize = SIZE_MAX) - //---------------------------------------------------------------------------------------------- + void CopyN(char (&destBuffer)[destSize], const char *srcBuffer, const size_t srcSize = std::numeric_limits<size_t>::max()) + //------------------------------------------------------------------------------------------------------------------------ { const size_t copySize = std::min(destSize - 1u, srcSize); std::strncpy(destBuffer, srcBuffer, copySize); @@ -377,8 +377,8 @@ } // Copy at most srcSize characters from srcBuffer to a std::string. - static inline void CopyN(std::string &dest, const char *srcBuffer, const size_t srcSize = SIZE_MAX) - //------------------------------------------------------------------------------------------------- + static inline void CopyN(std::string &dest, const char *srcBuffer, const size_t srcSize = std::numeric_limits<size_t>::max()) + //--------------------------------------------------------------------------------------------------------------------------- { dest.assign(srcBuffer, srcBuffer + mpt::strnlen(srcBuffer, srcSize)); } Modified: trunk/OpenMPT/common/mptString.h =================================================================== --- trunk/OpenMPT/common/mptString.h 2014-10-25 19:29:55 UTC (rev 4499) +++ trunk/OpenMPT/common/mptString.h 2014-10-26 10:39:06 UTC (rev 4500) @@ -111,7 +111,7 @@ #if MPT_COMPILER_MSVC return ::strnlen(str, n); #else - if(n >= SIZE_MAX) + if(n >= std::numeric_limits<std::size_t>::max()) { return std::strlen(str); } Modified: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h 2014-10-25 19:29:55 UTC (rev 4499) +++ trunk/OpenMPT/soundlib/FileReader.h 2014-10-26 10:39:06 UTC (rev 4500) @@ -604,7 +604,7 @@ } // Read a null-terminated string into a std::string - bool ReadNullString(std::string &dest, const off_t maxLength = SIZE_MAX) + bool ReadNullString(std::string &dest, const off_t maxLength = std::numeric_limits<std::size_t>::max()) { dest.clear(); char c; Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-10-25 19:29:55 UTC (rev 4499) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-10-26 10:39:06 UTC (rev 4500) @@ -1760,7 +1760,7 @@ size_t GetLength() const { if(length == 0) // Broken files - return SIZE_MAX; + return std::numeric_limits<size_t>::max(); return SwapBytesReturnBE(length); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |