Use memcmp instead of that wxString hack
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -169,7 +169,6 @@ typedef struct
|
|||||||
|
|
||||||
int wxWave::OpenDSP(void)
|
int wxWave::OpenDSP(void)
|
||||||
{
|
{
|
||||||
wxString str;
|
|
||||||
WAVEFORMAT waveformat;
|
WAVEFORMAT waveformat;
|
||||||
int dev=-1;
|
int dev=-1;
|
||||||
unsigned long ul;
|
unsigned long ul;
|
||||||
@@ -179,14 +178,14 @@ int wxWave::OpenDSP(void)
|
|||||||
|
|
||||||
memcpy(&waveformat,&m_waveData[FMT_INDEX+4],sizeof(WAVEFORMAT));
|
memcpy(&waveformat,&m_waveData[FMT_INDEX+4],sizeof(WAVEFORMAT));
|
||||||
|
|
||||||
str= wxString(m_waveData,4);
|
if (memcmp(m_waveData, "RIFF", 4) != 0)
|
||||||
if (str != "RIFF") return -1;
|
return -1;
|
||||||
str= wxString(&m_waveData[WAVE_INDEX],4);
|
if (memcmp(&m_waveData[WAVE_INDEX], "WAVE", 4) != 0)
|
||||||
if (str != "WAVE") return -1;
|
return -1;
|
||||||
str= wxString(&m_waveData[FMT_INDEX],4);
|
if (memcmp(&m_waveData[FMT_INDEX], "fmt ", 4) != 0)
|
||||||
if (str != "fmt ") return -1;
|
return -1;
|
||||||
str= wxString(&m_waveData[FMT_INDEX+waveformat.uiSize+8],4);
|
if (memcmp(&m_waveData[FMT_INDEX+waveformat.uiSize+8], "data", 4) != 0)
|
||||||
if(str != "data") return -1;
|
return -1;
|
||||||
memcpy(&ul,&m_waveData[FMT_INDEX+waveformat.uiSize+12],4);
|
memcpy(&ul,&m_waveData[FMT_INDEX+waveformat.uiSize+12],4);
|
||||||
m_sizeData=ul;
|
m_sizeData=ul;
|
||||||
if ((int)(m_sizeData+FMT_INDEX+waveformat.uiSize+16) != m_waveLength)
|
if ((int)(m_sizeData+FMT_INDEX+waveformat.uiSize+16) != m_waveLength)
|
||||||
|
@@ -169,7 +169,6 @@ typedef struct
|
|||||||
|
|
||||||
int wxWave::OpenDSP(void)
|
int wxWave::OpenDSP(void)
|
||||||
{
|
{
|
||||||
wxString str;
|
|
||||||
WAVEFORMAT waveformat;
|
WAVEFORMAT waveformat;
|
||||||
int dev=-1;
|
int dev=-1;
|
||||||
unsigned long ul;
|
unsigned long ul;
|
||||||
@@ -179,14 +178,14 @@ int wxWave::OpenDSP(void)
|
|||||||
|
|
||||||
memcpy(&waveformat,&m_waveData[FMT_INDEX+4],sizeof(WAVEFORMAT));
|
memcpy(&waveformat,&m_waveData[FMT_INDEX+4],sizeof(WAVEFORMAT));
|
||||||
|
|
||||||
str= wxString(m_waveData,4);
|
if (memcmp(m_waveData, "RIFF", 4) != 0)
|
||||||
if (str != "RIFF") return -1;
|
return -1;
|
||||||
str= wxString(&m_waveData[WAVE_INDEX],4);
|
if (memcmp(&m_waveData[WAVE_INDEX], "WAVE", 4) != 0)
|
||||||
if (str != "WAVE") return -1;
|
return -1;
|
||||||
str= wxString(&m_waveData[FMT_INDEX],4);
|
if (memcmp(&m_waveData[FMT_INDEX], "fmt ", 4) != 0)
|
||||||
if (str != "fmt ") return -1;
|
return -1;
|
||||||
str= wxString(&m_waveData[FMT_INDEX+waveformat.uiSize+8],4);
|
if (memcmp(&m_waveData[FMT_INDEX+waveformat.uiSize+8], "data", 4) != 0)
|
||||||
if(str != "data") return -1;
|
return -1;
|
||||||
memcpy(&ul,&m_waveData[FMT_INDEX+waveformat.uiSize+12],4);
|
memcpy(&ul,&m_waveData[FMT_INDEX+waveformat.uiSize+12],4);
|
||||||
m_sizeData=ul;
|
m_sizeData=ul;
|
||||||
if ((int)(m_sizeData+FMT_INDEX+waveformat.uiSize+16) != m_waveLength)
|
if ((int)(m_sizeData+FMT_INDEX+waveformat.uiSize+16) != m_waveLength)
|
||||||
|
Reference in New Issue
Block a user