changeset 2431:ca548150de6b

Fix grepping of consecutive values in fanalyze when using > byte size types.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 19 Feb 2020 01:52:36 +0200
parents 190f5caaf1a8
children 758223ba6551
files tools/fanalyze.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tools/fanalyze.c	Tue Feb 18 23:31:10 2020 +0200
+++ b/tools/fanalyze.c	Wed Feb 19 01:52:36 2020 +0200
@@ -242,10 +242,11 @@
 void dmPrintGrepValueList(const DMGrepValue *node, const BOOL match, DMSourceFile *file, const size_t offs)
 {
     char mfmt[16];
+    unsigned int bsize = dmGrepTypes[node->type].bsize;
 
     snprintf(mfmt, sizeof(mfmt), "%%%s%d%s%%s",
         dmGrepDisp[node->disp].fmtPrefix,
-        dmGrepTypes[node->type].bsize * 2,
+        bsize * 2,
         dmGrepDisp[node->disp].fmt);
 
     for (int n = 0; n < node->nvalues; n++)
@@ -255,7 +256,7 @@
         if (match)
         {
             Uint32 mval;
-            dmGetData(node->type, file, offs + n, &mval);
+            dmGetData(node->type, file, offs + n * bsize, &mval);
             printf(mfmt, mval, veol);
         }
         else
@@ -725,7 +726,7 @@
                     if (!node->vwildcards[n])
                     {
                         Uint32 mval;
-                        dmGetData(node->type, file, offs + n, &mval);
+                        dmGetData(node->type, file, offs + n * def->bsize, &mval);
 
                         if (mval != node->values[n])
                         {