Imported Upstream version 3.3.59
أحمد المحمودي (Ahmed El-Mahmoudy)
10 years ago
1460 | 1460 | Change [1] at end of struct to C99 [] notation with appropriate |
1461 | 1461 | allocation size modification. |
1462 | 1462 | System_profiler speed fix for OSX. |
1463 | 3.3.59 26apr14 Use Duff's Device for 8 byte -> 1 byte binary value compression | |
1464 | algorithm in FST writer. | |
1465 | Warnings fixes from cppcheck. | |
1466 | Moved MinGW for FST to using different windows tempfile | |
1467 | generation instead of tmpfile(). | |
1468 | Removed fflush() in FST for MinGW in places that can cause | |
1469 | crashes with read only files. | |
1470 | Updated man page for gtkwave.1 indicating that XID is in hex. | |
1471 | Allow decimal conversions on popcnt filtered vectors that are | |
1472 | greater than 64 bits (they will never overflow). |
0 | 0 | ########################################################################## |
1 | 1 | |
2 | GTKWave 3.3.58 Wave Viewer is Copyright (C) 1999-2014 Tony Bybell. | |
2 | GTKWave 3.3.59 Wave Viewer is Copyright (C) 1999-2014 Tony Bybell. | |
3 | 3 | Portions of GTKWave are Copyright (C) 1999-2014 Udi Finkelstein. |
4 | 4 | Context support is Copyright (C) 2007-2014 Kermin Elliott Fleming. |
5 | 5 | Trace group support is Copyright (C) 2009-2014 Donald Baltus. |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.69 for gtkwave 3.3.58. | |
2 | # Generated by GNU Autoconf 2.69 for gtkwave 3.3.59. | |
3 | 3 | # |
4 | 4 | # Report bugs to <bybell@rocketmail.com>. |
5 | 5 | # |
579 | 579 | # Identity of this package. |
580 | 580 | PACKAGE_NAME='gtkwave' |
581 | 581 | PACKAGE_TARNAME='gtkwave' |
582 | PACKAGE_VERSION='3.3.58' | |
583 | PACKAGE_STRING='gtkwave 3.3.58' | |
582 | PACKAGE_VERSION='3.3.59' | |
583 | PACKAGE_STRING='gtkwave 3.3.59' | |
584 | 584 | PACKAGE_BUGREPORT='bybell@rocketmail.com' |
585 | 585 | PACKAGE_URL='' |
586 | 586 | |
1381 | 1381 | # Omit some internal or obsolete options to make the list less imposing. |
1382 | 1382 | # This message is too long to be a string in the A/UX 3.1 sh. |
1383 | 1383 | cat <<_ACEOF |
1384 | \`configure' configures gtkwave 3.3.58 to adapt to many kinds of systems. | |
1384 | \`configure' configures gtkwave 3.3.59 to adapt to many kinds of systems. | |
1385 | 1385 | |
1386 | 1386 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1387 | 1387 | |
1447 | 1447 | |
1448 | 1448 | if test -n "$ac_init_help"; then |
1449 | 1449 | case $ac_init_help in |
1450 | short | recursive ) echo "Configuration of gtkwave 3.3.58:";; | |
1450 | short | recursive ) echo "Configuration of gtkwave 3.3.59:";; | |
1451 | 1451 | esac |
1452 | 1452 | cat <<\_ACEOF |
1453 | 1453 | |
1592 | 1592 | test -n "$ac_init_help" && exit $ac_status |
1593 | 1593 | if $ac_init_version; then |
1594 | 1594 | cat <<\_ACEOF |
1595 | gtkwave configure 3.3.58 | |
1595 | gtkwave configure 3.3.59 | |
1596 | 1596 | generated by GNU Autoconf 2.69 |
1597 | 1597 | |
1598 | 1598 | Copyright (C) 2012 Free Software Foundation, Inc. |
2236 | 2236 | This file contains any messages produced by compilers while |
2237 | 2237 | running configure, to aid debugging if configure makes a mistake. |
2238 | 2238 | |
2239 | It was created by gtkwave $as_me 3.3.58, which was | |
2239 | It was created by gtkwave $as_me 3.3.59, which was | |
2240 | 2240 | generated by GNU Autoconf 2.69. Invocation command line was |
2241 | 2241 | |
2242 | 2242 | $ $0 $@ |
3103 | 3103 | |
3104 | 3104 | # Define the identity of the package. |
3105 | 3105 | PACKAGE='gtkwave' |
3106 | VERSION='3.3.58' | |
3106 | VERSION='3.3.59' | |
3107 | 3107 | |
3108 | 3108 | |
3109 | 3109 | cat >>confdefs.h <<_ACEOF |
10958 | 10958 | # report actual input values of CONFIG_FILES etc. instead of their |
10959 | 10959 | # values after options handling. |
10960 | 10960 | ac_log=" |
10961 | This file was extended by gtkwave $as_me 3.3.58, which was | |
10961 | This file was extended by gtkwave $as_me 3.3.59, which was | |
10962 | 10962 | generated by GNU Autoconf 2.69. Invocation command line was |
10963 | 10963 | |
10964 | 10964 | CONFIG_FILES = $CONFIG_FILES |
11024 | 11024 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
11025 | 11025 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
11026 | 11026 | ac_cs_version="\\ |
11027 | gtkwave config.status 3.3.58 | |
11027 | gtkwave config.status 3.3.59 | |
11028 | 11028 | configured by $0, generated by GNU Autoconf 2.69, |
11029 | 11029 | with options \\"\$ac_cs_config\\" |
11030 | 11030 |
1 | 1 | # Process this file with autoconf to produce a configure script. |
2 | 2 | |
3 | 3 | AC_PREREQ(2.59) |
4 | AC_INIT(gtkwave, 3.3.58, bybell@rocketmail.com) | |
4 | AC_INIT(gtkwave, 3.3.59, bybell@rocketmail.com) | |
5 | 5 | AC_CONFIG_SRCDIR([src/vcd.c]) |
6 | 6 | AM_INIT_AUTOMAKE |
7 | 7 | AC_CONFIG_HEADER([config.h]) |
7 | 7 | <key>CFBundleExecutable</key> |
8 | 8 | <string>gtkwave</string> |
9 | 9 | <key>CFBundleGetInfoString</key> |
10 | <string>3.3.58, (C) 1999-2014 Tony Bybell http://gtkwave.sourceforge.net</string> | |
10 | <string>3.3.59, (C) 1999-2014 Tony Bybell http://gtkwave.sourceforge.net</string> | |
11 | 11 | <key>CFBundleIconFile</key> |
12 | 12 | <string>gtkwave.icns</string> |
13 | 13 | <key>CFBundleIdentifier</key> |
17 | 17 | <key>CFBundlePackageType</key> |
18 | 18 | <string>APPL</string> |
19 | 19 | <key>CFBundleShortVersionString</key> |
20 | <string>3.3.58</string> | |
20 | <string>3.3.59</string> | |
21 | 21 | <key>CFBundleSignature</key> |
22 | 22 | <string>????</string> |
23 | 23 | <key>CFBundleVersion</key> |
24 | <string>3.3.58</string> | |
24 | <string>3.3.59</string> | |
25 | 25 | <key>NSHumanReadableCopyright</key> |
26 | 26 | <string>Copyright 1999 - 2014 Tony Bybell, GNU General Public License.</string> |
27 | 27 | <key>LSMinimumSystemVersion</key> |
Binary diff not shown
0 | .TH "GTKWAVE" "1" "3.3.29" "Anthony Bybell" "Simulation Wave Viewer" | |
0 | .TH "GTKWAVE" "1" "3.3.59" "Anthony Bybell" "Simulation Wave Viewer" | |
1 | 1 | .SH "NAME" |
2 | 2 | .LP |
3 | 3 | gtkwave \- Visualization tool for VCD, LXT, LXT2, VZT, FST, and GHW files |
93 | 93 | Specifies delay in milliseconds between successive executions of the repscript. Default is 500. |
94 | 94 | .TP |
95 | 95 | \fB\-X\fR,\fB\-\-xid\fR <\fIXID\fP> |
96 | Specify XID of window for a GtkPlug to connect to. GTKWave does not directly render to a window but instead renders into a | |
96 | Specify XID (in hexadecimal) of window for a GtkPlug to connect to. GTKWave does not directly render to a window but instead renders into a | |
97 | 97 | GtkPlug expecting a GtkSocket at the other end. Note that there are issues with accelerators working properly so menus are |
98 | 98 | disabled in the componentized version of GTKWave when it functions as a plug-in. |
99 | 99 | .TP |
329 | 329 | if(GLOBALS->show_base) { *(pnt++)='"'; } |
330 | 330 | *(pnt)=0x00; /* scan build : remove dead increment */ |
331 | 331 | } |
332 | else if((flags&TR_HEX)||((flags&(TR_DEC|TR_SIGNED))&&(nbits>64))) | |
332 | else if((flags&TR_HEX)||((flags&(TR_DEC|TR_SIGNED))&&(nbits>64)&&(!(flags&TR_POPCNT)))) | |
333 | 333 | { |
334 | 334 | char *parse; |
335 | 335 | |
989 | 989 | if(GLOBALS->show_base) { *(pnt++)='"'; } |
990 | 990 | *(pnt)=0x00; /* scan build : remove dead increment */ |
991 | 991 | } |
992 | else if((flags&TR_HEX)||((flags&(TR_DEC|TR_SIGNED))&&(nbits>64))) | |
992 | else if((flags&TR_HEX)||((flags&(TR_DEC|TR_SIGNED))&&(nbits>64)&&(!(flags&TR_POPCNT)))) | |
993 | 993 | { |
994 | 994 | char *parse; |
995 | 995 |
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
176 | sprintf(lpstrFilter, "%s%c%s%c%s%c%s%c", pattn, 0, pattn, 0, "All", 0, "*.*"); | |
176 | sprintf(lpstrFilter, "%s%c%s%c%s%c%s%c", pattn, 0, pattn, 0, "All", 0, "*.*", 0); /* cppcheck */ | |
177 | 177 | ofn.nFilterIndex = 0; |
178 | 178 | } |
179 | 179 |
523 | 523 | e->wkt = ghw_wkt_unknown; |
524 | 524 | e->name = ghw_read_strid (h); |
525 | 525 | if (ghw_read_uleb128 (h, (uint32_t *)&e->nbr) != 0) |
526 | return -1; | |
526 | { | |
527 | free(e); /* cppcheck */ | |
528 | return -1; | |
529 | } | |
527 | 530 | e->lits = (const char **) calloc (1, e->nbr * sizeof (char *)); |
528 | 531 | if (h->flag_verbose > 1) |
529 | 532 | printf ("enum %s:", e->name); |
567 | 570 | int ix; |
568 | 571 | |
569 | 572 | if (ghw_read_uleb128 (h, &ph->nbr_units) != 0) |
570 | return -1; | |
573 | { | |
574 | free(ph); /* cppcheck */ | |
575 | return -1; | |
576 | } | |
571 | 577 | ph->units = calloc (ph->nbr_units, sizeof (struct ghw_unit)); |
572 | 578 | for (ix = 0; ix < ph->nbr_units; ix++) |
573 | 579 | { |
574 | 580 | ph->units[ix].name = ghw_read_strid (h); |
575 | 581 | if (ghw_read_lsleb128 (h, &ph->units[ix].val) < 0) |
576 | return -1; | |
582 | { | |
583 | free(ph->units); /* missed by cppcheck */ | |
584 | free(ph); /* missed by cppcheck */ | |
585 | return -1; | |
586 | } | |
577 | 587 | } |
578 | 588 | } |
579 | 589 | if (h->flag_verbose > 1) |
605 | 615 | arr->name = ghw_read_strid (h); |
606 | 616 | arr->el = ghw_read_typeid (h); |
607 | 617 | if (ghw_read_uleb128 (h, (uint32_t *)&arr->nbr_dim) != 0) |
608 | return -1; | |
618 | { | |
619 | free(arr); /* cppcheck */ | |
620 | return -1; | |
621 | } | |
609 | 622 | arr->dims = (union ghw_type **) |
610 | 623 | calloc (arr->nbr_dim, sizeof (union ghw_type *)); |
611 | 624 | for (j = 0; j < arr->nbr_dim; j++) |
649 | 662 | rec->kind = t; |
650 | 663 | rec->name = ghw_read_strid (h); |
651 | 664 | if (ghw_read_uleb128 (h, (uint32_t *)&rec->nbr_fields) != 0) |
652 | return -1; | |
665 | { | |
666 | free(rec); /* cppcheck */ | |
667 | return -1; | |
668 | } | |
653 | 669 | rec->el = calloc |
654 | 670 | (rec->nbr_fields, sizeof (struct ghw_record_element)); |
655 | 671 | nbr_el = 0; |
25 | 25 | * FST_DYNAMIC_ALIAS_DISABLE : dynamic aliases are not processed |
26 | 26 | * FST_DYNAMIC_ALIAS2_DISABLE : new encoding for dynamic aliases is not generated |
27 | 27 | * FST_WRITEX_DISABLE : fast write I/O routines are disabled |
28 | * FST_DISABLE_DUFFS_DEVICE : only if indirect branches are incredibly bad on host arch | |
28 | 29 | * |
29 | 30 | * possible enables: |
30 | 31 | * |
48 | 49 | |
49 | 50 | #ifdef FST_WRITER_PARALLEL |
50 | 51 | #include <pthread.h> |
52 | #endif | |
53 | ||
54 | #ifdef __MINGW32__ | |
55 | #include <windows.h> | |
51 | 56 | #endif |
52 | 57 | |
53 | 58 | #if HAVE_ALLOCA_H |
138 | 143 | #endif |
139 | 144 | #endif |
140 | 145 | |
141 | ||
142 | /* the recoded "extra" values... */ | |
146 | /* | |
147 | * the recoded "extra" values... | |
148 | * note that FST_RCV_Q is currently unused and is for future expansion. | |
149 | * its intended use is as another level of escape such that any arbitrary | |
150 | * value can be stored as the value: { time_delta, 8 bits, FST_RCV_Q }. | |
151 | * this is currently not implemented so that the branchless decode is: | |
152 | * uint32_t shcnt = 2 << (vli & 1); tdelta = vli >> shcnt; | |
153 | */ | |
143 | 154 | #define FST_RCV_X (1 | (0<<1)) |
144 | 155 | #define FST_RCV_Z (1 | (1<<1)) |
145 | 156 | #define FST_RCV_H (1 | (2<<1)) |
147 | 158 | #define FST_RCV_W (1 | (4<<1)) |
148 | 159 | #define FST_RCV_L (1 | (5<<1)) |
149 | 160 | #define FST_RCV_D (1 | (6<<1)) |
161 | #define FST_RCV_Q (1 | (7<<1)) | |
150 | 162 | |
151 | 163 | #define FST_RCV_STR "xzhuwl-?" |
152 | 164 | /* 01234567 */ |
160 | 172 | unlink(nam); |
161 | 173 | return(fopen(nam, mode)); |
162 | 174 | } |
175 | ||
176 | ||
177 | /* | |
178 | * system-specific temp file handling | |
179 | */ | |
180 | #ifdef __MINGW32__ | |
181 | ||
182 | static FILE* tmpfile_open(char **nam) | |
183 | { | |
184 | char *fname = NULL; | |
185 | TCHAR szTempFileName[MAX_PATH]; | |
186 | TCHAR lpTempPathBuffer[MAX_PATH]; | |
187 | DWORD dwRetVal = 0; | |
188 | UINT uRetVal = 0; | |
189 | FILE *fh = NULL; | |
190 | ||
191 | dwRetVal = GetTempPath(MAX_PATH, lpTempPathBuffer); | |
192 | if((dwRetVal > MAX_PATH) || (dwRetVal == 0)) | |
193 | { | |
194 | fprintf(stderr, "GetTempPath() failed in "__FILE__" line %d, exiting.\n", __LINE__); | |
195 | exit(255); | |
196 | } | |
197 | else | |
198 | { | |
199 | uRetVal = GetTempFileName(lpTempPathBuffer, TEXT("FSTW"), 0, szTempFileName); | |
200 | if (uRetVal == 0) | |
201 | { | |
202 | fprintf(stderr, "GetTempFileName() failed in "__FILE__" line %d, exiting.\n", __LINE__); | |
203 | exit(255); | |
204 | } | |
205 | else | |
206 | { | |
207 | fname = strdup(szTempFileName); | |
208 | } | |
209 | } | |
210 | ||
211 | if(fname) | |
212 | { | |
213 | if(nam) { *nam = fname; } | |
214 | fh = unlink_fopen("fname", "w+b"); | |
215 | } | |
216 | ||
217 | return(fh); | |
218 | } | |
219 | ||
220 | #else | |
221 | ||
222 | static FILE* tmpfile_open(char **nam) | |
223 | { | |
224 | FILE *f = tmpfile(); /* replace with mkstemp() + fopen(), etc if this is not good enough */ | |
225 | if(nam) { *nam = NULL; } | |
226 | return(f); | |
227 | } | |
228 | ||
229 | #endif | |
230 | ||
231 | ||
232 | static void tmpfile_close(FILE **f, char **nam) | |
233 | { | |
234 | if(f) | |
235 | { | |
236 | if(*f) { fclose(*f); *f = NULL; } | |
237 | } | |
238 | ||
239 | if(nam) | |
240 | { | |
241 | if(*nam) | |
242 | { | |
243 | unlink(*nam); | |
244 | free(*nam); | |
245 | *nam = NULL; | |
246 | } | |
247 | } | |
248 | } | |
249 | ||
250 | /*****************************************/ | |
163 | 251 | |
164 | 252 | |
165 | 253 | /* |
693 | 781 | uint32_t path_array_count; |
694 | 782 | |
695 | 783 | unsigned fseek_failed : 1; |
784 | ||
785 | char *geom_handle_nam; | |
786 | char *valpos_handle_nam; | |
787 | char *curval_handle_nam; | |
788 | char *tchn_handle_nam; | |
696 | 789 | }; |
697 | 790 | |
698 | 791 | |
1009 | 1102 | xc->compress_hier = use_compressed_hier; |
1010 | 1103 | fstDetermineBreakSize(xc); |
1011 | 1104 | |
1012 | if((!nam)||(!(xc->handle=unlink_fopen(nam, "w+b")))) | |
1105 | if((!nam)|| | |
1106 | (!(xc->handle=unlink_fopen(nam, "w+b")))) | |
1013 | 1107 | { |
1014 | 1108 | free(xc); |
1015 | 1109 | xc=NULL; |
1023 | 1117 | strcpy(hf + flen, ".hier"); |
1024 | 1118 | xc->hier_handle = unlink_fopen(hf, "w+b"); |
1025 | 1119 | |
1026 | xc->geom_handle = tmpfile(); /* .geom */ | |
1027 | xc->valpos_handle = tmpfile(); /* .offs */ | |
1028 | xc->curval_handle = tmpfile(); /* .bits */ | |
1029 | xc->tchn_handle = tmpfile(); /* .tchn */ | |
1120 | xc->geom_handle = tmpfile_open(&xc->geom_handle_nam); /* .geom */ | |
1121 | xc->valpos_handle = tmpfile_open(&xc->valpos_handle_nam); /* .offs */ | |
1122 | xc->curval_handle = tmpfile_open(&xc->curval_handle_nam); /* .bits */ | |
1123 | xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* .tchn */ | |
1030 | 1124 | xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size; |
1031 | 1125 | xc->vchg_mem = malloc(xc->vchg_alloc_siz); |
1032 | 1126 | |
1033 | free(hf); | |
1034 | 1127 | if(xc->hier_handle && xc->geom_handle && xc->valpos_handle && xc->curval_handle && xc->vchg_mem && xc->tchn_handle) |
1035 | 1128 | { |
1036 | 1129 | xc->filename = strdup(nam); |
1046 | 1139 | } |
1047 | 1140 | else |
1048 | 1141 | { |
1049 | if(xc->hier_handle) fclose(xc->hier_handle); | |
1050 | if(xc->geom_handle) fclose(xc->geom_handle); | |
1051 | if(xc->valpos_handle) fclose(xc->valpos_handle); | |
1052 | if(xc->curval_handle) fclose(xc->curval_handle); | |
1053 | if(xc->tchn_handle) fclose(xc->tchn_handle); | |
1142 | fclose(xc->handle); | |
1143 | if(xc->hier_handle) { fclose(xc->hier_handle); unlink(hf); } | |
1144 | tmpfile_close(&xc->geom_handle, &xc->geom_handle_nam); | |
1145 | tmpfile_close(&xc->valpos_handle, &xc->valpos_handle_nam); | |
1146 | tmpfile_close(&xc->curval_handle, &xc->curval_handle_nam); | |
1147 | tmpfile_close(&xc->tchn_handle, &xc->tchn_handle_nam); | |
1054 | 1148 | free(xc->vchg_mem); |
1055 | 1149 | free(xc); |
1056 | 1150 | xc=NULL; |
1057 | 1151 | } |
1152 | ||
1153 | free(hf); | |
1058 | 1154 | } |
1059 | 1155 | |
1060 | 1156 | return(xc); |
1160 | 1256 | #endif |
1161 | 1257 | #endif |
1162 | 1258 | |
1163 | if((!xc)||(xc->vchg_siz <= 1)||(xc->already_in_flush)) return; | |
1259 | if((xc->vchg_siz <= 1)||(xc->already_in_flush)) return; | |
1164 | 1260 | xc->already_in_flush = 1; /* should really do this with a semaphore */ |
1165 | 1261 | |
1166 | 1262 | xc->section_header_only = 0; |
1290 | 1386 | if(is_binary) |
1291 | 1387 | { |
1292 | 1388 | unsigned char acc = 0; |
1389 | #ifdef FST_DISABLE_DUFFS_DEVICE | |
1390 | /* old algorithm */ | |
1293 | 1391 | int shift = 7 - ((vm4ip[1]-1) & 7); |
1294 | 1392 | for(idx=vm4ip[1]-1;idx>=0;idx--) |
1295 | 1393 | { |
1302 | 1400 | acc = 0; |
1303 | 1401 | } |
1304 | 1402 | } |
1403 | #else | |
1404 | /* new algorithm */ | |
1405 | idx = ((vm4ip[1]+7) & ~7); | |
1406 | switch(vm4ip[1] & 7) | |
1407 | { | |
1408 | case 0: do { acc = (pnt[idx+7-8] & 1) << 0; | |
1409 | case 7: acc |= (pnt[idx+6-8] & 1) << 1; | |
1410 | case 6: acc |= (pnt[idx+5-8] & 1) << 2; | |
1411 | case 5: acc |= (pnt[idx+4-8] & 1) << 3; | |
1412 | case 4: acc |= (pnt[idx+3-8] & 1) << 4; | |
1413 | case 3: acc |= (pnt[idx+2-8] & 1) << 5; | |
1414 | case 2: acc |= (pnt[idx+1-8] & 1) << 6; | |
1415 | case 1: acc |= (pnt[idx+0-8] & 1) << 7; | |
1416 | *(--scratchpnt) = acc; | |
1417 | idx -= 8; | |
1418 | } while(idx); | |
1419 | } | |
1420 | #endif | |
1305 | 1421 | |
1306 | 1422 | scratchpnt = fstCopyVarint32ToLeft(scratchpnt, (time_delta << 1)); |
1307 | 1423 | } |
1659 | 1775 | #endif |
1660 | 1776 | free(xc->valpos_mem); |
1661 | 1777 | free(xc->vchg_mem); |
1662 | fclose(xc->tchn_handle); | |
1778 | tmpfile_close(&xc->tchn_handle, &xc->tchn_handle_nam); | |
1663 | 1779 | free(xc); |
1664 | 1780 | |
1665 | 1781 | return(NULL); |
1702 | 1818 | } |
1703 | 1819 | |
1704 | 1820 | xc->tchn_cnt = xc->tchn_idx = 0; |
1705 | xc->tchn_handle = tmpfile(); | |
1821 | xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* child thread will deallocate file/name */ | |
1706 | 1822 | fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET); |
1707 | 1823 | fstFtruncate(fileno(xc->tchn_handle), 0); |
1708 | 1824 | |
1974 | 2090 | fstWriterUint64(xc->handle, xc->secnum); |
1975 | 2091 | fflush(xc->handle); |
1976 | 2092 | |
1977 | if(xc->tchn_handle) { fclose(xc->tchn_handle); xc->tchn_handle = NULL; } | |
2093 | tmpfile_close(&xc->tchn_handle, &xc->tchn_handle_nam); | |
1978 | 2094 | free(xc->vchg_mem); xc->vchg_mem = NULL; |
1979 | if(xc->curval_handle) { fclose(xc->curval_handle); xc->curval_handle = NULL; } | |
1980 | if(xc->valpos_handle) { fclose(xc->valpos_handle); xc->valpos_handle = NULL; } | |
1981 | if(xc->geom_handle) { fclose(xc->geom_handle); xc->geom_handle = NULL; } | |
2095 | tmpfile_close(&xc->curval_handle, &xc->curval_handle_nam); | |
2096 | tmpfile_close(&xc->valpos_handle, &xc->valpos_handle_nam); | |
2097 | tmpfile_close(&xc->geom_handle, &xc->geom_handle_nam); | |
1982 | 2098 | if(xc->hier_handle) { fclose(xc->hier_handle); xc->hier_handle = NULL; } |
1983 | 2099 | if(xc->handle) |
1984 | 2100 | { |
2987 | 3103 | int writex_fd; |
2988 | 3104 | unsigned char writex_buf[FST_WRITEX_MAX]; |
2989 | 3105 | #endif |
3106 | ||
3107 | char *f_nam; | |
3108 | char *fh_nam; | |
2990 | 3109 | }; |
2991 | 3110 | |
2992 | 3111 | |
3464 | 3583 | static int fstVcdIDForFwrite(char *buf, unsigned int value) |
3465 | 3584 | { |
3466 | 3585 | char *pnt = buf; |
3467 | unsigned int vmod; | |
3468 | 3586 | |
3469 | 3587 | /* zero is illegal for a value...it is assumed they start at one */ |
3470 | 3588 | while (value) |
3507 | 3625 | sprintf(fnam, "%s.hier_%d_%p", xc->filename, getpid(), (void *)xc); |
3508 | 3626 | fstReaderFseeko(xc, xc->f, xc->hier_pos, SEEK_SET); |
3509 | 3627 | uclen = fstReaderUint64(xc->f); |
3628 | #ifndef __MINGW32__ | |
3510 | 3629 | fflush(xc->f); |
3511 | ||
3630 | #endif | |
3512 | 3631 | if(htyp == FST_BL_HIER) |
3513 | 3632 | { |
3514 | 3633 | fstReaderFseeko(xc, xc->f, xc->hier_pos, SEEK_SET); |
3515 | 3634 | uclen = fstReaderUint64(xc->f); |
3635 | #ifndef __MINGW32__ | |
3516 | 3636 | fflush(xc->f); |
3517 | ||
3637 | #endif | |
3518 | 3638 | zfd = dup(fileno(xc->f)); |
3519 | 3639 | zhandle = gzdopen(zfd, "rb"); |
3520 | 3640 | if(!zhandle) |
3531 | 3651 | fstReaderFseeko(xc, xc->f, xc->hier_pos - 8, SEEK_SET); /* get section len */ |
3532 | 3652 | clen = fstReaderUint64(xc->f) - 16; |
3533 | 3653 | uclen = fstReaderUint64(xc->f); |
3654 | #ifndef __MINGW32__ | |
3534 | 3655 | fflush(xc->f); |
3656 | #endif | |
3535 | 3657 | } |
3536 | 3658 | |
3537 | 3659 | #ifndef __MINGW32__ |
3539 | 3661 | if(!xc->fh) |
3540 | 3662 | #endif |
3541 | 3663 | { |
3542 | xc->fh = tmpfile(); | |
3664 | xc->fh = tmpfile_open(&xc->fh_nam); | |
3543 | 3665 | free(fnam); fnam = NULL; |
3544 | 3666 | if(!xc->fh) |
3545 | 3667 | { |
3668 | tmpfile_close(&xc->fh, &xc->fh_nam); | |
3546 | 3669 | free(mem); |
3547 | 3670 | return(0); |
3548 | 3671 | } |
4130 | 4253 | fcomp = fopen(hf, "w+b"); |
4131 | 4254 | if(!fcomp) |
4132 | 4255 | { |
4133 | fcomp = tmpfile(); | |
4256 | fcomp = tmpfile_open(&xc->f_nam); | |
4134 | 4257 | free(hf); hf = NULL; |
4135 | if(!fcomp) return(0); | |
4258 | if(!fcomp) { tmpfile_close(&fcomp, &xc->f_nam); return(0); } | |
4136 | 4259 | } |
4137 | 4260 | |
4138 | 4261 | #if defined(FST_MACOSX) |
4151 | 4274 | #endif |
4152 | 4275 | |
4153 | 4276 | fstReaderFseeko(xc, xc->f, 1+8+8, SEEK_SET); |
4277 | #ifndef __MINGW32__ | |
4154 | 4278 | fflush(xc->f); |
4279 | #endif | |
4155 | 4280 | |
4156 | 4281 | zfd = dup(fileno(xc->f)); |
4157 | 4282 | zhandle = gzdopen(zfd, "rb"); |
4500 | 4625 | |
4501 | 4626 | if(xc->fh) |
4502 | 4627 | { |
4503 | fclose(xc->fh); xc->fh = NULL; | |
4628 | tmpfile_close(&xc->fh, &xc->fh_nam); | |
4504 | 4629 | } |
4505 | 4630 | |
4506 | 4631 | if(xc->f) |
4507 | 4632 | { |
4508 | fclose(xc->f); xc->f = NULL; | |
4633 | tmpfile_close(&xc->f, &xc->f_nam); | |
4509 | 4634 | if(xc->filename_unpacked) |
4510 | 4635 | { |
4511 | 4636 | unlink(xc->filename_unpacked); |
54 | 54 | static uint32_t var_direction_idx = 0; |
55 | 55 | static unsigned char *var_direction = NULL; |
56 | 56 | |
57 | ||
58 | static void *realloc_2(void *ptr, size_t siz) /* cppcheck */ | |
59 | { | |
60 | void *pnt = realloc(ptr, siz); | |
61 | if(!pnt) | |
62 | { | |
63 | fprintf(stderr, "ERROR: Out of memory in realloc(), exiting!\n"); /* normally free(ptr) here */ | |
64 | exit(255); | |
65 | } | |
66 | ||
67 | return(pnt); | |
68 | } | |
69 | ||
70 | ||
57 | 71 | /*********************************************************/ |
58 | 72 | /*** vvv extload component type name determination vvv ***/ |
59 | 73 | /*********************************************************/ |
379 | 393 | while(((*wbuf)[*len] != 1) && !feof(f)) |
380 | 394 | { |
381 | 395 | /* fprintf(stderr, "overflow %d\n", (int)(*len)); */ |
382 | *wbuf = realloc(*wbuf, (*len) * 2 + 1); | |
396 | *wbuf = realloc_2(*wbuf, (*len) * 2 + 1); | |
383 | 397 | (*wbuf)[(*len) * 2] = 1; |
384 | 398 | |
385 | 399 | fgets_rc = fgets(*wbuf + (*len), (*len) + 1, f); |
506 | 520 | { |
507 | 521 | printf("Could not open '%s', exiting.\n", vname); |
508 | 522 | free(bin_fixbuff); bin_fixbuff = NULL; |
523 | free(vname); free(fstname); | |
509 | 524 | exit(255); |
510 | 525 | } |
511 | 526 | |
515 | 530 | { |
516 | 531 | printf("Could not open '%s', exiting.\n", fstname); |
517 | 532 | free(bin_fixbuff); bin_fixbuff = NULL; |
533 | free(vname); free(fstname); | |
534 | fclose(f); | |
518 | 535 | exit(255); |
519 | 536 | } |
520 | 537 | |
1349 | 1366 | if(node_len >= bin_fixbuff_len) |
1350 | 1367 | { |
1351 | 1368 | bin_fixbuff_len = node_len + 1; |
1352 | bin_fixbuff = realloc(bin_fixbuff, bin_fixbuff_len); | |
1369 | bin_fixbuff = realloc_2(bin_fixbuff, bin_fixbuff_len); | |
1353 | 1370 | } |
1354 | 1371 | |
1355 | 1372 | memset(bin_fixbuff, buf[1] != '1' ? buf[1] : '0', delta); |
1375 | 1392 | if(node_len >= bin_fixbuff_len) |
1376 | 1393 | { |
1377 | 1394 | bin_fixbuff_len = node_len + 1; |
1378 | bin_fixbuff = realloc(bin_fixbuff, bin_fixbuff_len); | |
1395 | bin_fixbuff = realloc_2(bin_fixbuff, bin_fixbuff_len); | |
1379 | 1396 | } |
1380 | 1397 | |
1381 | 1398 | memset(bin_fixbuff, buf[1] != '1' ? buf[1] : '0', delta); |
1427 | 1444 | if(p_len >= bin_fixbuff_len) |
1428 | 1445 | { |
1429 | 1446 | bin_fixbuff_len = p_len + 1; |
1430 | bin_fixbuff = realloc(bin_fixbuff, bin_fixbuff_len); | |
1447 | bin_fixbuff = realloc_2(bin_fixbuff, bin_fixbuff_len); | |
1431 | 1448 | } |
1432 | 1449 | pnt = bin_fixbuff; |
1433 | 1450 |
1435 | 1435 | vpa->lt = lt; |
1436 | 1436 | vpa->b = b; |
1437 | 1437 | |
1438 | vzt_rd_pthread_create(lt, &b->pth, &b->pth_attr, vzt_rd_decompress_blk_pth_actual, vpa); | |
1438 | vzt_rd_pthread_create(lt, &b->pth, &b->pth_attr, vzt_rd_decompress_blk_pth_actual, vpa); /* cppcheck misfires thinking vpa is not freed even though vzt_rd_decompress_blk_pth_actual() does it */ | |
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | /* |