Change wxSound ctor from in-memory data to use size_t/void *.
This constructor previously used int and, especially annoyingly, wxByte* for the data. Use standard void* for untyped binary data instead. Also document this ctor as it seems to be implemented in all ports. Closes #13451. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69178 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -435,7 +435,7 @@ wxSound::wxSound(const wxString& sFileName, bool isResource) : m_data(NULL)
|
||||
Create(sFileName, isResource);
|
||||
}
|
||||
|
||||
wxSound::wxSound(int size, const wxByte* data) : m_data(NULL)
|
||||
wxSound::wxSound(size_t size, const void* data) : m_data(NULL)
|
||||
{
|
||||
Create(size, data);
|
||||
}
|
||||
@@ -483,7 +483,7 @@ bool wxSound::Create(const wxString& fileName,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxSound::Create(int size, const wxByte* data)
|
||||
bool wxSound::Create(size_t size, const void* data)
|
||||
{
|
||||
wxASSERT( data != NULL );
|
||||
|
||||
@@ -623,7 +623,7 @@ typedef struct
|
||||
#define WAVE_INDEX 8
|
||||
#define FMT_INDEX 12
|
||||
|
||||
bool wxSound::LoadWAV(const wxUint8 *data, size_t length, bool copyData)
|
||||
bool wxSound::LoadWAV(const void* data_, size_t length, bool copyData)
|
||||
{
|
||||
// the simplest wave file header consists of 44 bytes:
|
||||
//
|
||||
@@ -648,6 +648,8 @@ bool wxSound::LoadWAV(const wxUint8 *data, size_t length, bool copyData)
|
||||
if ( length < 44 )
|
||||
return false;
|
||||
|
||||
const wxUint8* data = static_cast<const wxUint8*>(data_);
|
||||
|
||||
WAVEFORMAT waveformat;
|
||||
memcpy(&waveformat, &data[FMT_INDEX + 4], sizeof(WAVEFORMAT));
|
||||
waveformat.uiSize = wxUINT32_SWAP_ON_BE(waveformat.uiSize);
|
||||
|
Reference in New Issue
Block a user