diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-06-06 18:14:29 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-06-08 18:59:20 +0200 |
commit | 274c5f6f66c73a7b02ddd3d9b2297860212c154b (patch) | |
tree | 543a1dfa1aa527895ebbd24c325cca3a52bd7689 /tools/benchmark-io.c | |
parent | de377d3eaec2b07f16d841ac79a97a8282c7e983 (diff) | |
download | fiv-274c5f6f66c73a7b02ddd3d9b2297860212c154b.tar.gz fiv-274c5f6f66c73a7b02ddd3d9b2297860212c154b.tar.xz fiv-274c5f6f66c73a7b02ddd3d9b2297860212c154b.zip |
benchmark-io: fix URI passing
g_filename_to_uri() doesn't support relative paths.
Diffstat (limited to 'tools/benchmark-io.c')
-rw-r--r-- | tools/benchmark-io.c | 6 |
1 files 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 <p@janouch.name> +// Copyright (c) 2021 - 2023, Přemysl Eric Janouch <p@janouch.name> // // 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) |