Skip to content

Commit

Permalink
vcardparser.c: yet more debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Apr 26, 2024
1 parent 3abf1fe commit 1020d7f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/libicalvcard/vcardparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 1020d7f

Please sign in to comment.