diff --git a/include/gtkwave/fstapi.c b/include/gtkwave/fstapi.c index 6b6adefc5..7bc7fd821 100644 --- a/include/gtkwave/fstapi.c +++ b/include/gtkwave/fstapi.c @@ -130,6 +130,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3 #define FST_HDR_TIMEZERO_SIZE (8) #define FST_GZIO_LEN (32768) #define FST_HDR_FOURPACK_DUO_SIZE (4*1024*1024) +#define FST_ZWRAPPER_HDR_SIZE (1+8+8) #if defined(__APPLE__) && defined(__MACH__) #define FST_MACOSX @@ -4633,9 +4634,14 @@ if(sectype == FST_BL_ZWRAPPER) } #endif - fstReaderFseeko(xc, xc->f, 1+8+8, SEEK_SET); + fstReaderFseeko(xc, xc->f, FST_ZWRAPPER_HDR_SIZE, SEEK_SET); #ifndef __MINGW32__ fflush(xc->f); +#else + /* Windows UCRT runtime library reads one byte ahead in the file + even with buffering disabled and does not synchronise the + file position after fseek. */ + _lseek(fileno(xc->f), FST_ZWRAPPER_HDR_SIZE, SEEK_SET); #endif zfd = dup(fileno(xc->f)); @@ -6185,7 +6191,9 @@ struct fstReaderContext *xc = (struct fstReaderContext *)ctx; fst_off_t blkpos = 0, prev_blkpos; uint64_t beg_tim, end_tim, beg_tim2, end_tim2; int sectype; +#ifdef FST_DEBUG unsigned int secnum = 0; +#endif uint64_t seclen; uint64_t tsec_uclen = 0, tsec_clen = 0; uint64_t tsec_nitems; @@ -6277,7 +6285,9 @@ for(;;) } blkpos += seclen; +#ifdef FST_DEBUG secnum++; +#endif } xc->rvat_beg_tim = beg_tim;