diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/io.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 241bcfc3a1..34bcef483c 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -331,28 +331,31 @@ void *sim_codec_load_ram(char* codecptr, int size, | |||
331 | char path[MAX_PATH]; | 331 | char path[MAX_PATH]; |
332 | int fd; | 332 | int fd; |
333 | int copy_n; | 333 | int copy_n; |
334 | static int codec_count = 0; | 334 | int codec_count; |
335 | #ifdef WIN32 | 335 | #ifdef WIN32 |
336 | char buf[256]; | 336 | char buf[256]; |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | *pd = NULL; | 339 | *pd = NULL; |
340 | 340 | ||
341 | /* We have to create the dynamic link library file from ram | 341 | /* We have to create the dynamic link library file from ram so we |
342 | so we could simulate the codec loading. */ | 342 | can simulate the codec loading. With voice and crossfade, |
343 | 343 | multiple codecs may be loaded at the same time, so we need | |
344 | sprintf(path, TEMP_CODEC_FILE, codec_count); | 344 | to find an unused filename */ |
345 | 345 | for (codec_count = 0; codec_count < 10; codec_count++) | |
346 | /* if voice is enabled, two codecs may be loaded at same time */ | 346 | { |
347 | if (!codec_count) | 347 | sprintf(path, TEMP_CODEC_FILE, codec_count); |
348 | codec_count++; | 348 | |
349 | 349 | #ifdef WIN32 | |
350 | #ifdef WIN32 | 350 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); |
351 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); | 351 | #else |
352 | #else | 352 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); |
353 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); | 353 | #endif |
354 | #endif | 354 | if (fd >= 0) |
355 | if (fd < 0) { | 355 | break; /* Created a file ok */ |
356 | } | ||
357 | if (fd < 0) | ||
358 | { | ||
356 | DEBUGF("failed to open for write: %s\n", path); | 359 | DEBUGF("failed to open for write: %s\n", path); |
357 | return NULL; | 360 | return NULL; |
358 | } | 361 | } |