Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed: adpcm codec could crash on 64 bit because it stored a pointer …

…in int
  • Loading branch information...
commit b65dcb8eb66852317da1e90873aaa3cb797d6089 1 parent e5fe718
bobo1on1 authored
View
32 lib/DllAdpcm.h
@@ -27,27 +27,27 @@ class DllADPCMInterface
{
public:
virtual ~DllADPCMInterface() {}
- virtual int LoadXWAV(const char* szFileName)=0;
- virtual void FreeXWAV(int)=0;
- virtual long FillBuffer(int nsf, char* buffer, int size)=0;
- virtual int GetPlaybackRate(int nsf)=0;
- virtual int GetNumberOfChannels(int info)=0;
- virtual int GetSampleSize(int info)=0;
- virtual int GetLength(int info)=0;
- virtual int Seek(int info, int pos)=0;
+ virtual void* LoadXWAV(const char* szFileName)=0;
+ virtual void FreeXWAV(void*)=0;
+ virtual long FillBuffer(void* nsf, char* buffer, int size)=0;
+ virtual int GetPlaybackRate(void* nsf)=0;
+ virtual int GetNumberOfChannels(void* info)=0;
+ virtual int GetSampleSize(void* info)=0;
+ virtual int GetLength(void* info)=0;
+ virtual int Seek(void* info, int pos)=0;
};
class DllADPCM : public DllDynamic, DllADPCMInterface
{
DECLARE_DLL_WRAPPER(DllADPCM, DLL_PATH_ADPCM_CODEC)
- DEFINE_METHOD1(int, LoadXWAV, (const char* p1))
- DEFINE_METHOD1(void, FreeXWAV, (int p1))
- DEFINE_METHOD3(long, FillBuffer, (int p1, char* p2, int p3))
- DEFINE_METHOD1(int, GetPlaybackRate, (int p1))
- DEFINE_METHOD1(int, GetNumberOfChannels, (int p1))
- DEFINE_METHOD1(int, GetSampleSize, (int p1))
- DEFINE_METHOD1(int, GetLength, (int p1))
- DEFINE_METHOD2(int, Seek, (int p1, int p2))
+ DEFINE_METHOD1(void*, LoadXWAV, (const char* p1))
+ DEFINE_METHOD1(void, FreeXWAV, (void* p1))
+ DEFINE_METHOD3(long, FillBuffer, (void* p1, char* p2, int p3))
+ DEFINE_METHOD1(int, GetPlaybackRate, (void* p1))
+ DEFINE_METHOD1(int, GetNumberOfChannels, (void* p1))
+ DEFINE_METHOD1(int, GetSampleSize, (void* p1))
+ DEFINE_METHOD1(int, GetLength, (void* p1))
+ DEFINE_METHOD2(int, Seek, (void* p1, int p2))
BEGIN_METHOD_RESOLVE()
RESOLVE_METHOD_RENAME(DLL_LoadXWAV, LoadXWAV)
View
22 lib/xbadpcm/ADPCMDll.cpp
@@ -64,14 +64,14 @@ extern "C"
}
- long __declspec(dllexport) DLL_LoadXWAV(const char* szFileName)
+ void* __declspec(dllexport) DLL_LoadXWAV(const char* szFileName)
{
ADPCMInfo* info = (ADPCMInfo*)malloc(sizeof(ADPCMInfo));
info->f = fopen(szFileName,"rb");
if (!info->f)
{
free(info);
- return 0;
+ return NULL;
}
int iResult = getwavinfo(info);
@@ -79,24 +79,24 @@ extern "C"
{
fclose(info->f);
free(info);
- return 0;
+ return NULL;
}
info->szBuf = (char*)malloc(XBOX_ADPCM_DSTSIZE*info->fmt.wChannels*4);
info->szInputBuffer = (char*)malloc(XBOX_ADPCM_SRCSIZE*info->fmt.wChannels*4);
info->szStartOfBuf = info->szBuf+XBOX_ADPCM_DSTSIZE*info->fmt.wChannels*4;
info->bufLen = XBOX_ADPCM_DSTSIZE*info->fmt.wChannels*4;
- return (long)info;
+ return (void*)info;
}
- void __declspec(dllexport) DLL_FreeXWAV(int info)
+ void __declspec(dllexport) DLL_FreeXWAV(void* info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
fclose(pInfo->f);
free(pInfo);
}
- int __declspec(dllexport) DLL_Seek(int info, int pos)
+ int __declspec(dllexport) DLL_Seek(void* info, int pos)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
int offs = pInfo->data_offset + ((((pos/ 1000) * pInfo->fmt.dwSamplesPerSec) / XBOX_ADPCM_DSTSIZE) * XBOX_ADPCM_SRCSIZE * pInfo->fmt.wChannels * (16 >> 3));
@@ -107,7 +107,7 @@ extern "C"
return pos;
}
- long __declspec(dllexport) DLL_FillBuffer(int info, char* buffer, int size)
+ long __declspec(dllexport) DLL_FillBuffer(void* info, char* buffer, int size)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
int iCurrSize = size;
@@ -138,25 +138,25 @@ extern "C"
return size-iCurrSize;
}
- int __declspec(dllexport) DLL_GetPlaybackRate(int info)
+ int __declspec(dllexport) DLL_GetPlaybackRate(void* info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->fmt.dwSamplesPerSec;
}
- int __declspec(dllexport) DLL_GetNumberOfChannels(int info)
+ int __declspec(dllexport) DLL_GetNumberOfChannels(void* info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->fmt.wChannels;
}
- int __declspec(dllexport) DLL_GetSampleSize(int info)
+ int __declspec(dllexport) DLL_GetSampleSize(void* info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->fmt.wBitsPerSample;
}
- int __declspec(dllexport) DLL_GetLength(int info)
+ int __declspec(dllexport) DLL_GetLength(void* info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->length;
View
4 xbmc/cores/paplayer/ADPCMCodec.cpp
@@ -25,7 +25,7 @@
ADPCMCodec::ADPCMCodec()
{
m_CodecName = "ADPCM";
- m_adpcm = 0;
+ m_adpcm = NULL;
m_bIsPlaying = false;
}
@@ -62,7 +62,7 @@ void ADPCMCodec::DeInit()
if (m_adpcm)
m_dll.FreeXWAV(m_adpcm);
- m_adpcm = 0;
+ m_adpcm = NULL;
m_bIsPlaying = false;
}
View
2  xbmc/cores/paplayer/ADPCMCodec.h
@@ -37,7 +37,7 @@ class ADPCMCodec : public ICodec
virtual bool CanInit();
private:
- int m_adpcm;
+ void* m_adpcm;
bool m_bIsPlaying;
DllADPCM m_dll;
Please sign in to comment.
Something went wrong with that request. Please try again.