pkgsrc/multimedia/mpeg_encode/patches/patch-ah
2012-11-01 19:40:08 +00:00

49 lines
1.2 KiB
Text

$NetBSD: patch-ah,v 1.3 2012/11/01 19:40:08 joerg Exp $
--- ../convert/eyuvtojpeg.c.orig 1995-04-14 21:16:52.000000000 +0000
+++ ../convert/eyuvtojpeg.c
@@ -24,7 +24,7 @@
*==============*/
#include <stdio.h>
#include <stdlib.h>
-#include <malloc.h>
+#include <unistd.h>
typedef unsigned char uint8;
@@ -43,11 +43,12 @@ void ReadYUV(FILE *fp);
void AllocYCC(void);
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
FILE *fpointer;
- char command[256];
- char src[256], dest[256];
+ char command[4096];
+ char src[4096], dest[4096], tempfile[4096];
+ int ret;
if ((strcmp(argv[1],"-?") == 0) ||
(strcmp(argv[1],"-h") == 0) ||
@@ -98,13 +99,16 @@ void main(int argc, char **argv)
YUVtoPPM();
fprintf(stdout, "Writing PPM\n");
- fpointer = fopen("/tmp/foobar", "w");
+ sprintf(tempfile, "%s.tmp", dest);
+ fpointer = fopen(tempfile, "w");
WritePPM(fpointer);
fclose(fpointer);
fprintf(stdout, "Converting to JPEG %s\n", dest);
- sprintf(command, "cjpeg /tmp/foobar > %s", dest);
- system(command);
+ sprintf(command, "cjpeg %s > %s", tempfile, dest);
+ ret = system(command);
+ unlink(tempfile);
+ return ret;
}