Update to latest GTKWAve files
This commit is contained in:
parent
542fe2cf77
commit
7fa6eaef0a
280
vpi/fstapi.c
280
vpi/fstapi.c
|
|
@ -283,7 +283,7 @@ static char *fstRealpath(const char *path, char *resolved_path)
|
|||
#if (defined(__MACH__) && defined(__APPLE__))
|
||||
if(!resolved_path)
|
||||
{
|
||||
resolved_path = malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */
|
||||
resolved_path = (unsigned char *)malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ return(realpath(path, resolved_path));
|
|||
#ifdef __MINGW32__
|
||||
if(!resolved_path)
|
||||
{
|
||||
resolved_path = malloc(PATH_MAX+1);
|
||||
resolved_path = (unsigned char *)malloc(PATH_MAX+1);
|
||||
}
|
||||
return(_fullpath(resolved_path, path, PATH_MAX));
|
||||
#else
|
||||
|
|
@ -317,7 +317,7 @@ static void *fstMmap2(size_t __len, int __fd, off_t __off)
|
|||
{
|
||||
(void)__off;
|
||||
|
||||
unsigned char *pnt = malloc(__len);
|
||||
unsigned char *pnt = (unsigned char *)malloc(__len);
|
||||
off_t cur_offs = lseek(__fd, 0, SEEK_CUR);
|
||||
size_t i;
|
||||
|
||||
|
|
@ -804,7 +804,7 @@ if(rc<0)
|
|||
{
|
||||
xc->fseek_failed = 1;
|
||||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"Seek to #%"PRId64" (whence = %d) failed!\n", offset, whence);
|
||||
fprintf(stderr, FST_APIMESS"Seek to #%" PRId64 " (whence = %d) failed!\n", offset, whence);
|
||||
perror("Why");
|
||||
#endif
|
||||
}
|
||||
|
|
@ -970,12 +970,12 @@ fflush(xc->handle);
|
|||
if(!xc->valpos_mem)
|
||||
{
|
||||
fflush(xc->valpos_handle);
|
||||
xc->valpos_mem = fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
|
||||
xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
|
||||
}
|
||||
if(!xc->curval_mem)
|
||||
{
|
||||
fflush(xc->curval_handle);
|
||||
xc->curval_mem = fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
|
||||
xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1106,7 +1106,7 @@ xc->next_huge_break = FST_ACTIVATE_HUGE_BREAK;
|
|||
*/
|
||||
void *fstWriterCreate(const char *nam, int use_compressed_hier)
|
||||
{
|
||||
struct fstWriterContext *xc = calloc(1, sizeof(struct fstWriterContext));
|
||||
struct fstWriterContext *xc = (struct fstWriterContext *)calloc(1, sizeof(struct fstWriterContext));
|
||||
|
||||
xc->compress_hier = use_compressed_hier;
|
||||
fstDetermineBreakSize(xc);
|
||||
|
|
@ -1120,7 +1120,7 @@ if((!nam)||
|
|||
else
|
||||
{
|
||||
int flen = strlen(nam);
|
||||
char *hf = calloc(1, flen + 6);
|
||||
char *hf = (char *)calloc(1, flen + 6);
|
||||
|
||||
memcpy(hf, nam, flen);
|
||||
strcpy(hf + flen, ".hier");
|
||||
|
|
@ -1131,7 +1131,7 @@ if((!nam)||
|
|||
xc->curval_handle = tmpfile_open(&xc->curval_handle_nam); /* .bits */
|
||||
xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* .tchn */
|
||||
xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
|
||||
xc->vchg_mem = malloc(xc->vchg_alloc_siz);
|
||||
xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz);
|
||||
|
||||
if(xc->hier_handle && xc->geom_handle && xc->valpos_handle && xc->curval_handle && xc->vchg_mem && xc->tchn_handle)
|
||||
{
|
||||
|
|
@ -1180,7 +1180,7 @@ if(xc)
|
|||
int rc;
|
||||
|
||||
destlen = xc->maxvalpos;
|
||||
dmem = malloc(compressBound(destlen));
|
||||
dmem = (unsigned char *)malloc(compressBound(destlen));
|
||||
rc = compress2(dmem, &destlen, xc->curval_mem, xc->maxvalpos, 4); /* was 9...which caused performance drag on traces with many signals */
|
||||
|
||||
fputc(FST_BL_SKIP, xc->handle); /* temporarily tag the section, use FST_BL_VCDATA on finalize */
|
||||
|
|
@ -1269,7 +1269,7 @@ if((xc->vchg_siz <= 1)||(xc->already_in_flush)) return;
|
|||
xc->already_in_flush = 1; /* should really do this with a semaphore */
|
||||
|
||||
xc->section_header_only = 0;
|
||||
scratchpad = malloc(xc->vchg_siz);
|
||||
scratchpad = (unsigned char *)malloc(xc->vchg_siz);
|
||||
|
||||
vchg_mem = xc->vchg_mem;
|
||||
|
||||
|
|
@ -1279,7 +1279,7 @@ fputc(xc->fourpack ? '4' : (xc->fastpack ? 'F' : 'Z'), f);
|
|||
fpos = 1;
|
||||
|
||||
packmemlen = 1024; /* maintain a running "longest" allocation to */
|
||||
packmem = malloc(packmemlen); /* prevent continual malloc...free every loop iter */
|
||||
packmem = (unsigned char *)malloc(packmemlen); /* prevent continual malloc...free every loop iter */
|
||||
|
||||
for(i=0;i<xc->maxhandle;i++)
|
||||
{
|
||||
|
|
@ -1399,13 +1399,13 @@ for(i=0;i<xc->maxhandle;i++)
|
|||
idx = ((vm4ip[1]+7) & ~7);
|
||||
switch(vm4ip[1] & 7)
|
||||
{
|
||||
case 0: do { acc = (pnt[idx+7-8] & 1) << 0;
|
||||
case 7: acc |= (pnt[idx+6-8] & 1) << 1;
|
||||
case 6: acc |= (pnt[idx+5-8] & 1) << 2;
|
||||
case 5: acc |= (pnt[idx+4-8] & 1) << 3;
|
||||
case 4: acc |= (pnt[idx+3-8] & 1) << 4;
|
||||
case 3: acc |= (pnt[idx+2-8] & 1) << 5;
|
||||
case 2: acc |= (pnt[idx+1-8] & 1) << 6;
|
||||
case 0: do { acc = (pnt[idx+7-8] & 1) << 0; /* fallthrough */
|
||||
case 7: acc |= (pnt[idx+6-8] & 1) << 1; /* fallthrough */
|
||||
case 6: acc |= (pnt[idx+5-8] & 1) << 2; /* fallthrough */
|
||||
case 5: acc |= (pnt[idx+4-8] & 1) << 3; /* fallthrough */
|
||||
case 4: acc |= (pnt[idx+3-8] & 1) << 4; /* fallthrough */
|
||||
case 3: acc |= (pnt[idx+2-8] & 1) << 5; /* fallthrough */
|
||||
case 2: acc |= (pnt[idx+1-8] & 1) << 6; /* fallthrough */
|
||||
case 1: acc |= (pnt[idx+0-8] & 1) << 7;
|
||||
*(--scratchpnt) = acc;
|
||||
idx -= 8;
|
||||
|
|
@ -1441,7 +1441,7 @@ for(i=0;i<xc->maxhandle;i++)
|
|||
else
|
||||
{
|
||||
free(packmem);
|
||||
dmem = packmem = malloc(compressBound(packmemlen = wrlen));
|
||||
dmem = packmem = (unsigned char *)malloc(compressBound(packmemlen = wrlen));
|
||||
}
|
||||
|
||||
rc = compress2(dmem, &destlen, scratchpnt, wrlen, 4);
|
||||
|
|
@ -1496,7 +1496,7 @@ for(i=0;i<xc->maxhandle;i++)
|
|||
else
|
||||
{
|
||||
free(packmem);
|
||||
dmem = packmem = malloc(packmemlen = (wrlen * 2) + 2);
|
||||
dmem = packmem = (unsigned char *)malloc(packmemlen = (wrlen * 2) + 2);
|
||||
}
|
||||
|
||||
rc = (xc->fourpack) ? LZ4_compress((char *)scratchpnt, (char *)dmem, wrlen) : fastlz_compress(scratchpnt, wrlen, dmem);
|
||||
|
|
@ -1678,11 +1678,11 @@ fflush(xc->tchn_handle);
|
|||
tlen = ftello(xc->tchn_handle);
|
||||
fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET);
|
||||
|
||||
tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
|
||||
tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
|
||||
if(tmem)
|
||||
{
|
||||
unsigned long destlen = tlen;
|
||||
unsigned char *dmem = malloc(compressBound(destlen));
|
||||
unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
|
||||
int rc = compress2(dmem, &destlen, tmem, tlen, 9);
|
||||
|
||||
if((rc == Z_OK) && (((off_t)destlen) < tlen))
|
||||
|
|
@ -1781,7 +1781,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
|
|||
|
||||
if(xc->parallel_enabled)
|
||||
{
|
||||
struct fstWriterContext *xc2 = malloc(sizeof(struct fstWriterContext));
|
||||
struct fstWriterContext *xc2 = (struct fstWriterContext *)malloc(sizeof(struct fstWriterContext));
|
||||
unsigned int i;
|
||||
|
||||
pthread_mutex_lock(&xc->mutex);
|
||||
|
|
@ -1790,16 +1790,16 @@ if(xc->parallel_enabled)
|
|||
xc->xc_parent = xc;
|
||||
memcpy(xc2, xc, sizeof(struct fstWriterContext));
|
||||
|
||||
xc2->valpos_mem = malloc(xc->maxhandle * 4 * sizeof(uint32_t));
|
||||
xc2->valpos_mem = (uint32_t *)malloc(xc->maxhandle * 4 * sizeof(uint32_t));
|
||||
memcpy(xc2->valpos_mem, xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t));
|
||||
|
||||
/* curval mem is updated in the thread */
|
||||
#ifdef FST_REMOVE_DUPLICATE_VC
|
||||
xc2->curval_mem = malloc(xc->maxvalpos);
|
||||
xc2->curval_mem = (unsigned char *)malloc(xc->maxvalpos);
|
||||
memcpy(xc2->curval_mem, xc->curval_mem, xc->maxvalpos);
|
||||
#endif
|
||||
|
||||
xc->vchg_mem = malloc(xc->vchg_alloc_siz);
|
||||
xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz);
|
||||
xc->vchg_mem[0] = '!';
|
||||
xc->vchg_siz = 1;
|
||||
|
||||
|
|
@ -1908,11 +1908,11 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
/* write out geom section */
|
||||
fflush(xc->geom_handle);
|
||||
tlen = ftello(xc->geom_handle);
|
||||
tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
|
||||
tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
|
||||
if(tmem)
|
||||
{
|
||||
unsigned long destlen = tlen;
|
||||
unsigned char *dmem = malloc(compressBound(destlen));
|
||||
unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
|
||||
int rc = compress2(dmem, &destlen, tmem, tlen, 9);
|
||||
|
||||
if((rc != Z_OK) || (((off_t)destlen) > tlen))
|
||||
|
|
@ -1980,7 +1980,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
int zfd;
|
||||
int fourpack_duo = 0;
|
||||
#ifndef __MINGW32__
|
||||
char *fnam = malloc(strlen(xc->filename) + 5 + 1);
|
||||
char *fnam = (char *)malloc(strlen(xc->filename) + 5 + 1);
|
||||
#endif
|
||||
|
||||
fixup_offs = ftello(xc->handle);
|
||||
|
|
@ -1991,7 +1991,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
|
||||
if(!xc->fourpack)
|
||||
{
|
||||
unsigned char *mem = malloc(FST_GZIO_LEN);
|
||||
unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
|
||||
zfd = dup(fileno(xc->handle));
|
||||
fflush(xc->handle);
|
||||
zhandle = gzdopen(zfd, "wb4");
|
||||
|
|
@ -2022,8 +2022,8 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
fflush(xc->handle);
|
||||
|
||||
lz4_maxlen = LZ4_compressBound(xc->hier_file_len);
|
||||
mem = malloc(lz4_maxlen);
|
||||
hmem = fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0);
|
||||
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);
|
||||
packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len);
|
||||
fstMunmap(hmem, xc->hier_file_len);
|
||||
|
||||
|
|
@ -2036,7 +2036,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
int packed_len_duo;
|
||||
|
||||
lz4_maxlen_duo = LZ4_compressBound(packed_len);
|
||||
mem_duo = malloc(lz4_maxlen_duo);
|
||||
mem_duo = (unsigned char *)malloc(lz4_maxlen_duo);
|
||||
packed_len_duo = LZ4_compress((char *)mem, (char *)mem_duo, packed_len);
|
||||
|
||||
fstWriterVarint(xc->handle, packed_len); /* 1st round compressed length */
|
||||
|
|
@ -2096,7 +2096,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
FILE *fp;
|
||||
off_t offpnt, uclen;
|
||||
int flen = strlen(xc->filename);
|
||||
char *hf = calloc(1, flen + 5);
|
||||
char *hf = (char *)calloc(1, flen + 5);
|
||||
|
||||
strcpy(hf, xc->filename);
|
||||
strcpy(hf+flen, ".pak");
|
||||
|
|
@ -2104,7 +2104,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
|||
|
||||
if(fp)
|
||||
{
|
||||
void *dsth;
|
||||
gzFile dsth;
|
||||
int zfd;
|
||||
char gz_membuf[FST_GZIO_LEN];
|
||||
|
||||
|
|
@ -2586,7 +2586,7 @@ if(xc && nam)
|
|||
xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
|
||||
if(xc->vchg_mem)
|
||||
{
|
||||
xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2758,7 +2758,7 @@ if((xc) && (handle <= xc->maxhandle))
|
|||
if((fpos + len + 10) > xc->vchg_alloc_siz)
|
||||
{
|
||||
xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */
|
||||
xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||
if(!xc->vchg_mem)
|
||||
{
|
||||
fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitValueChange, exiting.\n");
|
||||
|
|
@ -2872,7 +2872,7 @@ if((xc) && (handle <= xc->maxhandle))
|
|||
if((fpos + len + 10 + 5) > xc->vchg_alloc_siz)
|
||||
{
|
||||
xc->vchg_alloc_siz += (xc->fst_break_add_size + len + 5); /* +len added in the case of extremely long vectors and small break add sizes */
|
||||
xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||
if(!xc->vchg_mem)
|
||||
{
|
||||
fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitVariableLengthValueChange, exiting.\n");
|
||||
|
|
@ -2949,7 +2949,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
|
|||
|
||||
if(xc)
|
||||
{
|
||||
struct fstBlackoutChain *b = calloc(1, sizeof(struct fstBlackoutChain));
|
||||
struct fstBlackoutChain *b = (struct fstBlackoutChain *)calloc(1, sizeof(struct fstBlackoutChain));
|
||||
|
||||
b->tim = xc->curtime;
|
||||
b->active = (enable != 0);
|
||||
|
|
@ -3120,7 +3120,7 @@ if(rc<0)
|
|||
{
|
||||
xc->fseek_failed = 1;
|
||||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"Seek to #%"PRId64" (whence = %d) failed!\n", offset, whence);
|
||||
fprintf(stderr, FST_APIMESS"Seek to #%" PRId64 " (whence = %d) failed!\n", offset, whence);
|
||||
perror("Why");
|
||||
#endif
|
||||
}
|
||||
|
|
@ -3248,12 +3248,12 @@ const char *fstReaderPushScope(void *ctx, const char *nam, void *user_info)
|
|||
struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
|
||||
if(xc)
|
||||
{
|
||||
struct fstCurrHier *ch = malloc(sizeof(struct fstCurrHier));
|
||||
struct fstCurrHier *ch = (struct fstCurrHier *)malloc(sizeof(struct fstCurrHier));
|
||||
int chl = xc->curr_hier ? xc->curr_hier->len : 0;
|
||||
int len = chl + 1 + strlen(nam);
|
||||
if(len >= xc->flat_hier_alloc_len)
|
||||
{
|
||||
xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? realloc(xc->curr_flat_hier_nam, len+1) : malloc(len+1);
|
||||
xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? (char *)realloc(xc->curr_flat_hier_nam, len+1) : (char *)malloc(len+1);
|
||||
}
|
||||
|
||||
if(chl)
|
||||
|
|
@ -3473,7 +3473,7 @@ return(xc ? xc->date : NULL);
|
|||
int fstReaderGetFileType(void *ctx)
|
||||
{
|
||||
struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
|
||||
return(xc ? xc->filetype : FST_FT_VERILOG);
|
||||
return(xc ? (int)xc->filetype : (int)FST_FT_VERILOG);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3606,8 +3606,8 @@ int pass_status = 1;
|
|||
if(!xc->fh)
|
||||
{
|
||||
off_t offs_cache = ftello(xc->f);
|
||||
char *fnam = malloc(strlen(xc->filename) + 6 + 16 + 32 + 1);
|
||||
unsigned char *mem = malloc(FST_GZIO_LEN);
|
||||
char *fnam = (char *)malloc(strlen(xc->filename) + 6 + 16 + 32 + 1);
|
||||
unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
|
||||
off_t hl, uclen;
|
||||
off_t clen = 0;
|
||||
gzFile zhandle = NULL;
|
||||
|
|
@ -3704,8 +3704,8 @@ if(!xc->fh)
|
|||
else
|
||||
if(htyp == FST_BL_HIER_LZ4DUO)
|
||||
{
|
||||
unsigned char *lz4_cmem = malloc(clen);
|
||||
unsigned char *lz4_ucmem = malloc(uclen);
|
||||
unsigned char *lz4_cmem = (unsigned char *)malloc(clen);
|
||||
unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen);
|
||||
unsigned char *lz4_ucmem2;
|
||||
uint64_t uclen2;
|
||||
int skiplen2 = 0;
|
||||
|
|
@ -3713,7 +3713,7 @@ if(!xc->fh)
|
|||
fstFread(lz4_cmem, clen, 1, xc->f);
|
||||
|
||||
uclen2 = fstGetVarint64(lz4_cmem, &skiplen2);
|
||||
lz4_ucmem2 = malloc(uclen2);
|
||||
lz4_ucmem2 = (unsigned char *)malloc(uclen2);
|
||||
pass_status = (uclen2 == (uint64_t)LZ4_decompress_safe_partial ((char *)lz4_cmem + skiplen2, (char *)lz4_ucmem2, clen - skiplen2, uclen2, uclen2));
|
||||
if(pass_status)
|
||||
{
|
||||
|
|
@ -3732,8 +3732,8 @@ if(!xc->fh)
|
|||
else
|
||||
if(htyp == FST_BL_HIER_LZ4)
|
||||
{
|
||||
unsigned char *lz4_cmem = malloc(clen);
|
||||
unsigned char *lz4_ucmem = malloc(uclen);
|
||||
unsigned char *lz4_cmem = (unsigned char *)malloc(clen);
|
||||
unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen);
|
||||
|
||||
fstFread(lz4_cmem, clen, 1, xc->f);
|
||||
pass_status = (uclen == LZ4_decompress_safe_partial ((char *)lz4_cmem, (char *)lz4_ucmem, clen, uclen, uclen));
|
||||
|
|
@ -3970,7 +3970,7 @@ if(!xc->fh)
|
|||
}
|
||||
}
|
||||
|
||||
str = malloc(FST_ID_NAM_ATTR_SIZ+1);
|
||||
str = (char *)malloc(FST_ID_NAM_ATTR_SIZ+1);
|
||||
|
||||
if(fv)
|
||||
{
|
||||
|
|
@ -3979,40 +3979,40 @@ if(fv)
|
|||
|
||||
fprintf(fv, "$date\n\t%s\n$end\n", xc->date);
|
||||
fprintf(fv, "$version\n\t%s\n$end\n", xc->version);
|
||||
if(xc->timezero) fprintf(fv, "$timezero\n\t%"PRId64"\n$end\n", xc->timezero);
|
||||
if(xc->timezero) fprintf(fv, "$timezero\n\t%" PRId64 "\n$end\n", xc->timezero);
|
||||
|
||||
switch(xc->timescale)
|
||||
{
|
||||
case 2: time_scale = 100; time_dimension[0] = 0; break;
|
||||
case 1: time_scale = 10;
|
||||
case 1: time_scale = 10; /* fallthrough */
|
||||
case 0: time_dimension[0] = 0; break;
|
||||
|
||||
case -1: time_scale = 100; time_dimension[0] = 'm'; break;
|
||||
case -2: time_scale = 10;
|
||||
case -2: time_scale = 10; /* fallthrough */
|
||||
case -3: time_dimension[0] = 'm'; break;
|
||||
|
||||
case -4: time_scale = 100; time_dimension[0] = 'u'; break;
|
||||
case -5: time_scale = 10;
|
||||
case -5: time_scale = 10; /* fallthrough */
|
||||
case -6: time_dimension[0] = 'u'; break;
|
||||
|
||||
case -10: time_scale = 100; time_dimension[0] = 'p'; break;
|
||||
case -11: time_scale = 10;
|
||||
case -11: time_scale = 10; /* fallthrough */
|
||||
case -12: time_dimension[0] = 'p'; break;
|
||||
|
||||
case -13: time_scale = 100; time_dimension[0] = 'f'; break;
|
||||
case -14: time_scale = 10;
|
||||
case -14: time_scale = 10; /* fallthrough */
|
||||
case -15: time_dimension[0] = 'f'; break;
|
||||
|
||||
case -16: time_scale = 100; time_dimension[0] = 'a'; break;
|
||||
case -17: time_scale = 10;
|
||||
case -17: time_scale = 10; /* fallthrough */
|
||||
case -18: time_dimension[0] = 'a'; break;
|
||||
|
||||
case -19: time_scale = 100; time_dimension[0] = 'z'; break;
|
||||
case -20: time_scale = 10;
|
||||
case -20: time_scale = 10; /* fallthrough */
|
||||
case -21: time_dimension[0] = 'z'; break;
|
||||
|
||||
case -7: time_scale = 100; time_dimension[0] = 'n'; break;
|
||||
case -8: time_scale = 10;
|
||||
case -8: time_scale = 10; /* fallthrough */
|
||||
case -9:
|
||||
default: time_dimension[0] = 'n'; break;
|
||||
}
|
||||
|
|
@ -4024,10 +4024,10 @@ xc->maxhandle = 0;
|
|||
xc->num_alias = 0;
|
||||
|
||||
free(xc->signal_lens);
|
||||
xc->signal_lens = malloc(num_signal_dyn*sizeof(uint32_t));
|
||||
xc->signal_lens = (uint32_t *)malloc(num_signal_dyn*sizeof(uint32_t));
|
||||
|
||||
free(xc->signal_typs);
|
||||
xc->signal_typs = malloc(num_signal_dyn*sizeof(unsigned char));
|
||||
xc->signal_typs = (unsigned char *)malloc(num_signal_dyn*sizeof(unsigned char));
|
||||
|
||||
fstReaderFseeko(xc, xc->fh, 0, SEEK_SET);
|
||||
while(!feof(xc->fh))
|
||||
|
|
@ -4072,13 +4072,13 @@ while(!feof(xc->fh))
|
|||
switch(attrtype)
|
||||
{
|
||||
case FST_AT_ARRAY: if((subtype < FST_AR_NONE) || (subtype > FST_AR_MAX)) subtype = FST_AR_NONE;
|
||||
fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg);
|
||||
fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg);
|
||||
break;
|
||||
case FST_AT_ENUM: if((subtype < FST_EV_SV_INTEGER) || (subtype > FST_EV_MAX)) subtype = FST_EV_SV_INTEGER;
|
||||
fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg);
|
||||
fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg);
|
||||
break;
|
||||
case FST_AT_PACK: if((subtype < FST_PT_NONE) || (subtype > FST_PT_MAX)) subtype = FST_PT_NONE;
|
||||
fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg);
|
||||
fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg);
|
||||
break;
|
||||
case FST_AT_MISC:
|
||||
default: attrtype = FST_AT_MISC;
|
||||
|
|
@ -4093,11 +4093,11 @@ while(!feof(xc->fh))
|
|||
int sidx_skiplen_dummy = 0;
|
||||
uint64_t sidx = fstGetVarint64((unsigned char *)str, &sidx_skiplen_dummy);
|
||||
|
||||
fprintf(fv, "$attrbegin %s %02x %"PRId64" %"PRId64" $end\n", attrtypes[attrtype], subtype, sidx, attrarg);
|
||||
fprintf(fv, "$attrbegin %s %02x %" PRId64 " %" PRId64 " $end\n", attrtypes[attrtype], subtype, sidx, attrarg);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(fv, "$attrbegin %s %02x %s %"PRId64" $end\n", attrtypes[attrtype], subtype, str, attrarg);
|
||||
fprintf(fv, "$attrbegin %s %02x %s %" PRId64 " $end\n", attrtypes[attrtype], subtype, str, attrarg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -4155,8 +4155,8 @@ while(!feof(xc->fh))
|
|||
if(xc->maxhandle == num_signal_dyn)
|
||||
{
|
||||
num_signal_dyn *= 2;
|
||||
xc->signal_lens = realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t));
|
||||
xc->signal_typs = realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char));
|
||||
xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t));
|
||||
xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char));
|
||||
}
|
||||
xc->signal_lens[xc->maxhandle] = len;
|
||||
xc->signal_typs[xc->maxhandle] = vartype;
|
||||
|
|
@ -4177,7 +4177,7 @@ while(!feof(xc->fh))
|
|||
char vcdid_buf[16];
|
||||
uint32_t modlen = (vartype != FST_VT_VCD_PORT) ? len : ((len - 2) / 3);
|
||||
fstVcdID(vcdid_buf, xc->maxhandle+1);
|
||||
fprintf(fv, "$var %s %"PRIu32" %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
|
||||
fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
|
||||
}
|
||||
xc->maxhandle++;
|
||||
}
|
||||
|
|
@ -4193,7 +4193,7 @@ while(!feof(xc->fh))
|
|||
char vcdid_buf[16];
|
||||
uint32_t modlen = (vartype != FST_VT_VCD_PORT) ? len : ((len - 2) / 3);
|
||||
fstVcdID(vcdid_buf, alias);
|
||||
fprintf(fv, "$var %s %"PRIu32" %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
|
||||
fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str);
|
||||
}
|
||||
xc->num_alias++;
|
||||
}
|
||||
|
|
@ -4208,14 +4208,14 @@ if(fv) fprintf(fv, "$enddefinitions $end\n");
|
|||
|
||||
maxhandle_scanbuild = xc->maxhandle ? xc->maxhandle : 1; /*scan-build warning suppression, in reality we have at least one signal */
|
||||
|
||||
xc->signal_lens = realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t));
|
||||
xc->signal_typs = realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char));
|
||||
xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t));
|
||||
xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char));
|
||||
|
||||
free(xc->process_mask);
|
||||
xc->process_mask = calloc(1, (maxhandle_scanbuild+7)/8);
|
||||
xc->process_mask = (unsigned char *)calloc(1, (maxhandle_scanbuild+7)/8);
|
||||
|
||||
free(xc->temp_signal_value_buf);
|
||||
xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
|
||||
xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);
|
||||
|
||||
xc->var_count = xc->maxhandle + xc->num_alias;
|
||||
|
||||
|
|
@ -4244,7 +4244,7 @@ if(sectype == FST_BL_ZWRAPPER)
|
|||
FILE *fcomp;
|
||||
off_t offpnt, uclen;
|
||||
char gz_membuf[FST_GZIO_LEN];
|
||||
void *zhandle;
|
||||
gzFile zhandle;
|
||||
int zfd;
|
||||
int flen = strlen(xc->filename);
|
||||
char *hf;
|
||||
|
|
@ -4254,7 +4254,7 @@ if(sectype == FST_BL_ZWRAPPER)
|
|||
|
||||
if(!seclen) return(0); /* not finished compressing, this is a failed read */
|
||||
|
||||
hf = calloc(1, flen + 16 + 32 + 1);
|
||||
hf = (char *)calloc(1, flen + 16 + 32 + 1);
|
||||
|
||||
sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc);
|
||||
fcomp = fopen(hf, "w+b");
|
||||
|
|
@ -4417,7 +4417,7 @@ if(gzread_pass_status)
|
|||
{
|
||||
uint64_t clen = seclen - 24;
|
||||
uint64_t uclen = fstReaderUint64(xc->f);
|
||||
unsigned char *ucdata = malloc(uclen);
|
||||
unsigned char *ucdata = (unsigned char *)malloc(uclen);
|
||||
unsigned char *pnt = ucdata;
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -4426,11 +4426,11 @@ if(gzread_pass_status)
|
|||
xc->longest_signal_value_len = 32; /* arbitrarily set at 32...this is much longer than an expanded double */
|
||||
|
||||
free(xc->process_mask);
|
||||
xc->process_mask = calloc(1, (xc->maxhandle+7)/8);
|
||||
xc->process_mask = (unsigned char *)calloc(1, (xc->maxhandle+7)/8);
|
||||
|
||||
if(clen != uclen)
|
||||
{
|
||||
unsigned char *cdata = malloc(clen);
|
||||
unsigned char *cdata = (unsigned char *)malloc(clen);
|
||||
unsigned long destlen = uclen;
|
||||
unsigned long sourcelen = clen;
|
||||
int rc;
|
||||
|
|
@ -4452,9 +4452,9 @@ if(gzread_pass_status)
|
|||
}
|
||||
|
||||
free(xc->signal_lens);
|
||||
xc->signal_lens = malloc(sizeof(uint32_t) * xc->maxhandle);
|
||||
xc->signal_lens = (uint32_t *)malloc(sizeof(uint32_t) * xc->maxhandle);
|
||||
free(xc->signal_typs);
|
||||
xc->signal_typs = malloc(sizeof(unsigned char) * xc->maxhandle);
|
||||
xc->signal_typs = (unsigned char *)malloc(sizeof(unsigned char) * xc->maxhandle);
|
||||
|
||||
for(i=0;i<xc->maxhandle;i++)
|
||||
{
|
||||
|
|
@ -4481,7 +4481,7 @@ if(gzread_pass_status)
|
|||
}
|
||||
|
||||
free(xc->temp_signal_value_buf);
|
||||
xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
|
||||
xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);
|
||||
|
||||
free(ucdata);
|
||||
}
|
||||
|
|
@ -4510,9 +4510,9 @@ if(gzread_pass_status)
|
|||
|
||||
xc->num_blackouts = fstReaderVarint32(xc->f);
|
||||
free(xc->blackout_times);
|
||||
xc->blackout_times = calloc(xc->num_blackouts, sizeof(uint64_t));
|
||||
xc->blackout_times = (uint64_t *)calloc(xc->num_blackouts, sizeof(uint64_t));
|
||||
free(xc->blackout_activity);
|
||||
xc->blackout_activity = calloc(xc->num_blackouts, sizeof(unsigned char));
|
||||
xc->blackout_activity = (unsigned char *)calloc(xc->num_blackouts, sizeof(unsigned char));
|
||||
|
||||
for(i=0;i<xc->num_blackouts;i++)
|
||||
{
|
||||
|
|
@ -4547,7 +4547,7 @@ return(hdr_seen);
|
|||
|
||||
void *fstReaderOpenForUtilitiesOnly(void)
|
||||
{
|
||||
struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext));
|
||||
struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext));
|
||||
|
||||
return(xc);
|
||||
}
|
||||
|
|
@ -4555,7 +4555,7 @@ return(xc);
|
|||
|
||||
void *fstReaderOpen(const char *nam)
|
||||
{
|
||||
struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext));
|
||||
struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext));
|
||||
|
||||
if((!nam)||(!(xc->f=fopen(nam, "rb"))))
|
||||
{
|
||||
|
|
@ -4565,7 +4565,7 @@ if((!nam)||(!(xc->f=fopen(nam, "rb"))))
|
|||
else
|
||||
{
|
||||
int flen = strlen(nam);
|
||||
char *hf = calloc(1, flen + 6);
|
||||
char *hf = (char *)calloc(1, flen + 6);
|
||||
int rc;
|
||||
|
||||
#if defined(__MINGW32__) || defined(FST_MACOSX)
|
||||
|
|
@ -4704,9 +4704,9 @@ uint32_t mc_mem_len; /* corresponds to largest value encountered in chain_table_
|
|||
|
||||
if(!xc) return(0);
|
||||
|
||||
scatterptr = calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
headptr = calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
length_remaining = calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
scatterptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
headptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
length_remaining = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
|
||||
if(fv)
|
||||
{
|
||||
|
|
@ -4768,7 +4768,7 @@ for(;;)
|
|||
|
||||
|
||||
mem_required_for_traversal = fstReaderUint64(xc->f);
|
||||
mem_for_traversal = malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */
|
||||
mem_for_traversal = (unsigned char *)malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */
|
||||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"sec: %u seclen: %d begtim: %d endtim: %d\n",
|
||||
secnum, (int)seclen, (int)beg_tim, (int)end_tim);
|
||||
|
|
@ -4794,7 +4794,7 @@ for(;;)
|
|||
(int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
|
||||
#endif
|
||||
if(tsec_clen > seclen) break; /* corrupted tsec_clen: by definition it can't be larger than size of section */
|
||||
ucdata = malloc(tsec_uclen);
|
||||
ucdata = (unsigned char *)malloc(tsec_uclen);
|
||||
if(!ucdata) break; /* malloc fail as tsec_uclen out of range from corrupted file */
|
||||
destlen = tsec_uclen;
|
||||
sourcelen = tsec_clen;
|
||||
|
|
@ -4803,7 +4803,7 @@ for(;;)
|
|||
|
||||
if(tsec_uclen != tsec_clen)
|
||||
{
|
||||
cdata = malloc(tsec_clen);
|
||||
cdata = (unsigned char *)malloc(tsec_clen);
|
||||
fstFread(cdata, tsec_clen, 1, xc->f);
|
||||
|
||||
rc = uncompress(ucdata, &destlen, cdata, sourcelen);
|
||||
|
|
@ -4822,7 +4822,7 @@ for(;;)
|
|||
}
|
||||
|
||||
free(time_table);
|
||||
time_table = calloc(tsec_nitems, sizeof(uint64_t));
|
||||
time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t));
|
||||
tpnt = ucdata;
|
||||
tpval = 0;
|
||||
for(ti=0;ti<tsec_nitems;ti++)
|
||||
|
|
@ -4833,7 +4833,7 @@ for(;;)
|
|||
tpnt += skiplen;
|
||||
}
|
||||
|
||||
tc_head = calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
|
||||
tc_head = (uint32_t *)calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
|
||||
free(ucdata);
|
||||
}
|
||||
|
||||
|
|
@ -4847,7 +4847,7 @@ for(;;)
|
|||
{
|
||||
if((beg_tim != time_table[0]) || (blocks_skipped))
|
||||
{
|
||||
unsigned char *mu = malloc(frame_uclen);
|
||||
unsigned char *mu = (unsigned char *)malloc(frame_uclen);
|
||||
uint32_t sig_offs = 0;
|
||||
|
||||
if(fv)
|
||||
|
|
@ -4857,7 +4857,7 @@ for(;;)
|
|||
|
||||
if(beg_tim)
|
||||
{
|
||||
wx_len = sprintf(wx_buf, "#%"PRIu64"\n", beg_tim);
|
||||
wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", beg_tim);
|
||||
fstWritex(xc, wx_buf, wx_len);
|
||||
}
|
||||
if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts))
|
||||
|
|
@ -4876,7 +4876,7 @@ for(;;)
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned char *mc = malloc(frame_clen);
|
||||
unsigned char *mc = (unsigned char *)malloc(frame_clen);
|
||||
int rc;
|
||||
|
||||
unsigned long destlen = frame_uclen;
|
||||
|
|
@ -5061,7 +5061,7 @@ for(;;)
|
|||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
|
||||
#endif
|
||||
chain_cmem = malloc(chain_clen);
|
||||
chain_cmem = (unsigned char *)malloc(chain_clen);
|
||||
if(!chain_cmem) goto block_err;
|
||||
fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
|
||||
fstFread(chain_cmem, chain_clen, 1, xc->f);
|
||||
|
|
@ -5072,8 +5072,8 @@ for(;;)
|
|||
free(chain_table_lengths);
|
||||
|
||||
vc_maxhandle_largest = vc_maxhandle;
|
||||
chain_table = calloc((vc_maxhandle+1), sizeof(off_t));
|
||||
chain_table_lengths = calloc((vc_maxhandle+1), sizeof(uint32_t));
|
||||
chain_table = (off_t *)calloc((vc_maxhandle+1), sizeof(off_t));
|
||||
chain_table_lengths = (uint32_t *)calloc((vc_maxhandle+1), sizeof(uint32_t));
|
||||
}
|
||||
|
||||
if(!chain_table || !chain_table_lengths) goto block_err;
|
||||
|
|
@ -5178,11 +5178,11 @@ for(;;)
|
|||
}
|
||||
|
||||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"decompressed chain idx len: %"PRIu32"\n", idx);
|
||||
fprintf(stderr, FST_APIMESS"decompressed chain idx len: %" PRIu32 "\n", idx);
|
||||
#endif
|
||||
|
||||
mc_mem_len = 16384;
|
||||
mc_mem = malloc(mc_mem_len); /* buffer for compressed reads */
|
||||
mc_mem = (unsigned char *)malloc(mc_mem_len); /* buffer for compressed reads */
|
||||
|
||||
/* check compressed VC data */
|
||||
if(idx > xc->maxhandle) idx = xc->maxhandle;
|
||||
|
|
@ -5212,7 +5212,7 @@ for(;;)
|
|||
if(mc_mem_len < chain_table_lengths[i])
|
||||
{
|
||||
free(mc_mem);
|
||||
mc_mem = malloc(mc_mem_len = chain_table_lengths[i]);
|
||||
mc_mem = (unsigned char *)malloc(mc_mem_len = chain_table_lengths[i]);
|
||||
}
|
||||
mc = mc_mem;
|
||||
|
||||
|
|
@ -5291,7 +5291,7 @@ for(;;)
|
|||
}
|
||||
}
|
||||
|
||||
wx_len = sprintf(wx_buf, "#%"PRIu64"\n", time_table[i]);
|
||||
wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", time_table[i]);
|
||||
fstWritex(xc, wx_buf, wx_len);
|
||||
|
||||
if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts))
|
||||
|
|
@ -5391,7 +5391,7 @@ for(;;)
|
|||
|
||||
vcdid_len = fstVcdIDForFwrite(vcd_id+1, idx+1);
|
||||
{
|
||||
unsigned char *vesc = malloc(len*4 + 1);
|
||||
unsigned char *vesc = (unsigned char *)malloc(len*4 + 1);
|
||||
int vlen = fstUtilityBinToEsc(vesc, vdata, len);
|
||||
fstWritex(xc, vesc, vlen);
|
||||
free(vesc);
|
||||
|
|
@ -5718,7 +5718,7 @@ if(!xc->rvat_sig_offs)
|
|||
{
|
||||
uint32_t cur_offs = 0;
|
||||
|
||||
xc->rvat_sig_offs = calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
xc->rvat_sig_offs = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||
for(i=0;i<xc->maxhandle;i++)
|
||||
{
|
||||
xc->rvat_sig_offs[i] = cur_offs;
|
||||
|
|
@ -5822,14 +5822,14 @@ tsec_nitems = fstReaderUint64(xc->f);
|
|||
fprintf(stderr, FST_APIMESS"time section unc: %d, com: %d (%d items)\n",
|
||||
(int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
|
||||
#endif
|
||||
ucdata = malloc(tsec_uclen);
|
||||
ucdata = (unsigned char *)malloc(tsec_uclen);
|
||||
destlen = tsec_uclen;
|
||||
sourcelen = tsec_clen;
|
||||
|
||||
fstReaderFseeko(xc, xc->f, -24 - ((off_t)tsec_clen), SEEK_CUR);
|
||||
if(tsec_uclen != tsec_clen)
|
||||
{
|
||||
cdata = malloc(tsec_clen);
|
||||
cdata = (unsigned char *)malloc(tsec_clen);
|
||||
fstFread(cdata, tsec_clen, 1, xc->f);
|
||||
|
||||
rc = uncompress(ucdata, &destlen, cdata, sourcelen);
|
||||
|
|
@ -5847,7 +5847,7 @@ if(tsec_uclen != tsec_clen)
|
|||
fstFread(ucdata, tsec_uclen, 1, xc->f);
|
||||
}
|
||||
|
||||
xc->rvat_time_table = calloc(tsec_nitems, sizeof(uint64_t));
|
||||
xc->rvat_time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t));
|
||||
tpnt = ucdata;
|
||||
tpval = 0;
|
||||
for(ti=0;ti<tsec_nitems;ti++)
|
||||
|
|
@ -5866,7 +5866,7 @@ fstReaderFseeko(xc, xc->f, blkpos+32, SEEK_SET);
|
|||
frame_uclen = fstReaderVarint64(xc->f);
|
||||
frame_clen = fstReaderVarint64(xc->f);
|
||||
xc->rvat_frame_maxhandle = fstReaderVarint64(xc->f);
|
||||
xc->rvat_frame_data = malloc(frame_uclen);
|
||||
xc->rvat_frame_data = (unsigned char *)malloc(frame_uclen);
|
||||
|
||||
if(frame_uclen == frame_clen)
|
||||
{
|
||||
|
|
@ -5874,7 +5874,7 @@ if(frame_uclen == frame_clen)
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned char *mc = malloc(frame_clen);
|
||||
unsigned char *mc = (unsigned char *)malloc(frame_clen);
|
||||
int rc;
|
||||
|
||||
unsigned long destlen = frame_uclen;
|
||||
|
|
@ -5907,12 +5907,12 @@ indx_pos = indx_pntr - chain_clen;
|
|||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
|
||||
#endif
|
||||
chain_cmem = malloc(chain_clen);
|
||||
chain_cmem = (unsigned char *)malloc(chain_clen);
|
||||
fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
|
||||
fstFread(chain_cmem, chain_clen, 1, xc->f);
|
||||
|
||||
xc->rvat_chain_table = calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t));
|
||||
xc->rvat_chain_table_lengths = calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t));
|
||||
xc->rvat_chain_table = (off_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t));
|
||||
xc->rvat_chain_table_lengths = (uint32_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t));
|
||||
|
||||
pnt = chain_cmem;
|
||||
idx = 0;
|
||||
|
|
@ -5921,10 +5921,10 @@ pval = 0;
|
|||
if(sectype == FST_BL_VCDATA_DYN_ALIAS2)
|
||||
{
|
||||
uint32_t prev_alias = 0;
|
||||
|
||||
|
||||
do {
|
||||
int skiplen;
|
||||
|
||||
|
||||
if(*pnt & 0x01)
|
||||
{
|
||||
int64_t shval = fstGetSVarint64(pnt, &skiplen) >> 1;
|
||||
|
|
@ -5939,7 +5939,7 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2)
|
|||
xc->rvat_chain_table[idx] = 0; /* need to explicitly zero as calloc above might not run */
|
||||
xc->rvat_chain_table_lengths[idx] = prev_alias = shval; /* because during this loop iter would give stale data! */
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xc->rvat_chain_table[idx] = 0; /* need to explicitly zero as calloc above might not run */
|
||||
|
|
@ -5950,14 +5950,14 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2)
|
|||
else
|
||||
{
|
||||
uint64_t val = fstGetVarint32(pnt, &skiplen);
|
||||
|
||||
|
||||
fstHandle loopcnt = val >> 1;
|
||||
for(i=0;i<loopcnt;i++)
|
||||
{
|
||||
xc->rvat_chain_table[idx++] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pnt += skiplen;
|
||||
} while (pnt != (chain_cmem + chain_clen));
|
||||
}
|
||||
|
|
@ -5967,7 +5967,7 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2)
|
|||
{
|
||||
int skiplen;
|
||||
uint64_t val = fstGetVarint32(pnt, &skiplen);
|
||||
|
||||
|
||||
if(!val)
|
||||
{
|
||||
pnt += skiplen;
|
||||
|
|
@ -5991,7 +5991,7 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2)
|
|||
xc->rvat_chain_table[idx++] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pnt += skiplen;
|
||||
} while (pnt != (chain_cmem + chain_clen));
|
||||
}
|
||||
|
|
@ -6016,7 +6016,7 @@ for(i=0;i<idx;i++)
|
|||
}
|
||||
|
||||
#ifdef FST_DEBUG
|
||||
fprintf(stderr, FST_APIMESS"decompressed chain idx len: %"PRIu32"\n", idx);
|
||||
fprintf(stderr, FST_APIMESS"decompressed chain idx len: %" PRIu32 "\n", idx);
|
||||
#endif
|
||||
|
||||
xc->rvat_data_valid = 1;
|
||||
|
|
@ -6054,8 +6054,8 @@ if(!xc->rvat_chain_mem)
|
|||
xc->rvat_chain_len = fstReaderVarint32WithSkip(xc->f, &skiplen);
|
||||
if(xc->rvat_chain_len)
|
||||
{
|
||||
unsigned char *mu = malloc(xc->rvat_chain_len);
|
||||
unsigned char *mc = malloc(xc->rvat_chain_table_lengths[facidx]);
|
||||
unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len);
|
||||
unsigned char *mc = (unsigned char *)malloc(xc->rvat_chain_table_lengths[facidx]);
|
||||
unsigned long destlen = xc->rvat_chain_len;
|
||||
unsigned long sourcelen = xc->rvat_chain_table_lengths[facidx];
|
||||
int rc = Z_OK;
|
||||
|
|
@ -6086,7 +6086,7 @@ if(!xc->rvat_chain_mem)
|
|||
else
|
||||
{
|
||||
int destlen = xc->rvat_chain_table_lengths[facidx] - skiplen;
|
||||
unsigned char *mu = malloc(xc->rvat_chain_len = destlen);
|
||||
unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len = destlen);
|
||||
fstFread(mu, destlen, 1, xc->f);
|
||||
/* data to process is for(j=0;j<destlen;j++) in mu[j] */
|
||||
xc->rvat_chain_mem = mu;
|
||||
|
|
@ -6387,17 +6387,17 @@ static uint32_t j_hash(const uint8_t *k, uint32_t length, uint32_t initval)
|
|||
c += length;
|
||||
switch(len) /* all the case statements fall through */
|
||||
{
|
||||
case 11: c+=((uint32_t)k[10]<<24);
|
||||
case 10: c+=((uint32_t)k[9]<<16);
|
||||
case 9 : c+=((uint32_t)k[8]<<8);
|
||||
case 11: c+=((uint32_t)k[10]<<24); /* fallthrough */
|
||||
case 10: c+=((uint32_t)k[9]<<16); /* fallthrough */
|
||||
case 9 : c+=((uint32_t)k[8]<<8); /* fallthrough */
|
||||
/* the first byte of c is reserved for the length */
|
||||
case 8 : b+=((uint32_t)k[7]<<24);
|
||||
case 7 : b+=((uint32_t)k[6]<<16);
|
||||
case 6 : b+=((uint32_t)k[5]<<8);
|
||||
case 5 : b+=k[4];
|
||||
case 4 : a+=((uint32_t)k[3]<<24);
|
||||
case 3 : a+=((uint32_t)k[2]<<16);
|
||||
case 2 : a+=((uint32_t)k[1]<<8);
|
||||
case 8 : b+=((uint32_t)k[7]<<24); /* fallthrough */
|
||||
case 7 : b+=((uint32_t)k[6]<<16); /* fallthrough */
|
||||
case 6 : b+=((uint32_t)k[5]<<8); /* fallthrough */
|
||||
case 5 : b+=k[4]; /* fallthrough */
|
||||
case 4 : a+=((uint32_t)k[3]<<24); /* fallthrough */
|
||||
case 3 : a+=((uint32_t)k[2]<<16); /* fallthrough */
|
||||
case 2 : a+=((uint32_t)k[1]<<8); /* fallthrough */
|
||||
case 1 : a+=k[0];
|
||||
/* case 0: nothing left to add */
|
||||
}
|
||||
|
|
@ -6432,7 +6432,7 @@ struct collchain_t *chain, *pchain;
|
|||
|
||||
if(!*base)
|
||||
{
|
||||
*base = calloc(1, (hashmask + 1) * sizeof(void *));
|
||||
*base = (struct collchain_t **)calloc(1, (hashmask + 1) * sizeof(void *));
|
||||
}
|
||||
ar = *base;
|
||||
|
||||
|
|
@ -6455,7 +6455,7 @@ while(chain)
|
|||
chain = chain->next;
|
||||
}
|
||||
|
||||
chain = calloc(1, sizeof(struct collchain_t) + length - 1);
|
||||
chain = (struct collchain_t *)calloc(1, sizeof(struct collchain_t) + length - 1);
|
||||
memcpy(chain->mem, mem, length);
|
||||
chain->fullhash = hf;
|
||||
chain->length = length;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ if (lo<hi)
|
|||
|
||||
static void wave_msort(struct lxt2_wr_symbol **a, int num)
|
||||
{
|
||||
struct lxt2_wr_symbol **b = malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
|
||||
struct lxt2_wr_symbol **b = (struct lxt2_wr_symbol**)malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
|
||||
|
||||
wave_mergesort(a, b, 0, num-1);
|
||||
|
||||
|
|
@ -583,7 +583,7 @@ unsigned int i;
|
|||
if((lt)&&(lt->numfacs))
|
||||
{
|
||||
struct lxt2_wr_symbol *s = lt->symchain;
|
||||
struct lxt2_wr_symbol **aliascache = calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
|
||||
struct lxt2_wr_symbol **aliascache = (struct lxt2_wr_symbol**)calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
|
||||
unsigned int aliases_encountered, facs_encountered;
|
||||
|
||||
lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *));
|
||||
|
|
@ -920,7 +920,7 @@ if(flags&LXT2_WR_SYM_F_DOUBLE)
|
|||
s->len = 32;
|
||||
}
|
||||
|
||||
s->value = malloc(s->len + 1);
|
||||
s->value = (char*)malloc(s->len + 1);
|
||||
memset(s->value, lt->initial_value, s->len);
|
||||
s->value[s->len]=0;
|
||||
|
||||
|
|
@ -1017,7 +1017,7 @@ static void lxt2_wr_emit_do_breakfile(struct lxt2_wr_trace *lt)
|
|||
{
|
||||
unsigned int len = strlen(lt->lxtname);
|
||||
int i;
|
||||
char *tname = malloc(len + 30);
|
||||
char *tname = (char*)malloc(len + 30);
|
||||
FILE *f2, *clone;
|
||||
off_t cnt, seg;
|
||||
char buf[32768];
|
||||
|
|
@ -1810,13 +1810,13 @@ while(s->aliased_to) /* find root alias if exists */
|
|||
valuelen = strlen(value); /* ensure string is proper length */
|
||||
if(valuelen == s->len)
|
||||
{
|
||||
vfix = wave_alloca(s->len+1);
|
||||
vfix = (char*)wave_alloca(s->len+1);
|
||||
strcpy(vfix, value);
|
||||
value = vfix;
|
||||
}
|
||||
else
|
||||
{
|
||||
vfix = wave_alloca(s->len+1);
|
||||
vfix = (char*)wave_alloca(s->len+1);
|
||||
|
||||
if(valuelen < s->len)
|
||||
{
|
||||
|
|
@ -2088,7 +2088,7 @@ if((lt)&&(lt->blackout))
|
|||
else
|
||||
{
|
||||
free(s->value);
|
||||
s->value = calloc(1, 1*sizeof(char));
|
||||
s->value = (char*)calloc(1, 1*sizeof(char));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2101,9 +2101,11 @@ if((lt)&&(lt->blackout))
|
|||
{
|
||||
if((!(s->flags&LXT2_WR_SYM_F_ALIAS))&&(s->rows<2))
|
||||
{
|
||||
char tmp[16]; /* To get rid of the warning */
|
||||
if(!(s->flags&(LXT2_WR_SYM_F_DOUBLE|LXT2_WR_SYM_F_STRING)))
|
||||
{
|
||||
lxt2_wr_emit_value_bit_string(lt, s, 0, "x");
|
||||
strcpy(tmp, "x");
|
||||
lxt2_wr_emit_value_bit_string(lt, s, 0, tmp);
|
||||
}
|
||||
else if (s->flags&LXT2_WR_SYM_F_DOUBLE)
|
||||
{
|
||||
|
|
@ -2113,7 +2115,8 @@ if((lt)&&(lt->blackout))
|
|||
}
|
||||
else if (s->flags&LXT2_WR_SYM_F_STRING)
|
||||
{
|
||||
lxt2_wr_emit_value_string(lt, s, 0, "UNDEF");
|
||||
strcpy(tmp, "UNDEF");
|
||||
lxt2_wr_emit_value_string(lt, s, 0, tmp);
|
||||
}
|
||||
}
|
||||
s=s->symchain;
|
||||
|
|
@ -2202,4 +2205,3 @@ if(lt)
|
|||
lt->timezero = timeval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ extern "C" {
|
|||
#define ftello ftell
|
||||
#endif
|
||||
|
||||
#include <wavealloca.h>
|
||||
#include "wavealloca.h"
|
||||
|
||||
#define LXT2_WR_HDRID (0x1380)
|
||||
#define LXT2_WR_VERSION (0x0001)
|
||||
|
|
@ -314,4 +314,3 @@ int lxt2_wr_emit_value_bit_string(struct lxt2_wr_trace *lt, struct lxt2_wr_sy
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@ static const int LZ4_minLength = (MFLIMIT+1);
|
|||
#define GB *(1U<<30)
|
||||
|
||||
#define MAXD_LOG 16
|
||||
#ifdef MAX_DISTANCE
|
||||
#undef MAX_DISTANCE
|
||||
#endif
|
||||
#define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
|
||||
|
||||
#define ML_BITS 4
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) Tony Bybell 1999.
|
||||
* Copyright (c) 1999 Tony Bybell.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef WAVE_ALLOCA_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue