Update to latest GTKWave files

This commit is contained in:
Cary R 2019-09-29 09:56:33 -07:00
parent d7ee6bb6bb
commit 8a85d62ec7
1 changed files with 37 additions and 7 deletions

View File

@ -42,6 +42,7 @@
#include "fstapi.h"
#include "fastlz.h"
#include "lz4.h"
#include <errno.h>
#ifndef HAVE_LIBPTHREAD
#undef FST_WRITER_PARALLEL
@ -952,6 +953,17 @@ fflush(xc->handle);
/*
* mmap functions
*/
static void fstWriterMmapSanity(void *pnt, const char *file, int line, const char *usage)
{
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;
}
}
static void fstWriterCreateMmaps(struct fstWriterContext *xc)
{
off_t curpos = ftello(xc->handle);
@ -974,12 +986,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");
}
}
}
@ -1682,7 +1702,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;
@ -1874,7 +1895,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 */
@ -1912,7 +1933,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;
@ -2020,14 +2046,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);