load_aiff.c
changeset 473 60b7e1c4f6b2
parent 386 695494546b3c
child 518 8bc9b5fd2aae
equal deleted inserted replaced
472:463ba3222193 473:60b7e1c4f6b2
   175 		/* a 0 pad byte can be stored for any odd-length chunk */
   175 		/* a 0 pad byte can be stored for any odd-length chunk */
   176 		if (chunk_length&1)
   176 		if (chunk_length&1)
   177 			next_chunk++;
   177 			next_chunk++;
   178 	} while ( ( ( (AIFFmagic == AIFF) && ( !found_SSND || !found_COMM ) )
   178 	} while ( ( ( (AIFFmagic == AIFF) && ( !found_SSND || !found_COMM ) )
   179 		  || ( (AIFFmagic == _8SVX ) && ( !found_VHDR || !found_BODY ) ) )
   179 		  || ( (AIFFmagic == _8SVX ) && ( !found_VHDR || !found_BODY ) ) )
   180 		  && SDL_RWseek(src, next_chunk, SEEK_SET) != 1 );
   180 		  && SDL_RWseek(src, next_chunk, RW_SEEK_SET) != 1 );
   181 
   181 
   182 	if ( (AIFFmagic == AIFF) && !found_SSND ) {
   182 	if ( (AIFFmagic == AIFF) && !found_SSND ) {
   183 		SDL_SetError("Bad AIFF (no SSND chunk)");
   183 		SDL_SetError("Bad AIFF (no SSND chunk)");
   184 		was_error = 1;
   184 		was_error = 1;
   185 		goto done;
   185 		goto done;
   225 	*audio_buf = (Uint8 *)malloc(*audio_len);
   225 	*audio_buf = (Uint8 *)malloc(*audio_len);
   226 	if ( *audio_buf == NULL ) {
   226 	if ( *audio_buf == NULL ) {
   227 		SDL_SetError("Out of memory");
   227 		SDL_SetError("Out of memory");
   228 		return(NULL);
   228 		return(NULL);
   229 	}
   229 	}
   230 	SDL_RWseek(src, start, SEEK_SET);
   230 	SDL_RWseek(src, start, RW_SEEK_SET);
   231 	if ( SDL_RWread(src, *audio_buf, *audio_len, 1) != 1 ) {
   231 	if ( SDL_RWread(src, *audio_buf, *audio_len, 1) != 1 ) {
   232 		SDL_SetError("Unable to read audio data");
   232 		SDL_SetError("Unable to read audio data");
   233 		return(NULL);
   233 		return(NULL);
   234 	}
   234 	}
   235 
   235