Update gtkwave files to latest

This commit is contained in:
Wilson Snyder 2019-11-16 03:44:51 -05:00
parent 617424e04a
commit b9322206d7
1 changed files with 39 additions and 7 deletions

View File

@ -44,6 +44,7 @@
#include "fstapi.h"
#include "fastlz.h"
#include "lz4.h"
#include <errno.h>
#ifndef HAVE_LIBPTHREAD
#undef FST_WRITER_PARALLEL
@ -954,6 +955,19 @@ fflush(xc->handle);
/*
* mmap functions
*/
static void fstWriterMmapSanity(void *pnt, const char *file, int line, const char *usage)
{
#if !defined(__CYGWIN__) && !defined(__MINGW32__)
if(pnt == MAP_FAILED)
{
fprintf(stderr, "fstMmap() assigned to %s failed: errno: %d, file %s, line %d.\n", usage, errno, file, line);
perror("Why");
pnt = NULL;
}
#endif
}
static void fstWriterCreateMmaps(struct fstWriterContext *xc)
{
off_t curpos = ftello(xc->handle);
@ -976,12 +990,20 @@ fflush(xc->handle);
if(!xc->valpos_mem)
{
fflush(xc->valpos_handle);
xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
errno = 0;
if(xc->maxhandle)
{
fstWriterMmapSanity(xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0), __FILE__, __LINE__, "xc->valpos_mem");
}
}
if(!xc->curval_mem)
{
fflush(xc->curval_handle);
xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
errno = 0;
if(xc->maxvalpos)
{
fstWriterMmapSanity(xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0), __FILE__, __LINE__, "xc->curval_handle");
}
}
}
@ -1684,7 +1706,8 @@ fflush(xc->tchn_handle);
tlen = ftello(xc->tchn_handle);
fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET);
tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
errno = 0;
fstWriterMmapSanity(tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0), __FILE__, __LINE__, "tmem");
if(tmem)
{
unsigned long destlen = tlen;
@ -1876,7 +1899,7 @@ if(xc)
if(xc && !xc->already_in_close && !xc->already_in_flush)
{
unsigned char *tmem;
unsigned char *tmem = NULL;
off_t fixup_offs, tlen, hlen;
xc->already_in_close = 1; /* never need to zero this out as it is freed at bottom */
@ -1914,7 +1937,12 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
/* write out geom section */
fflush(xc->geom_handle);
tlen = ftello(xc->geom_handle);
tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
errno = 0;
if(tlen)
{
fstWriterMmapSanity(tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0), __FILE__, __LINE__, "tmem");
}
if(tmem)
{
unsigned long destlen = tlen;
@ -2022,14 +2050,18 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
{
int lz4_maxlen;
unsigned char *mem;
unsigned char *hmem;
unsigned char *hmem = NULL;
int packed_len;
fflush(xc->handle);
lz4_maxlen = LZ4_compressBound(xc->hier_file_len);
mem = (unsigned char *)malloc(lz4_maxlen);
hmem = (unsigned char *)fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0);
errno = 0;
if(xc->hier_file_len)
{
fstWriterMmapSanity(hmem = (unsigned char *)fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0), __FILE__, __LINE__, "hmem");
}
packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len);
fstMunmap(hmem, xc->hier_file_len);