89
90
while ((entry = readdir(dir)) != NULL) {
93
94
if (entry->d_name[0] == '.')
97
97
hash = FNV_hash(entry->d_name);
99
if (Picture8_load(pic, hash, directoryname,
100
entry->d_name) != 0) {
101
Picture8_delete(pic);
105
tmp = g_slist_prepend(tmp, (gpointer)pic);
108
if (libbiniou_verbose && !(size % 5))
111
100
for (t = g_slist_next(tmp);
113
102
t = g_slist_next(t))
114
if (((Picture8_t *)t->data)->id == hash)
115
xerror("Duplicated picture hash: %s / %s, %li\n",
116
((Picture8_t *)t->data)->name, entry->d_name, hash);
103
if (((Picture8_t *)t->data)->id == hash) {
104
const char *name = ((Picture8_t *)t->data)->name;
106
if (strcmp(name, entry->d_name))
107
printf("[!] Ignoring picture '%s'\n"
108
"[!] (same hash as '%s': %"PRIu32")\n",
109
entry->d_name, name, hash);
114
pic = Picture8_new();
116
if (Picture8_load(pic, hash, directoryname,
117
entry->d_name) != 0) {
118
Picture8_delete(pic);
121
if (libbiniou_verbose && !(size % 5))
124
tmp = g_slist_prepend(tmp, (gpointer)pic);
118
129
if (closedir(dir) == -1)
119
130
xperror("closedir");
120
131
g_free(directoryname);
182
193
return pictures->pics[0]->dname;
184
printf("[!] Pictures_name: id %li not found\n", id);
195
printf("[!] Pictures_name: id %"PRIu16" not found\n", id);
191
Pictures_index(const long id)
202
Pictures_index(const uint32_t id)
195
206
if (pictures == NULL) {
196
207
printf("[!] No pictures loaded\n");
201
212
if (pictures->pics[i]->id == id)
204
printf("[!] Pictures_index: id %li not found\n", id);
215
printf("[!] Pictures_index: id %"PRIu16" not found\n", id);
211
222
Pictures_find(const char *name)
215
226
if (pictures == NULL) {
216
227
printf("[!] No pictures loaded\n");
220
231
for (i = 0; i < pictures->size; i++)