diff src/audio/SDL_audio.c @ 2728:2768bd7281e0

Fixed Visual Studio compilation problems
author Sam Lantinga <slouken@libsdl.org>
date Tue, 26 Aug 2008 07:34:49 +0000
parents f8f68f47285a
children 204be4fc2726
line wrap: on
line diff
--- a/src/audio/SDL_audio.c	Tue Aug 26 07:34:23 2008 +0000
+++ b/src/audio/SDL_audio.c	Tue Aug 26 07:34:49 2008 +0000
@@ -291,10 +291,8 @@
 int
 SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence)
 {
-    int i;
-
     /* First try to allocate the buffer */
-    stream->buffer = (Uint8 *) malloc(max_len);
+    stream->buffer = (Uint8 *) SDL_malloc(max_len);
     if (stream->buffer == NULL) {
         return -1;
     }
@@ -304,9 +302,9 @@
     stream->write_pos = 0;
 
     /* Zero out the buffer */
-    for (i = 0; i < max_len; ++i) {
-        stream->buffer[i] = silence;
-    }
+    SDL_memset(stream->buffer, silence, max_len);
+
+    return 0;
 }
 
 /* Deinitialize the stream simply by freeing the buffer */
@@ -314,7 +312,7 @@
 SDL_StreamDeinit(SDL_AudioStreamer * stream)
 {
     if (stream->buffer != NULL) {
-        free(stream->buffer);
+        SDL_free(stream->buffer);
     }
 }