comparison src/collect-io.c @ 360:822040a51249

Increase collection_load() buffer size and do not activate error limiting for GQview collections.
author zas_
date Mon, 14 Apr 2008 22:45:53 +0000
parents 96fb24f948b7
children e0295af4f716
comparison
equal deleted inserted replaced
359:96fb24f948b7 360:822040a51249
24 24
25 #define GQ_COLLECTION_MARKER "#" GQ_APPNAME 25 #define GQ_COLLECTION_MARKER "#" GQ_APPNAME
26 26
27 #define GQ_COLLECTION_FAIL_MIN 300 27 #define GQ_COLLECTION_FAIL_MIN 300
28 #define GQ_COLLECTION_FAIL_PERCENT 98 28 #define GQ_COLLECTION_FAIL_PERCENT 98
29 #define GQ_COLLECTION_READ_BUFSIZE 4096
29 30
30 typedef struct _CollectManagerEntry CollectManagerEntry; 31 typedef struct _CollectManagerEntry CollectManagerEntry;
31 32
32 static void collection_load_thumb_step(CollectionData *cd); 33 static void collection_load_thumb_step(CollectionData *cd);
33 static gint collection_save_private(CollectionData *cd, const gchar *path); 34 static gint collection_save_private(CollectionData *cd, const gchar *path);
51 return TRUE; 52 return TRUE;
52 } 53 }
53 54
54 static gint collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) 55 static gint collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
55 { 56 {
56 gchar s_buf[2048]; 57 gchar s_buf[GQ_COLLECTION_READ_BUFSIZE];
57 FILE *f; 58 FILE *f;
58 gchar *pathl; 59 gchar *pathl;
59 gint official = FALSE; 60 gint official = FALSE;
60 gint success = TRUE; 61 gint success = TRUE;
61 guint total = 0; 62 guint total = 0;
83 } 84 }
84 85
85 if (!path && !cd->path) return FALSE; 86 if (!path && !cd->path) return FALSE;
86 87
87 if (!path) path = cd->path; 88 if (!path) path = cd->path;
89
90 if (debug) printf("collection load: append=%d flush=%d only_geometry=%d path=%s\n",
91 append, flush, only_geometry, path);
88 92
89 /* load it */ 93 /* load it */
90 pathl = path_from_utf8(path); 94 pathl = path_from_utf8(path);
91 f = fopen(pathl, "r"); 95 f = fopen(pathl, "r");
92 g_free(pathl); 96 g_free(pathl);
117 if (only_geometry) 121 if (only_geometry)
118 { 122 {
119 fclose(f); 123 fclose(f);
120 return TRUE; 124 return TRUE;
121 } 125 }
126 }
127 else if (strncasecmp(s_buf, "GQview collection", strlen("GQview collection")) == 0)
128 {
129 /* As 2008/04/15 there is no difference between our collection file format
130 * and GQview 2.1.5 collection file format so ignore failures as well. */
131 official = TRUE;
122 } 132 }
123 continue; 133 continue;
124 } 134 }
125 if (s_buf[0]=='\n') continue; 135 if (s_buf[0]=='\n') continue;
126 136