From ced60542797673db5c00ad4042d383fc6194d726 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Fri, 11 Jul 2014 02:39:08 +0200 Subject: [PATCH] Improve debugging output in read_fixed_signal() --- libhpcs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libhpcs.c b/libhpcs.c index 81510b2..3b3583b 100644 --- a/libhpcs.c +++ b/libhpcs.c @@ -459,6 +459,9 @@ static enum HPCS_ParseCode read_fixed_signal(FILE* datafile, struct HPCS_TVPair* char raw[2]; size_t r; enum HPCS_DataCheckCode dret; +#ifndef NDEBUG + size_t bytes_read = 0; +#endif fseek(datafile, DATA_OFFSET_DATA_START, SEEK_SET); if (feof(datafile)) @@ -502,6 +505,9 @@ static enum HPCS_ParseCode read_fixed_signal(FILE* datafile, struct HPCS_TVPair* return PARSE_E_CANT_READ; } segments_read++; +#ifndef NDEBUG + bytes_read += SEGMENT_SIZE; +#endif if (alloc_size == data_segments_read) { struct HPCS_TVPair* nptr; @@ -522,12 +528,13 @@ static enum HPCS_ParseCode read_fixed_signal(FILE* datafile, struct HPCS_TVPair* dret = check_for_marker(raw, &next_marker_idx); switch (dret) { case DCHECK_GOT_MARKER: + PR_DEBUGF("Got marker at: 0x%lx\n", bytes_read + DATA_OFFSET_DATA_START); break; case DCHECK_EOF: read_file = false; break; default: - PR_DEBUGF("%s %lu\n", "Marker was expected but it was not found at:", segments_read); + PR_DEBUGF("Marker was expected but it was not found at: 0x%lx\n", bytes_read + DATA_OFFSET_DATA_START); free(*pairs); *pairs = NULL; return PARSE_E_NOT_FOUND; -- 2.43.5