comparison src/buddyicon.c @ 10589:0f7452b1f777

[gaim-migrate @ 11994] Use GLib 2.6's gstdio functions. This should fix gaim not liking non-ascii filenames in win32. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 11 Feb 2005 05:10:40 +0000
parents f5c9438982f8
children dc59482c8d37
comparison
equal deleted inserted replaced
10588:529111933c9c 10589:0f7452b1f777
223 223
224 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) 224 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR))
225 { 225 {
226 gaim_debug_info("buddy icons", "Creating icon cache directory.\n"); 226 gaim_debug_info("buddy icons", "Creating icon cache directory.\n");
227 227
228 if (mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) 228 if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0)
229 { 229 {
230 gaim_debug_error("buddy icons", 230 gaim_debug_error("buddy icons",
231 "Unable to create directory %s: %s\n", 231 "Unable to create directory %s: %s\n",
232 dirname, strerror(errno)); 232 dirname, strerror(errno));
233 } 233 }
234 } 234 }
235 235
236 if ((file = fopen(filename, "wb")) != NULL) 236 if ((file = g_fopen(filename, "wb")) != NULL)
237 { 237 {
238 fwrite(data, 1, len, file); 238 fwrite(data, 1, len, file);
239 fclose(file); 239 fclose(file);
240 } 240 }
241 241
242 g_free(filename); 242 g_free(filename);
243 243
244 if (old_icon != NULL) 244 if (old_icon != NULL)
245 { 245 {
246 if(!stat(old_icon, &st)) 246 if(!g_stat(old_icon, &st))
247 unlink(old_icon); 247 g_unlink(old_icon);
248 else { 248 else {
249 filename = g_build_filename(dirname, old_icon, NULL); 249 filename = g_build_filename(dirname, old_icon, NULL);
250 if(!stat(filename, &st)) 250 if(!g_stat(filename, &st))
251 unlink(filename); 251 g_unlink(filename);
252 g_free(filename); 252 g_free(filename);
253 } 253 }
254 } 254 }
255 255
256 gaim_blist_node_set_string((GaimBlistNode *)buddy, "buddy_icon", random); 256 gaim_blist_node_set_string((GaimBlistNode *)buddy, "buddy_icon", random);
371 return NULL; 371 return NULL;
372 372
373 if ((file = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon")) == NULL) 373 if ((file = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon")) == NULL)
374 return NULL; 374 return NULL;
375 375
376 if (!stat(file, &st)) 376 if (!g_stat(file, &st))
377 filename = g_strdup(file); 377 filename = g_strdup(file);
378 else 378 else
379 filename = g_build_filename(gaim_buddy_icons_get_cache_dir(), file, NULL); 379 filename = g_build_filename(gaim_buddy_icons_get_cache_dir(), file, NULL);
380 380
381 if (!stat(filename, &st)) { 381 if (!g_stat(filename, &st)) {
382 FILE *f = fopen(filename, "rb"); 382 FILE *f = g_fopen(filename, "rb");
383 if (f) { 383 if (f) {
384 char *data = g_malloc(st.st_size); 384 char *data = g_malloc(st.st_size);
385 fread(data, 1, st.st_size, f); 385 fread(data, 1, st.st_size, f);
386 fclose(f); 386 fclose(f);
387 ret = gaim_buddy_icon_create(account, username); 387 ret = gaim_buddy_icon_create(account, username);