From 16460a8d2e835bd075f89b185504b4c8126956d1 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 6 Mar 2003 01:34:45 +0000 Subject: [PATCH] Show all failing CRCs. Added note to README regarding expected failures with "version 1" records. --- nufxlib-0/samples/README-S.txt | 13 +++++++++++-- nufxlib-0/samples/TestTwirl.c | 12 +++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/nufxlib-0/samples/README-S.txt b/nufxlib-0/samples/README-S.txt index f18822a..3f432b2 100644 --- a/nufxlib-0/samples/README-S.txt +++ b/nufxlib-0/samples/README-S.txt @@ -105,6 +105,15 @@ place", deleting and adding threads within existing records several times. The changes are periodically flushed, but the archive is never closed. The goal is to test repeated updates on an open archive. -This will leave a file called "TwirlCopy678" in the current directory, and -overwrite "TwirlTmp789" during processing. +The CRC verification mechanism will fail on archives created with ProDOS +8 ShrinkIt. The older "version 1" records didn't have CRCs in the thread +headers, so you will get a series of messages that look like this: + +ERROR: CRC mismatch: 0 old=0x0000 new=0x681b +ERROR: CRC mismatch: 1 old=0x0000 new=0x5570 +ERROR: CRC mismatch: 2 old=0x0000 new=0x4ec5 + +This will leave the original archive alone, making a copy of it named +"TwirlCopy678" in the current directory. It overwrites its temp file, +"TwirlTmp789", without prompting. diff --git a/nufxlib-0/samples/TestTwirl.c b/nufxlib-0/samples/TestTwirl.c index b9c5de8..9b106e0 100644 --- a/nufxlib-0/samples/TestTwirl.c +++ b/nufxlib-0/samples/TestTwirl.c @@ -233,6 +233,7 @@ CompareCRCs(NuArchive* pArchive, const CRCList* pOldCRCList) { CRCList* pNewCRCList = nil; int result = -1; + int badCrc = 0; int i; pNewCRCList = GatherCRCs(pArchive); @@ -250,13 +251,14 @@ CompareCRCs(NuArchive* pArchive, const CRCList* pOldCRCList) for (i = 0; i < pNewCRCList->numEntries; i++) { if (pOldCRCList->entries[i] != pNewCRCList->entries[i]) { fprintf(stderr, "ERROR: CRC mismatch: %5d old=0x%04x new=0x%04x\n", - i, pOldCRCList->numEntries, pNewCRCList->numEntries); - goto bail; + i, pOldCRCList->entries[i], pNewCRCList->entries[i]); + badCrc = 1; } } - printf(" Matched %d CRCs\n", pOldCRCList->numEntries); - - result = 0; + if (!badCrc) { + printf(" Matched %d CRCs\n", pOldCRCList->numEntries); + result = 0; + } bail: FreeCRCs(pNewCRCList);