AudioLib: malloc + memset to zero --> calloc

DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5162 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-04-24 00:09:19 +00:00
parent ce55b4a6fb
commit 940bef522d
4 changed files with 4 additions and 8 deletions

View file

@ -185,8 +185,7 @@ int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *sampleb
// dummy channel 2 runs our fillData() callback as an effect // dummy channel 2 runs our fillData() callback as an effect
Mix_RegisterEffect(2, fillData, NULL, NULL); Mix_RegisterEffect(2, fillData, NULL, NULL);
DummyBuffer = (uint8_t *) malloc(chunksize); DummyBuffer = (uint8_t *) calloc(1, chunksize);
memset(DummyBuffer, 0, chunksize);
DummyChunk = Mix_QuickLoad_RAW(DummyBuffer, chunksize); DummyChunk = Mix_QuickLoad_RAW(DummyBuffer, chunksize);

View file

@ -450,13 +450,12 @@ int32_t MV_PlayFLAC
return MV_Error; return MV_Error;
} }
fd = (flac_data *) malloc( sizeof(flac_data) ); fd = (flac_data *) calloc( 1, sizeof(flac_data) );
if (!fd) { if (!fd) {
MV_SetErrorCode( MV_InvalidFLACFile ); MV_SetErrorCode( MV_InvalidFLACFile );
return MV_Error; return MV_Error;
} }
memset(fd, 0, sizeof(flac_data));
fd->ptr = ptr; fd->ptr = ptr;
fd->pos = 0; fd->pos = 0;
fd->blocksize = 0; fd->blocksize = 0;

View file

@ -406,13 +406,12 @@ int32_t MV_PlayVorbis
return MV_Error; return MV_Error;
} }
vd = (vorbis_data *) malloc( sizeof(vorbis_data) ); vd = (vorbis_data *) calloc( 1, sizeof(vorbis_data) );
if (!vd) { if (!vd) {
MV_SetErrorCode( MV_InvalidVorbisFile ); MV_SetErrorCode( MV_InvalidVorbisFile );
return MV_Error; return MV_Error;
} }
memset(vd, 0, sizeof(vorbis_data));
vd->ptr = ptr; vd->ptr = ptr;
vd->pos = 0; vd->pos = 0;
vd->length = ptrlength; vd->length = ptrlength;

View file

@ -458,13 +458,12 @@ int32_t MV_PlayXA
return MV_Error; return MV_Error;
} }
xad = (xa_data *) malloc( sizeof(xa_data) ); xad = (xa_data *) calloc( 1, sizeof(xa_data) );
if (!xad) { if (!xad) {
MV_SetErrorCode( MV_InvalidXAFile ); MV_SetErrorCode( MV_InvalidXAFile );
return MV_Error; return MV_Error;
} }
memset(xad, 0, sizeof(xa_data));
xad->ptr = ptr; xad->ptr = ptr;
xad->pos = XA_DATA_START; xad->pos = XA_DATA_START;
xad->blocksize = 0; xad->blocksize = 0;