From 1020d7f9bf9ce906a115cf4a46268040eef9db64 Mon Sep 17 00:00:00 2001 From: Ken Murchison Date: Fri, 26 Apr 2024 08:13:44 -0400 Subject: [PATCH] vcardparser.c: yet more debugging --- src/libicalvcard/vcardparser.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/libicalvcard/vcardparser.c b/src/libicalvcard/vcardparser.c index 5d85f0848..1051dbdc6 100755 --- a/src/libicalvcard/vcardparser.c +++ b/src/libicalvcard/vcardparser.c @@ -796,7 +796,8 @@ static void _parse_eatline(struct vcardparser_state *state) static void _parse_prop(struct vcardparser_state *state) { int r = _parse_prop_name(state); - fprintf(stderr, "_parse_prop_name: %d '%s'\n", r, state->prop ? vcardproperty_get_property_name(state->prop) : ""); + +fprintf(stderr, "_parse_prop_name: %d '%s'\n", r, state->prop ? vcardproperty_get_property_name(state->prop) : ""); if (r) { if (r == PE_PROP_MULTIGROUP) { vcardproperty_kind prop_kind = vcardproperty_isa(state->prop); @@ -868,6 +869,7 @@ static int _parse_vcard(struct vcardparser_state *state, int r = 0; while (*state->p) { +fprintf(stderr, "p: '%c'\n", *state->p); /* whitespace is very skippable before AND afterwards */ if (*state->p == '\r' || *state->p == '\n' || *state->p == ' ' || *state->p == '\t') { @@ -915,20 +917,23 @@ fprintf(stderr, "END val: '%s'\n", val); /* special case mismatched card, the "start" was the start of * the card */ state->itemstart = cardstart; - fprintf(stderr, "BEGIN comp (%u) != END (%u)\n", - vcardcomponent_isa(comp), kind); +fprintf(stderr, "BEGIN comp (%u) != END (%u)\n", + vcardcomponent_isa(comp), kind); +fprintf(stderr, "cardstart: '%s'\n", cardstart); r = PE_MISMATCHED_CARD; } break; } else { +fprintf(stderr, "add prop\n"); vcardcomponent_add_property(comp, state->prop); state->prop = NULL; } } if (state->prop) { +fprintf(stderr, "end of card\n"); if (vcardproperty_isa(state->prop) != VCARD_END_PROPERTY) { r = PE_FINISHED_EARLY; } @@ -1032,11 +1037,11 @@ vcardcomponent *vcardparser_parse_string(const char *str) parser.root = NULL; } } - else { - fprintf(stderr, "vcardparser_parse_string() failed: %s\n%s\n", - vcardparser_errstr(r), - vcardcomponent_as_vcard_string(parser.root)); - } +else { + fprintf(stderr, "vcardparser_parse_string() failed: %s\n%s\n", + vcardparser_errstr(r), + vcardcomponent_as_vcard_string(parser.root)); +} vcardparser_free(&parser);