Mercurial > hg > dmlib
changeset 1685:904904f145b4
Various fixes in fanalyze.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 31 May 2018 17:55:40 +0300 |
parents | e7990551c6d6 |
children | dcc48679a89e |
files | tools/fanalyze.c |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/fanalyze.c Thu May 31 17:25:35 2018 +0300 +++ b/tools/fanalyze.c Thu May 31 17:55:40 2018 +0300 @@ -118,7 +118,6 @@ for (int nfile = 0; nfile < nsrcFiles; nfile++) { DMSourceFile *file = &srcFiles[nfile]; - dmPrint(2, "Input #%d: %s\n", nfile + 1, file->filename); if ((res = dmReadDataFile(NULL, file->filename, &file->data, &file->size)) != DMERR_OK) { dmErrorMsg("Could not read '%s': %s\n", @@ -126,7 +125,10 @@ goto out; } - if (file->size > compBufSize) + dmPrint(2, "Input #%d: '%s', %" DM_PRIu_SIZE_T " bytes.\n", + nfile + 1, file->filename, file->size); + + if (!compBufSize || file->size < compBufSize) compBufSize = file->size; } @@ -147,10 +149,10 @@ { DMSourceFile *file = &srcFiles[nfile]; for (size_t offs = 0; offs < compBufSize; offs++) - if (offs < file->size) - compBuf[offs].counts[file->data[offs]]++; - else - compBuf[offs].counts[0]++; + { + Uint8 data = offs < file->size ? file->data[offs] : 0; + compBuf[offs].counts[data]++; + } } for (size_t offs = 0; offs < compBufSize; offs++) @@ -173,7 +175,7 @@ BOOL var = el->variants > 1; if (n == 0) - printf("%08" DM_PRIu_SIZE_T "x | ", offs); + printf("%08" DM_PRIx_SIZE_T " | ", offs); if (var) printf("[%2d] ", el->variants);