From: <man...@us...> - 2013-05-11 19:24:45
|
Revision: 2023 http://sourceforge.net/p/modplug/code/2023 Author: manxorist Date: 2013-05-11 19:24:39 +0000 (Sat, 11 May 2013) Log Message: ----------- Merged revision(s) 2022 from branches/manx/gcc-fixes: [Var] Portability and correctness fixes for libopenmpt and openmpt123. ........ Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt.hpp trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp trunk/OpenMPT/libopenmpt/libopenmpt_interactive.cpp trunk/OpenMPT/libopenmpt/libopenmpt_stream_callbacks.h trunk/OpenMPT/openmpt123/openmpt123.cpp Property Changed: ---------------- trunk/OpenMPT/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT 2013-05-11 19:24:39 UTC (rev 2023) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -1,4 +1,5 ## /branches/manx/build-speedup:1586-1589 +/branches/manx/gcc-fixes:2022 /branches/manx/header-dependencies-cleanups:1394-1397,1401-1402,1405-1406 /branches/manx/nonglobal-mixer:1715-1841 /branches/manx/profiler:1813 \ No newline at end of property Modified: trunk/OpenMPT/libopenmpt/libopenmpt.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.hpp 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/libopenmpt/libopenmpt.hpp 2013-05-11 19:24:39 UTC (rev 2023) @@ -25,7 +25,12 @@ class LIBOPENMPT_CXX_API exception : public std::exception { public: - exception( const char * text ); + exception( const char * text ) throw(); + virtual ~exception() throw(); +public: + virtual const char * what() const throw(); +private: + const char * const text; }; // class exception LIBOPENMPT_CXX_API std::uint32_t get_library_version(); @@ -69,7 +74,7 @@ class LIBOPENMPT_CXX_API module { - friend interactive_module; + friend class interactive_module; public: Modified: trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp 2013-05-11 19:24:39 UTC (rev 2023) @@ -15,6 +15,8 @@ #include "libopenmpt_impl.hpp" +#include <stdexcept> + #include <cmath> #include <cstdlib> #include <cstring> @@ -331,12 +333,12 @@ return 0; } -void openmpt_log_func_default( const char * message, void * user ) { +void openmpt_log_func_default( const char * message, void * /*user*/ ) { fprintf( stderr, "%s\n", message ); fflush( stderr ); } -void openmpt_log_func_silent( const char * message, void * user ) { +void openmpt_log_func_silent( const char * /*message*/, void * /*user*/ ) { return; } @@ -434,7 +436,7 @@ double openmpt_module_seek_seconds( openmpt_module * mod, double seconds ) { try { OPENMPT_INTERFACE_CHECK_SOUNDFILE( mod ); - return mod->impl->get_current_position_seconds(); + return mod->impl->seek_seconds( seconds ); } OPENMPT_INTERFACE_CATCH_TO_LOG; return 0; } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp 2013-05-11 19:24:39 UTC (rev 2023) @@ -15,15 +15,24 @@ #include "libopenmpt_impl.hpp" #include <algorithm> +#include <stdexcept> //#ifndef NO_LIBOPENMPT_CXX namespace openmpt { -exception::exception( const char * text ) : std::exception( text ) { +exception::exception( const char * text_ ) throw() : text(text_) { return; } +exception::~exception() throw() { + return; +} + +const char * exception::what() const throw() { + return text; +} + std::uint32_t get_library_version() { return openmpt::version::get_library_version(); } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp 2013-05-11 19:24:39 UTC (rev 2023) @@ -125,8 +125,8 @@ } void apply_mixer_settings( std::int32_t samplerate, int channels, SampleFormat format ) { if ( - m_sndFile.m_MixerSettings.gdwMixingFreq != samplerate || - m_sndFile.m_MixerSettings.gnChannels != channels || + static_cast<std::int32_t>( m_sndFile.m_MixerSettings.gdwMixingFreq ) != samplerate || + static_cast<int>( m_sndFile.m_MixerSettings.gnChannels ) != channels || m_sndFile.m_MixerSettings.m_SampleFormat != format ) { MixerSettings mixersettings = m_sndFile.m_MixerSettings; @@ -249,6 +249,7 @@ case SRCMODE_LINEAR: return module::INTERPOLATION_LINEAR; break; case SRCMODE_SPLINE: return module::INTERPOLATION_SPLINE; break; case SRCMODE_POLYPHASE: return module::INTERPOLATION_POLYPHASE; break; + case SRCMODE_DEFAULT: case SRCMODE_FIRFILTER: { switch ( m_sndFile.m_Resampler.m_Settings.gbWFIRType ) { case WFIR_HANN: return module::INTERPOLATION_FIR_HANN; break; @@ -261,6 +262,9 @@ case WFIR_KAISER4T: return module::INTERPOLATION_FIR_KAISER4T; break; } } break; + case NUM_SRC_MODES: + default: + break; } throw exception("unknown interpolation mode set internally"); } break; @@ -278,7 +282,7 @@ switch ( command ) { case module::RENDER_MASTERGAIN_DB: { float gainFactor = static_cast<float>( std::pow( 10.0f, value * 0.1f * 0.5f ) ); - if ( m_sndFile.m_MixerSettings.m_FinalOutputGain != float_to_fx16( gainFactor ) ) { + if ( static_cast<std::int32_t>( m_sndFile.m_MixerSettings.m_FinalOutputGain ) != float_to_fx16( gainFactor ) ) { MixerSettings settings = m_sndFile.m_MixerSettings; settings.m_FinalOutputGain = float_to_fx16( gainFactor ); m_sndFile.SetMixerSettings( settings ); @@ -286,7 +290,7 @@ } break; case module::RENDER_STEREOSEPARATION_PERCENT: { std::int32_t newvalue = value * 128 / 100; - if ( newvalue != m_sndFile.m_MixerSettings.m_nStereoSeparation ) { + if ( newvalue != static_cast<std::int32_t>( m_sndFile.m_MixerSettings.m_nStereoSeparation ) ) { MixerSettings settings = m_sndFile.m_MixerSettings; settings.gdwMixingFreq = newvalue; m_sndFile.SetMixerSettings( settings ); @@ -299,7 +303,7 @@ set_quality( value ); } break; case module::RENDER_MAXMIXCHANNELS: { - if ( value != m_sndFile.m_MixerSettings.m_nMaxMixChannels ) { + if ( value != static_cast<std::int32_t>( m_sndFile.m_MixerSettings.m_nMaxMixChannels ) ) { MixerSettings settings = m_sndFile.m_MixerSettings; settings.m_nMaxMixChannels = value; m_sndFile.SetMixerSettings( settings ); Modified: trunk/OpenMPT/libopenmpt/libopenmpt_interactive.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_interactive.cpp 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/libopenmpt/libopenmpt_interactive.cpp 2013-05-11 19:24:39 UTC (rev 2023) @@ -5,6 +5,8 @@ #include "libopenmpt_interactive.hpp" #include "libopenmpt_impl.hpp" +#include <stdexcept> + namespace openmpt { class interactive_module_impl : public module_impl { Modified: trunk/OpenMPT/libopenmpt/libopenmpt_stream_callbacks.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_stream_callbacks.h 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/libopenmpt/libopenmpt_stream_callbacks.h 2013-05-11 19:24:39 UTC (rev 2023) @@ -12,10 +12,15 @@ #include "libopenmpt.h" +#ifdef _MSC_VER #include <io.h> +#endif #include <stdint.h> #include <stdio.h> #include <string.h> +#ifndef _MSC_VER +#include <unistd.h> +#endif #ifdef __cplusplus extern "C" { Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-05-11 19:22:37 UTC (rev 2022) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-05-11 19:24:39 UTC (rev 2023) @@ -20,6 +20,7 @@ #include <vector> #include <cstdint> +#include <cstring> #if defined(_MSC_VER) #include <fcntl.h> @@ -33,25 +34,25 @@ #include <portaudio.h> -struct show_help_exception : public std::exception { +struct show_help_exception { std::string message; show_help_exception( const std::string & msg = "" ) : message(msg) { } }; -struct openmpt123_exception : public std::exception { - openmpt123_exception( const char * text ) : std::exception( text ) { } +struct openmpt123_exception : public openmpt::exception { + openmpt123_exception( const char * text ) throw() : openmpt::exception( text ) { } }; struct silent_exit_exception : public std::exception { - silent_exit_exception() { } + silent_exit_exception() throw() { } }; struct show_version_number_exception : public std::exception { - show_version_number_exception() { } + show_version_number_exception() throw() { } }; -struct portaudio_exception : public std::exception { - portaudio_exception( PaError code ) : std::exception( Pa_GetErrorText( code ) ) { } +struct portaudio_exception : public openmpt::exception { + portaudio_exception( PaError code ) throw() : openmpt::exception( Pa_GetErrorText( code ) ) { } }; struct openmpt123_flags { @@ -196,7 +197,7 @@ if ( verbose ) { portaudio_log_stream = &log; } else { - portaudio_log_stream = nullptr; + portaudio_log_stream = 0; } PaUtil_SetDebugPrintFunction( portaudio_log_function ); log_set = true; @@ -213,13 +214,13 @@ } if ( log_set ) { PaUtil_SetDebugPrintFunction( NULL ); - portaudio_log_stream = nullptr; + portaudio_log_stream = 0; log_set = false; } } }; -std::ostream * portaudio_raii::portaudio_log_stream = nullptr; +std::ostream * portaudio_raii::portaudio_log_stream = 0; class write_buffers_interface { public: @@ -454,8 +455,6 @@ bool use_stdin = ( filename == "-" ); if ( !use_stdin ) { file_stream.open( filename, std::ios::binary ); - } else { - stdin_stream.setf( std::ios::binary ); } std::istream & data_stream = use_stdin ? stdin_stream : file_stream; if ( data_stream.fail() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |