From: <man...@us...> - 2013-09-05 14:32:34
|
Revision: 2635 http://sourceforge.net/p/modplug/code/2635 Author: manxorist Date: 2013-09-05 14:32:28 +0000 (Thu, 05 Sep 2013) Log Message: ----------- [Fix] Fix unix compile. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-05 14:21:11 UTC (rev 2634) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-05 14:32:28 UTC (rev 2635) @@ -190,12 +190,13 @@ #else iconv_t conv = iconv_t(); conv = iconv_open( "UTF-8", charset.c_str() ); - std::vector<char> utf8_string( ( encoded.length() + 1 ) * 8 ); // large enough - const char * inbuf = encoded.c_str(); - size_t inbytesleft = encoded.length() + 1; + std::vector<char> encoded_string( encoded.c_str(), encoded.c_str() + encoded.length() + 1 ); + std::vector<char> utf8_string( encoded_string.size() * 8 ); // large enough + char * inbuf = &encoded_string[0]; + size_t inbytesleft = encoded_string.size(); char * outbuf = &utf8_string[0]; size_t outbytesleft = utf8_string.size(); - if ( iconv( conv, encoded.c_str(), &inbuf, &inbytesleft, &outbuf, &outbytesleft ) < 0 ) { + if ( iconv( conv, &inbuf, &inbytesleft, &outbuf, &outbytesleft ) == (size_t)-1 ) { iconv_close( conv ); conv = iconv_t(); return std::string(); @@ -203,6 +204,7 @@ std::string result = &utf8_string[0]; iconv_close( conv ); conv = iconv_t(); + return result; #endif } void module_impl::apply_mixer_settings( std::int32_t samplerate, int channels ) { Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp 2013-09-05 14:21:11 UTC (rev 2634) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp 2013-09-05 14:32:28 UTC (rev 2635) @@ -49,7 +49,7 @@ return; } public: - virtual void write( const std::string & text ) { + virtual void write( const std::string & /* text */ ) { return; } }; @@ -76,6 +76,8 @@ } }; +#if defined(_MSC_VER) + class textout_console : public textout { private: HANDLE handle; @@ -94,6 +96,8 @@ } }; +#endif // _MSC_VER + static inline float mpt_round( float val ) { if ( val >= 0.0f ) { return std::floor( val + 0.5f ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |