Skip to content

Commit

Permalink
Fix: iterate with get_next in handle_get_notes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell authored and a-h-abdelsalam committed Jun 14, 2024
1 parent 8e61336 commit e238c71
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13665,9 +13665,21 @@ handle_get_notes (gmp_parser_t *gmp_parser, GError **error)

buffer = g_string_new ("");

// TODO: Do the iteration with get_next so it checks "first".
buffer_notes_xml (buffer, &notes, get_notes_data->get.details,
get_notes_data->result, &count);
while (1)
{
ret = get_next (&notes, &get_notes_data->get, &first, &count,
init_note_iterator_all);
if (ret == 1)
break;
if (ret == -1)
{
internal_error_send_to_client (error);
return;
}

buffer_note_xml (buffer, &notes, get_notes_data->get.details,
get_notes_data->result, &count);
}

SEND_TO_CLIENT_OR_FAIL (buffer->str);
g_string_free (buffer, TRUE);
Expand Down

0 comments on commit e238c71

Please sign in to comment.