Fix compilation errors

Fix compilation errors with obvious fixes.
This commit is contained in:
Martin Nordholts 2009-07-20 12:39:09 +02:00
parent b2b2b41e62
commit 5ad570e3cc
9 changed files with 32 additions and 40 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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);