configure.ac, *: require GLib 2.40.0

Remove gimp_output_stream_[v]printf() and use the new functions from
GLib instead. Use memmove() instead of the deprecated g_memmove().
This commit is contained in:
Michael Natterer 2014-08-12 15:29:34 +02:00
parent 0904b1e923
commit dae366bb6e
10 changed files with 37 additions and 98 deletions

View file

@ -258,8 +258,8 @@ dump_gimprc_manpage (GimpConfig *rc,
guint n_property_specs; guint n_property_specs;
guint i; guint i;
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"%s", man_page_header); "%s", man_page_header);
klass = G_OBJECT_GET_CLASS (rc); klass = G_OBJECT_GET_CLASS (rc);
property_specs = g_object_class_list_properties (klass, &n_property_specs); property_specs = g_object_class_list_properties (klass, &n_property_specs);
@ -275,20 +275,20 @@ dump_gimprc_manpage (GimpConfig *rc,
if (prop_spec->flags & GIMP_CONFIG_PARAM_IGNORE) if (prop_spec->flags & GIMP_CONFIG_PARAM_IGNORE)
continue; continue;
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
".TP\n"); ".TP\n");
if (gimp_config_serialize_property (rc, prop_spec, writer)) if (gimp_config_serialize_property (rc, prop_spec, writer))
{ {
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"\n"); "\n");
desc = dump_describe_param (prop_spec); desc = dump_describe_param (prop_spec);
dump_with_linebreaks (output, desc); dump_with_linebreaks (output, desc);
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"\n"); "\n");
g_free (desc); g_free (desc);
} }
@ -296,10 +296,10 @@ dump_gimprc_manpage (GimpConfig *rc,
g_free (property_specs); g_free (property_specs);
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"%s", man_page_path); "%s", man_page_path);
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"%s", man_page_footer); "%s", man_page_footer);
} }
@ -521,8 +521,8 @@ dump_with_linebreaks (GOutputStream *output,
/* groff doesn't like lines to start with a single quote */ /* groff doesn't like lines to start with a single quote */
if (*text == '\'') if (*text == '\'')
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"\\&"); /* a zero width space */ "\\&"); /* a zero width space */
for (t = text, i = 0, space = 0; for (t = text, i = 0, space = 0;
*t != '\n' && (i <= LINE_LENGTH || space == 0) && i < len; *t != '\n' && (i <= LINE_LENGTH || space == 0) && i < len;
@ -536,12 +536,12 @@ dump_with_linebreaks (GOutputStream *output,
i = space; i = space;
g_output_stream_write_all (output, text, i, NULL, NULL, NULL); g_output_stream_write_all (output, text, i, NULL, NULL, NULL);
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
"\n"); "\n");
if (*t == '\n') if (*t == '\n')
gimp_output_stream_printf (output, NULL, NULL, NULL, g_output_stream_printf (output, NULL, NULL, NULL,
".br\n"); ".br\n");
i++; i++;

View file

@ -305,7 +305,7 @@ themes_apply_theme (Gimp *gimp,
esc_gtkrc_user = g_strescape (tmp, NULL); esc_gtkrc_user = g_strescape (tmp, NULL);
g_free (tmp); g_free (tmp);
if (! gimp_output_stream_printf if (! g_output_stream_printf
(output, NULL, NULL, &error, (output, NULL, NULL, &error,
"# GIMP themerc\n" "# GIMP themerc\n"
"#\n" "#\n"

View file

@ -1435,7 +1435,7 @@ gimp_text_buffer_load (GimpTextBuffer *buffer,
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &iter); gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &iter);
remaining = (buf + remaining + bytes_read) - leftover; remaining = (buf + remaining + bytes_read) - leftover;
g_memmove (buf, leftover, remaining); memmove (buf, leftover, remaining);
if (! success) if (! success)
{ {

View file

@ -42,7 +42,7 @@ m4_define([gimp_full_name], [GNU Image Manipulation Program])
# required versions of other packages # required versions of other packages
m4_define([babl_required_version], [0.1.11]) m4_define([babl_required_version], [0.1.11])
m4_define([gegl_required_version], [0.3.0]) m4_define([gegl_required_version], [0.3.0])
m4_define([glib_required_version], [2.36.0]) m4_define([glib_required_version], [2.40.0])
m4_define([atk_required_version], [2.2.0]) m4_define([atk_required_version], [2.2.0])
m4_define([gtk_required_version], [2.24.10]) m4_define([gtk_required_version], [2.24.10])
m4_define([gdk_pixbuf_required_version], [2.24.1]) m4_define([gdk_pixbuf_required_version], [2.24.1])
@ -583,13 +583,13 @@ if test "x$GDBUS_CODEGEN" = xno; then
AC_MSG_ERROR([Could not find gdbus-codegen in your PATH]) AC_MSG_ERROR([Could not find gdbus-codegen in your PATH])
fi fi
AC_MSG_CHECKING([if GLib is version 2.39.0 or newer]) AC_MSG_CHECKING([if GLib is version 2.43.0 or newer])
if $PKG_CONFIG --atleast-version=2.39.0 glib-2.0; then if $PKG_CONFIG --atleast-version=2.43.0 glib-2.0; then
have_glib_2_39=yes have_glib_2_43=yes
else else
have_glib_2_39=no have_glib_2_43=no
fi fi
AC_MSG_RESULT($have_glib_2_39) AC_MSG_RESULT($have_glib_2_43)
# Check for bind_textdomain_codeset, including -lintl if GLib brings it in. # Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
@ -2035,7 +2035,7 @@ CPPFLAGS="${CPPFLAGS} -DGIMP_DISABLE_DEPRECATED -DBABL_DISABLE_DEPRECATED -DGSEA
# We must build without problems with future releases of libraries # We must build without problems with future releases of libraries
# and disabling deprecated API risks breaking the build # and disabling deprecated API risks breaking the build
if test "x$have_glib_2_39" != "xyes"; then if test "x$have_glib_2_43" != "xyes"; then
CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED" CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED"
fi fi

View file

@ -83,8 +83,6 @@ EXPORTS
gimp_minor_version gimp_minor_version
gimp_offset_type_get_type gimp_offset_type_get_type
gimp_orientation_type_get_type gimp_orientation_type_get_type
gimp_output_stream_printf
gimp_output_stream_vprintf
gimp_paint_application_mode_get_type gimp_paint_application_mode_get_type
gimp_param_memsize_get_type gimp_param_memsize_get_type
gimp_param_parasite_get_type gimp_param_parasite_get_type

View file

@ -810,47 +810,3 @@ gimp_flags_value_get_help (GFlagsClass *flags_class,
return NULL; return NULL;
} }
gboolean
gimp_output_stream_printf (GOutputStream *stream,
gsize *bytes_written,
GCancellable *cancellable,
GError **error,
const gchar *format,
...)
{
va_list args;
gboolean success;
va_start (args, format);
success = gimp_output_stream_vprintf (stream, bytes_written, cancellable,
error, format, args);
va_end (args);
return success;
}
gboolean
gimp_output_stream_vprintf (GOutputStream *stream,
gsize *bytes_written,
GCancellable *cancellable,
GError **error,
const gchar *format,
va_list args)
{
gchar *text;
gboolean success;
g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (stream), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (format != NULL, FALSE);
text = g_strdup_vprintf (format, args);
success = g_output_stream_write_all (stream,
text, strlen (text),
bytes_written, cancellable, error);
g_free (text);
return success;
}

View file

@ -69,21 +69,6 @@ const gchar * gimp_flags_value_get_desc (GFlagsClass *flags_class,
const gchar * gimp_flags_value_get_help (GFlagsClass *flags_class, const gchar * gimp_flags_value_get_help (GFlagsClass *flags_class,
GFlagsValue *flags_value); GFlagsValue *flags_value);
/* temporary, to be removed when we depend on glib 2.40, which will
* clearly be before gimp 2.10
*/
gboolean gimp_output_stream_printf (GOutputStream *stream,
gsize *bytes_written,
GCancellable *cancellable,
GError **error,
const gchar *format,
...) G_GNUC_PRINTF (5, 6);
gboolean gimp_output_stream_vprintf (GOutputStream *stream,
gsize *bytes_written,
GCancellable *cancellable,
GError **error,
const gchar *format,
va_list args) G_GNUC_PRINTF (5, 0);
G_END_DECLS G_END_DECLS

View file

@ -277,8 +277,8 @@ gimp_value_array_insert (GimpValueArray *value_array,
value_array_grow (value_array, value_array->n_values + 1, FALSE); value_array_grow (value_array, value_array->n_values + 1, FALSE);
if (index + 1 < value_array->n_values) if (index + 1 < value_array->n_values)
g_memmove (value_array->values + index + 1, value_array->values + index, memmove (value_array->values + index + 1, value_array->values + index,
(i - index) * sizeof (value_array->values[0])); (i - index) * sizeof (value_array->values[0]));
memset (value_array->values + index, 0, sizeof (value_array->values[0])); memset (value_array->values + index, 0, sizeof (value_array->values[0]));
@ -317,8 +317,8 @@ gimp_value_array_remove (GimpValueArray *value_array,
value_array->n_values--; value_array->n_values--;
if (index < value_array->n_values) if (index < value_array->n_values)
g_memmove (value_array->values + index, value_array->values + index + 1, memmove (value_array->values + index, value_array->values + index + 1,
(value_array->n_values - index) * sizeof (value_array->values[0])); (value_array->n_values - index) * sizeof (value_array->values[0]));
value_array_shrink (value_array); value_array_shrink (value_array);

View file

@ -309,8 +309,8 @@ print (GOutputStream *stream,
gboolean success; gboolean success;
va_start (args, format); va_start (args, format);
success = gimp_output_stream_vprintf (stream, NULL, NULL, success = g_output_stream_vprintf (stream, NULL, NULL,
error, format, args); error, format, args);
va_end (args); va_end (args);
return success; return success;

View file

@ -323,8 +323,8 @@ pcx_header_from_buffer (guint8 *buf)
for (i = 0; pcx_header_buf_xlate[i].size != 0; i++) for (i = 0; pcx_header_buf_xlate[i].size != 0; i++)
{ {
g_memmove (pcx_header_buf_xlate[i].address, buf + buf_offset, memmove (pcx_header_buf_xlate[i].address, buf + buf_offset,
pcx_header_buf_xlate[i].size); pcx_header_buf_xlate[i].size);
buf_offset += pcx_header_buf_xlate[i].size; buf_offset += pcx_header_buf_xlate[i].size;
} }
} }
@ -337,8 +337,8 @@ pcx_header_to_buffer (guint8 *buf)
for (i = 0; pcx_header_buf_xlate[i].size != 0; i++) for (i = 0; pcx_header_buf_xlate[i].size != 0; i++)
{ {
g_memmove (buf + buf_offset, pcx_header_buf_xlate[i].address, memmove (buf + buf_offset, pcx_header_buf_xlate[i].address,
pcx_header_buf_xlate[i].size); pcx_header_buf_xlate[i].size);
buf_offset += pcx_header_buf_xlate[i].size; buf_offset += pcx_header_buf_xlate[i].size;
} }
} }