From 274c5f6f66c73a7b02ddd3d9b2297860212c154b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Tue, 6 Jun 2023 18:14:29 +0200 Subject: benchmark-io: fix URI passing g_filename_to_uri() doesn't support relative paths. --- tools/benchmark-io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/benchmark-io.c b/tools/benchmark-io.c index be8fb8f..4275ceb 100644 --- a/tools/benchmark-io.c +++ b/tools/benchmark-io.c @@ -1,7 +1,7 @@ // // benchmark-io.c: measure and compare image loading times // -// Copyright (c) 2021 - 2022, Přemysl Eric Janouch +// Copyright (c) 2021 - 2023, Přemysl Eric Janouch // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted. @@ -32,15 +32,17 @@ timestamp(void) static void one_file(const char *filename) { + GFile *file = g_file_new_for_commandline_arg(filename); double since_us = timestamp(); FivIoOpenContext ctx = { - .uri = g_filename_to_uri(filename, NULL, NULL), + .uri = g_file_get_uri(file), .screen_dpi = 96, // Only using this array as a redirect. .warnings = g_ptr_array_new_with_free_func(g_free), }; cairo_surface_t *loaded_by_us = fiv_io_open(&ctx, NULL); + g_clear_object(&file); g_free((char *) ctx.uri); g_ptr_array_free(ctx.warnings, TRUE); if (!loaded_by_us) -- cgit v1.2.3