diff --git a/ChangeLog b/ChangeLog index 69c4ec328b..c256c44d56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2003-07-01 Sven Neumann + + * libgimp/gimp.[ch] + * libgimp/gimpchannel.[ch] + * libgimp/gimpdrawable.[ch] + * libgimp/gimpimage.[ch] + * libgimp/gimplayer.[ch] + * libgimp/gimpmisc.[ch] + * libgimp/gimpmiscui.[ch] + * libgimp/gimppixelrgn.[ch] + * libgimp/gimpproceduraldb.[ch]: added const qualifiers to the + libgimp API. Will cause lots of compiler warnings until the + generated PDB code has been constified as well. + + * libgimpbase/gimpparasite.[ch]: use gconstpointer, not const + gpointer. + 2003-07-01 Sven Neumann * plug-ins/common/ripple.c (average_four_pixels): fixed the diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 9b69594838..c4b6f43e3f 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -485,19 +485,19 @@ gimp_quit (void) * that will be automatically started on each GIMP startup. **/ void -gimp_install_procedure (const gchar *name, - const gchar *blurb, - const gchar *help, - const gchar *author, - const gchar *copyright, - const gchar *date, - const gchar *menu_path, - const gchar *image_types, - GimpPDBProcType type, - gint n_params, - gint n_return_vals, - GimpParamDef *params, - GimpParamDef *return_vals) +gimp_install_procedure (const gchar *name, + const gchar *blurb, + const gchar *help, + const gchar *author, + const gchar *copyright, + const gchar *date, + const gchar *menu_path, + const gchar *image_types, + GimpPDBProcType type, + gint n_params, + gint n_return_vals, + const GimpParamDef *params, + const GimpParamDef *return_vals) { GPProcInstall proc_install; @@ -566,20 +566,20 @@ gimp_install_procedure (const gchar *name, * details. **/ void -gimp_install_temp_proc (const gchar *name, - const gchar *blurb, - const gchar *help, - const gchar *author, - const gchar *copyright, - const gchar *date, - const gchar *menu_path, - const gchar *image_types, - GimpPDBProcType type, - gint n_params, - gint n_return_vals, - GimpParamDef *params, - GimpParamDef *return_vals, - GimpRunProc run_proc) +gimp_install_temp_proc (const gchar *name, + const gchar *blurb, + const gchar *help, + const gchar *author, + const gchar *copyright, + const gchar *date, + const gchar *menu_path, + const gchar *image_types, + GimpPDBProcType type, + gint n_params, + gint n_return_vals, + const GimpParamDef *params, + const GimpParamDef *return_vals, + GimpRunProc run_proc) { g_return_if_fail (name != NULL); g_return_if_fail ((n_params == 0 && params == NULL) || @@ -869,10 +869,10 @@ gimp_read_expect_msg (WireMessage *msg, * Return value: the procedure's return values. **/ GimpParam * -gimp_run_procedure2 (const gchar *name, - gint *n_return_vals, - gint n_params, - GimpParam *params) +gimp_run_procedure2 (const gchar *name, + gint *n_return_vals, + gint n_params, + const GimpParam *params) { GPProcRun proc_run; GPProcReturn *proc_return; @@ -1235,10 +1235,10 @@ gimp_extension_process (guint timeout) * See Also: gimp_parasite_attach() */ void -gimp_attach_new_parasite (const gchar *name, - gint flags, - gint size, - const gpointer data) +gimp_attach_new_parasite (const gchar *name, + gint flags, + gint size, + gconstpointer data) { GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); diff --git a/libgimp/gimp.h b/libgimp/gimp.h index 2495c039ba..f4b175b67a 100644 --- a/libgimp/gimp.h +++ b/libgimp/gimp.h @@ -74,11 +74,11 @@ GIMPVAR const guint gimp_micro_version; typedef void (* GimpInitProc) (void); typedef void (* GimpQuitProc) (void); typedef void (* GimpQueryProc) (void); -typedef void (* GimpRunProc) (gchar *name, - gint nparams, - GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); +typedef void (* GimpRunProc) (const gchar *name, + gint n_params, + const GimpParam *param, + gint *n_return_vals, + GimpParam **return_vals); struct _GimpPlugInInfo @@ -217,36 +217,36 @@ void G_GNUC_NORETURN gimp_quit (void); /* Install a procedure in the procedure database. */ -void gimp_install_procedure (const gchar *name, - const gchar *blurb, - const gchar *help, - const gchar *author, - const gchar *copyright, - const gchar *date, - const gchar *menu_path, - const gchar *image_types, - GimpPDBProcType type, - gint n_params, - gint n_return_vals, - GimpParamDef *params, - GimpParamDef *return_vals); +void gimp_install_procedure (const gchar *name, + const gchar *blurb, + const gchar *help, + const gchar *author, + const gchar *copyright, + const gchar *date, + const gchar *menu_path, + const gchar *image_types, + GimpPDBProcType type, + gint n_params, + gint n_return_vals, + const GimpParamDef *params, + const GimpParamDef *return_vals); /* Install a temporary procedure in the procedure database. */ -void gimp_install_temp_proc (const gchar *name, - const gchar *blurb, - const gchar *help, - const gchar *author, - const gchar *copyright, - const gchar *date, - const gchar *menu_path, - const gchar *image_types, - GimpPDBProcType type, - gint n_params, - gint n_return_vals, - GimpParamDef *params, - GimpParamDef *return_vals, - GimpRunProc run_proc); +void gimp_install_temp_proc (const gchar *name, + const gchar *blurb, + const gchar *help, + const gchar *author, + const gchar *copyright, + const gchar *date, + const gchar *menu_path, + const gchar *image_types, + GimpPDBProcType type, + gint n_params, + gint n_return_vals, + const GimpParamDef *params, + const GimpParamDef *return_vals, + GimpRunProc run_proc); /* Uninstall a temporary procedure */ @@ -279,7 +279,7 @@ GimpParam * gimp_run_procedure (const gchar *name, GimpParam * gimp_run_procedure2 (const gchar *name, gint *n_return_vals, gint n_params, - GimpParam *params); + const GimpParam *params); /* Destroy the an array of parameters. This is useful for * destroying the return values returned by a call to @@ -314,7 +314,7 @@ const gchar * gimp_get_progname (void) G_GNUC_CONST; void gimp_attach_new_parasite (const gchar *name, gint flags, gint size, - const gpointer data); + gconstpointer data); G_END_DECLS diff --git a/libgimp/gimpchannel.c b/libgimp/gimpchannel.c index 80e0f8f3f3..18bb914e8c 100644 --- a/libgimp/gimpchannel.c +++ b/libgimp/gimpchannel.c @@ -46,12 +46,12 @@ * Returns: The newly created channel. */ gint32 -gimp_channel_new (gint32 image_ID, - gchar *name, - guint width, - guint height, - gdouble opacity, - GimpRGB *color) +gimp_channel_new (gint32 image_ID, + const gchar *name, + guint width, + guint height, + gdouble opacity, + const GimpRGB *color) { return _gimp_channel_new (image_ID, width, diff --git a/libgimp/gimpchannel.h b/libgimp/gimpchannel.h index 48c81d8443..e8db8215fe 100644 --- a/libgimp/gimpchannel.h +++ b/libgimp/gimpchannel.h @@ -30,12 +30,12 @@ G_BEGIN_DECLS #define gimp_channel_get_image_id gimp_drawable_image -gint32 gimp_channel_new (gint32 image_ID, - gchar *name, - guint width, - guint height, - gdouble opacity, - GimpRGB *color); +gint32 gimp_channel_new (gint32 image_ID, + const gchar *name, + guint width, + guint height, + gdouble opacity, + const GimpRGB *color); G_END_DECLS diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c index 326093a91c..7eb45a1065 100644 --- a/libgimp/gimpdrawable.c +++ b/libgimp/gimpdrawable.c @@ -103,7 +103,6 @@ gimp_drawable_delete (GimpDrawable *drawable) } } - gchar * gimp_drawable_name (gint32 drawable_ID) { @@ -113,7 +112,6 @@ gimp_drawable_name (gint32 drawable_ID) return gimp_channel_get_name (drawable_ID); } - gboolean gimp_drawable_visible (gint32 drawable_ID) { @@ -123,10 +121,9 @@ gimp_drawable_visible (gint32 drawable_ID) return gimp_channel_get_visible (drawable_ID); } - void -gimp_drawable_set_name (gint32 drawable_ID, - gchar *name) +gimp_drawable_set_name (gint32 drawable_ID, + const gchar *name) { if (gimp_drawable_is_layer (drawable_ID)) gimp_layer_set_name (drawable_ID, name); @@ -268,7 +265,7 @@ gimp_drawable_attach_new_parasite (gint32 drawable_ID, const gchar *name, gint flags, gint size, - const gpointer data) + gconstpointer data) { GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); diff --git a/libgimp/gimpdrawable.h b/libgimp/gimpdrawable.h index b5031aae30..1e5524d5dd 100644 --- a/libgimp/gimpdrawable.h +++ b/libgimp/gimpdrawable.h @@ -50,7 +50,7 @@ void gimp_drawable_delete (GimpDrawable *drawable); gchar * gimp_drawable_name (gint32 drawable_ID); gboolean gimp_drawable_visible (gint32 drawable_ID); void gimp_drawable_set_name (gint32 drawable_ID, - gchar *name); + const gchar *name); void gimp_drawable_set_visible (gint32 drawable_ID, gboolean visible); GimpTile * gimp_drawable_get_tile (GimpDrawable *drawable, @@ -71,7 +71,7 @@ void gimp_drawable_attach_new_parasite (gint32 drawable_ID, const gchar *name, gint flags, gint size, - const gpointer data); + gconstpointer data); G_END_DECLS diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c index 915b9baa57..65869d6e65 100644 --- a/libgimp/gimpimage.c +++ b/libgimp/gimpimage.c @@ -68,9 +68,9 @@ gimp_image_get_cmap (gint32 image_ID, * Returns: TRUE on success. */ gboolean -gimp_image_set_cmap (gint32 image_ID, - guchar *cmap, - gint num_colors) +gimp_image_set_cmap (gint32 image_ID, + const guchar *cmap, + gint num_colors) { return _gimp_image_set_cmap (image_ID, num_colors * 3, @@ -117,11 +117,11 @@ gimp_image_get_thumbnail_data (gint32 image_ID, * See Also: gimp_image_parasite_attach() */ void -gimp_image_attach_new_parasite (gint32 image_ID, - const gchar *name, - gint flags, - gint size, - const gpointer data) +gimp_image_attach_new_parasite (gint32 image_ID, + const gchar *name, + gint flags, + gint size, + gconstpointer data) { GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h index e3e3816145..5e1417618a 100644 --- a/libgimp/gimpimage.h +++ b/libgimp/gimpimage.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS guchar * gimp_image_get_cmap (gint32 image_ID, gint *num_colors); gboolean gimp_image_set_cmap (gint32 image_ID, - guchar *cmap, + const guchar *cmap, gint num_colors); guchar * gimp_image_get_thumbnail_data (gint32 image_ID, @@ -46,7 +46,7 @@ void gimp_image_attach_new_parasite (gint32 image_ID, const gchar *name, gint flags, gint size, - const gpointer data); + gconstpointer data); G_END_DECLS diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c index 7723880006..0cbad892e6 100644 --- a/libgimp/gimplayer.c +++ b/libgimp/gimplayer.c @@ -47,7 +47,7 @@ */ gint32 gimp_layer_new (gint32 image_ID, - gchar *name, + const gchar *name, gint width, gint height, GimpImageType type, diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h index fcdf4d7c36..5bd444147c 100644 --- a/libgimp/gimplayer.h +++ b/libgimp/gimplayer.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS gint32 gimp_layer_new (gint32 image_ID, - gchar *name, + const gchar *name, gint width, gint height, GimpImageType type, diff --git a/libgimp/gimpmisc.c b/libgimp/gimpmisc.c index d1d2b913b6..58ed34e9f6 100644 --- a/libgimp/gimpmisc.c +++ b/libgimp/gimpmisc.c @@ -169,7 +169,7 @@ void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf, gint x, gint y, - guchar *pixel) + const guchar *pixel) { guchar *p; gint i; diff --git a/libgimp/gimpmisc.h b/libgimp/gimpmisc.h index 6b9a19bcdc..e9a7347511 100644 --- a/libgimp/gimpmisc.h +++ b/libgimp/gimpmisc.h @@ -57,7 +57,7 @@ void gimp_pixel_fetcher_get_pixel2 (GimpPixelFetcher *pf, void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf, gint x, gint y, - guchar *pixel); + const guchar *pixel); void gimp_pixel_fetcher_destroy (GimpPixelFetcher *pf); diff --git a/libgimp/gimpmiscui.c b/libgimp/gimpmiscui.c index 44af2ea95b..8db9a42d06 100644 --- a/libgimp/gimpmiscui.c +++ b/libgimp/gimpmiscui.c @@ -92,11 +92,14 @@ gimp_fixme_preview_free (GimpFixMePreview *preview) } GimpFixMePreview* -gimp_fixme_preview_new2 (GimpImageType drawable_type, gboolean has_frame) +gimp_fixme_preview_new2 (GimpImageType drawable_type, + gboolean has_frame) { - GimpFixMePreview *preview = g_new0 (GimpFixMePreview, 1); - guchar *buf = NULL; - gint y; + GimpFixMePreview *preview; + guchar *buf = NULL; + gint y; + + preview = g_new0 (GimpFixMePreview, 1); switch (drawable_type) { @@ -140,14 +143,14 @@ gimp_fixme_preview_new2 (GimpImageType drawable_type, gboolean has_frame) void gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, - gint x, - gint y, - const guchar *pixel) + gint x, + gint y, + const guchar *pixel) { guchar *dest; - g_assert (x >= 0 && x < PREVIEW_SIZE); - g_assert (y >= 0 && y < PREVIEW_SIZE); + g_return_if_fail (x >= 0 && x < PREVIEW_SIZE); + g_return_if_fail (y >= 0 && y < PREVIEW_SIZE); dest = preview->buffer + y * preview->rowstride; @@ -167,14 +170,14 @@ gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, void gimp_fixme_preview_get_pixel (GimpFixMePreview *preview, - gint x, - gint y, - guchar *pixel) + gint x, + gint y, + guchar *pixel) { - guchar *src; + const guchar *src; - g_assert (x >= 0 && x < PREVIEW_SIZE); - g_assert (y >= 0 && y < PREVIEW_SIZE); + g_return_if_fail (x >= 0 && x < PREVIEW_SIZE); + g_return_if_fail (y >= 0 && y < PREVIEW_SIZE); src = preview->buffer + y * preview->rowstride; @@ -196,52 +199,54 @@ void gimp_fixme_preview_do_row (GimpFixMePreview *preview, gint row, gint width, - guchar *src) + const guchar *src) { gint x; guchar *p0 = preview->even; guchar *p1 = preview->odd; - gint bpp = preview->bpp; + gint bpp = preview->bpp; gdouble r, g, b, a; gdouble c0, c1; for (x = 0; x < width; x++) { - if (bpp == 4) - { + switch (bpp) + { + case 4: r = ((gdouble) src[x*4 + 0]) / 255.0; g = ((gdouble) src[x*4 + 1]) / 255.0; b = ((gdouble) src[x*4 + 2]) / 255.0; a = ((gdouble) src[x*4 + 3]) / 255.0; - } - else if (bpp == 3) - { + break; + + case 3: r = ((gdouble) src[x*3 + 0]) / 255.0; g = ((gdouble) src[x*3 + 1]) / 255.0; b = ((gdouble) src[x*3 + 2]) / 255.0; a = 1.0; - } - else - { + break; + + default: if (preview->cmap) { gint index = MIN (src[x*bpp], preview->ncolors - 1); - r = ((gdouble)preview->cmap[index * 3 + 0]) / 255.0; - g = ((gdouble)preview->cmap[index * 3 + 1]) / 255.0; - b = ((gdouble)preview->cmap[index * 3 + 2]) / 255.0; + r = ((gdouble) preview->cmap[index * 3 + 0]) / 255.0; + g = ((gdouble) preview->cmap[index * 3 + 1]) / 255.0; + b = ((gdouble) preview->cmap[index * 3 + 2]) / 255.0; } else { - r = ((gdouble)src[x*bpp + 0]) / 255.0; + r = ((gdouble) src[x*bpp + 0]) / 255.0; g = b = r; } if (bpp == 2) - a = ((gdouble)src[x*2 + 1]) / 255.0; + a = ((gdouble) src[x*2 + 1]) / 255.0; else a = 1.0; - } + break; + } if ((x / GIMP_CHECK_SIZE_SM) & 1) { @@ -266,12 +271,12 @@ gimp_fixme_preview_do_row (GimpFixMePreview *preview, if ((row / GIMP_CHECK_SIZE_SM) & 1) { gtk_preview_draw_row (GTK_PREVIEW (preview->widget), - (guchar *) preview->odd, 0, row, width); + preview->odd, 0, row, width); } else { gtk_preview_draw_row (GTK_PREVIEW (preview->widget), - (guchar *) preview->even, 0, row, width); + preview->even, 0, row, width); } } @@ -280,8 +285,8 @@ gimp_fixme_preview_update (GimpFixMePreview *preview, GimpFixeMePreviewFunc func, gpointer data) { - gint x, y; guchar *buffer; + gint x, y; gint bpp; bpp = preview->bpp; @@ -289,8 +294,8 @@ gimp_fixme_preview_update (GimpFixMePreview *preview, for (y = 0; y < preview->height; y++) { - guchar *src = preview->cache + y * preview->rowstride; - guchar *dest = buffer; + const guchar *src = preview->cache + y * preview->rowstride; + guchar *dest = buffer; for (x = 0; x < preview->width; x++) { @@ -312,11 +317,11 @@ void gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, gint32 drawable_ID) { - gint bpp; - gint y; - gint width = PREVIEW_SIZE; - gint height = PREVIEW_SIZE; - guchar *src; + const guchar *src; + gint bpp; + gint y; + gint width = PREVIEW_SIZE; + gint height = PREVIEW_SIZE; preview->cache = gimp_drawable_get_thumbnail_data (drawable_ID, &width, &height, &bpp); @@ -369,7 +374,7 @@ gimp_fixme_preview_fill (GimpFixMePreview *preview, gint x1, x2, y1, y2; gint bpp; gint y; - guchar *src; + const guchar *src; gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2); @@ -504,8 +509,8 @@ gimp_fixme_preview_fill_scaled (GimpFixMePreview *preview, preview->height = GTK_PREVIEW (preview->widget)->buffer_height; } -GList* -gimp_plug_in_parse_path (gchar *path_name, +GList * +gimp_plug_in_parse_path (const gchar *path_name, const gchar *dir_name) { GList *path_list = NULL; diff --git a/libgimp/gimpmiscui.h b/libgimp/gimpmiscui.h index c13760f849..ead317d3ab 100644 --- a/libgimp/gimpmiscui.h +++ b/libgimp/gimpmiscui.h @@ -39,7 +39,8 @@ G_BEGIN_DECLS * Don't say I didn't warn you (Maurits). */ -typedef struct { +typedef struct +{ GtkWidget *widget; GtkWidget *frame; guchar *cache; @@ -57,40 +58,45 @@ typedef struct { gboolean is_gray; } GimpFixMePreview; -typedef void (*GimpFixeMePreviewFunc)(guchar *src, guchar *dest, - gint bpp, gpointer data); +typedef void (*GimpFixeMePreviewFunc) (const guchar *src, + guchar *dest, + gint bpp, + gpointer data); -GimpFixMePreview *gimp_fixme_preview_new (GimpDrawable *drawable, - gboolean has_frame); -GimpFixMePreview *gimp_fixme_preview_new2 (GimpImageType drawable_type, - gboolean has_frame); -void gimp_fixme_preview_free (GimpFixMePreview *preview); +GimpFixMePreview * gimp_fixme_preview_new (GimpDrawable *drawable, + gboolean has_frame); +GimpFixMePreview * gimp_fixme_preview_new2 (GimpImageType drawable_type, + gboolean has_frame); +void gimp_fixme_preview_free (GimpFixMePreview *preview); -void gimp_fixme_preview_update (GimpFixMePreview *preview, - GimpFixeMePreviewFunc func, - gpointer data); +void gimp_fixme_preview_update (GimpFixMePreview *preview, + GimpFixeMePreviewFunc func, + gpointer data); -void gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, - gint32 drawable_ID); -void gimp_fixme_preview_fill (GimpFixMePreview *preview, - GimpDrawable *drawable); -void gimp_fixme_preview_fill_scaled (GimpFixMePreview *preview, - GimpDrawable *drawable); -void gimp_fixme_preview_do_row (GimpFixMePreview *preview, - gint row, - gint width, - guchar *src); +void gimp_fixme_preview_fill_with_thumb (GimpFixMePreview *preview, + gint32 drawable_ID); +void gimp_fixme_preview_fill (GimpFixMePreview *preview, + GimpDrawable *drawable); +void gimp_fixme_preview_fill_scaled (GimpFixMePreview *preview, + GimpDrawable *drawable); -void gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, - gint x, - gint y, - const guchar *pixel); -void gimp_fixme_preview_get_pixel (GimpFixMePreview *preview, - gint x, - gint y, - guchar *pixel); +void gimp_fixme_preview_do_row (GimpFixMePreview *preview, + gint row, + gint width, + const guchar *src); + +void gimp_fixme_preview_put_pixel (GimpFixMePreview *preview, + gint x, + gint y, + const guchar *pixel); +void gimp_fixme_preview_get_pixel (GimpFixMePreview *preview, + gint x, + gint y, + guchar *pixel); + +GList * gimp_plug_in_parse_path (const gchar *path_name, + const gchar *dir_name); -GList *gimp_plug_in_parse_path (gchar *path_name, const gchar *dir_name); G_END_DECLS diff --git a/libgimp/gimppixelfetcher.c b/libgimp/gimppixelfetcher.c index d1d2b913b6..58ed34e9f6 100644 --- a/libgimp/gimppixelfetcher.c +++ b/libgimp/gimppixelfetcher.c @@ -169,7 +169,7 @@ void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf, gint x, gint y, - guchar *pixel) + const guchar *pixel) { guchar *p; gint i; diff --git a/libgimp/gimppixelfetcher.h b/libgimp/gimppixelfetcher.h index 6b9a19bcdc..e9a7347511 100644 --- a/libgimp/gimppixelfetcher.h +++ b/libgimp/gimppixelfetcher.h @@ -57,7 +57,7 @@ void gimp_pixel_fetcher_get_pixel2 (GimpPixelFetcher *pf, void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf, gint x, gint y, - guchar *pixel); + const guchar *pixel); void gimp_pixel_fetcher_destroy (GimpPixelFetcher *pf); diff --git a/libgimp/gimppixelrgn.c b/libgimp/gimppixelrgn.c index 7907a92d50..618136eac4 100644 --- a/libgimp/gimppixelrgn.c +++ b/libgimp/gimppixelrgn.c @@ -322,13 +322,13 @@ gimp_pixel_rgn_get_rect (GimpPixelRgn *pr, void gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y) { GimpTile *tile; guchar *tile_data; - gint b; + gint b; g_return_if_fail (pr != NULL && pr->drawable != NULL); g_return_if_fail (buf != NULL); @@ -338,7 +338,8 @@ gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr, tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y); gimp_tile_ref (tile); - tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)); + tile_data = tile->data + tile->bpp * (tile->ewidth * + (y % TILE_HEIGHT) + (x % TILE_WIDTH)); for (b = 0; b < tile->bpp; b++) *tile_data++ = *buf++; @@ -348,18 +349,18 @@ gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr, void gimp_pixel_rgn_set_row (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y, gint width) { GimpTile *tile; guchar *tile_data; - gint inc, min; - gint end; - gint boundary; + gint inc, min; + gint end; + gint boundary; #ifndef MEMCPY_IS_NICE - gint b; + gint b; #endif g_return_if_fail (pr != NULL && pr->drawable != NULL); @@ -399,17 +400,17 @@ gimp_pixel_rgn_set_row (GimpPixelRgn *pr, void gimp_pixel_rgn_set_col (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y, gint height) { GimpTile *tile; guchar *tile_data; - gint inc; - gint end; - gint boundary; - gint b; + gint inc; + gint end; + gint boundary; + gint b; g_return_if_fail (pr != NULL && pr->drawable != NULL); g_return_if_fail (buf != NULL); @@ -441,7 +442,7 @@ gimp_pixel_rgn_set_col (GimpPixelRgn *pr, void gimp_pixel_rgn_set_rect (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y, gint width, @@ -451,14 +452,14 @@ gimp_pixel_rgn_set_rect (GimpPixelRgn *pr, guchar *src; guchar *dest; gulong bufstride; - gint xstart, ystart; - gint xend, yend; - gint xboundary; - gint yboundary; - gint xstep, ystep; - gint ty, bpp; + gint xstart, ystart; + gint xend, yend; + gint xboundary; + gint yboundary; + gint xstep, ystep; + gint ty, bpp; #ifndef MEMCPY_IS_NICE - gint b, tx; + gint b, tx; #endif g_return_if_fail (pr != NULL && pr->drawable != NULL); @@ -495,7 +496,8 @@ gimp_pixel_rgn_set_rect (GimpPixelRgn *pr, for (ty = y; ty < yboundary; ty++) { src = buf + bufstride * (ty - ystart) + bpp * (x - xstart); - dest = tile->data + tile->bpp * (tile->ewidth * (ty % TILE_HEIGHT) + (x % TILE_WIDTH)); + dest = tile->data + tile->bpp * (tile->ewidth * + (ty % TILE_HEIGHT) + (x % TILE_WIDTH)); #ifdef MEMCPY_IS_NICE memcpy ((void *)dest, (const void *)src, (xboundary-x)*bpp); @@ -523,7 +525,7 @@ gimp_pixel_rgns_register2 (gint nrgns, GimpPixelRgn *pr; GimpPixelRgnHolder *prh; GimpPixelRgnIterator *pri; - gboolean found; + gboolean found; pri = g_new (GimpPixelRgnIterator, 1); pri->pixel_regions = NULL; @@ -569,9 +571,9 @@ gimp_pixel_rgns_register (gint nrgns, ...) { GimpPixelRgn **prs; - gpointer pri; - gint n; - va_list ap; + gpointer pri; + gint n; + va_list ap; prs = g_new (GimpPixelRgn *, nrgns); @@ -592,9 +594,9 @@ gimp_pixel_rgns_register (gint nrgns, gpointer gimp_pixel_rgns_process (gpointer pri_ptr) { - GSList *list; GimpPixelRgnHolder *prh; GimpPixelRgnIterator *pri; + GSList *list; pri = (GimpPixelRgnIterator*) pri_ptr; pri->process_count++; @@ -614,11 +616,15 @@ gimp_pixel_rgns_process (gpointer pri_ptr) */ prh->pr->process_count++; - /* Unref the last referenced tile if the underlying region is a tile manager */ + /* Unref the last referenced tile if the underlying region + * is a tile manager + */ if (prh->pr->drawable) { - GimpTile *tile = gimp_drawable_get_tile2 (prh->pr->drawable, prh->pr->shadow, - prh->pr->x, prh->pr->y); + GimpTile *tile = gimp_drawable_get_tile2 (prh->pr->drawable, + prh->pr->shadow, + prh->pr->x, + prh->pr->y); gimp_tile_unref (tile, prh->pr->dirty); } @@ -640,12 +646,13 @@ static gint gimp_get_portion_width (GimpPixelRgnIterator *pri) { GimpPixelRgnHolder *prh; - GSList *list; - gint min_width = G_MAXINT; - gint width; + GSList *list; + gint min_width = G_MAXINT; + gint width; - /* Find the minimum width to the next vertical tile (in the case of a tile manager) - * or to the end of the pixel region (in the case of no tile manager) + /* Find the minimum width to the next vertical tile (in the case of + * a tile manager) or to the end of the pixel region (in the case of + * no tile manager) */ list = pri->pixel_regions; @@ -683,12 +690,13 @@ static int gimp_get_portion_height (GimpPixelRgnIterator *pri) { GimpPixelRgnHolder *prh; - GSList *list; - gint min_height = G_MAXINT; - gint height; + GSList *list; + gint min_height = G_MAXINT; + gint height; - /* Find the minimum height to the next vertical tile (in the case of a tile manager) - * or to the end of the pixel region (in the case of no tile manager) + /* Find the minimum height to the next vertical tile (in the case of + * a tile manager) or to the end of the pixel region (in the case of + * no tile manager) */ list = pri->pixel_regions; @@ -781,14 +789,18 @@ gimp_pixel_rgn_configure (GimpPixelRgnHolder *prh, gint offx; gint offy; - tile = gimp_drawable_get_tile2 (prh->pr->drawable, prh->pr->shadow, prh->pr->x, prh->pr->y); + tile = gimp_drawable_get_tile2 (prh->pr->drawable, + prh->pr->shadow, + prh->pr->x, + prh->pr->y); gimp_tile_ref (tile); offx = prh->pr->x % TILE_WIDTH; offy = prh->pr->y % TILE_HEIGHT; prh->pr->rowstride = tile->ewidth * prh->pr->bpp; - prh->pr->data = tile->data + offy * prh->pr->rowstride + offx * prh->pr->bpp; + prh->pr->data = (tile->data + + offy * prh->pr->rowstride + offx * prh->pr->bpp); } else { diff --git a/libgimp/gimppixelrgn.h b/libgimp/gimppixelrgn.h index 029ba4e9da..96c3e7d865 100644 --- a/libgimp/gimppixelrgn.h +++ b/libgimp/gimppixelrgn.h @@ -75,21 +75,21 @@ void gimp_pixel_rgn_get_rect (GimpPixelRgn *pr, gint width, gint height); void gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y); void gimp_pixel_rgn_set_row (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y, gint width); void gimp_pixel_rgn_set_col (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y, gint height); void gimp_pixel_rgn_set_rect (GimpPixelRgn *pr, - guchar *buf, + const guchar *buf, gint x, gint y, gint width, diff --git a/libgimp/gimpproceduraldb.c b/libgimp/gimpproceduraldb.c index 779f9aa020..6608614140 100644 --- a/libgimp/gimpproceduraldb.c +++ b/libgimp/gimpproceduraldb.c @@ -51,7 +51,7 @@ * Returns: TRUE on success. */ gboolean -gimp_procedural_db_proc_info (gchar *procedure, +gimp_procedural_db_proc_info (const gchar *procedure, gchar **blurb, gchar **help, gchar **author, @@ -130,8 +130,8 @@ gimp_procedural_db_proc_info (gchar *procedure, * the identifier */ gboolean -gimp_procedural_db_get_data (gchar *identifier, - gpointer data) +gimp_procedural_db_get_data (const gchar *identifier, + gpointer data) { gint size; guint8 *hack; @@ -164,9 +164,9 @@ gimp_procedural_db_get_data (gchar *identifier, * Returns: TRUE on success. */ gboolean -gimp_procedural_db_set_data (gchar *identifier, - gpointer data, - guint32 bytes) +gimp_procedural_db_set_data (const gchar *identifier, + gpointer data, + guint32 bytes) { return _gimp_procedural_db_set_data (identifier, bytes, diff --git a/libgimp/gimpproceduraldb.h b/libgimp/gimpproceduraldb.h index cafc925135..9ad4c8746e 100644 --- a/libgimp/gimpproceduraldb.h +++ b/libgimp/gimpproceduraldb.h @@ -27,7 +27,7 @@ G_BEGIN_DECLS /* For information look into the C source or the html documentation */ -gboolean gimp_procedural_db_proc_info (gchar *procedure, +gboolean gimp_procedural_db_proc_info (const gchar *procedure, gchar **blurb, gchar **help, gchar **author, @@ -38,9 +38,9 @@ gboolean gimp_procedural_db_proc_info (gchar *procedure, gint *num_values, GimpParamDef **args, GimpParamDef **return_vals); -gboolean gimp_procedural_db_get_data (gchar *identifier, +gboolean gimp_procedural_db_get_data (const gchar *identifier, gpointer data); -gboolean gimp_procedural_db_set_data (gchar *identifier, +gboolean gimp_procedural_db_set_data (const gchar *identifier, gpointer data, guint32 bytes); diff --git a/libgimp/gimpregioniterator.c b/libgimp/gimpregioniterator.c index d1d2b913b6..58ed34e9f6 100644 --- a/libgimp/gimpregioniterator.c +++ b/libgimp/gimpregioniterator.c @@ -169,7 +169,7 @@ void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf, gint x, gint y, - guchar *pixel) + const guchar *pixel) { guchar *p; gint i; diff --git a/libgimp/gimpregioniterator.h b/libgimp/gimpregioniterator.h index 6b9a19bcdc..e9a7347511 100644 --- a/libgimp/gimpregioniterator.h +++ b/libgimp/gimpregioniterator.h @@ -57,7 +57,7 @@ void gimp_pixel_fetcher_get_pixel2 (GimpPixelFetcher *pf, void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf, gint x, gint y, - guchar *pixel); + const guchar *pixel); void gimp_pixel_fetcher_destroy (GimpPixelFetcher *pf); diff --git a/libgimpbase/gimpparasite.c b/libgimpbase/gimpparasite.c index e30d67b2ba..3d04002171 100644 --- a/libgimpbase/gimpparasite.c +++ b/libgimpbase/gimpparasite.c @@ -66,7 +66,7 @@ GimpParasite * gimp_parasite_new (const gchar *name, guint32 flags, guint32 size, - const gpointer data) + gconstpointer data) { GimpParasite *parasite; diff --git a/libgimpbase/gimpparasite.h b/libgimpbase/gimpparasite.h index c16e3de023..62472a3173 100644 --- a/libgimpbase/gimpparasite.h +++ b/libgimpbase/gimpparasite.h @@ -53,7 +53,7 @@ struct _GimpParasite GimpParasite * gimp_parasite_new (const gchar *name, guint32 flags, guint32 size, - const gpointer data); + gconstpointer data); void gimp_parasite_free (GimpParasite *parasite); GimpParasite * gimp_parasite_copy (const GimpParasite *parasite);