Commit ef31a5f7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

fixed use of fread(). Unfortunately this slowed down the plug-in again.

2004-11-19  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/postscript.c (skip_ps) (ps_close): fixed use of
	fread(). Unfortunately this slowed down the plug-in again.
	Disabled the code that reads the pipe to the end. This brings it
	back to speed. Seems to work fine for me, let's see if this causes
	problems for anyone...
parent 7ec94063
2004-11-19 Sven Neumann <sven@gimp.org>
* plug-ins/common/postscript.c (skip_ps) (ps_close): fixed use of
fread(). Unfortunately this slowed down the plug-in again.
Disabled the code that reads the pipe to the end. This brings it
back to speed. Seems to work fine for me, let's see if this causes
problems for anyone...
2004-11-19 Sven Neumann <sven@gimp.org>
 
* plug-ins/script-fu/scripts/selection-round.scm: moved into the
......
......@@ -1676,19 +1676,25 @@ out:
static void
ps_close (FILE *ifp, gint ChildPid)
{
guchar buf[8192];
#ifndef USE_REAL_OUTPUTFILE
int status;
pid_t RetVal;
/* Even if we dont want all images, we have to read the pipe until EOF. */
/* Otherwise the subprocess may not finish. */
/* Enabling the code below causes us to read the pipe until EOF even
* if we dont want all images. Should be enabled if people report that
* the gs subprocess does not finish. For now it is disabled since it
* causes a significant slowdown.
*/
#ifdef EMPTY_PIPE
guchar buf[8192];
#ifdef PS_DEBUG
g_print ("Reading rest from pipe\n");
#endif
while (fread (buf, sizeof (buf), 1, ifp) == 8192);
while (fread (buf, sizeof (buf), 1, ifp));
#endif /* EMPTY_PIPE */
/* Finish reading from pipe. */
fclose (ifp);
......@@ -1710,7 +1716,7 @@ ps_close (FILE *ifp, gint ChildPid)
#endif
}
#else
#else /* USE_REAL_OUTPUTFILE */
/* If a real outputfile was used, close the file and remove it. */
fclose (ifp);
unlink (pnmfile);
......@@ -1849,7 +1855,7 @@ skip_ps (FILE *ifp)
len = bpl * height;
while (len)
{
gsize bytes = fread (buf, MIN (len, sizeof (buf)), 1, ifp);
gsize bytes = fread (buf, 1, MIN (len, sizeof (buf)), ifp);
if (bytes < MIN (len, sizeof (buf)))
return FALSE;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment