From 192e948c54a032d0797254c9287339a91b7fb0a0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 18:30:37 +0100 Subject: Use g_filename_display_name() with files inside GError messages The path of a file may contain non-Unicode glyphs, as file names have their own encoding. --- gdk-pixbuf/gdk-pixbuf-io.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c index eb442e3bc..182781178 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.c +++ b/gdk-pixbuf/gdk-pixbuf-io.c @@ -393,6 +393,7 @@ gdk_pixbuf_io_init_modules (const char *filename, channel = g_io_channel_new_file (filename, "r", &local_error); if (!channel) { + char *filename_utf8 = g_filename_display_name (filename); g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, @@ -401,9 +402,10 @@ gdk_pixbuf_io_init_modules (const char *filename, "Try running the command\n" " gdk-pixbuf-query-loaders > %s\n" "to make things work again for the time being.", - filename, local_error->message, filename); + filename_utf8, local_error->message, filename_utf8); g_clear_error (&local_error); g_string_free (tmp_buf, TRUE); + g_free (filename_utf8); return FALSE; } @@ -544,11 +546,13 @@ gdk_pixbuf_io_init_modules (const char *filename, g_io_channel_unref (channel); if (g_slist_length (file_formats) <= num_formats) { + char *filename_utf8 = g_filename_display_name (filename); g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_INITIALIZED, "No new GdkPixbufModule loaded from '%s'", - filename); + filename_utf8); + g_free (filename_utf8); return FALSE; } #endif @@ -797,11 +801,13 @@ gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module, module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); if (!module) { + char *path_utf8 = g_filename_display_name (path); g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Unable to load image-loading module: %s: %s"), - path, g_module_error ()); + path_utf8, g_module_error ()); + g_free (path_utf8); return FALSE; } @@ -812,11 +818,13 @@ gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module, (* fill_vtable) (image_module); return TRUE; } else { + char *path_utf8 = g_filename_display_name (path); g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Image-loading module %s does not export the proper interface; perhaps it’s from a different gdk-pixbuf version?"), - path); + path_utf8); + g_free (path_utf8); return FALSE; } } -- cgit v1.2.1 From d9b59fb70cdade59f56710360c6b52e9a19d9a13 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 18:32:02 +0100 Subject: bmp: Use g_set_error_literal() Never use g_set_error() without a format string. --- gdk-pixbuf/io-bmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c index b2d2a4f16..f2daf90ca 100644 --- a/gdk-pixbuf/io-bmp.c +++ b/gdk-pixbuf/io-bmp.c @@ -1307,10 +1307,10 @@ gdk_pixbuf__bmp_image_load_increment(gpointer data, case READ_STATE_PALETTE: if (!DecodeColormap (context->buff, context, error)) { - g_set_error (error, - GDK_PIXBUF_ERROR, - GDK_PIXBUF_ERROR_CORRUPT_IMAGE, - _("Error while decoding colormap")); + g_set_error_literal (error, + GDK_PIXBUF_ERROR, + GDK_PIXBUF_ERROR_CORRUPT_IMAGE, + _("Error while decoding colormap")); return FALSE; } break; -- cgit v1.2.1 From 9284c568592645661af87febf5efd1c6bb28d424 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 18:32:34 +0100 Subject: build: Fix libjpeg checks We are checking for libjpeg only if we find a header to include, but the dependency check with pkg-config, and the fallback with a wrap file, should happen outside of that check. --- meson.build | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 4724bf5cc..738e447d4 100644 --- a/meson.build +++ b/meson.build @@ -332,17 +332,30 @@ if get_option('jpeg') and not native_windows_loaders jpeg_dep = cc.find_library('libjpeg', required: false) endif - if not jpeg_dep.found() - jpeg_dep = dependency('libjpeg', required: false, fallback: 'libjpeg') + if jpeg_dep.found() + enabled_loaders += 'jpeg' + loaders_deps += jpeg_dep endif + endif + + # If we couldn't find libjpeg in our include/linker paths, + # then use pkg-config, and if that fails, fall back to the + # wrap + if not enabled_loaders.contains('jpeg') + jpeg_dep = dependency('libjpeg', required: false, fallback: 'libjpeg') - if jpeg_dep.found() and cc.has_function('jpeg_destroy_decompress', dependencies: jpeg_dep) + if jpeg_dep.found() enabled_loaders += 'jpeg' loaders_deps += jpeg_dep + endif + endif + + if jpeg_dep.found() + has_destroy_decompress = cc.has_function('jpeg_destroy_decompress', dependencies: jpeg_dep) + has_simple_progression = cc.has_function('jpeg_simple_progression', dependencies: jpeg_dep) - gdk_pixbuf_conf.set('HAVE_PROGRESSIVE_JPEG', - cc.has_function('jpeg_simple_progression', - dependencies: jpeg_dep)) + if has_destroy_decompress and has_simple_progression + gdk_pixbuf_conf.set('HAVE_PROGRESSIVE_JPEG', has_simple_progression) endif endif endif -- cgit v1.2.1 From c44312e579c7e91ea8dd8ecca96e47f805294434 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 18:46:08 +0100 Subject: Update the checksum for the libjpeg source archive The checksum from the wrapdb does not match the checksum from the source website. Apparently, the ICJ libjpeg maintainers decided to re-upload the 9c source tarball after changing its contents. See: https://github.com/mesonbuild/wrapdb/issues/94 --- subprojects/libjpeg.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libjpeg.wrap b/subprojects/libjpeg.wrap index 1433fce3a..54a7fe624 100644 --- a/subprojects/libjpeg.wrap +++ b/subprojects/libjpeg.wrap @@ -2,7 +2,7 @@ directory = jpeg-9c source_url = http://ijg.org/files/jpegsrc.v9c.tar.gz source_filename = jpegsrc.v9c.tar.gz -source_hash = 650250979303a649e21f87b5ccd02672af1ea6954b911342ea491f351ceb7122 +source_hash = 1e9793e1c6ba66e7e0b6e5fe7fd0f9e935cc697854d5737adec54d93e5b3f730 patch_url = https://wrapdb.mesonbuild.com/v1/projects/libjpeg/9c/3/get_zip patch_filename = libjpeg-9c-3-wrap.zip patch_hash = 2d66676d254be9198d8b6b62a798d6858c7f7cea9ed0e93809d6c035351a9bba -- cgit v1.2.1 From 676533c04995bb7777024b16460c115bf37b35dd Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 19:25:03 +0100 Subject: ci: Specify 0.56.2 as the installed Meson version According to @xclaesse, this version seems to work when it comes to resolving the dependency of libpng and libjpeg. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 19f7516d3..7887596f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,7 +64,7 @@ macos: tags: - macos before_script: - - pip3 install --user meson==0.56 + - pip3 install --user meson==0.56.2 - pip3 install --user ninja - export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH script: -- cgit v1.2.1 From 7583d07890ca4ec0ee4e050c24396f21ba410077 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 16 Apr 2021 15:31:29 -0400 Subject: build: Use old syntax for fallback dependencies With meson 0.56, this can be done more elegantly with allow_fallback and a [provide] section in the wrap files, but with 0.55, we need to explictly mention the variable names in the meson file. --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 738e447d4..c07e9cb08 100644 --- a/meson.build +++ b/meson.build @@ -297,7 +297,7 @@ if get_option('png') # that will bypass --wrap-mode and cause issues for distro packagers. # See: https://mesonbuild.com/Reference-manual.html#dependency if not png_dep.found() - png_dep = dependency('', required: false, fallback: 'libpng') + png_dep = dependency('', required: false, fallback: ['libpng', 'png_dep']) if png_dep.found() enabled_loaders += 'png' loaders_deps += png_dep @@ -342,7 +342,7 @@ if get_option('jpeg') and not native_windows_loaders # then use pkg-config, and if that fails, fall back to the # wrap if not enabled_loaders.contains('jpeg') - jpeg_dep = dependency('libjpeg', required: false, fallback: 'libjpeg') + jpeg_dep = dependency('libjpeg', required: false, fallback: ['libjpeg', 'jpeg_dep']) if jpeg_dep.found() enabled_loaders += 'jpeg' -- cgit v1.2.1 From e7b6681e3f419d9cb3d2287f10a6c405fe4850aa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 16 Apr 2021 15:32:35 -0400 Subject: build: Don't do function checks for subprojects meson can't do function checks for subprojects, since these have not been built yet at configure time. So, check if we are in that case and bypass the checks. The libjpeg we build as a subproject is new enough to have those functions, anyway. --- meson.build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index c07e9cb08..06c0d27dc 100644 --- a/meson.build +++ b/meson.build @@ -351,8 +351,13 @@ if get_option('jpeg') and not native_windows_loaders endif if jpeg_dep.found() - has_destroy_decompress = cc.has_function('jpeg_destroy_decompress', dependencies: jpeg_dep) - has_simple_progression = cc.has_function('jpeg_simple_progression', dependencies: jpeg_dep) + if jpeg_dep.type_name() == 'internal' + has_destroy_decompress = true + has_simple_progression = true + else + has_destroy_decompress = cc.has_function('jpeg_destroy_decompress', dependencies: jpeg_dep) + has_simple_progression = cc.has_function('jpeg_simple_progression', dependencies: jpeg_dep) + endif if has_destroy_decompress and has_simple_progression gdk_pixbuf_conf.set('HAVE_PROGRESSIVE_JPEG', has_simple_progression) -- cgit v1.2.1 From 993e75a9d3165512a3f472c3a154f975d7193f18 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Apr 2021 23:37:48 +0100 Subject: build: Reorganise the libjpeg checks Follow the same pattern as the libpng checks: 1. look for libjpeg via pkg-config 2. if pkg-config fails, and we're using the MSVC toolchain, look for header and library 3. if that fails, fall back to the libjpeg subproject --- meson.build | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index 06c0d27dc..8328fcbc3 100644 --- a/meson.build +++ b/meson.build @@ -324,33 +324,28 @@ endif # Don't check and build the jpeg loader if native_windows_loaders is true if get_option('jpeg') and not native_windows_loaders - if cc.has_header('jpeglib.h') + jpeg_dep = dependency('libjpeg', required: false) + + if not jpeg_dep.found() and cc.has_header('jpeglib.h') jpeg_dep = cc.find_library('jpeg', required: false) if cc.get_id() == 'msvc' and not jpeg_dep.found() # The IJG JPEG library builds the .lib file as libjpeg.lib in its MSVC build system, # so look for it as well when jpeg.lib cannot be found jpeg_dep = cc.find_library('libjpeg', required: false) endif - - if jpeg_dep.found() - enabled_loaders += 'jpeg' - loaders_deps += jpeg_dep - endif endif # If we couldn't find libjpeg in our include/linker paths, # then use pkg-config, and if that fails, fall back to the # wrap - if not enabled_loaders.contains('jpeg') + if not jpeg_dep.found() jpeg_dep = dependency('libjpeg', required: false, fallback: ['libjpeg', 'jpeg_dep']) - - if jpeg_dep.found() - enabled_loaders += 'jpeg' - loaders_deps += jpeg_dep - endif endif if jpeg_dep.found() + enabled_loaders += 'jpeg' + loaders_deps += jpeg_dep + if jpeg_dep.type_name() == 'internal' has_destroy_decompress = true has_simple_progression = true -- cgit v1.2.1