From 5ad570e3ccff7aabe20be4f8f457c907b58ac64a Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 20 Jul 2009 12:39:09 +0200 Subject: [PATCH] Fix compilation errors Fix compilation errors with obvious fixes. --- app/core/gimp-transform-resize.c | 6 ++++++ app/core/gimpgradient-load.c | 8 +++++-- libgimpconfig/gimpscanner.c | 4 ++++ plug-ins/common/file-wmf.c | 4 ++++ plug-ins/common/lcms.c | 4 ++++ plug-ins/common/mail.c | 4 ++++ plug-ins/file-jpeg/jpeg-exif.c | 4 ++++ plug-ins/flame/libifs.c | 37 -------------------------------- plug-ins/flame/libifs.h | 1 - 9 files changed, 32 insertions(+), 40 deletions(-) diff --git a/app/core/gimp-transform-resize.c b/app/core/gimp-transform-resize.c index c705e7ebae..b7944f3d9d 100644 --- a/app/core/gimp-transform-resize.c +++ b/app/core/gimp-transform-resize.c @@ -189,6 +189,12 @@ gimp_transform_resize_boundary (const GimpMatrix3 *inv, ((gdouble) u2 - u1) / (v2 - v1), x1, y1, x2, y2); break; + + case GIMP_TRANSFORM_RESIZE_CLIP: + /* Remove warning about not handling all enum values. We handle + * this case in the beginning of the function + */ + break; } /* ensure that resulting rectangle has at least area 1 */ diff --git a/app/core/gimpgradient-load.c b/app/core/gimpgradient-load.c index b01fceced9..6bc6b0f861 100644 --- a/app/core/gimpgradient-load.c +++ b/app/core/gimpgradient-load.c @@ -519,8 +519,12 @@ svg_parse_gradient_stop_style (SvgStop *stop, if (end > sep && sep > style) { - gchar *name = g_strndup (style, sep - style); - gchar *value = g_strndup (++sep, end - sep - (*end == ';' ? 1 : 0)); + gchar *name; + gchar *value; + + name = g_strndup (style, sep - style); + sep++; + value = g_strndup (sep, end - sep - (*end == ';' ? 1 : 0)); svg_parse_gradient_stop_style_prop (stop, name, value); diff --git a/libgimpconfig/gimpscanner.c b/libgimpconfig/gimpscanner.c index 6b4d018a1b..b0c82b594c 100644 --- a/libgimpconfig/gimpscanner.c +++ b/libgimpconfig/gimpscanner.c @@ -176,7 +176,11 @@ gimp_scanner_destroy (GScanner *scanner) data = scanner->user_data; if (data->file) +#if GLIB_CHECK_VERSION(2, 21, 3) + g_mapped_file_unref (data->file); +#else g_mapped_file_free (data->file); +#endif g_free (data->name); g_slice_free (GimpScannerData, data); diff --git a/plug-ins/common/file-wmf.c b/plug-ins/common/file-wmf.c index fe2ee46b43..1dabd3e848 100644 --- a/plug-ins/common/file-wmf.c +++ b/plug-ins/common/file-wmf.c @@ -339,7 +339,11 @@ load_wmf_size (const gchar *filename, success = FALSE; wmf_mem_close (API); +#if GLIB_CHECK_VERSION(2, 21, 3) + g_mapped_file_unref (file); +#else g_mapped_file_free (file); +#endif if (width < 1 || height < 1) { diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c index 7bf2898240..f8b869c3ed 100644 --- a/plug-ins/common/lcms.c +++ b/plug-ins/common/lcms.c @@ -836,7 +836,11 @@ lcms_image_set_profile (gint32 image, g_mapped_file_get_length (file), g_mapped_file_get_contents (file)); +#if GLIB_CHECK_VERSION(2, 21, 3) + g_mapped_file_unref (file); +#else g_mapped_file_free (file); +#endif gimp_image_parasite_attach (image, parasite); gimp_parasite_free (parasite); diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c index fc13a08e6a..bfcf403346 100644 --- a/plug-ins/common/mail.c +++ b/plug-ins/common/mail.c @@ -707,7 +707,11 @@ to64 (const gchar *filename, bytes = g_base64_encode_close (TRUE, out, &state, &save); fwrite (out, 1, bytes, outfile); +#if GLIB_CHECK_VERSION(2, 21, 3) + g_mapped_file_unref (infile); +#else g_mapped_file_free (infile); +#endif return TRUE; } diff --git a/plug-ins/file-jpeg/jpeg-exif.c b/plug-ins/file-jpeg/jpeg-exif.c index 3df5e5925c..86cbe761e4 100644 --- a/plug-ins/file-jpeg/jpeg-exif.c +++ b/plug-ins/file-jpeg/jpeg-exif.c @@ -76,7 +76,11 @@ jpeg_exif_data_new_from_file (const gchar *filename, data = exif_data_new_from_data ((guchar *) g_mapped_file_get_contents (file), g_mapped_file_get_length (file)); +#if GLIB_CHECK_VERSION(2, 21, 3) + g_mapped_file_unref (file); +#else g_mapped_file_free (file); +#endif return data; } diff --git a/plug-ins/flame/libifs.c b/plug-ins/flame/libifs.c index c8095725a0..7ad323aa3c 100644 --- a/plug-ins/flame/libifs.c +++ b/plug-ins/flame/libifs.c @@ -1260,43 +1260,6 @@ estimate_bounding_box (control_point *cp, } } -/* use hill climberer to find smooth ordering of control points - this is untested */ - -void -sort_control_points (control_point *cps, - int ncps, - double (*metric)()) -{ - int niter = ncps * 1000; - int i, n, m; - double same, swap; - for (i = 0; i < niter; i++) - { - /* consider switching points with indexes n and m */ - n = g_random_int_range (0, ncps); - m = g_random_int_range (0, ncps); - - same = (metric(cps + n, cps + (n - 1) % ncps) + - metric(cps + n, cps + (n + 1) % ncps) + - metric(cps + m, cps + (m - 1) % ncps) + - metric(cps + m, cps + (m + 1) % ncps)); - - swap = (metric(cps + n, cps + (m - 1) % ncps) + - metric(cps + n, cps + (m + 1) % ncps) + - metric(cps + m, cps + (n - 1) % ncps) + - metric(cps + m, cps + (n + 1) % ncps)); - - if (swap < same) - { - control_point t; - t = cps[n]; - cps[n] = cps[m]; - cps[m] = t; - } - } -} - /* this has serious flaws in it */ double diff --git a/plug-ins/flame/libifs.h b/plug-ins/flame/libifs.h index 2b0fd7c135..e14f75778f 100644 --- a/plug-ins/flame/libifs.h +++ b/plug-ins/flame/libifs.h @@ -78,7 +78,6 @@ extern void print_control_point(FILE *f, control_point *cp, int quote); extern void random_control_point(control_point *cp, int ivar); extern void parse_control_point(char **ss, control_point *cp); extern void estimate_bounding_box(control_point *cp, double eps, double *bmin, double *bmax); -extern void sort_control_points(control_point *cps, int ncps, double (*metric)()); extern double standard_metric(control_point *cp1, control_point *cp2); extern double random_uniform01(void); extern double random_uniform11(void);