[gmime] Fixed test-parser.c's usage of part iters
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fixed test-parser.c's usage of part iters
- Date: Sat, 18 Feb 2012 15:37:29 +0000 (UTC)
commit d868ffbc159fe2a6b3567e8cb1ea221f8a5ee506
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sat Feb 18 10:36:55 2012 -0500
Fixed test-parser.c's usage of part iters
tests/test-parser.c | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/tests/test-parser.c b/tests/test-parser.c
index bda3301..7f1f16c 100644
--- a/tests/test-parser.c
+++ b/tests/test-parser.c
@@ -124,28 +124,32 @@ print_mime_struct_iter (GMimeMessage *message)
char *path;
iter = g_mime_part_iter_new ((GMimeObject *) message);
-
- part = g_mime_part_iter_get_parent (iter);
- print_mime_part_info ("TEXT", part);
-
- do {
- part = g_mime_part_iter_get_current (iter);
- path = g_mime_part_iter_get_path (iter);
- print_mime_part_info (path, part);
- g_free (path);
- } while (g_mime_part_iter_next (iter));
-
+ if (g_mime_part_iter_is_valid (iter)) {
+ part = g_mime_part_iter_get_parent (iter);
+ print_mime_part_info ("TEXT", part);
+
+ do {
+ part = g_mime_part_iter_get_current (iter);
+ path = g_mime_part_iter_get_path (iter);
+ print_mime_part_info (path, part);
+ g_free (path);
+ } while (g_mime_part_iter_next (iter));
+
#if 0
- fprintf (stdout, "Jumping to %s\n", jump_to);
- if (g_mime_part_iter_jump_to (iter, jump_to)) {
- part = g_mime_part_iter_get_current (iter);
- path = g_mime_part_iter_get_path (iter);
- print_mime_part_info (path, part);
- g_free (path);
+ fprintf (stdout, "Jumping to %s\n", jump_to);
+ if (g_mime_part_iter_jump_to (iter, jump_to)) {
+ part = g_mime_part_iter_get_current (iter);
+ path = g_mime_part_iter_get_path (iter);
+ print_mime_part_info (path, part);
+ g_free (path);
+ } else {
+ fprintf (stdout, "Failed to jump to %s\n", jump_to);
+ }
+#endif
} else {
- fprintf (stdout, "Failed to jump to %s\n", jump_to);
+ part = g_mime_message_get_mime_part (message);
+ print_mime_part_info ("TEXT", part);
}
-#endif
g_mime_part_iter_free (iter);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]