Mercurial > geeqie
comparison src/collect-io.c @ 366:ce00494827e2
collection_load(): use booleans and always count failures (for debug).
author | zas_ |
---|---|
date | Mon, 14 Apr 2008 23:39:46 +0000 |
parents | addd05a425fe |
children | 2649a28d31b6 |
comparison
equal
deleted
inserted
replaced
365:addd05a425fe | 366:ce00494827e2 |
---|---|
65 gint need_header = TRUE; | 65 gint need_header = TRUE; |
66 guint total = 0; | 66 guint total = 0; |
67 guint fail = 0; | 67 guint fail = 0; |
68 gboolean changed = FALSE; | 68 gboolean changed = FALSE; |
69 CollectManagerEntry *entry = NULL; | 69 CollectManagerEntry *entry = NULL; |
70 guint flush = flags & COLLECTION_LOAD_FLUSH; | 70 guint flush = !!(flags & COLLECTION_LOAD_FLUSH); |
71 guint append = flags & COLLECTION_LOAD_APPEND; | 71 guint append = !!(flags & COLLECTION_LOAD_APPEND); |
72 guint only_geometry = flags & COLLECTION_LOAD_GEOMETRY; | 72 guint only_geometry = !!(flags & COLLECTION_LOAD_GEOMETRY); |
73 | 73 |
74 if (!only_geometry) | 74 if (!only_geometry) |
75 { | 75 { |
76 collection_load_stop(cd); | 76 collection_load_stop(cd); |
77 | 77 |
157 valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); | 157 valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); |
158 if (debug && !valid) printf("collection invalid file: %s\n", buf); | 158 if (debug && !valid) printf("collection invalid file: %s\n", buf); |
159 g_free(buf); | 159 g_free(buf); |
160 | 160 |
161 total++; | 161 total++; |
162 if (!valid && limit_failures) | 162 if (!valid) |
163 { | 163 { |
164 fail++; | 164 fail++; |
165 if (fail > GQ_COLLECTION_FAIL_MIN && | 165 if (limit_failures && |
166 fail > GQ_COLLECTION_FAIL_MIN && | |
166 fail * 100 / total > GQ_COLLECTION_FAIL_PERCENT) | 167 fail * 100 / total > GQ_COLLECTION_FAIL_PERCENT) |
167 { | 168 { |
168 printf("%d invalid filenames in unoffical collection file, closing: %s\n", fail, path); | 169 printf("%d invalid filenames in unoffical collection file, closing: %s\n", fail, path); |
169 success = FALSE; | 170 success = FALSE; |
170 break; | 171 break; |