| 2531 /* We were able to save the image as this image type and |
2531 /* We were able to save the image as this image type and |
| 2532 have it be within the size constraints. Great! Return |
2532 have it be within the size constraints. Great! Return |
| 2533 the image. */ |
2533 the image. */ |
| 2534 purple_debug_info("buddyicon", "Converted image from " |
2534 purple_debug_info("buddyicon", "Converted image from " |
| 2535 "%dx%d to %dx%d, format=%s, quality=%u, " |
2535 "%dx%d to %dx%d, format=%s, quality=%u, " |
| 2536 "filesize=%zu\n", orig_width, orig_height, |
2536 "filesize=%" G_GSIZE_FORMAT "\n", |
| 2537 new_width, new_height, prpl_formats[i], quality, |
2537 orig_width, orig_height, new_width, new_height, |
| 2538 length); |
2538 prpl_formats[i], quality, length); |
| 2539 if (len) |
2539 if (len) |
| 2540 *len = length; |
2540 *len = length; |
| 2541 g_strfreev(prpl_formats); |
2541 g_strfreev(prpl_formats); |
| 2542 g_object_unref(G_OBJECT(pixbuf)); |
2542 g_object_unref(G_OBJECT(pixbuf)); |
| 2543 g_object_unref(G_OBJECT(original)); |
2543 g_object_unref(G_OBJECT(original)); |
| 3124 |
3124 |
| 3125 loader = gdk_pixbuf_loader_new(); |
3125 loader = gdk_pixbuf_loader_new(); |
| 3126 |
3126 |
| 3127 if (!gdk_pixbuf_loader_write(loader, buf, count, &error) || error) { |
3127 if (!gdk_pixbuf_loader_write(loader, buf, count, &error) || error) { |
| 3128 purple_debug_warning("gtkutils", "gdk_pixbuf_loader_write() " |
3128 purple_debug_warning("gtkutils", "gdk_pixbuf_loader_write() " |
| 3129 "failed with size=%zu: %s\n", count, |
3129 "failed with size=%" G_GSIZE_FORMAT ": %s\n", count, |
| 3130 error ? error->message : "(no error message)"); |
3130 error ? error->message : "(no error message)"); |
| 3131 if (error) |
3131 if (error) |
| 3132 g_error_free(error); |
3132 g_error_free(error); |
| 3133 g_object_unref(G_OBJECT(loader)); |
3133 g_object_unref(G_OBJECT(loader)); |
| 3134 return NULL; |
3134 return NULL; |
| 3135 } |
3135 } |
| 3136 |
3136 |
| 3137 if (!gdk_pixbuf_loader_close(loader, &error) || error) { |
3137 if (!gdk_pixbuf_loader_close(loader, &error) || error) { |
| 3138 purple_debug_warning("gtkutils", "gdk_pixbuf_loader_close() " |
3138 purple_debug_warning("gtkutils", "gdk_pixbuf_loader_close() " |
| 3139 "failed for image of size %zu: %s\n", count, |
3139 "failed for image of size %" G_GSIZE_FORMAT ": %s\n", count, |
| 3140 error ? error->message : "(no error message)"); |
3140 error ? error->message : "(no error message)"); |
| 3141 if (error) |
3141 if (error) |
| 3142 g_error_free(error); |
3142 g_error_free(error); |
| 3143 g_object_unref(G_OBJECT(loader)); |
3143 g_object_unref(G_OBJECT(loader)); |
| 3144 return NULL; |
3144 return NULL; |
| 3148 pixbuf = G_OBJECT(gdk_pixbuf_loader_get_animation(loader)); |
3148 pixbuf = G_OBJECT(gdk_pixbuf_loader_get_animation(loader)); |
| 3149 else |
3149 else |
| 3150 pixbuf = G_OBJECT(gdk_pixbuf_loader_get_pixbuf(loader)); |
3150 pixbuf = G_OBJECT(gdk_pixbuf_loader_get_pixbuf(loader)); |
| 3151 if (!pixbuf) { |
3151 if (!pixbuf) { |
| 3152 purple_debug_warning("gtkutils", "%s() returned NULL for image " |
3152 purple_debug_warning("gtkutils", "%s() returned NULL for image " |
| 3153 "of size %zu\n", |
3153 "of size %" G_GSIZE_FORMAT "\n", |
| 3154 animated ? "gdk_pixbuf_loader_get_animation" |
3154 animated ? "gdk_pixbuf_loader_get_animation" |
| 3155 : "gdk_pixbuf_loader_get_pixbuf", count); |
3155 : "gdk_pixbuf_loader_get_pixbuf", count); |
| 3156 g_object_unref(G_OBJECT(loader)); |
3156 g_object_unref(G_OBJECT(loader)); |
| 3157 return NULL; |
3157 return NULL; |
| 3158 } |
3158 } |