Compare commits

..

2 Commits

Author SHA1 Message Date
Přemysl Eric Janouch bac9fce4e0
Fix argument order in g_malloc0_n() usages
Alpine 3.20 Success Details
Arch Linux Success Details
Arch Linux AUR Success Details
Debian Bookworm Success Details
Fedora 39 Success Details
OpenBSD 7.5 Success Details
openSUSE 15.5 Success Details
2024-07-10 00:30:27 +02:00
Přemysl Eric Janouch 2e9ea9b4e2
Do not rely on a particular CWD on Windows
on_app_activate() currently makes use of the CWD we are launched with,
so I'm choosing to not enforce it globally.
2024-07-10 00:29:49 +02:00
3 changed files with 22 additions and 4 deletions

View File

@ -828,9 +828,18 @@ thumbnailer_next(Thumbnailer *t)
"--thumbnail", fiv_thumbnail_sizes[self->item_size].thumbnail_spec_name,
"--", uri, NULL};
GSubprocessLauncher *launcher =
g_subprocess_launcher_new(G_SUBPROCESS_FLAGS_STDOUT_PIPE);
#ifdef G_OS_WIN32
gchar *prefix = g_win32_get_package_installation_directory_of_module(NULL);
g_subprocess_launcher_set_cwd(launcher, prefix);
g_free(prefix);
#endif
GError *error = NULL;
t->minion = g_subprocess_newv(t->target->icon ? argv_faster : argv_slower,
G_SUBPROCESS_FLAGS_STDOUT_PIPE, &error);
t->minion = g_subprocess_launcher_spawnv(
launcher, t->target->icon ? argv_faster : argv_slower, &error);
g_object_unref(launcher);
if (error) {
g_warning("%s", error->message);
g_error_free(error);

View File

@ -185,15 +185,24 @@ info_spawn(GtkWidget *dialog, const char *path, GBytes *bytes_in)
if (bytes_in)
flags |= G_SUBPROCESS_FLAGS_STDIN_PIPE;
GSubprocessLauncher *launcher = g_subprocess_launcher_new(flags);
#ifdef G_OS_WIN32
// Both to find wperl, and then to let wperl find the nearby exiftool.
gchar *prefix = g_win32_get_package_installation_directory_of_module(NULL);
g_subprocess_launcher_set_cwd(launcher, prefix);
g_free(prefix);
#endif
// TODO(p): Add a fallback to internal capabilities.
// The simplest is to specify the filename and the resolution.
GError *error = NULL;
GSubprocess *subprocess = g_subprocess_new(flags, &error,
GSubprocess *subprocess = g_subprocess_launcher_spawn(launcher, &error,
#ifdef G_OS_WIN32
"wperl",
#endif
"exiftool", "-tab", "-groupNames", "-duplicates", "-extractEmbedded",
"--binary", "-quiet", "--", path, NULL);
g_object_unref(launcher);
if (error) {
info_redirect_error(dialog, error);
return;

View File

@ -976,7 +976,7 @@ static uint32_t *
parse_mpf_index_entries(const struct tiffer *T, struct tiffer_entry *entry)
{
uint32_t count = entry->remaining_count / 16;
uint32_t *offsets = g_malloc0_n(sizeof *offsets, count + 1), *out = offsets;
uint32_t *offsets = g_malloc0_n(count + 1, sizeof *offsets), *out = offsets;
for (uint32_t i = 0; i < count; i++) {
// 5.2.3.3.3. Individual Image Data Offset
uint32_t offset = parse_mpf_mpentry(entry->p + i * 16, T);