From d59d701871a9d3bdef6e09c915f7e8075cff9de4 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Sat, 4 Mar 2006 20:16:17 +0000 Subject: [PATCH] Portability fixes. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2262 8092fc87-c524-0410-9efc-e669fe64eaf9 --- tools/aif/aif2raw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/aif/aif2raw.c b/tools/aif/aif2raw.c index 25787943d..8ddfbd66e 100644 --- a/tools/aif/aif2raw.c +++ b/tools/aif/aif2raw.c @@ -25,13 +25,13 @@ main(int argc, char *argv[]) { return EXIT_FAILURE; } - in = fopen(argv[1], "r"); + in = fopen(argv[1], "rb"); if (!in) { perror("Could not open input file"); return EXIT_FAILURE; } - out = fopen(argv[2], "w"); + out = fopen(argv[2], "wb"); if (!out) { perror("Could not open output file"); return EXIT_FAILURE; @@ -253,9 +253,9 @@ write_data(const uint8_t *data, ssize_t size, int numChannels, FILE *out) { endptr = data + size; srcptr = data; - buffer = alloca(size * sizeof (uint16_t)); + buffer = malloc(size * sizeof (uint16_t)); dstptr = buffer; - last = alloca(numChannels * sizeof(int16_t)); + last = malloc(numChannels * sizeof(int16_t)); memset(last, '\0', numChannels * sizeof(uint16_t)); while (srcptr < endptr) { for (i = 0; i < numChannels; i++) { @@ -270,5 +270,9 @@ write_data(const uint8_t *data, ssize_t size, int numChannels, FILE *out) { } } fwrite(buffer, size * sizeof (uint16_t), 1, out); + + free(last); + free(buffer); } +