Update fstapi.c to match latest from GTKWave.

This commit is contained in:
Cary R 2010-06-11 11:51:41 -07:00 committed by Stephen Williams
parent 3f6aff47c9
commit 263dff6fbe
1 changed files with 23 additions and 3 deletions

View File

@ -2177,8 +2177,19 @@ if(!xc->fh)
fflush(xc->f);
zhandle = gzdopen(dup(fileno(xc->f)), "rb");
xc->fh = fopen(fnam, "w+b");
if(!xc->fh)
{
xc->fh = tmpfile();
free(fnam); fnam = NULL;
if(!xc->fh)
{
free(mem);
return;
}
}
#ifndef __MINGW32__
unlink(fnam);
if(fnam) unlink(fnam);
#endif
for(hl = 0; hl < uclen; hl += FST_GZIO_LEN)
@ -2557,13 +2568,22 @@ if(sectype == FST_BL_ZWRAPPER)
sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc);
fcomp = fopen(hf, "w+b");
if(!fcomp)
{
fcomp = tmpfile();
free(hf); hf = NULL;
if(!fcomp) return(0);
}
#ifdef __MINGW32__
setvbuf(fcomp, (char *)NULL, _IONBF, 0); /* keeps gzip from acting weird in tandem with fopen */
xc->filename_unpacked = hf;
#else
unlink(hf);
free(hf);
if(hf)
{
unlink(hf);
free(hf);
}
#endif
fseeko(xc->f, 1+8+8, SEEK_SET);