[Pkg-electronics-commits] [gtkwave] 01/03: Imported Upstream version 3.3.58
أحمد المحمودي (Ahmed El-Mahmoudy)
aelmahmoudy at sabily.org
Mon Mar 24 14:17:32 UTC 2014
This is an automated email from the git hooks/post-receive script.
aelmahmoudy-guest pushed a commit to branch master
in repository gtkwave.
commit 38ef80b9ff14d829e1a8f545b29d546b0231d5ca
Author: أحمد المحمودي (Ahmed El-Mahmoudy) <aelmahmoudy at sabily.org>
Date: Mon Mar 24 11:09:42 2014 +0200
Imported Upstream version 3.3.58
---
ChangeLog | 7 ++
LICENSE.TXT | 2 +-
configure | 20 +++---
configure.ac | 2 +-
contrib/bundle_for_osx/Info-gtkwave.plist | 6 +-
contrib/fsdb2vcd/fsdb2vcd_fast.cc | 14 +---
contrib/rtlbrowse/stem_recurse.c | 2 +-
contrib/rtlbrowse/tcl_helper.c | 5 +-
contrib/vermin/args.c | 2 +
contrib/vermin/jrb.c | 2 +-
contrib/vermin/shred.c | 2 +-
doc/gtkwave.odt | Bin 1391885 -> 1394936 bytes
src/analyzer.c | 11 +--
src/analyzer.h | 11 +--
src/baseconvert.c | 36 +++++++++-
src/bitvec.c | 21 +++---
src/fgetdynamic.h | 2 +-
src/fst.c | 3 +-
src/ghw.c | 18 ++---
src/ghwlib.c | 8 ++-
src/helpers/fst/fastlz.c | 2 +-
src/helpers/fst/fstapi.c | 108 +++++++++++++++---------------
src/helpers/fstminer.c | 4 +-
src/helpers/lxt2vcd.c | 19 ++----
src/helpers/vcd2fst.c | 2 +
src/helpers/vcd2lxt.c | 4 +-
src/helpers/vcd2lxt2.c | 4 +-
src/helpers/vcd2vzt.c | 4 +-
src/helpers/vzt2vcd.c | 19 ++----
src/helpers/vzt_read.c | 4 +-
src/interp.c | 2 +-
src/main.c | 12 ++--
src/menu.c | 48 ++++++++++++-
src/menu.h | 4 +-
src/mouseover.c | 7 +-
src/mouseover_sigs.c | 7 +-
src/tcl_helper.c | 8 +--
src/translate.c | 4 +-
src/tree.c | 16 ++---
src/tree.h | 2 +-
src/treesearch_gtk2.c | 2 -
src/ttranslate.c | 12 ++--
src/vlist.c | 2 +-
43 files changed, 279 insertions(+), 191 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 765b2cb..f15b70c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1454,3 +1454,10 @@
Added missing compressBound() for compress2() dest mallocs.
3.3.57 13feb14 Fix for Electric Fence crash in vlist_freeze().
Updated LZ4 for version r113.
+3.3.58 16mar14 Added /Data Format/Popcnt function for ones counting.
+ Warnings fixes from new Clang 3.4 scan-build.
+ Updated VCD ID generation in various helpers to use a faster,
+ equivalent algorithm.
+ Change [1] at end of struct to C99 [] notation with appropriate
+ allocation size modification.
+ System_profiler speed fix for OSX.
diff --git a/LICENSE.TXT b/LICENSE.TXT
index 6042d03..ab981fd 100644
--- a/LICENSE.TXT
+++ b/LICENSE.TXT
@@ -1,6 +1,6 @@
##########################################################################
-GTKWave 3.3.56 Wave Viewer is Copyright (C) 1999-2014 Tony Bybell.
+GTKWave 3.3.58 Wave Viewer is Copyright (C) 1999-2014 Tony Bybell.
Portions of GTKWave are Copyright (C) 1999-2014 Udi Finkelstein.
Context support is Copyright (C) 2007-2014 Kermin Elliott Fleming.
Trace group support is Copyright (C) 2009-2014 Donald Baltus.
diff --git a/configure b/configure
index ac7caba..bbf8fab 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gtkwave 3.3.57.
+# Generated by GNU Autoconf 2.69 for gtkwave 3.3.58.
#
# Report bugs to <bybell at rocketmail.com>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gtkwave'
PACKAGE_TARNAME='gtkwave'
-PACKAGE_VERSION='3.3.57'
-PACKAGE_STRING='gtkwave 3.3.57'
+PACKAGE_VERSION='3.3.58'
+PACKAGE_STRING='gtkwave 3.3.58'
PACKAGE_BUGREPORT='bybell at rocketmail.com'
PACKAGE_URL=''
@@ -1382,7 +1382,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gtkwave 3.3.57 to adapt to many kinds of systems.
+\`configure' configures gtkwave 3.3.58 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1448,7 +1448,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gtkwave 3.3.57:";;
+ short | recursive ) echo "Configuration of gtkwave 3.3.58:";;
esac
cat <<\_ACEOF
@@ -1593,7 +1593,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gtkwave configure 3.3.57
+gtkwave configure 3.3.58
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2237,7 +2237,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gtkwave $as_me 3.3.57, which was
+It was created by gtkwave $as_me 3.3.58, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3104,7 +3104,7 @@ fi
# Define the identity of the package.
PACKAGE='gtkwave'
- VERSION='3.3.57'
+ VERSION='3.3.58'
cat >>confdefs.h <<_ACEOF
@@ -10959,7 +10959,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gtkwave $as_me 3.3.57, which was
+This file was extended by gtkwave $as_me 3.3.58, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -11025,7 +11025,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gtkwave config.status 3.3.57
+gtkwave config.status 3.3.58
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 3c1fa0d..efc84bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT(gtkwave, 3.3.57, bybell at rocketmail.com)
+AC_INIT(gtkwave, 3.3.58, bybell at rocketmail.com)
AC_CONFIG_SRCDIR([src/vcd.c])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([config.h])
diff --git a/contrib/bundle_for_osx/Info-gtkwave.plist b/contrib/bundle_for_osx/Info-gtkwave.plist
index e2d0f79..367566a 100644
--- a/contrib/bundle_for_osx/Info-gtkwave.plist
+++ b/contrib/bundle_for_osx/Info-gtkwave.plist
@@ -8,7 +8,7 @@
<key>CFBundleExecutable</key>
<string>gtkwave</string>
<key>CFBundleGetInfoString</key>
- <string>3.3.57, (C) 1999-2014 Tony Bybell http://gtkwave.sourceforge.net</string>
+ <string>3.3.58, (C) 1999-2014 Tony Bybell http://gtkwave.sourceforge.net</string>
<key>CFBundleIconFile</key>
<string>gtkwave.icns</string>
<key>CFBundleIdentifier</key>
@@ -18,11 +18,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>3.3.57</string>
+ <string>3.3.58</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>3.3.57</string>
+ <string>3.3.58</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 1999 - 2014 Tony Bybell, GNU General Public License.</string>
<key>LSMinimumSystemVersion</key>
diff --git a/contrib/fsdb2vcd/fsdb2vcd_fast.cc b/contrib/fsdb2vcd/fsdb2vcd_fast.cc
index fd27a89..696cf0b 100644
--- a/contrib/fsdb2vcd/fsdb2vcd_fast.cc
+++ b/contrib/fsdb2vcd/fsdb2vcd_fast.cc
@@ -91,21 +91,13 @@ static char *makeVcdID(unsigned int value, int *idlen)
{
static char buf[16];
char *pnt = buf;
-unsigned int vmod;
/* zero is illegal for a value...it is assumed they start at one */
-for(;;)
+while (value)
{
- if((vmod = (value % 94)))
- {
- *(pnt++) = (char)(vmod + 32);
- }
- else
- {
- *(pnt++) = '~'; value -= 94;
- }
+ value--;
+ *(pnt++) = (char)('!' + value % 94);
value = value / 94;
- if(!value) { break; }
}
*pnt = 0;
diff --git a/contrib/rtlbrowse/stem_recurse.c b/contrib/rtlbrowse/stem_recurse.c
index 49340e5..f76a94f 100644
--- a/contrib/rtlbrowse/stem_recurse.c
+++ b/contrib/rtlbrowse/stem_recurse.c
@@ -383,7 +383,7 @@ mod_cnt = 0;
rec_tree(modules, &mod_cnt);
/* printf("number of modules: %d\n", mod_cnt); */
-mod_list = calloc(mod_cnt, sizeof(ds_Tree *));
+mod_list = calloc(mod_cnt /* scan-build */ ? mod_cnt : 1, sizeof(ds_Tree *));
mod_cnt = 0;
rec_tree_populate(modules, &mod_cnt, mod_list);
diff --git a/contrib/rtlbrowse/tcl_helper.c b/contrib/rtlbrowse/tcl_helper.c
index c0b0cb8..9e1c127 100644
--- a/contrib/rtlbrowse/tcl_helper.c
+++ b/contrib/rtlbrowse/tcl_helper.c
@@ -809,7 +809,10 @@ static void DNDDataReceivedCB(
for(i=impcnt-1;i>=0;i--) /* reverse list so it is forwards in rtlbrowse */
{
- bwlogbox(fta[i]->fullname, 640 + 8*8, fta[i], 0);
+ if(fta[i]) /* scan-build */
+ {
+ bwlogbox(fta[i]->fullname, 640 + 8*8, fta[i], 0);
+ }
}
free(fta);
diff --git a/contrib/vermin/args.c b/contrib/vermin/args.c
index dbb9733..fb03098 100644
--- a/contrib/vermin/args.c
+++ b/contrib/vermin/args.c
@@ -180,5 +180,7 @@ for(i=0;i<argc;i++)
total_args++;
}
}
+
+free(shadow_list); /* scan-build */
}
diff --git a/contrib/vermin/jrb.c b/contrib/vermin/jrb.c
index 8354e94..ae53d32 100644
--- a/contrib/vermin/jrb.c
+++ b/contrib/vermin/jrb.c
@@ -130,7 +130,7 @@ JRB make_jrb()
{
JRB head;
- head = (JRB) malloc (sizeof(struct jrb_node));
+ head = (JRB) calloc (1, sizeof(struct jrb_node)); /* scan-build because of sethead() below */
head->flink = head;
head->blink = head;
head->parent = head;
diff --git a/contrib/vermin/shred.c b/contrib/vermin/shred.c
index 6eafdb4..a5c37de 100644
--- a/contrib/vermin/shred.c
+++ b/contrib/vermin/shred.c
@@ -19,7 +19,7 @@ void shred_alloc(void)
{
shred_root=shred_pnt=(void **)calloc(SHRED_ROOT_SIZE,sizeof(void *)); /* with 12+ preclevels this is more than enough */
exp_root=exp_pnt=(void **)calloc(EXP_ROOT_SIZE,sizeof(void *)); /* dictates longest expr */
-exp_now_root=exp_now_pnt=(void ***)calloc(EXP_NOW_SIZE,sizeof(void *)); /* levels of parentheses */
+exp_now_root=exp_now_pnt=(void ***)calloc(EXP_NOW_SIZE,sizeof(void **)); /* levels of parentheses */
}
void shred_free(void)
diff --git a/doc/gtkwave.odt b/doc/gtkwave.odt
index 8ff6317..f5e0855 100644
Binary files a/doc/gtkwave.odt and b/doc/gtkwave.odt differ
diff --git a/src/analyzer.c b/src/analyzer.c
index 3a1c5aa..03e731c 100644
--- a/src/analyzer.c
+++ b/src/analyzer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 1999-2012.
+ * Copyright (c) Tony Bybell 1999-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -109,9 +109,12 @@ void updateTraceGroup(Trptr t)
if (IsGroupEnd(t))
{
Trptr g_begin = t->t_prev->t_grp;
- t->t_grp = g_begin->t_grp;
- t->t_match = g_begin;
- g_begin->t_match = t;
+ if(g_begin) /* scan-build */
+ {
+ t->t_grp = g_begin->t_grp;
+ t->t_match = g_begin;
+ g_begin->t_match = t;
+ }
}
else
{
diff --git a/src/analyzer.h b/src/analyzer.h
index eb06210..e99ca8a 100644
--- a/src/analyzer.h
+++ b/src/analyzer.h
@@ -142,7 +142,7 @@ typedef struct VectorEnt
{
TimeType time;
vptr next;
-unsigned char v[1];
+unsigned char v[]; /* C99 */
} VectorEnt;
#ifdef WAVE_USE_STRUCT_PACKING
@@ -395,7 +395,7 @@ typedef struct Bits
int nnbits; /* number of bits in this vector */
baptr attribs; /* for keeping track of combined timeshifts and inversions (and for savefile) */
- nptr nodes[1]; /* pointers to the bits (nodes) */
+ nptr nodes[]; /* C99 pointers to the bits (nodes) */
} Bits;
#ifdef WAVE_USE_STRUCT_PACKING
@@ -418,7 +418,7 @@ typedef struct BitVector
int nbits; /* number of bits in this vector */
int numregions; /* number of regions that follow */
bptr bits; /* pointer to Bits structs for save file */
- vptr vectors[1]; /* pointers to the vectors */
+ vptr vectors[]; /* C99 pointers to the vectors */
} BitVector;
#ifdef WAVE_USE_STRUCT_PACKING
@@ -521,7 +521,8 @@ enum TraceEntFlagBits
TR_ZEROFILL_B, TR_ONEFILL_B, TR_CLOSED_B, TR_GRP_BEGIN_B,
TR_GRP_END_B,
TR_BINGRAY_B, TR_GRAYBIN_B,
- TR_REAL2BITS_B, TR_TTRANSLATED_B
+ TR_REAL2BITS_B, TR_TTRANSLATED_B,
+ TR_POPCNT_B
};
#define TR_HIGHLIGHT (1<<TR_HIGHLIGHT_B)
@@ -564,6 +565,8 @@ enum TraceEntFlagBits
#define TR_PTRANSLATED (1<<TR_PTRANSLATED_B)
#define TR_TTRANSLATED (1<<TR_TTRANSLATED_B)
+#define TR_POPCNT (1<<TR_POPCNT_B)
+
#define TR_ANALOGMASK (TR_ANALOG_STEP|TR_ANALOG_INTERPOLATED)
Trptr GiveNextTrace(Trptr t);
diff --git a/src/baseconvert.c b/src/baseconvert.c
index 9edbf72..75b0e5e 100644
--- a/src/baseconvert.c
+++ b/src/baseconvert.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 1999-2009.
+ * Copyright (c) Tony Bybell 1999-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,14 +29,15 @@
#endif
/*
- * convert binary <=> gray in place
+ * convert binary <=> gray/popcnt in place
*/
#define cvt_gray(f,p,n) \
do { \
-if((f)&TR_GRAYMASK) \
+if((f)&(TR_GRAYMASK|TR_POPCNT)) \
{ \
if((f)&TR_BINGRAY) { convert_bingray((p),(n)); } \
if((f)&TR_GRAYBIN) { convert_graybin((p),(n)); } \
+ if((f)&TR_POPCNT) { convert_popcnt((p),(n)); } \
} \
} while(0)
@@ -138,6 +139,35 @@ for(i=0;i<nbits;i++)
}
+static void convert_popcnt(char *pnt, int nbits)
+{
+int i;
+unsigned int pop = 0;
+
+for(i=0;i<nbits;i++)
+ {
+ char ch = pnt[i];
+
+ switch(ch)
+ {
+ case AN_1:
+ case AN_H: pop++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+for(i=nbits-1;i>=0;i--) /* always requires less number of bits */
+ {
+ pnt[i] = (pop & 1) ? AN_1 : AN_0;
+ pop >>= 1;
+ }
+}
+
+
/*
* convert trptr+vptr into an ascii string
*/
diff --git a/src/bitvec.c b/src/bitvec.c
index 4e2cb1d..1207918 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -251,7 +251,7 @@ if(!b) return(NULL);
h=(hptr *)calloc_2(b->nnbits, sizeof(hptr));
-numextrabytes=(b->nnbits)-1;
+numextrabytes=b->nnbits;
for(i=0;i<b->nnbits;i++)
{
@@ -380,11 +380,11 @@ while(h[0]) /* should never exit through this point the way we set up histents w
vadd=(vptr)calloc_2(1,sizeof(struct VectorEnt)+numextrabytes);
vadd->time=MAX_HISTENT_TIME;
-for(i=0;i<=numextrabytes;i++) vadd->v[i]=AN_U; /* formerly 0x55 */
+for(i=0;i<numextrabytes;i++) vadd->v[i]=AN_U; /* formerly 0x55 */
if(vcurr) { vcurr->next=vadd; } /* scan-build */
regions++;
-bitvec=(bvptr)calloc_2(1,sizeof(struct BitVector)+((regions-1)*sizeof(vptr))); /* ajb : found "regions" by manual inspection, changed to "regions-1" as array is already [1] */
+bitvec=(bvptr)calloc_2(1,sizeof(struct BitVector)+((regions)*sizeof(vptr))); /* ajb : found "regions" by manual inspection, changed to "regions-1" as array is already [1] */ /* C99, back to regions with [] */
strcpy(bitvec->bvname=(char *)malloc_2(strlen(b->name)+1),b->name);
bitvec->nbits=b->nnbits;
@@ -666,8 +666,7 @@ str=pnt;
ifnode:
if(nodepnt)
{
- b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt-1)*
- sizeof(struct Node *));
+ b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt)*sizeof(struct Node *));
for(i=0;i<nodepnt;i++)
{
@@ -831,8 +830,7 @@ str=pnt;
ifnode:
if(nodepnt)
{
- b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt-1)*
- sizeof(struct Node *));
+ b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt)*sizeof(struct Node *));
b->attribs = calloc_2(nodepnt, sizeof(struct BitAttributes));
@@ -884,8 +882,7 @@ for(i=0;i<GLOBALS->numfacs;i++) /* to keep vectors in lo..hi order */
if(nodepnt)
{
- b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt-1)*
- sizeof(struct Node *));
+ b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt)*sizeof(struct Node *));
for(i=0;i<nodepnt;i++)
{
@@ -981,8 +978,7 @@ if(!GLOBALS->autocoalesce_reversal) /* normal case for MTI */
if(nodepnt)
{
- b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt-1)*
- sizeof(struct Node *));
+ b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt)*sizeof(struct Node *));
for(i=0;i<nodepnt;i++)
{
@@ -1192,8 +1188,7 @@ for(i=lo;i<=hi;i++) /* to keep vectors in lo..hi order */
if(nodepnt)
{
- b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt-1)*
- sizeof(struct Node *));
+ b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt)*sizeof(struct Node *));
for(i=0;i<nodepnt;i++)
{
diff --git a/src/fgetdynamic.h b/src/fgetdynamic.h
index 10eadc0..976f2f5 100644
--- a/src/fgetdynamic.h
+++ b/src/fgetdynamic.h
@@ -18,7 +18,7 @@
struct wave_script_args {
struct wave_script_args *curr;
struct wave_script_args *next;
- char payload[1];
+ char payload[]; /* C99 */
};
char *fgetmalloc(FILE *handle);
diff --git a/src/fst.c b/src/fst.c
index 73c6093..cb64f15 100644
--- a/src/fst.c
+++ b/src/fst.c
@@ -459,7 +459,7 @@ return(NULL);
static void fst_append_graft_chain(int len, char *nam, int which, struct tree *par)
{
-struct tree *t = talloc_2(sizeof(struct tree) + len);
+struct tree *t = talloc_2(sizeof(struct tree) + len + 1);
memcpy(t->name, nam, len+1);
t->t_which = which;
@@ -758,6 +758,7 @@ for(i=0;i<GLOBALS->numfacs;i++)
else /* convert any variable length records into strings */
{
nvt = ND_GEN_STRING;
+ nvd = ND_DIR_IMPLICIT;
GLOBALS->mvlfacs_fst_c_3[i].flags = VZT_RD_SYM_F_STRING;
GLOBALS->mvlfacs_fst_c_3[i].len = 2;
}
diff --git a/src/ghw.c b/src/ghw.c
index 15a7870..526b1d0 100644
--- a/src/ghw.c
+++ b/src/ghw.c
@@ -1,5 +1,5 @@
/* GHDL Wavefile reader interface.
- Copyright (C) 2005-2011 Tristan Gingold and Tony Bybell
+ Copyright (C) 2005-2014 Tristan Gingold and Tony Bybell
GHDL 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
@@ -456,7 +456,7 @@ build_hierarchy_type (struct ghw_handler *h, union ghw_type *t,
GLOBALS->curnode->symbol=s;
GLOBALS->nbr_sig_ref_ghw_c_1++;
- res = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(pfx));
+ res = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(pfx) + 1);
strcpy(res->name, (char *)pfx);
res->t_which = *(*sig)++;
@@ -466,7 +466,7 @@ build_hierarchy_type (struct ghw_handler *h, union ghw_type *t,
case ghdl_rtik_subtype_array_ptr:
{
struct tree *r;
- res = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(pfx));
+ res = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(pfx) + 1);
strcpy(res->name, (char *)pfx);
res->t_which = WAVE_T_WHICH_UNDEFINED_COMPNAME;
r = res;
@@ -481,7 +481,7 @@ build_hierarchy_type (struct ghw_handler *h, union ghw_type *t,
struct tree *c;
int i;
- res = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(pfx));
+ res = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(pfx) + 1);
strcpy(res->name, (char *)pfx);
res->t_which = WAVE_T_WHICH_UNDEFINED_COMPNAME;
@@ -549,7 +549,7 @@ build_hierarchy (struct ghw_handler *h, struct ghw_hie *hie)
name_len = strlen (hie->name);
buf_len = strlen (buf);
- t = (struct tree *) calloc_2(1, sizeof (struct tree) + (2 + buf_len + name_len));
+ t = (struct tree *) calloc_2(1, sizeof (struct tree) + (2 + buf_len + name_len + 1));
t->kind = ttype;
n = t->name;
@@ -565,13 +565,13 @@ build_hierarchy (struct ghw_handler *h, struct ghw_hie *hie)
{
if(hie->name)
{
- t = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(hie->name));
+ t = (struct tree *) calloc_2(1, sizeof (struct tree) + strlen(hie->name) + 1);
t->kind = ttype;
strcpy(t->name, (char *)hie->name);
}
else
{
- t = (struct tree *) calloc_2(1, sizeof (struct tree));
+ t = (struct tree *) calloc_2(1, sizeof (struct tree) + 1);
t->kind = ttype;
}
}
@@ -1133,9 +1133,9 @@ ghw_main(char *fname)
{
const char *base_hier = "top";
- struct tree *t = calloc_2(1, sizeof(struct tree) + strlen(base_hier));
+ struct tree *t = calloc_2(1, sizeof(struct tree) + strlen(base_hier) + 1);
memcpy(t, GLOBALS->treeroot, sizeof(struct tree));
- strcpy(t->name, base_hier);
+ strcpy(t->name, base_hier); /* scan-build false warning here, thinks name[1] is total length */
#ifndef WAVE_TALLOC_POOL_SIZE
free_2(GLOBALS->treeroot); /* if using tree alloc pool, can't deallocate this */
#endif
diff --git a/src/ghwlib.c b/src/ghwlib.c
index f52a62a..1dd57d1 100644
--- a/src/ghwlib.c
+++ b/src/ghwlib.c
@@ -1,5 +1,5 @@
/* GHDL Wavefile reader library.
- Copyright (C) 2005-2012 Tristan Gingold
+ Copyright (C) 2005-2014 Tristan Gingold
GHDL 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
@@ -462,6 +462,12 @@ get_nbr_elements (union ghw_type *t)
int
ghw_get_range_length (union ghw_range *rng)
{
+if(!rng) /* scan-build */
+ {
+ fprintf (stderr, "get_range_length: null pointer passed, is GHW file corrupt?\n");
+ abort ();
+ }
+
switch (rng->kind)
{
case ghdl_rtik_type_i32:
diff --git a/src/helpers/fst/fastlz.c b/src/helpers/fst/fastlz.c
index 8e14ecf..aa2f8bf 100644
--- a/src/helpers/fst/fastlz.c
+++ b/src/helpers/fst/fastlz.c
@@ -215,7 +215,7 @@ static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void*
if(ip[0] == ip[-1] && FASTLZ_READU16(ip-1)==FASTLZ_READU16(ip+1))
{
distance = 1;
- ip += 3;
+ /* ip += 3; */ /* scan-build, never used */
ref = anchor - 1 + 3;
goto match;
}
diff --git a/src/helpers/fst/fstapi.c b/src/helpers/fst/fstapi.c
index 1a2f170..9535111 100644
--- a/src/helpers/fst/fstapi.c
+++ b/src/helpers/fst/fstapi.c
@@ -121,6 +121,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
#if defined(__APPLE__) && defined(__MACH__)
#define FST_MACOSX
+#include <sys/sysctl.h>
#endif
@@ -918,14 +919,10 @@ xc->curval_mem = NULL;
static void fstDetermineBreakSize(struct fstWriterContext *xc)
{
#if defined(__linux__) || defined(FST_MACOSX)
+int was_set = 0;
#ifdef __linux__
FILE *f = fopen("/proc/meminfo", "rb");
-#else
-FILE *f = popen("system_profiler", "r");
-#endif
-
-int was_set = 0;
if(f)
{
@@ -937,18 +934,10 @@ if(f)
s = fgets(buf, 256, f);
if(s && *s)
{
-#ifdef __linux__
if(!strncmp(s, "MemTotal:", 9))
{
size_t v = atol(s+10);
v *= 1024; /* convert to bytes */
-#else
- if((s=strstr(s, "Memory:")))
- {
- size_t v = atol(s+7);
- v <<= 30; /* convert GB to bytes */
-#endif
-
v /= 8; /* chop down to 1/8 physical memory */
if(v > FST_BREAK_SIZE)
{
@@ -965,18 +954,45 @@ if(f)
}
}
-#ifdef __linux__
fclose(f);
-#else
- pclose(f);
-#endif
}
if(!was_set)
-#endif
{
xc->fst_huge_break_size = FST_BREAK_SIZE;
}
+#else
+int mib[2];
+int64_t v;
+size_t length;
+
+mib[0] = CTL_HW;
+mib[1] = HW_MEMSIZE;
+length = sizeof(int64_t);
+if(!sysctl(mib, 2, &v, &length, NULL, 0))
+ {
+ v /= 8;
+
+ if(v > FST_BREAK_SIZE)
+ {
+ if(v > FST_BREAK_SIZE_MAX)
+ {
+ v = FST_BREAK_SIZE_MAX;
+ }
+
+ xc->fst_huge_break_size = v;
+ was_set = 1;
+ }
+ }
+
+if(!was_set)
+ {
+ xc->fst_huge_break_size = FST_BREAK_SIZE;
+ }
+#endif
+#else
+xc->fst_huge_break_size = FST_BREAK_SIZE;
+#endif
xc->fst_break_size = xc->fst_orig_break_size = FST_BREAK_SIZE;
xc->fst_break_add_size = xc->fst_orig_break_add_size = FST_BREAK_ADD_SIZE;
@@ -3012,14 +3028,14 @@ if(len)
else
{
fstWritex(xc, NULL, 0);
- write(xc->writex_fd, s, len);
+ if (write(xc->writex_fd, s, len)) { };
}
}
else
{
if(xc->writex_pos)
{
- write(xc->writex_fd, xc->writex_buf, xc->writex_pos);
+ if(write(xc->writex_fd, xc->writex_buf, xc->writex_pos)) { };
xc->writex_pos = 0;
}
}
@@ -3434,21 +3450,13 @@ if(xc)
static void fstVcdID(char *buf, unsigned int value)
{
char *pnt = buf;
-unsigned int vmod;
/* zero is illegal for a value...it is assumed they start at one */
-for(;;)
+while (value)
{
- if((vmod = (value % 94)))
- {
- *(pnt++) = (char)(vmod + 32);
- }
- else
- {
- *(pnt++) = '~'; value -= 94;
- }
+ value--;
+ *(pnt++) = (char)('!' + value % 94);
value = value / 94;
- if(!value) { break; }
}
*pnt = 0;
@@ -3460,18 +3468,11 @@ char *pnt = buf;
unsigned int vmod;
/* zero is illegal for a value...it is assumed they start at one */
-for(;;)
+while (value)
{
- if((vmod = (value % 94)))
- {
- *(pnt++) = (char)(vmod + 32);
- }
- else
- {
- *(pnt++) = '~'; value -= 94;
- }
+ value--;
+ *(pnt++) = (char)('!' + value % 94);
value = value / 94;
- if(!value) { break; }
}
return(pnt - buf);
@@ -3489,7 +3490,7 @@ if(!xc->fh)
unsigned char *mem = malloc(FST_GZIO_LEN);
off_t hl, uclen;
off_t clen = 0;
- gzFile zhandle;
+ gzFile zhandle = NULL;
int zfd;
int htyp = FST_BL_SKIP;
@@ -3826,6 +3827,7 @@ uint32_t len, alias;
int num_signal_dyn = 65536;
int attrtype, subtype;
uint64_t attrarg;
+fstHandle maxhandle_scanbuild;
if(!xc) return(0);
@@ -3889,7 +3891,7 @@ if(fv)
if(fv) fprintf(fv, "$timescale\n\t%d%ss\n$end\n", time_scale, time_dimension);
}
-xc->maxhandle = 0;
+xc->maxhandle = 0;
xc->num_alias = 0;
free(xc->signal_lens);
@@ -4075,11 +4077,13 @@ while(!feof(xc->fh))
}
if(fv) fprintf(fv, "$enddefinitions $end\n");
-xc->signal_lens = realloc(xc->signal_lens, xc->maxhandle*sizeof(uint32_t));
-xc->signal_typs = realloc(xc->signal_typs, xc->maxhandle*sizeof(unsigned char));
+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));
free(xc->process_mask);
-xc->process_mask = calloc(1, (xc->maxhandle+7)/8);
+xc->process_mask = calloc(1, (maxhandle_scanbuild+7)/8);
free(xc->temp_signal_value_buf);
xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
@@ -4698,7 +4702,7 @@ for(;;)
tpnt += skiplen;
}
- tc_head = calloc(tsec_nitems, sizeof(uint32_t));
+ tc_head = calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
free(ucdata);
}
@@ -5476,22 +5480,20 @@ for(;;)
block_err:
free(tc_head);
free(chain_cmem);
- free(mem_for_traversal);
+ free(mem_for_traversal); mem_for_traversal = NULL;
secnum++;
if(secnum == xc->vc_section_count) break; /* in case file is growing, keep with original block count */
blkpos += seclen;
}
+if(mem_for_traversal) free(mem_for_traversal); /* scan-build */
free(length_remaining);
free(headptr);
free(scatterptr);
-if(chain_table)
- {
- free(chain_table);
- free(chain_table_lengths);
- }
+if(chain_table) free(chain_table);
+if(chain_table_lengths) free(chain_table_lengths);
free(time_table);
diff --git a/src/helpers/fstminer.c b/src/helpers/fstminer.c
index ee80282..c633362 100644
--- a/src/helpers/fstminer.c
+++ b/src/helpers/fstminer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Tony Bybell.
+ * Copyright (c) 2012-2014 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -130,7 +130,7 @@ if(plen >= matchlen)
{
if(!killed_list[pnt_facidx])
{
- if((!match) || (strstr((const char *)pnt_value, match)))
+ if((!match) || (pnt_value /* scan-build */ && (strstr((const char *)pnt_value, match))))
{
char *fn;
fn = get_facname(lt, pnt_facidx);
diff --git a/src/helpers/lxt2vcd.c b/src/helpers/lxt2vcd.c
index 00eca09..1ee5601 100644
--- a/src/helpers/lxt2vcd.c
+++ b/src/helpers/lxt2vcd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-9 Tony Bybell.
+ * Copyright (c) 2003-2014 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -48,21 +48,14 @@ static char *vcdid(unsigned int value)
{
static char buf[16];
char *pnt = buf;
-unsigned int vmod;
value++;
-for(;;)
+/* zero is illegal for a value...it is assumed they start at one */
+while (value)
{
- if((vmod = (value % 94)))
- {
- *(pnt++) = (char)(vmod + 32);
- }
- else
- {
- *(pnt++) = '~'; value -= 94;
- }
- value = value / 94;
- if(!value) { break; }
+ value--;
+ *(pnt++) = (char)('!' + value % 94);
+ value = value / 94;
}
*pnt = 0;
diff --git a/src/helpers/vcd2fst.c b/src/helpers/vcd2fst.c
index 532663a..c6487fd 100644
--- a/src/helpers/vcd2fst.c
+++ b/src/helpers/vcd2fst.c
@@ -424,11 +424,13 @@ int repack_all = 0; /* 0 is normal, 1 does the repack (via fstapi) at end */
int parallel_mode = 0; /* 0 is is single threaded, 1 is multi-threaded */
+#ifdef VCD2FST_EXTLOADERS_CONV
static int suffix_check(const char *s, const char *sfx)
{
int sfxlen = strlen(sfx);
return((strlen(s)>=sfxlen)&&(!strcasecmp(s+strlen(s)-sfxlen,sfx)));
}
+#endif
int fst_main(char *vname, char *fstname)
diff --git a/src/helpers/vcd2lxt.c b/src/helpers/vcd2lxt.c
index 0656925..82f8eb5 100644
--- a/src/helpers/vcd2lxt.c
+++ b/src/helpers/vcd2lxt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2010 Tony Bybell.
+ * Copyright (c) 2001-2014 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -239,6 +239,8 @@ return(strcmp(v1->id, v2->id));
*/
static void alias_vs_normal_symadd(struct vcdsymbol *v, struct vcdsymbol *root_v)
{
+if(!v) return; /* scan-build : should never happen */
+
if(!root_v)
{
if((v->vartype==V_INTEGER)||(v->vartype==V_REAL))
diff --git a/src/helpers/vcd2lxt2.c b/src/helpers/vcd2lxt2.c
index 56afe6f..3422a64 100644
--- a/src/helpers/vcd2lxt2.c
+++ b/src/helpers/vcd2lxt2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2010 Tony Bybell.
+ * Copyright (c) 2001-2014 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -245,6 +245,8 @@ return(strcmp(v1->id, v2->id));
*/
static void alias_vs_normal_symadd(struct vcdsymbol *v, struct vcdsymbol *root_v)
{
+if(!v) return; /* scan-build : should never happen */
+
if(!root_v)
{
if((v->vartype==V_INTEGER)||(v->vartype==V_REAL))
diff --git a/src/helpers/vcd2vzt.c b/src/helpers/vcd2vzt.c
index 776f2ad..48ede6e 100644
--- a/src/helpers/vcd2vzt.c
+++ b/src/helpers/vcd2vzt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2010 Tony Bybell.
+ * Copyright (c) 1999-2014 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -247,6 +247,8 @@ return(strcmp(v1->id, v2->id));
*/
static void alias_vs_normal_symadd(struct vcdsymbol *v, struct vcdsymbol *root_v)
{
+if(!v) return; /* scan-build : should never happen */
+
if(!root_v)
{
if((v->vartype==V_INTEGER)||(v->vartype==V_REAL))
diff --git a/src/helpers/vzt2vcd.c b/src/helpers/vzt2vcd.c
index c756a7c..d722960 100644
--- a/src/helpers/vzt2vcd.c
+++ b/src/helpers/vzt2vcd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2009 Tony Bybell.
+ * Copyright (c) 2003-2014 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -48,21 +48,14 @@ static char *vcdid(unsigned int value)
{
static char buf[16];
char *pnt = buf;
-unsigned int vmod;
value++;
-for(;;)
+/* zero is illegal for a value...it is assumed they start at one */
+while (value)
{
- if((vmod = (value % 94)))
- {
- *(pnt++) = (char)(vmod + 32);
- }
- else
- {
- *(pnt++) = '~'; value -= 94;
- }
- value = value / 94;
- if(!value) { break; }
+ value--;
+ *(pnt++) = (char)('!' + value % 94);
+ value = value / 94;
}
*pnt = 0;
diff --git a/src/helpers/vzt_read.c b/src/helpers/vzt_read.c
index d2ca6e6..c263cb9 100644
--- a/src/helpers/vzt_read.c
+++ b/src/helpers/vzt_read.c
@@ -817,7 +817,7 @@ struct vzt_ncycle_autosort *autofacs= calloc(lt->numrealfacs, sizeof(struct vzt_
vzt_rd_block_vch_decode(lt, b);
vzt_rd_pthread_mutex_lock(lt, &b->mutex);
-autosort = calloc(b->num_time_ticks, sizeof(struct vzt_ncycle_autosort));
+autosort = calloc(b->num_time_ticks, sizeof(struct vzt_ncycle_autosort *));
for(i=0;i<b->num_time_ticks;i++) autosort[i]=NULL;
deadlist=NULL;
@@ -2058,6 +2058,8 @@ if((!lt)||(lt->vectorize)||(lt->numfacs<2))
}
}
+ free(pbuff); /* scan-build */
+
for(i=lt->numrealfacs;i<lt->numfacs;i++)
{
if(lt->flags[i] & VZT_RD_SYM_F_ALIAS) /* not necessary, only for sanity */
diff --git a/src/interp.c b/src/interp.c
index 1419c0a..eed35fc 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -31,7 +31,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <stdio.h>
#include <stdlib.h>
-#include <strings.h>
+#include <string.h>
#include <math.h>
#ifndef HAVE_BZERO
diff --git a/src/main.c b/src/main.c
index 41152af..dc14d09 100644
--- a/src/main.c
+++ b/src/main.c
@@ -470,7 +470,7 @@ if(!GLOBALS)
mainwindow_already_built = 0;
tcl_interpreter_needs_making = 1;
- GLOBALS->logfiles = calloc(1, sizeof(void **)); /* calloc is deliberate! */
+ GLOBALS->logfiles = calloc(1, sizeof(void *)); /* calloc is deliberate! */
}
else
{
@@ -2295,12 +2295,12 @@ if(!GLOBALS->notebook)
{
GLOBALS->num_notebook_pages = 1;
GLOBALS->this_context_page = 0;
- GLOBALS->contexts = calloc(1, sizeof(struct Globals ***)); /* calloc is deliberate! */
- *GLOBALS->contexts = calloc(1, sizeof(struct Globals **)); /* calloc is deliberate! */
+ GLOBALS->contexts = calloc(1, sizeof(struct Global **)); /* calloc is deliberate! */ /* scan-build */
+ *GLOBALS->contexts = calloc(1, sizeof(struct Global *)); /* calloc is deliberate! */ /* scan-build */
(*GLOBALS->contexts)[0] = GLOBALS;
- GLOBALS->dead_context = calloc(1, sizeof(struct Globals ***)); /* calloc is deliberate! */
- *GLOBALS->dead_context = calloc(1, sizeof(struct Globals **)); /* calloc is deliberate! */
+ GLOBALS->dead_context = calloc(1, sizeof(struct Global **)); /* calloc is deliberate! */ /* scan-build */
+ *GLOBALS->dead_context = calloc(1, sizeof(struct Global *)); /* calloc is deliberate! */ /* scan-build */
*(GLOBALS->dead_context)[0] = NULL;
GLOBALS->notebook = gtk_notebook_new();
@@ -2318,7 +2318,7 @@ if(!GLOBALS->notebook)
GLOBALS->this_context_page = GLOBALS->num_notebook_pages;
GLOBALS->num_notebook_pages++;
GLOBALS->num_notebook_pages_cumulative++; /* this never decreases, acts as an incrementing flipper id for side tabs */
- *GLOBALS->contexts = realloc(*GLOBALS->contexts, GLOBALS->num_notebook_pages * sizeof(struct Globals *)); /* realloc is deliberate! */
+ *GLOBALS->contexts = realloc(*GLOBALS->contexts, GLOBALS->num_notebook_pages * sizeof(struct Global *)); /* realloc is deliberate! */ /* scan-build */
(*GLOBALS->contexts)[GLOBALS->this_context_page] = GLOBALS;
for(ix=0;ix<GLOBALS->num_notebook_pages;ix++)
diff --git a/src/menu.c b/src/menu.c
index c54cc8f..d14331d 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 1999-2013.
+ * Copyright (c) Tony Bybell 1999-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -2908,8 +2908,7 @@ bvptr combine_traces(int direction, Trptr single_trace_only)
t=t->t_next;
}
- b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt-1)*
- sizeof(struct Node *));
+ b=(struct Bits *)calloc_2(1,sizeof(struct Bits)+(nodepnt)*sizeof(struct Node *));
b->attribs = malloc_2(nodepnt * sizeof(struct BitAttributes));
for(i=0;i<nodepnt;i++) /* for up combine we need to reverse the attribs list! */
@@ -5795,6 +5794,42 @@ dataformat( ~(TR_GRAYMASK|TR_ANALOGMASK), 0 );
}
void
+menu_dataformat_popcnt_on(gpointer null_data, guint callback_action, GtkWidget *widget)
+{
+if(GLOBALS->helpbox_is_active)
+ {
+ help_text_bold("\n\nData Format-Popcnt-On");
+ help_text(
+ " will step through all highlighted traces and ensure that"
+ " bits and vectors with this qualifier will be displayed after"
+ " going through a population (one's) count conversion. This is a filter"
+ " which sits before other Data Format options such as hex, etc."
+ );
+ return;
+ }
+
+dataformat( ~(TR_POPCNT), TR_POPCNT );
+}
+
+void
+menu_dataformat_popcnt_off(gpointer null_data, guint callback_action, GtkWidget *widget)
+{
+if(GLOBALS->helpbox_is_active)
+ {
+ help_text_bold("\n\nData Format-Popcnt-Off");
+ help_text(
+ " will step through all highlighted traces and ensure that"
+ " bits and vectors with this qualifier will be displayed with"
+ " normal encoding."
+ );
+ return;
+ }
+
+dataformat( ~(TR_POPCNT), 0 );
+}
+
+//
+void
menu_dataformat_invert_on(gpointer null_data, guint callback_action, GtkWidget *widget)
{
if(GLOBALS->helpbox_is_active)
@@ -6480,6 +6515,7 @@ if(GLOBALS->helpbox_is_active)
" F = File Filter\n"
" P = Process Filter\n"
" T = Transaction Filter\n"
+ " p = Population Count\n"
);
}
else
@@ -6611,6 +6647,9 @@ static gtkwave_mlist_t menu_items[] =
WAVE_GTKIFE("/Edit/Data Format/Gray Filters/To Gray", NULL, menu_dataformat_bingray_on, WV_MENU_B2G, "<Item>"),
WAVE_GTKIFE("/Edit/Data Format/Gray Filters/From Gray", NULL, menu_dataformat_graybin_on, WV_MENU_G2B, "<Item>"),
WAVE_GTKIFE("/Edit/Data Format/Gray Filters/None", NULL, menu_dataformat_nogray, WV_MENU_GBNONE, "<Item>"),
+ WAVE_GTKIFE("/Edit/Data Format/Popcnt/On", NULL, menu_dataformat_popcnt_on, WV_MENU_POPON, "<Item>"),
+ WAVE_GTKIFE("/Edit/Data Format/Popcnt/Off", NULL, menu_dataformat_popcnt_off, WV_MENU_POPOFF, "<Item>"),
+
WAVE_GTKIFE("/Edit/Color Format/Normal", NULL, menu_colorformat_0, WV_MENU_CLRFMT0, "<Item>"),
WAVE_GTKIFE("/Edit/Color Format/Red", NULL, menu_colorformat_1, WV_MENU_CLRFMT1, "<Item>"),
WAVE_GTKIFE("/Edit/Color Format/Orange", NULL, menu_colorformat_2, WV_MENU_CLRFMT2, "<Item>"),
@@ -7274,6 +7313,9 @@ static gtkwave_mlist_t popmenu_items[] =
WAVE_GTKIFE("/Data Format/Gray Filters/To Gray", NULL, menu_dataformat_bingray_on, WV_MENU_B2G, "<Item>"),
WAVE_GTKIFE("/Data Format/Gray Filters/From Gray", NULL, menu_dataformat_graybin_on, WV_MENU_G2B, "<Item>"),
WAVE_GTKIFE("/Data Format/Gray Filters/None", NULL, menu_dataformat_nogray, WV_MENU_GBNONE, "<Item>"),
+ WAVE_GTKIFE("/Data Format/Popcnt/On", NULL, menu_dataformat_popcnt_on, WV_MENU_POPON, "<Item>"),
+ WAVE_GTKIFE("/Data Format/Popcnt/Off", NULL, menu_dataformat_popcnt_off, WV_MENU_POPOFF, "<Item>"),
+
WAVE_GTKIFE("/Color Format/Normal", NULL, menu_colorformat_0, WV_MENU_CLRFMT0, "<Item>"),
WAVE_GTKIFE("/Color Format/Red", NULL, menu_colorformat_1, WV_MENU_CLRFMT1, "<Item>"),
WAVE_GTKIFE("/Color Format/Orange", NULL, menu_colorformat_2, WV_MENU_CLRFMT2, "<Item>"),
diff --git a/src/menu.h b/src/menu.h
index c07025e..6c9355e 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 1999-2013.
+ * Copyright (c) Tony Bybell 1999-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -160,6 +160,8 @@ WV_MENU_RFILLOFF,
WV_MENU_B2G,
WV_MENU_G2B,
WV_MENU_GBNONE,
+WV_MENU_POPON,
+WV_MENU_POPOFF,
WV_MENU_CLRFMT0,
WV_MENU_CLRFMT1,
WV_MENU_CLRFMT2,
diff --git a/src/mouseover.c b/src/mouseover.c
index d431d4c..2e7d816 100644
--- a/src/mouseover.c
+++ b/src/mouseover.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 2006-2012.
+ * Copyright (c) Tony Bybell 2006-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -82,7 +82,10 @@ if((flags & TR_PTRANSLATED) != 0) { ch[pos++] = 'P'; }
/* [13] */
if((flags & TR_TTRANSLATED) != 0) { ch[pos++] = 'T'; }
-/* [14] (at worst case this needs 14 characters) */
+/* [14] */
+if((flags & TR_POPCNT) != 0) { ch[pos++] = 'p'; }
+
+/* [15] (at worst case this needs 16 characters) */
ch[pos] = 0;
return(pos);
diff --git a/src/mouseover_sigs.c b/src/mouseover_sigs.c
index b83d16f..d12f67a 100644
--- a/src/mouseover_sigs.c
+++ b/src/mouseover_sigs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 2006-2012.
+ * Copyright (c) Tony Bybell 2006-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -109,7 +109,10 @@ if((flags & TR_PTRANSLATED) != 0) { ch[pos++] = 'P'; }
/* [13] */
if((flags & TR_TTRANSLATED) != 0) { ch[pos++] = 'T'; }
-/* [14] (at worst case this needs 14 characters) */
+/* [14] */
+if((flags & TR_POPCNT) != 0) { ch[pos++] = 'p'; }
+
+/* [15] (at worst case this needs 16 characters) */
ch[pos] = 0;
if(!t->vector)
diff --git a/src/tcl_helper.c b/src/tcl_helper.c
index 833be63..96e3d3e 100644
--- a/src/tcl_helper.c
+++ b/src/tcl_helper.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell and Concept Engineering GmbH 2008-2012.
+ * Copyright (c) Tony Bybell and Concept Engineering GmbH 2008-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -2654,11 +2654,11 @@ if(objc > 1)
{
char *s = Tcl_GetString(objv[i]);
int slen = strlen(s);
- struct wave_script_args *w = wave_alloca(sizeof(struct wave_script_args) + slen);
+ struct wave_script_args *w = wave_alloca(sizeof(struct wave_script_args) + slen + 1);
/* alloca used in case we context switch and get our allocator ripped out from under us -- the call stack won't go away */
if(slen)
{
- strcpy(w->payload, s);
+ strcpy(w->payload, s); /* scan-build complains but it thinks payload[1] is the actual memory allocated */
}
w->curr = NULL; /* yes, curr is only ever used for the 1st struct, but there is no sense creating head/follower structs for this */
w->next = NULL;
@@ -2681,7 +2681,7 @@ if(objc > 1)
if(!GLOBALS->wave_script_args) /* create a dummy list in order to keep requesters from popping up in file.c, etc. */
{
- GLOBALS->wave_script_args = wave_alloca(sizeof(struct wave_script_args));
+ GLOBALS->wave_script_args = wave_alloca(sizeof(struct wave_script_args) + 1);
GLOBALS->wave_script_args->curr = NULL;
GLOBALS->wave_script_args->next = NULL;
GLOBALS->wave_script_args->payload[0] = 0;
diff --git a/src/translate.c b/src/translate.c
index 7f64aff..6e99c27 100644
--- a/src/translate.c
+++ b/src/translate.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Tony Bybell 2005-6.
+ * Copyright (c) Tony Bybell 2005-2014.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -352,7 +352,7 @@ if(*GLOBALS->fileselbox_text)
GLOBALS->num_file_filters++;
load_file_filter(GLOBALS->num_file_filters, *GLOBALS->fileselbox_text);
-if(GLOBALS->xl_file_filter[GLOBALS->num_file_filters])
+if(GLOBALS->xl_file_filter[GLOBALS->num_file_filters] && (*GLOBALS->fileselbox_text /* scan-build */))
{
if(GLOBALS->filesel_filter[GLOBALS->num_file_filters]) free_2(GLOBALS->filesel_filter[GLOBALS->num_file_filters]);
GLOBALS->filesel_filter[GLOBALS->num_file_filters] = malloc_2(strlen(*GLOBALS->fileselbox_text) + 1);
diff --git a/src/tree.c b/src/tree.c
index 8f1fcbe..765dbde 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -176,7 +176,7 @@ if(GLOBALS->treeroot)
return;
}
- t = talloc_2(sizeof(struct tree) + scopename_len);
+ t = talloc_2(sizeof(struct tree) + scopename_len + 1);
*PPValue = t;
goto t_allocated;
}
@@ -219,14 +219,14 @@ if(GLOBALS->treeroot)
strcpy(str+len, scopename);
PPValue = JudySLIns(&GLOBALS->sym_tree, (uint8_t *)str, PJE0);
- t = talloc_2(sizeof(struct tree) + scopename_len);
+ t = talloc_2(sizeof(struct tree) + scopename_len + 1);
*PPValue = t;
goto t_allocated;
}
}
#endif
- t = talloc_2(sizeof(struct tree) + scopename_len);
+ t = talloc_2(sizeof(struct tree) + scopename_len + 1);
#ifdef _WAVE_HAVE_JUDY
t_allocated:
#endif
@@ -256,7 +256,7 @@ t_allocated:
t = t->next;
}
- t = talloc_2(sizeof(struct tree) + scopename_len);
+ t = talloc_2(sizeof(struct tree) + scopename_len + 1);
strcpy(t->name, scopename);
t->kind = ttype;
t->t_which = mtyp;
@@ -269,7 +269,7 @@ t_allocated:
}
else
{
- t = talloc_2(sizeof(struct tree) + scopename_len);
+ t = talloc_2(sizeof(struct tree) + scopename_len + 1);
strcpy(t->name, scopename);
t->kind = ttype;
t->t_which = mtyp;
@@ -796,7 +796,7 @@ rescan:
#ifdef _WAVE_HAVE_JUDY
construct:
#endif
- nt=(struct tree *)talloc_2(sizeof(struct tree)+GLOBALS->module_len_tree_c_1);
+ nt=(struct tree *)talloc_2(sizeof(struct tree)+GLOBALS->module_len_tree_c_1 + 1);
memcpy(nt->name, GLOBALS->module_tree_c_1, GLOBALS->module_len_tree_c_1);
if(s)
@@ -836,7 +836,7 @@ construct:
{
s=get_module_name(s);
- nt=(struct tree *)talloc_2(sizeof(struct tree)+GLOBALS->module_len_tree_c_1);
+ nt=(struct tree *)talloc_2(sizeof(struct tree)+GLOBALS->module_len_tree_c_1 + 1);
memcpy(nt->name, GLOBALS->module_tree_c_1, GLOBALS->module_len_tree_c_1);
if(s)
@@ -862,7 +862,7 @@ else
{
s=get_module_name(s);
- nt=(struct tree *)talloc_2(sizeof(struct tree)+GLOBALS->module_len_tree_c_1);
+ nt=(struct tree *)talloc_2(sizeof(struct tree)+GLOBALS->module_len_tree_c_1 + 1);
memcpy(nt->name, GLOBALS->module_tree_c_1, GLOBALS->module_len_tree_c_1);
if(!s) nt->t_which=which; else nt->t_which = WAVE_T_WHICH_UNDEFINED_COMPNAME;
diff --git a/src/tree.h b/src/tree.h
index cc54199..503df8e 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -118,7 +118,7 @@ uint32_t t_istem; /* source stem (if >0) for Open Hierarchy Source Inst, see ste
unsigned kind : 7; /* Kind of the leaf: ghwlib reads this as val & 0x7f so only 7 bits needed */
unsigned children_in_gui : 1; /* indicates that the child nodes are in the gtk2 tree, but gets borrowed during tree creation for fast judy sort */
-char name[1];
+char name[]; /* C99 */
};
#ifdef WAVE_USE_STRUCT_PACKING
diff --git a/src/treesearch_gtk2.c b/src/treesearch_gtk2.c
index a90f948..47f3af4 100644
--- a/src/treesearch_gtk2.c
+++ b/src/treesearch_gtk2.c
@@ -82,7 +82,6 @@ static void *fix_escaped_names(char *s, int do_free)
{
char *s2 = s;
int found = 0;
-int len;
while(*s2)
{
@@ -96,7 +95,6 @@ while(*s2)
if(found)
{
- len = strlen(s);
s2 = strdup_2(s);
if(do_free) free_2(s);
s = s2;
diff --git a/src/ttranslate.c b/src/ttranslate.c
index 1a60b9b..67cdd4e 100644
--- a/src/ttranslate.c
+++ b/src/ttranslate.c
@@ -624,11 +624,11 @@ if((t->t_filter) && (t->flags & TR_TTRANSLATED) && (t->vector) && (!t->t_filter_
cvt_ok = 1;
- vt_head = vt_curr = vt = calloc_2(1, sizeof(struct VectorEnt));
+ vt_head = vt_curr = vt = calloc_2(1, sizeof(struct VectorEnt) + 1);
vt->time = LLDescriptor(-2);
vprev = vt; /* for duplicate removal */
- vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt));
+ vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt) + 1);
vt->time = LLDescriptor(-1);
for(;;)
@@ -694,7 +694,7 @@ ex: buf[n] = 0;
} while(pnt != (sp-1));
}
- vt = calloc_2(1, sizeof(struct VectorEnt) + slen);
+ vt = calloc_2(1, sizeof(struct VectorEnt) + slen + 1);
if(sp) strcpy((char *)vt->v, sp);
if(tim > prev_tim)
@@ -795,15 +795,15 @@ ex: buf[n] = 0;
}
}
- vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt));
+ vt_curr = vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt) + 1);
vt->time = MAX_HISTENT_TIME - 1;
regions++;
- /* vt_curr = */ vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt)); /* scan-build */
+ /* vt_curr = */ vt_curr->next = vt = calloc_2(1, sizeof(struct VectorEnt) + 1); /* scan-build */
vt->time = MAX_HISTENT_TIME;
regions++;
- bv = calloc_2(1, sizeof(struct BitVector) + (sizeof(vptr) * (regions-1)));
+ bv = calloc_2(1, sizeof(struct BitVector) + (sizeof(vptr) * (regions)));
bv->bvname = strdup_2(trace_name ? trace_name : orig_name);
bv->nbits = 1;
bv->numregions = regions;
diff --git a/src/vlist.c b/src/vlist.c
index 0b4fade..6cab77e 100644
--- a/src/vlist.c
+++ b/src/vlist.c
@@ -247,7 +247,7 @@ if(v->siz > 32)
int rc;
rc = compress2((unsigned char *)dmem, &destlen, (unsigned char *)(v+1), v->siz, GLOBALS->vlist_compression_depth);
- if((rc == Z_OK)&&(destlen < (v->siz - sizeof(long))))
+ if( (rc == Z_OK) && ((destlen + sizeof(int)) < v->siz) )
{
/* printf("siz: %d, dest: %d rc: %d\n", v->siz, (int)destlen, rc); */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gtkwave.git
More information about the Pkg-electronics-commits
mailing list