#include "image-load-collection.h"
#include "cache.h"
+#include "filedata.h"
#include "misc.h"
#include "ui-fileops.h"
-typedef struct _ImageLoaderCOLLECTION ImageLoaderCOLLECTION;
-struct _ImageLoaderCOLLECTION {
+struct ImageLoaderCOLLECTION {
ImageLoaderBackendCbAreaUpdated area_updated_cb;
ImageLoaderBackendCbSize size_cb;
ImageLoaderBackendCbAreaPrepared area_prepared_cb;
gboolean abort;
};
-static gboolean image_loader_collection_load(gpointer loader, const guchar *UNUSED(buf), gsize UNUSED(count), GError **UNUSED(error))
+static gboolean image_loader_collection_load(gpointer loader, const guchar *, gsize, GError **)
{
auto ld = static_cast<ImageLoaderCOLLECTION *>(loader);
auto il = static_cast<ImageLoader *>(ld->data);
gboolean ret = FALSE;
gchar *randname;
gchar *cmd_line;
- FILE *fp = NULL;
+ FILE *fp = nullptr;
gint line_count = 0;
- GString *file_names = g_string_new(NULL);
+ GString *file_names = g_string_new(nullptr);
gchar line[LINE_LENGTH];
- gchar **split_line = NULL;
+ gchar **split_line = nullptr;
gchar *cache_found;
gchar *pathl;
cache_found = cache_find_location(CACHE_TYPE_THUMB, split_line[1]);
if (cache_found)
{
- file_names = g_string_append(file_names, g_strconcat("\"", cache_found,"\" ", NULL));
+ g_string_append_printf(file_names, "\"%s\" ", cache_found);
line_count++;
}
g_free(cache_found);
{
g_strfreev(split_line);
}
- split_line = NULL;
+ split_line = nullptr;
}
fclose(fp);
cmd_line = g_strdup_printf("montage %s -geometry %dx%d+1+1 %s >/dev/null 2>&1", file_names->str, options->thumbnails.max_width, options->thumbnails.max_height, randname);
runcmd(cmd_line);
- ld->pixbuf = gdk_pixbuf_new_from_file(randname, NULL);
+ ld->pixbuf = gdk_pixbuf_new_from_file(randname, nullptr);
if (ld->pixbuf)
{
ld->area_updated_cb(loader, 0, 0, gdk_pixbuf_get_width(ld->pixbuf), gdk_pixbuf_get_height(ld->pixbuf), ld->data);
unlink(randname);
g_free(randname);
- g_string_free(file_names, TRUE);
g_free(cmd_line);
ret = TRUE;
}
- else
- {
- g_string_free(file_names, TRUE);
- }
+
+ g_string_free(file_names, TRUE);
}
}
return ret;
return ld->pixbuf;
}
-static gchar* image_loader_collection_get_format_name(gpointer UNUSED(loader))
+static gchar* image_loader_collection_get_format_name(gpointer)
{
return g_strdup("collection");
}
-static gchar** image_loader_collection_get_format_mime_types(gpointer UNUSED(loader))
+static gchar** image_loader_collection_get_format_mime_types(gpointer)
{
- static const gchar *mime[] = {"image/png", NULL};
+ static const gchar *mime[] = {"image/png", nullptr};
return g_strdupv(const_cast<gchar **>(mime));
}
-static gboolean image_loader_collection_close(gpointer UNUSED(loader), GError **UNUSED(error))
+static gboolean image_loader_collection_close(gpointer, GError **)
{
return TRUE;
}
funcs->loader_new = image_loader_collection_new;
funcs->set_size = image_loader_collection_set_size;
funcs->load = image_loader_collection_load;
- funcs->write = NULL;
+ funcs->write = nullptr;
funcs->get_pixbuf = image_loader_collection_get_pixbuf;
funcs->close = image_loader_collection_close;
funcs->abort = image_loader_collection_abort;