X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fbe65e96de24d94a071a351899048a6010b8a4c..cdc059191b6e36808967b8b1efecc8f5a6cd769e:/src/unix/sound.cpp diff --git a/src/unix/sound.cpp b/src/unix/sound.cpp index 8ef528b489..fbd9802383 100644 --- a/src/unix/sound.cpp +++ b/src/unix/sound.cpp @@ -9,11 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "sound.h" -#pragma implementation "soundbase.h" -#endif - // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -452,7 +447,8 @@ wxSound::~wxSound() Free(); } -bool wxSound::Create(const wxString& fileName, bool isResource) +bool wxSound::Create(const wxString& fileName, + bool WXUNUSED_UNLESS_DEBUG(isResource)) { wxASSERT_MSG( !isResource, _T("Loading sound from resources is only supported on Windows") ); @@ -465,9 +461,13 @@ bool wxSound::Create(const wxString& fileName, bool isResource) return false; } - wxFileOffset len = fileWave.Length(); + wxFileOffset lenOrig = fileWave.Length(); + if ( lenOrig == wxInvalidOffset ) + return false; + + size_t len = wx_truncate_cast(size_t, lenOrig); wxUint8 *data = new wxUint8[len]; - if (fileWave.Read(data, len) != len) + if ( fileWave.Read(data, len) != lenOrig ) { wxLogError(_("Couldn't load sound data from '%s'."), fileName.c_str()); return false;