diff --git a/.gitattributes b/.gitattributes index 2be92952cd..ac9cdcf890 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,15 +1,18 @@ -# Shell scripts sources can't have CRLF line endings -*.sh eol=lf +# Shell scripts can't have CRLF line endings +*.sh eol=lf -# Ignore repository language statistics and hide diffs for generated files -libvips/colour/profiles.c linguist-generated=true +# Excluded from stats, hidden in diffs +libvips/colour/profiles.c linguist-generated + +# Excluded from stats +libvips/foreign/libnsgif/* linguist-vendored # Omit from release tarball -.clang-format export-ignore -.codespellrc export-ignore -.editorconfig export-ignore -.git-blame-ignore-revs export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.gitkeep export-ignore -.github/ export-ignore +.clang-format export-ignore +.codespellrc export-ignore +.editorconfig export-ignore +.git-blame-ignore-revs export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.gitkeep export-ignore +.github/ export-ignore diff --git a/fuzz/oss_fuzz_build.sh b/fuzz/oss_fuzz_build.sh index 8ec7d9afc6..68d5980791 100755 --- a/fuzz/oss_fuzz_build.sh +++ b/fuzz/oss_fuzz_build.sh @@ -188,15 +188,13 @@ cmake \ cmake --build . --target install popd -# FIXME: Workaround for https://github.com/mesonbuild/meson/issues/14640 -export LDFLAGS+=" -Wl,-rpath=\$ORIGIN/lib" - # libvips # Disable building man pages, gettext po files, tools, and tests sed -i "/subdir('man')/{N;N;N;d;}" meson.build meson setup build --prefix=$WORK --libdir=lib --prefer-static --default-library=static --buildtype=debugoptimized \ -Dbackend_max_links=4 -Ddeprecated=false -Dexamples=false -Dcplusplus=false -Dmodules=disabled \ - -Dfuzzing_engine=oss-fuzz -Dfuzzer_ldflags="$LIB_FUZZING_ENGINE" + -Dfuzzing_engine=oss-fuzz -Dfuzzer_ldflags="$LIB_FUZZING_ENGINE" \ + -Dcpp_link_args="$LDFLAGS -Wl,-rpath=\$ORIGIN/lib" meson install -C build --tag devel # Copy fuzz executables to $OUT diff --git a/libvips/foreign/openslideload.c b/libvips/foreign/openslideload.c index aa450232ab..e12ebe391a 100644 --- a/libvips/foreign/openslideload.c +++ b/libvips/foreign/openslideload.c @@ -1070,6 +1070,7 @@ static const char *vips_foreign_openslide_suffs[] = { ".svslide", /* Sakura */ ".tif", /* Trestle */ ".bif", /* Ventana */ + ".dcm", /* DICOM */ NULL }; diff --git a/libvips/foreign/pdfiumload.c b/libvips/foreign/pdfiumload.c index 49adc4db33..8c1fdd890b 100644 --- a/libvips/foreign/pdfiumload.c +++ b/libvips/foreign/pdfiumload.c @@ -503,7 +503,6 @@ vips_foreign_load_pdf_header(VipsForeignLoad *load) VipsForeignLoadPdf *pdf = (VipsForeignLoadPdf *) load; int top; - int i; #ifdef DEBUG printf("vips_foreign_load_pdf_header: %p\n", pdf); @@ -535,7 +534,7 @@ vips_foreign_load_pdf_header(VipsForeignLoad *load) pdf->image.top = 0; pdf->image.width = 0; pdf->image.height = 0; - for (i = 0; i < pdf->n; i++) { + for (int i = 0; i < pdf->n; i++) { if (vips_foreign_load_pdf_get_page(pdf, pdf->page_no + i)) return -1; pdf->pages[i].left = 0; @@ -576,7 +575,7 @@ vips_foreign_load_pdf_header(VipsForeignLoad *load) /* If all pages are the same height, we can tag this as a toilet roll * image. */ - for (i = 1; i < pdf->n; i++) + for (int i = 1; i < pdf->n; i++) if (pdf->pages[i].height != pdf->pages[0].height) break; diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index 1780e80e8e..c722839d18 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -1018,7 +1018,7 @@ typedef enum { * @VIPS_FOREIGN_DZ_CONTAINER_ZIP: write tiles to a zip file * @VIPS_FOREIGN_DZ_CONTAINER_SZI: write to a szi file * - * How many pyramid layers to create. + * What container format to use. */ typedef enum { VIPS_FOREIGN_DZ_CONTAINER_FS, diff --git a/libvips/iofuncs/operation.c b/libvips/iofuncs/operation.c index 5b740f4870..f8adf74802 100644 --- a/libvips/iofuncs/operation.c +++ b/libvips/iofuncs/operation.c @@ -292,14 +292,9 @@ vips_operation_class_usage_classify(VipsArgumentClass *argument_class) /* Display a set of flags as "a:b:c" */ static void -vips__flags_to_str(VipsBuf *buf, GType type, guint value) +vips__flags_to_str(VipsBuf *buf, GFlagsClass *flags, guint value) { - GTypeClass *class = g_type_class_ref(type); - GFlagsClass *flags = G_FLAGS_CLASS(class); - - gboolean first; - - first = TRUE; + gboolean first = TRUE; for (int i = 0; i < flags->n_values; i++) // can't be 0 (would match everything), and all bits // should match all bits in the value, or "all" would always match @@ -321,18 +316,14 @@ vips_operation_pspec_usage(VipsBuf *buf, GParamSpec *pspec) /* These are the pspecs that vips uses that have interesting values. */ if (G_IS_PARAM_SPEC_ENUM(pspec)) { - GTypeClass *class = g_type_class_ref(type); + /* GParamSpecEnum holds a ref on the class so we just peek. + */ + GEnumClass *genum = g_type_class_peek(type); GParamSpecEnum *pspec_enum = (GParamSpecEnum *) pspec; - GEnumClass *genum; int i; - /* Should be impossible, no need to warn. - */ - if (!class) - return; - - genum = G_ENUM_CLASS(class); + g_assert(genum); vips_buf_appendf(buf, "\t\t\t"); vips_buf_appendf(buf, "%s", _("default enum")); @@ -351,23 +342,19 @@ vips_operation_pspec_usage(VipsBuf *buf, GParamSpec *pspec) vips_buf_appendf(buf, "\n"); } if (G_IS_PARAM_SPEC_FLAGS(pspec)) { - GTypeClass *class = g_type_class_ref(type); + /* GParamSpecFlags holds a ref on the class so we just peek. + */ + GFlagsClass *gflags = g_type_class_peek(type); GParamSpecFlags *pspec_flags = (GParamSpecFlags *) pspec; - GFlagsClass *gflags; int i; - /* Should be impossible, no need to warn. - */ - if (!class) - return; - - gflags = G_FLAGS_CLASS(class); + g_assert(gflags); vips_buf_appendf(buf, "\t\t\t"); vips_buf_appendf(buf, "%s", _("default flags")); vips_buf_appendf(buf, ": "); - vips__flags_to_str(buf, type, pspec_flags->default_value); + vips__flags_to_str(buf, gflags, pspec_flags->default_value); vips_buf_appendf(buf, "\n"); vips_buf_appendf(buf, "\t\t\t"); vips_buf_appendf(buf, "%s", _("allowed flags")); diff --git a/libvips/resample/reduce.c b/libvips/resample/reduce.c index d45c7258e4..fc5f8b80b1 100644 --- a/libvips/resample/reduce.c +++ b/libvips/resample/reduce.c @@ -60,14 +60,14 @@ /** * VipsKernel: - * @VIPS_KERNEL_NEAREST: The nearest pixel to the point. - * @VIPS_KERNEL_LINEAR: Convolve with a triangle filter. - * @VIPS_KERNEL_CUBIC: Convolve with a cubic filter. - * @VIPS_KERNEL_MITCHELL: Convolve with a Mitchell kernel. - * @VIPS_KERNEL_LANCZOS2: Convolve with a two-lobe Lanczos kernel. - * @VIPS_KERNEL_LANCZOS3: Convolve with a three-lobe Lanczos kernel. - * @VIPS_KERNEL_MKS2013: Convolve with Magic Kernel Sharp 2013. - * @VIPS_KERNEL_MKS2021: Convolve with Magic Kernel Sharp 2021. + * @VIPS_KERNEL_NEAREST: the nearest pixel to the point + * @VIPS_KERNEL_LINEAR: convolve with a triangle filter + * @VIPS_KERNEL_CUBIC: convolve with a cubic filter + * @VIPS_KERNEL_MITCHELL: convolve with a Mitchell kernel + * @VIPS_KERNEL_LANCZOS2: convolve with a two-lobe Lanczos kernel + * @VIPS_KERNEL_LANCZOS3: convolve with a three-lobe Lanczos kernel + * @VIPS_KERNEL_MKS2013: convolve with Magic Kernel Sharp 2013 + * @VIPS_KERNEL_MKS2021: convolve with Magic Kernel Sharp 2021 * * The resampling kernels vips supports. See [method@Image.reduce], for example. */ diff --git a/tools/vips.c b/tools/vips.c index 4ec35c148e..5ea7200e85 100644 --- a/tools/vips.c +++ b/tools/vips.c @@ -216,17 +216,13 @@ list_operation_arg(VipsObjectClass *object_class, /* These are the pspecs that vips uses that have interesting values. */ if (G_IS_PARAM_SPEC_ENUM(pspec)) { - GTypeClass *class = g_type_class_ref(type); + /* GParamSpecEnum holds a ref on the class so we just peek. + */ + GEnumClass *genum = g_type_class_peek(type); - GEnumClass *genum; int i; - /* Should be impossible, no need to warn. - */ - if (!class) - return NULL; - - genum = G_ENUM_CLASS(class); + g_assert(genum); printf("word:");