From: <man...@us...> - 2015-06-13 12:23:24
|
Revision: 5298 http://sourceforge.net/p/modplug/code/5298 Author: manxorist Date: 2015-06-13 12:23:20 +0000 (Sat, 13 Jun 2015) Log Message: ----------- [Ref] Another round of tiny MSVC W4 cleanups. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/common/StringFixer.h trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/soundlib/Dither.cpp Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2015-06-13 11:59:24 UTC (rev 5297) +++ trunk/OpenMPT/common/BuildSettings.h 2015-06-13 12:23:20 UTC (rev 5298) @@ -500,9 +500,6 @@ #if MPT_COMPILER_MSVC -// happens for if expression that only depend on template parameters -#pragma warning(disable:4127) // conditional expression is constant - // happens for immutable classes (i.e. classes containing const members) #pragma warning(disable:4512) // assignment operator could not be generated Modified: trunk/OpenMPT/common/StringFixer.h =================================================================== --- trunk/OpenMPT/common/StringFixer.h 2015-06-13 11:59:24 UTC (rev 5297) +++ trunk/OpenMPT/common/StringFixer.h 2015-06-13 12:23:20 UTC (rev 5298) @@ -20,6 +20,13 @@ namespace mpt { namespace String { + +#if MPT_COMPILER_MSVC +#pragma warning(push) +#pragma warning(disable:4127) // conditional expression is constant +#endif // MPT_COMPILER_MSVC + + // Sets last character to null in given char array. // Size of the array must be known at compile time. template <size_t size> @@ -383,6 +390,11 @@ } +#if MPT_COMPILER_MSVC +#pragma warning(pop) +#endif // MPT_COMPILER_MSVC + + } } // namespace mpt::String OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2015-06-13 11:59:24 UTC (rev 5297) +++ trunk/OpenMPT/common/mptString.cpp 2015-06-13 12:23:20 UTC (rev 5298) @@ -791,7 +791,7 @@ charsleft--; if ( charsleft == 0 ) { - if ( sizeof( wchar_t ) == 2 ) { + MPT_CONSTANT_IF ( sizeof( wchar_t ) == 2 ) { if ( ucs4 > 0x1fffff ) { out.push_back( replacement ); ucs4 = 0; @@ -842,7 +842,7 @@ } uint32 ucs4 = 0; - if ( sizeof( wchar_t ) == 2 ) { + MPT_CONSTANT_IF ( sizeof( wchar_t ) == 2 ) { if ( i + 1 < in.length() ) { // check for surrogate pair uint16 hi_sur = in[i+0]; Modified: trunk/OpenMPT/soundlib/Dither.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dither.cpp 2015-06-13 11:59:24 UTC (rev 5297) +++ trunk/OpenMPT/soundlib/Dither.cpp 2015-06-13 12:23:20 UTC (rev 5298) @@ -171,7 +171,7 @@ STATIC_ASSERT(sizeof(int) == 4); STATIC_ASSERT(FASTRAND_BITS * 3 >= (32-targetbits) - MIXING_ATTENUATION); const int rshift = (32-targetbits) - MIXING_ATTENUATION; - if(rshift <= 0) + MPT_CONSTANT_IF(rshift <= 0) { // nothing to dither return; @@ -186,7 +186,7 @@ for(std::size_t channel = 0; channel < channels; ++channel) { int noise = 0; - if(triangular) + MPT_CONSTANT_IF(triangular) { noise = (fastrandbits(s.rng, noise_bits) + fastrandbits(s.rng, noise_bits)) >> 1; } else @@ -195,7 +195,7 @@ } noise -= noise_bias; // un-bias int val = *mixbuffer; - if(shaped) + MPT_CONSTANT_IF(shaped) { val += (s.error[channel] >> 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |