Re: mkstemp patch for the pngalpha device

Ralph Giles <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
On Mon, Jan 19, 2004 at 06:29:36PM -0800, Ralph Giles wrote:

> Proposed log message:
> Use gp_open_scratch_file() instead of using a fixed filename in the pngalpha device. Part of the 
> fix for bug 687243.

Patch attached this time.

 -r

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
pnga-mkstemp.diff (text/plain, 1.3 KB)
Index: src/gdevpnga.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpnga.c,v
retrieving revision 1.7
diff -u -r1.7 gdevpnga.c
--- src/gdevpnga.c	24 Apr 2003 06:20:54 -0000	1.7
+++ src/gdevpnga.c	20 Jan 2004 02:24:30 -0000
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2001 artofcode LLC.
+  Copyright (C) 2001-2004 artofcode LLC. All rights reserved.
   
   This software is provided AS-IS with no warranty, either express or
   implied.
@@ -16,6 +16,7 @@
 
   Author: Raph Levien <[email protected]>
 */
+
 /* $Id: gdevpnga.c,v 1.7 2003/04/24 06:20:54 ray Exp $ */
 /* Test driver for PDF 1.4 transparency stuff */
 
@@ -642,13 +643,20 @@
     const char *software_key = "Software";
     char software_text[256];
     png_text text_png;
+    char prefix[] = "pnga_png"
+    char fname[gp_file_name_sizeof];
     FILE *file;
 
     pdf14_buf *buf = pdev->ctx->stack;
     int planestride = buf->planestride;
     byte *buf_ptr = buf->data;
 
-    file = fopen ("/tmp/tmp.png", "wb"); /* todo: suck from OutputFile */
+    file = gp_open_scratch_file(prefix, fname, "wb");
+    if (file == NULL) {
+	code = gs_note_error(gs_error_invalidfileaccess);
+	goto done;
+    }
+    /* todo: suck from OutputFile instead */
 
     if_debug0('v', "[v]pnga_output_page\n");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.