# HG changeset patch # User Matti Hamalainen # Date 1527778540 -10800 # Node ID 904904f145b430876bb33b91635aac6857adc954 # Parent e7990551c6d6669b0ea35dcc36c2bce6b0e0aad2 Various fixes in fanalyze. diff -r e7990551c6d6 -r 904904f145b4 tools/fanalyze.c --- 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);