diff xvid_rc.c @ 3233:18af2f7788c6 libavcodec

- Add new file internal.h for common internal-use-only functions. - Add new function av_tempfile() for creating temporary files; contains workaround for MinGW. - Make XviD stuff use av_tempfile().
author corey
date Thu, 30 Mar 2006 04:33:05 +0000
parents 5fc631919a98
children c8c591fe26f8
line wrap: on
line diff
--- a/xvid_rc.c	Wed Mar 29 21:11:57 2006 +0000
+++ b/xvid_rc.c	Thu Mar 30 04:33:05 2006 +0000
@@ -21,6 +21,7 @@
 #include <xvid.h>
 #include <unistd.h>
 #include "avcodec.h"
+#include "internal.h"
 //#include "dsputil.h"
 #include "mpegvideo.h"
 
@@ -37,11 +38,10 @@
 
 //xvid_debug=-1;
 
-    tmp_name= av_strdup("/tmp/xvidrc.XXXXXX");
-    fd = mkstemp(tmp_name);
-    if(fd < 0){
-        strcpy(tmp_name, "./xvidrc.XXXXXX");
-        fd = mkstemp(tmp_name);
+    fd=av_tempfile("xvidrc.", &tmp_name);
+    if (fd == -1) {
+        av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n");
+        return -1;
     }
 
     for(i=0; i<s->rc_context.num_entries; i++){