comparison decoders/timidity/instrum_dls.c @ 459:4d2febf33dc7

Changed some SDL_Error()s to __Sound_SetError() to fix linking issues.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 10 Oct 2003 08:00:42 +0000
parents 69c8ba97f4bd
children d02c00ce16d9
comparison
equal deleted inserted replaced
458:69c8ba97f4bd 459:4d2febf33dc7
64 64
65 static RIFF_Chunk *AllocRIFFChunk() 65 static RIFF_Chunk *AllocRIFFChunk()
66 { 66 {
67 RIFF_Chunk *chunk = (RIFF_Chunk *)malloc(sizeof(*chunk)); 67 RIFF_Chunk *chunk = (RIFF_Chunk *)malloc(sizeof(*chunk));
68 if ( !chunk ) { 68 if ( !chunk ) {
69 SDL_Error(SDL_ENOMEM); 69 __Sound_SetError(ERR_OUT_OF_MEMORY);
70 return NULL; 70 return NULL;
71 } 71 }
72 memset(chunk, 0, sizeof(*chunk)); 72 memset(chunk, 0, sizeof(*chunk));
73 return chunk; 73 return chunk;
74 } 74 }
177 177
178 /* Make sure the file is in RIFF format */ 178 /* Make sure the file is in RIFF format */
179 chunk->magic = SDL_ReadLE32(src); 179 chunk->magic = SDL_ReadLE32(src);
180 chunk->length = SDL_ReadLE32(src); 180 chunk->length = SDL_ReadLE32(src);
181 if ( chunk->magic != RIFF ) { 181 if ( chunk->magic != RIFF ) {
182 SDL_SetError("Not a RIFF file"); 182 __Sound_SetError("Not a RIFF file");
183 FreeRIFFChunk(chunk); 183 FreeRIFFChunk(chunk);
184 return NULL; 184 return NULL;
185 } 185 }
186 chunk->data = (Uint8 *)malloc(chunk->length); 186 chunk->data = (Uint8 *)malloc(chunk->length);
187 if ( chunk->data == NULL ) { 187 if ( chunk->data == NULL ) {
188 SDL_Error(SDL_ENOMEM); 188 __Sound_SetError(ERR_OUT_OF_MEMORY);
189 FreeRIFFChunk(chunk); 189 FreeRIFFChunk(chunk);
190 return NULL; 190 return NULL;
191 } 191 }
192 if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) { 192 if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) {
193 SDL_Error(SDL_EFREAD); 193 __Sound_SetError(ERR_IO_ERROR);
194 FreeRIFF(chunk); 194 FreeRIFF(chunk);
195 return NULL; 195 return NULL;
196 } 196 }
197 subchunkData = chunk->data; 197 subchunkData = chunk->data;
198 subchunkDataLen = chunk->length; 198 subchunkDataLen = chunk->length;
736 DLS_Data *LoadDLS(SDL_RWops *src) 736 DLS_Data *LoadDLS(SDL_RWops *src)
737 { 737 {
738 RIFF_Chunk *chunk; 738 RIFF_Chunk *chunk;
739 DLS_Data *data = (DLS_Data *)malloc(sizeof(*data)); 739 DLS_Data *data = (DLS_Data *)malloc(sizeof(*data));
740 if ( !data ) { 740 if ( !data ) {
741 SDL_Error(SDL_ENOMEM); 741 __Sound_SetError(ERR_OUT_OF_MEMORY);
742 return NULL; 742 return NULL;
743 } 743 }
744 memset(data, 0, sizeof(*data)); 744 memset(data, 0, sizeof(*data));
745 745
746 data->chunk = LoadRIFF(src); 746 data->chunk = LoadRIFF(src);