diff --git a/ChangeLog b/ChangeLog index 1820f43913..9c002b9528 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,110 @@ +2004-11-13 Manish Singh + + Fix a bunch of warnings from Sparse: + + * app/actions/dockable-commands.c + * app/actions/layers-actions.c + * app/actions/view-commands.c + * app/base/pixel-surround.c + * app/config/gimpconfig-utils.c + * app/config/gimpscanner.c + * app/core/gimpbrushgenerated.c + * app/core/gimpcontainer.c + * app/core/gimpimage.c + * app/dialogs/palette-import-dialog.c + * app/file/gimprecentlist.c + * app/plug-in/plug-in-params.c + * app/text/gimptext-compat.c + * app/text/gimptext-parasite.c + * app/vectors/gimpbezierstroke.c + * app/vectors/gimpstroke.c + * app/widgets/gimpcellrendereraccel.c + * app/widgets/gimpselectiondata.c + * app/xcf/xcf.c + * libgimp/gimp.c + * libgimpthumb/gimpthumb-utils.c + * libgimpthumb/gimpthumbnail.c + * modules/cdisplay_proof.c + * plug-ins/Lighting/lighting_ui.c + * plug-ins/common/csource.c + * plug-ins/common/glasstile.c + * plug-ins/common/nova.c + * plug-ins/common/pcx.c + * plug-ins/common/pnm.c + * plug-ins/common/randomize.c + * plug-ins/common/screenshot.c + * plug-ins/common/sel_gauss.c + * plug-ins/common/spheredesigner.c + * plug-ins/common/wind.c + * plug-ins/gfig/gfig-dialog.c + * plug-ins/gfig/gfig-dobject.c + * plug-ins/gimpressionist/gimpressionist.c + * plug-ins/ifscompose/ifscompose.c + * plug-ins/print/gimp_main_window.c + * plug-ins/print/print.c: Cleanup integer vs. pointer confusion. + + * app/base/temp-buf.c + * app/dialogs/about-dialog.c + * plug-ins/common/bumpmap.c + * plug-ins/common/jigsaw.c + * plug-ins/gfig/gfig-dobject.c: Cosmetic cleanups. + + * app/config/gimpconfig-deserialize.c + * app/config/gimpconfig-path.c + * app/config/gimpconfigwriter.c + * app/core/gimpgradient.c + * app/tools/gimpdrawtool.c + * plug-ins/common/nlfilt.c + * plug-ins/common/unsharp.c + * plug-ins/common/zealouscrop.c: Define inline functions before they + are used. + + * app/core/gimpdrawable-blend.c: PixelRegion definition was changed + some time ago, but the initialization here didn't change. Fix it. + + * app/plug-in/plug-in-rc.c (plug_in_extra_deserialize): No need to + assign token twice in a row. + + * libgimpbase/gimpdatafiles.c (gimp_datafiles_read_directories): No + need to initialize file_data, since the code fills out all the fields. + + * plug-ins/common/CML_explorer.c + * plug-ins/common/vpropagate.c: Declare function pointers fully. + + * plug-ins/common/grid.c (pix_composite): G_INLINE_FUNC isn't needed, + we assume we can use the "inline" keyword always. + + * plug-ins/common/psd_save.c + * plug-ins/common/vinvert.c + * plug-ins/gfig/gfig-arc.c + * plug-ins/gfig/gfig-bezier.c + * plug-ins/gfig/gfig-circle.c + * plug-ins/gfig/gfig-dialog.c + * plug-ins/gfig/gfig-dobject.c + * plug-ins/gfig/gfig-ellipse.c + * plug-ins/gfig/gfig-line.c + * plug-ins/gfig/gfig-poly.c + * plug-ins/gfig/gfig-spiral.c + * plug-ins/gfig/gfig-star.c + * plug-ins/gfig/gfig.c + * plug-ins/gimpressionist/orientmap.c + * plug-ins/gimpressionist/placement.c + * plug-ins/gimpressionist/sizemap.c + * plug-ins/imagemap/imap_grid.c + * plug-ins/imagemap/imap_main.c + * plug-ins/imagemap/imap_preferences.c + * plug-ins/imagemap/imap_settings.c + * plug-ins/maze/maze.c + * plug-ins/sel2path/curve.c + * plug-ins/sel2path/fit.c + * plug-ins/sel2path/pxl-outline.c + * plug-ins/sel2path/spline.c + * plug-ins/xjt/xjt.c: Functions with no args should be declared + with (void). + + * plug-ins/common/retinex.c (MSRCR): Initialize max_preview to quiet + the compiler. + 2004-11-14 Sven Neumann * themes/Default/images/Makefile.am diff --git a/app/actions/dockable-commands.c b/app/actions/dockable-commands.c index 129fe1a1a1..1f75f9226c 100644 --- a/app/actions/dockable-commands.c +++ b/app/actions/dockable-commands.c @@ -334,7 +334,7 @@ dockable_change_screen_cmd_callback (GtkAction *action, dialog = gimp_query_int_box ("Move Dock to Screen", dock, - NULL, 0, + NULL, NULL, "Enter destination screen", cur_screen, 0, num_screens - 1, G_OBJECT (dock), "destroy", diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index 8c045a6084..0e8d89d719 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -385,7 +385,7 @@ layers_actions_update (GimpActionGroup *group, { GimpImage *gimage = action_data_get_image (data); GimpLayer *layer = NULL; - GimpLayerMask *mask = FALSE; /* layer mask */ + GimpLayerMask *mask = NULL; /* layer mask */ gboolean fs = FALSE; /* floating sel */ gboolean ac = FALSE; /* active channel */ gboolean sel = FALSE; diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c index 89f15e45df..1ceae4c26a 100644 --- a/app/actions/view-commands.c +++ b/app/actions/view-commands.c @@ -669,7 +669,7 @@ view_change_screen_cmd_callback (GtkAction *action, dialog = gimp_query_int_box ("Move Display to Screen", gdisp->shell, - NULL, 0, + NULL, NULL, "Enter destination screen", cur_screen, 0, num_screens - 1, G_OBJECT (gdisp->shell), "destroy", diff --git a/app/base/pixel-surround.c b/app/base/pixel-surround.c index f078e89c11..257dc4597f 100644 --- a/app/base/pixel-surround.c +++ b/app/base/pixel-surround.c @@ -81,7 +81,7 @@ pixel_surround_lock (PixelSurround *ps, if (ps->tile) { tile_release (ps->tile, FALSE); - ps->tile = 0; + ps->tile = NULL; } /* copy pixels, one by one */ @@ -132,7 +132,7 @@ pixel_surround_release (PixelSurround *ps) if (ps->tile) { tile_release (ps->tile, FALSE); - ps->tile = 0; + ps->tile = NULL; } } @@ -142,7 +142,7 @@ pixel_surround_clear (PixelSurround *ps) if (ps->buff) { g_free (ps->buff); - ps->buff = 0; + ps->buff = NULL; ps->buff_size = 0; } } diff --git a/app/base/temp-buf.c b/app/base/temp-buf.c index 4ce49c15e2..81f7a60732 100644 --- a/app/base/temp-buf.c +++ b/app/base/temp-buf.c @@ -434,12 +434,12 @@ temp_buf_copy_area (TempBuf *src, gint dest_y) { TempBuf *new; - PixelRegion srcPR = { 0 }; - PixelRegion destPR = { 0 }; + PixelRegion srcPR = { 0, }; + PixelRegion destPR = { 0, }; guchar empty[MAX_CHANNELS] = { 0, 0, 0, 0 }; gint x1, y1, x2, y2; - g_return_val_if_fail (src != NULL, dest); + g_return_val_if_fail (src != NULL, dest); g_return_val_if_fail (!dest || dest->bytes == src->bytes, dest); g_return_val_if_fail (width + dest_x > 0, dest); diff --git a/app/config/gimpconfig-deserialize.c b/app/config/gimpconfig-deserialize.c index 6abc3815ae..4625174b86 100644 --- a/app/config/gimpconfig-deserialize.c +++ b/app/config/gimpconfig-deserialize.c @@ -89,6 +89,19 @@ static GTokenType gimp_config_deserialize_any (GValue *value, static inline gboolean scanner_string_utf8_valid (GScanner *scanner, const gchar *token_name); +static inline gboolean +scanner_string_utf8_valid (GScanner *scanner, + const gchar *token_name) +{ + if (g_utf8_validate (scanner->value.v_string, -1, NULL)) + return TRUE; + + g_scanner_error (scanner, + _("value for token %s is not a valid UTF-8 string"), + token_name); + + return FALSE; +} /** * gimp_config_deserialize_properties: @@ -777,17 +790,3 @@ gimp_config_deserialize_any (GValue *value, return G_TOKEN_RIGHT_PAREN; } - -static inline gboolean -scanner_string_utf8_valid (GScanner *scanner, - const gchar *token_name) -{ - if (g_utf8_validate (scanner->value.v_string, -1, NULL)) - return TRUE; - - g_scanner_error (scanner, - _("value for token %s is not a valid UTF-8 string"), - token_name); - - return FALSE; -} diff --git a/app/config/gimpconfig-path.c b/app/config/gimpconfig-path.c index d4fde004ba..0c5cd1f64a 100644 --- a/app/config/gimpconfig-path.c +++ b/app/config/gimpconfig-path.c @@ -39,6 +39,29 @@ static gchar * gimp_config_path_expand_only (const gchar *path, GError **error); static inline gchar * extract_token (const gchar **str); +static inline gchar * +extract_token (const gchar **str) +{ + const gchar *p; + gchar *token; + + if (strncmp (*str, "${", 2)) + return NULL; + + p = *str + 2; + + while (*p && (*p != '}')) + p = g_utf8_next_char (p); + + if (!p) + return NULL; + + token = g_strndup (*str + 2, g_utf8_pointer_to_offset (*str + 2, p)); + + *str = p + 1; /* after the closing bracket */ + + return token; +} /** * gimp_config_path_expand: @@ -230,27 +253,3 @@ gimp_config_path_expand_only (const gchar *path, return expanded; } - -static inline gchar * -extract_token (const gchar **str) -{ - const gchar *p; - gchar *token; - - if (strncmp (*str, "${", 2)) - return NULL; - - p = *str + 2; - - while (*p && (*p != '}')) - p = g_utf8_next_char (p); - - if (!p) - return NULL; - - token = g_strndup (*str + 2, g_utf8_pointer_to_offset (*str + 2, p)); - - *str = p + 1; /* after the closing bracket */ - - return token; -} diff --git a/app/config/gimpconfig-utils.c b/app/config/gimpconfig-utils.c index abe56cf9f1..fee89e197b 100644 --- a/app/config/gimpconfig-utils.c +++ b/app/config/gimpconfig-utils.c @@ -266,8 +266,8 @@ gimp_config_diff (GimpConfig *a, { GList *diff; - g_return_val_if_fail (GIMP_IS_CONFIG (a), FALSE); - g_return_val_if_fail (GIMP_IS_CONFIG (b), FALSE); + g_return_val_if_fail (GIMP_IS_CONFIG (a), NULL); + g_return_val_if_fail (GIMP_IS_CONFIG (b), NULL); if (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b)) diff = gimp_config_diff_same (a, b, flags); diff --git a/app/config/gimpconfigwriter.c b/app/config/gimpconfigwriter.c index e2ec8c3738..921176b28b 100644 --- a/app/config/gimpconfigwriter.c +++ b/app/config/gimpconfigwriter.c @@ -67,6 +67,29 @@ static inline void gimp_config_writer_newline (GimpConfigWriter *writer); static gboolean gimp_config_writer_close_file (GimpConfigWriter *writer, GError **error); +static inline void +gimp_config_writer_flush (GimpConfigWriter *writer) +{ + if (write (writer->fd, writer->buffer->str, writer->buffer->len) < 0) + g_set_error (&writer->error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, + g_strerror (errno)); + + g_string_truncate (writer->buffer, 0); +} + +static inline void +gimp_config_writer_newline (GimpConfigWriter *writer) +{ + gint i; + + g_string_append_c (writer->buffer, '\n'); + + if (writer->comment) + g_string_append_len (writer->buffer, "# ", 2); + + for (i = 0; i < writer->depth; i++) + g_string_append_len (writer->buffer, " ", 4); +} /** * gimp_config_writer_new_file: @@ -565,31 +588,6 @@ gimp_config_writer_comment (GimpConfigWriter *writer, #undef LINE_LENGTH } - -static inline void -gimp_config_writer_flush (GimpConfigWriter *writer) -{ - if (write (writer->fd, writer->buffer->str, writer->buffer->len) < 0) - g_set_error (&writer->error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, - g_strerror (errno)); - - g_string_truncate (writer->buffer, 0); -} - -static inline void -gimp_config_writer_newline (GimpConfigWriter *writer) -{ - gint i; - - g_string_append_c (writer->buffer, '\n'); - - if (writer->comment) - g_string_append_len (writer->buffer, "# ", 2); - - for (i = 0; i < writer->depth; i++) - g_string_append_len (writer->buffer, " ", 4); -} - static gboolean gimp_config_writer_close_file (GimpConfigWriter *writer, GError **error) diff --git a/app/config/gimpscanner.c b/app/config/gimpscanner.c index 84ab8d8397..7a0f32488b 100644 --- a/app/config/gimpscanner.c +++ b/app/config/gimpscanner.c @@ -439,7 +439,8 @@ gimp_scanner_parse_matrix2 (GScanner *scanner, old_scope_id = g_scanner_set_scope (scanner, scope_id); if (! g_scanner_scope_lookup_symbol (scanner, scope_id, "matrix")) - g_scanner_scope_add_symbol (scanner, scope_id, "matrix", 0); + g_scanner_scope_add_symbol (scanner, scope_id, + "matrix", GINT_TO_POINTER (0)); token = G_TOKEN_LEFT_PAREN; diff --git a/app/core/gimpbrushgenerated-load.c b/app/core/gimpbrushgenerated-load.c index 1112742ca8..40aa7c7f8c 100644 --- a/app/core/gimpbrushgenerated-load.c +++ b/app/core/gimpbrushgenerated-load.c @@ -428,7 +428,7 @@ gimp_brush_generated_dirty (GimpData *data) gbrush->mask = temp_buf_new (width * 2 + 1, height * 2 + 1, - 1, width, height, 0); + 1, width, height, NULL); centerp = temp_buf_data (gbrush->mask) + height * gbrush->mask->width + width; diff --git a/app/core/gimpbrushgenerated-save.c b/app/core/gimpbrushgenerated-save.c index 1112742ca8..40aa7c7f8c 100644 --- a/app/core/gimpbrushgenerated-save.c +++ b/app/core/gimpbrushgenerated-save.c @@ -428,7 +428,7 @@ gimp_brush_generated_dirty (GimpData *data) gbrush->mask = temp_buf_new (width * 2 + 1, height * 2 + 1, - 1, width, height, 0); + 1, width, height, NULL); centerp = temp_buf_data (gbrush->mask) + height * gbrush->mask->width + width; diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c index 1112742ca8..40aa7c7f8c 100644 --- a/app/core/gimpbrushgenerated.c +++ b/app/core/gimpbrushgenerated.c @@ -428,7 +428,7 @@ gimp_brush_generated_dirty (GimpData *data) gbrush->mask = temp_buf_new (width * 2 + 1, height * 2 + 1, - 1, width, height, 0); + 1, width, height, NULL); centerp = temp_buf_data (gbrush->mask) + height * gbrush->mask->width + width; diff --git a/app/core/gimpcontainer.c b/app/core/gimpcontainer.c index 999b30698b..d544ac0459 100644 --- a/app/core/gimpcontainer.c +++ b/app/core/gimpcontainer.c @@ -492,7 +492,7 @@ gimp_container_deserialize (GimpConfig *config, if (! GIMP_CONFIG_GET_INTERFACE (child)->deserialize (GIMP_CONFIG (child), scanner, nest_level + 1, - FALSE)) + NULL)) { if (add_child) g_object_unref (child); diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index ba7ac9c81c..979b649a0f 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -157,10 +157,13 @@ static PixelRegion distR = { NULL, /* data */ NULL, /* tiles */ + NULL, /* curtile */ + 0, 0, /* offx, offy */ 0, /* rowstride */ - 0, 0, /* w, h */ 0, 0, /* x, y */ + 0, 0, /* w, h */ 4, /* bytes */ + FALSE, /* dirty */ 0 /* process count */ }; diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c index ecd905e90f..fd6ccdad91 100644 --- a/app/core/gimpgradient.c +++ b/app/core/gimpgradient.c @@ -79,6 +79,67 @@ static inline gdouble gimp_gradient_calc_sphere_decreasing_factor (gdouble mid static GimpDataClass *parent_class = NULL; +static inline gdouble +gimp_gradient_calc_linear_factor (gdouble middle, + gdouble pos) +{ + if (pos <= middle) + { + if (middle < EPSILON) + return 0.0; + else + return 0.5 * pos / middle; + } + else + { + pos -= middle; + middle = 1.0 - middle; + + if (middle < EPSILON) + return 1.0; + else + return 0.5 + 0.5 * pos / middle; + } +} + +static inline gdouble +gimp_gradient_calc_curved_factor (gdouble middle, + gdouble pos) +{ + if (middle < EPSILON) + middle = EPSILON; + + return pow (pos, log (0.5) / log (middle)); +} + +static inline gdouble +gimp_gradient_calc_sine_factor (gdouble middle, + gdouble pos) +{ + pos = gimp_gradient_calc_linear_factor (middle, pos); + + return (sin ((-G_PI / 2.0) + G_PI * pos) + 1.0) / 2.0; +} + +static inline gdouble +gimp_gradient_calc_sphere_increasing_factor (gdouble middle, + gdouble pos) +{ + pos = gimp_gradient_calc_linear_factor (middle, pos) - 1.0; + + return sqrt (1.0 - pos * pos); /* Works for convex increasing and concave decreasing */ +} + +static inline gdouble +gimp_gradient_calc_sphere_decreasing_factor (gdouble middle, + gdouble pos) +{ + pos = gimp_gradient_calc_linear_factor (middle, pos); + + return 1.0 - sqrt(1.0 - pos * pos); /* Works for convex decreasing and concave increasing */ +} + + GType gimp_gradient_get_type (void) @@ -510,67 +571,6 @@ gimp_gradient_get_segment_at (GimpGradient *gradient, return NULL; } -static inline gdouble -gimp_gradient_calc_linear_factor (gdouble middle, - gdouble pos) -{ - if (pos <= middle) - { - if (middle < EPSILON) - return 0.0; - else - return 0.5 * pos / middle; - } - else - { - pos -= middle; - middle = 1.0 - middle; - - if (middle < EPSILON) - return 1.0; - else - return 0.5 + 0.5 * pos / middle; - } -} - -static inline gdouble -gimp_gradient_calc_curved_factor (gdouble middle, - gdouble pos) -{ - if (middle < EPSILON) - middle = EPSILON; - - return pow (pos, log (0.5) / log (middle)); -} - -static inline gdouble -gimp_gradient_calc_sine_factor (gdouble middle, - gdouble pos) -{ - pos = gimp_gradient_calc_linear_factor (middle, pos); - - return (sin ((-G_PI / 2.0) + G_PI * pos) + 1.0) / 2.0; -} - -static inline gdouble -gimp_gradient_calc_sphere_increasing_factor (gdouble middle, - gdouble pos) -{ - pos = gimp_gradient_calc_linear_factor (middle, pos) - 1.0; - - return sqrt (1.0 - pos * pos); /* Works for convex increasing and concave decreasing */ -} - -static inline gdouble -gimp_gradient_calc_sphere_decreasing_factor (gdouble middle, - gdouble pos) -{ - pos = gimp_gradient_calc_linear_factor (middle, pos); - - return 1.0 - sqrt(1.0 - pos * pos); /* Works for convex decreasing and concave increasing */ -} - - /* gradient segment functions */ GimpGradientSegment * diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 4d00642d82..58521f26fb 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -1457,7 +1457,7 @@ gimp_image_is_empty (const GimpImage *gimage) GimpLayer * gimp_image_floating_sel (const GimpImage *gimage) { - g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); return gimage->floating_sel; } diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c index 83414589b2..4ce080122e 100644 --- a/app/dialogs/about-dialog.c +++ b/app/dialogs/about-dialog.c @@ -108,7 +108,7 @@ PangoColor grad1ent[] = PangoColor foregr0und = { 37522, 51914, 57568 }; PangoColor backgr0und = { 0, 0, 0 }; -static GimpAboutInfo about_info = { 0 }; +static GimpAboutInfo about_info = { 0, }; static gboolean pp = FALSE; static gboolean about_dialog_load_logo (GtkWidget *window); diff --git a/app/dialogs/palette-import-dialog.c b/app/dialogs/palette-import-dialog.c index 178bed56be..fd50ea926c 100644 --- a/app/dialogs/palette-import-dialog.c +++ b/app/dialogs/palette-import-dialog.c @@ -270,7 +270,7 @@ palette_import_dialog_new (Gimp *gimp) /* Palette file name entry */ import_dialog->filename_entry = - gimp_file_entry_new (_("Select palette file"), 0, FALSE, FALSE); + gimp_file_entry_new (_("Select palette file"), NULL, FALSE, FALSE); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, NULL, 0.0, 0.5, import_dialog->filename_entry, 1, FALSE); diff --git a/app/file/gimprecentlist.c b/app/file/gimprecentlist.c index d15984fe78..6980a54dd6 100644 --- a/app/file/gimprecentlist.c +++ b/app/file/gimprecentlist.c @@ -161,7 +161,7 @@ gimp_recent_list_update_item (GList *items, static void parse_info_init (ParseInfo *info) { - info->states = g_slist_prepend (NULL, STATE_START); + info->states = g_slist_prepend (NULL, GINT_TO_POINTER (STATE_START)); info->items = NULL; } diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 143d9e2c80..373f2b0a67 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -329,10 +329,10 @@ plug_in_args_to_params (Argument *args, tmp = gimp_parasite_copy (args[i].value.pdb_pointer); if (tmp == NULL) { - params[i].data.d_parasite.name = 0; + params[i].data.d_parasite.name = NULL; params[i].data.d_parasite.flags = 0; params[i].data.d_parasite.size = 0; - params[i].data.d_parasite.data = 0; + params[i].data.d_parasite.data = NULL; } else { @@ -345,10 +345,10 @@ plug_in_args_to_params (Argument *args, { if (args[i].value.pdb_pointer == NULL) { - params[i].data.d_parasite.name = 0; + params[i].data.d_parasite.name = NULL; params[i].data.d_parasite.flags = 0; params[i].data.d_parasite.size = 0; - params[i].data.d_parasite.data = 0; + params[i].data.d_parasite.data = NULL; } else memcpy (¶ms[i].data.d_parasite, @@ -425,8 +425,8 @@ plug_in_params_destroy (GPParam *params, { g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); - params[i].data.d_parasite.name = 0; - params[i].data.d_parasite.data = 0; + params[i].data.d_parasite.name = NULL; + params[i].data.d_parasite.data = NULL; } break; case GIMP_PDB_STATUS: diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c index 95ca48d6ba..8e07637231 100644 --- a/app/plug-in/plug-in-rc.c +++ b/app/plug-in/plug-in-rc.c @@ -501,7 +501,7 @@ plug_in_extra_deserialize (GScanner *scanner, while (g_scanner_peek_next_token (scanner) == G_TOKEN_LEFT_PAREN) { - token = token = g_scanner_get_next_token (scanner); + token = g_scanner_get_next_token (scanner); if (token != G_TOKEN_LEFT_PAREN) return token; diff --git a/app/text/gimptext-compat.c b/app/text/gimptext-compat.c index d1d874b4a7..2f858875ca 100644 --- a/app/text/gimptext-compat.c +++ b/app/text/gimptext-compat.c @@ -62,13 +62,13 @@ text_render (GimpImage *gimage, gchar *font; gdouble size; - g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); - g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), FALSE); + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); + g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (drawable == NULL || - gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE); - g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE); - g_return_val_if_fail (fontname != NULL, FALSE); - g_return_val_if_fail (text != NULL, FALSE); + gimp_item_is_attached (GIMP_ITEM (drawable)), NULL); + g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (fontname != NULL, NULL); + g_return_val_if_fail (text != NULL, NULL); if (border < 0) border = 0; diff --git a/app/text/gimptext-parasite.c b/app/text/gimptext-parasite.c index c1905d4a4e..745ebf14a2 100644 --- a/app/text/gimptext-parasite.c +++ b/app/text/gimptext-parasite.c @@ -76,13 +76,13 @@ gimp_text_from_parasite (const GimpParasite *parasite, GimpText *text; const gchar *str; - g_return_val_if_fail (parasite != NULL, FALSE); + g_return_val_if_fail (parasite != NULL, NULL); g_return_val_if_fail (strcmp (gimp_parasite_name (parasite), - gimp_text_parasite_name ()) == 0, FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + gimp_text_parasite_name ()) == 0, NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); str = gimp_parasite_data (parasite); - g_return_val_if_fail (str != NULL, FALSE); + g_return_val_if_fail (str != NULL, NULL); text = g_object_new (GIMP_TYPE_TEXT, NULL); diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c index cf06e98b11..3ad0dee5c9 100644 --- a/app/tools/gimpdrawtool.c +++ b/app/tools/gimpdrawtool.c @@ -74,6 +74,133 @@ static inline void gimp_draw_tool_shift_to_center static GimpToolClass *parent_class = NULL; +/* private functions */ + +static inline void +gimp_draw_tool_shift_to_north_west (gdouble x, + gdouble y, + gint handle_width, + gint handle_height, + GtkAnchorType anchor, + gdouble *shifted_x, + gdouble *shifted_y) +{ + switch (anchor) + { + case GTK_ANCHOR_CENTER: + x -= (handle_width >> 1); + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_NORTH: + x -= (handle_width >> 1); + break; + + case GTK_ANCHOR_NORTH_WEST: + /* nothing, this is the default */ + break; + + case GTK_ANCHOR_NORTH_EAST: + x -= handle_width; + break; + + case GTK_ANCHOR_SOUTH: + x -= (handle_width >> 1); + y -= handle_height; + break; + + case GTK_ANCHOR_SOUTH_WEST: + y -= handle_height; + break; + + case GTK_ANCHOR_SOUTH_EAST: + x -= handle_width; + y -= handle_height; + break; + + case GTK_ANCHOR_WEST: + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_EAST: + x -= handle_width; + y -= (handle_height >> 1); + break; + + default: + break; + } + + if (shifted_x) + *shifted_x = x; + + if (shifted_y) + *shifted_y = y; +} + +static inline void +gimp_draw_tool_shift_to_center (gdouble x, + gdouble y, + gint handle_width, + gint handle_height, + GtkAnchorType anchor, + gdouble *shifted_x, + gdouble *shifted_y) +{ + switch (anchor) + { + case GTK_ANCHOR_CENTER: + /* nothing, this is the default */ + break; + + case GTK_ANCHOR_NORTH: + y += (handle_height >> 1); + break; + + case GTK_ANCHOR_NORTH_WEST: + x += (handle_width >> 1); + y += (handle_height >> 1); + break; + + case GTK_ANCHOR_NORTH_EAST: + x -= (handle_width >> 1); + y += (handle_height >> 1); + break; + + case GTK_ANCHOR_SOUTH: + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_SOUTH_WEST: + x += (handle_width >> 1); + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_SOUTH_EAST: + x -= (handle_width >> 1); + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_WEST: + x += (handle_width >> 1); + break; + + case GTK_ANCHOR_EAST: + x -= (handle_width >> 1); + break; + + default: + break; + } + + if (shifted_x) + *shifted_x = x; + + if (shifted_y) + *shifted_y = y; +} + + GType gimp_draw_tool_get_type (void) { @@ -1225,130 +1352,3 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, g_free (gdk_segs); } - - -/* private functions */ - -static inline void -gimp_draw_tool_shift_to_north_west (gdouble x, - gdouble y, - gint handle_width, - gint handle_height, - GtkAnchorType anchor, - gdouble *shifted_x, - gdouble *shifted_y) -{ - switch (anchor) - { - case GTK_ANCHOR_CENTER: - x -= (handle_width >> 1); - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_NORTH: - x -= (handle_width >> 1); - break; - - case GTK_ANCHOR_NORTH_WEST: - /* nothing, this is the default */ - break; - - case GTK_ANCHOR_NORTH_EAST: - x -= handle_width; - break; - - case GTK_ANCHOR_SOUTH: - x -= (handle_width >> 1); - y -= handle_height; - break; - - case GTK_ANCHOR_SOUTH_WEST: - y -= handle_height; - break; - - case GTK_ANCHOR_SOUTH_EAST: - x -= handle_width; - y -= handle_height; - break; - - case GTK_ANCHOR_WEST: - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_EAST: - x -= handle_width; - y -= (handle_height >> 1); - break; - - default: - break; - } - - if (shifted_x) - *shifted_x = x; - - if (shifted_y) - *shifted_y = y; -} - -static inline void -gimp_draw_tool_shift_to_center (gdouble x, - gdouble y, - gint handle_width, - gint handle_height, - GtkAnchorType anchor, - gdouble *shifted_x, - gdouble *shifted_y) -{ - switch (anchor) - { - case GTK_ANCHOR_CENTER: - /* nothing, this is the default */ - break; - - case GTK_ANCHOR_NORTH: - y += (handle_height >> 1); - break; - - case GTK_ANCHOR_NORTH_WEST: - x += (handle_width >> 1); - y += (handle_height >> 1); - break; - - case GTK_ANCHOR_NORTH_EAST: - x -= (handle_width >> 1); - y += (handle_height >> 1); - break; - - case GTK_ANCHOR_SOUTH: - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_SOUTH_WEST: - x += (handle_width >> 1); - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_SOUTH_EAST: - x -= (handle_width >> 1); - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_WEST: - x += (handle_width >> 1); - break; - - case GTK_ANCHOR_EAST: - x -= (handle_width >> 1); - break; - - default: - break; - } - - if (shifted_x) - *shifted_x = x; - - if (shifted_y) - *shifted_y = y; -} diff --git a/app/vectors/gimpbezierstroke.c b/app/vectors/gimpbezierstroke.c index 4ff033aaae..c1160e20b5 100644 --- a/app/vectors/gimpbezierstroke.c +++ b/app/vectors/gimpbezierstroke.c @@ -270,13 +270,13 @@ gimp_bezier_stroke_open (GimpStroke *stroke, GList *list, *list2; GimpStroke *new_stroke = NULL; - g_return_val_if_fail (GIMP_IS_BEZIER_STROKE (stroke), FALSE); + g_return_val_if_fail (GIMP_IS_BEZIER_STROKE (stroke), NULL); g_return_val_if_fail (end_anchor && - end_anchor->type == GIMP_ANCHOR_ANCHOR, FALSE); + end_anchor->type == GIMP_ANCHOR_ANCHOR, NULL); list = g_list_find (stroke->anchors, end_anchor); - g_return_val_if_fail (list != NULL && list->next != NULL, FALSE); + g_return_val_if_fail (list != NULL && list->next != NULL, NULL); list = g_list_next (list); /* protect the handle... */ diff --git a/app/vectors/gimpstroke.c b/app/vectors/gimpstroke.c index 458244807a..09d13d8fae 100644 --- a/app/vectors/gimpstroke.c +++ b/app/vectors/gimpstroke.c @@ -762,7 +762,7 @@ gimp_stroke_anchor_insert (GimpStroke *stroke, GimpAnchor *predec, gdouble position) { - g_return_val_if_fail (GIMP_IS_STROKE (stroke), FALSE); + g_return_val_if_fail (GIMP_IS_STROKE (stroke), NULL); return GIMP_STROKE_GET_CLASS (stroke)->anchor_insert (stroke, predec, position); @@ -773,7 +773,7 @@ gimp_stroke_real_anchor_insert (GimpStroke *stroke, GimpAnchor *predec, gdouble position) { - g_return_val_if_fail (GIMP_IS_STROKE (stroke), FALSE); + g_return_val_if_fail (GIMP_IS_STROKE (stroke), NULL); return NULL; } diff --git a/app/widgets/gimpcellrendereraccel.c b/app/widgets/gimpcellrendereraccel.c index ce87d2329f..095b233ef0 100644 --- a/app/widgets/gimpcellrendereraccel.c +++ b/app/widgets/gimpcellrendereraccel.c @@ -426,7 +426,7 @@ gimp_cell_renderer_accel_start_editing (GtkCellRenderer *cell, if (gdk_pointer_grab (widget->window, FALSE, GDK_BUTTON_PRESS_MASK, - FALSE, NULL, + NULL, NULL, gdk_event_get_time (event)) != GDK_GRAB_SUCCESS) { gdk_display_keyboard_ungrab (gtk_widget_get_display (widget), diff --git a/app/widgets/gimpselectiondata.c b/app/widgets/gimpselectiondata.c index f9ad18fe08..76c06ce53f 100644 --- a/app/widgets/gimpselectiondata.c +++ b/app/widgets/gimpselectiondata.c @@ -724,7 +724,7 @@ gimp_selection_data_get_font (GtkSelectionData *selection, if ((selection->format != 8) || (selection->length < 1)) { g_warning ("Received invalid font data!"); - return FALSE; + return NULL; } name = (gchar *) selection->data; diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index 21fd81a6e4..1b55ca2914 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -101,7 +101,7 @@ static PlugInProcDef xcf_plug_in_load_proc = "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", - FALSE, + NULL, GIMP_INTERNAL, 3, xcf_load_args, @@ -158,7 +158,7 @@ static PlugInProcDef xcf_plug_in_save_proc = "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", - FALSE, + NULL, GIMP_INTERNAL, 5, xcf_save_args, diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 1e50587bbc..44277e1122 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -1676,7 +1676,7 @@ gimp_config (GPConfig *config) /* Use SysV shared memory mechanisms for transferring tile data. */ - _shm_addr = (guchar *) shmat (_shm_ID, 0, 0); + _shm_addr = (guchar *) shmat (_shm_ID, NULL, 0); if (_shm_addr == (guchar *) -1) { diff --git a/libgimpbase/gimpdatafiles.c b/libgimpbase/gimpdatafiles.c index 3741f5a563..9b8d61d863 100644 --- a/libgimpbase/gimpdatafiles.c +++ b/libgimpbase/gimpdatafiles.c @@ -113,7 +113,7 @@ gimp_datafiles_read_directories (const gchar *path_str, GimpDatafileLoaderFunc loader_func, gpointer user_data) { - GimpDatafileData file_data = { 0 }; + GimpDatafileData file_data; struct stat filestat; gchar *local_path; GList *path; diff --git a/libgimpconfig/gimpconfig-deserialize.c b/libgimpconfig/gimpconfig-deserialize.c index 6abc3815ae..4625174b86 100644 --- a/libgimpconfig/gimpconfig-deserialize.c +++ b/libgimpconfig/gimpconfig-deserialize.c @@ -89,6 +89,19 @@ static GTokenType gimp_config_deserialize_any (GValue *value, static inline gboolean scanner_string_utf8_valid (GScanner *scanner, const gchar *token_name); +static inline gboolean +scanner_string_utf8_valid (GScanner *scanner, + const gchar *token_name) +{ + if (g_utf8_validate (scanner->value.v_string, -1, NULL)) + return TRUE; + + g_scanner_error (scanner, + _("value for token %s is not a valid UTF-8 string"), + token_name); + + return FALSE; +} /** * gimp_config_deserialize_properties: @@ -777,17 +790,3 @@ gimp_config_deserialize_any (GValue *value, return G_TOKEN_RIGHT_PAREN; } - -static inline gboolean -scanner_string_utf8_valid (GScanner *scanner, - const gchar *token_name) -{ - if (g_utf8_validate (scanner->value.v_string, -1, NULL)) - return TRUE; - - g_scanner_error (scanner, - _("value for token %s is not a valid UTF-8 string"), - token_name); - - return FALSE; -} diff --git a/libgimpconfig/gimpconfig-path.c b/libgimpconfig/gimpconfig-path.c index d4fde004ba..0c5cd1f64a 100644 --- a/libgimpconfig/gimpconfig-path.c +++ b/libgimpconfig/gimpconfig-path.c @@ -39,6 +39,29 @@ static gchar * gimp_config_path_expand_only (const gchar *path, GError **error); static inline gchar * extract_token (const gchar **str); +static inline gchar * +extract_token (const gchar **str) +{ + const gchar *p; + gchar *token; + + if (strncmp (*str, "${", 2)) + return NULL; + + p = *str + 2; + + while (*p && (*p != '}')) + p = g_utf8_next_char (p); + + if (!p) + return NULL; + + token = g_strndup (*str + 2, g_utf8_pointer_to_offset (*str + 2, p)); + + *str = p + 1; /* after the closing bracket */ + + return token; +} /** * gimp_config_path_expand: @@ -230,27 +253,3 @@ gimp_config_path_expand_only (const gchar *path, return expanded; } - -static inline gchar * -extract_token (const gchar **str) -{ - const gchar *p; - gchar *token; - - if (strncmp (*str, "${", 2)) - return NULL; - - p = *str + 2; - - while (*p && (*p != '}')) - p = g_utf8_next_char (p); - - if (!p) - return NULL; - - token = g_strndup (*str + 2, g_utf8_pointer_to_offset (*str + 2, p)); - - *str = p + 1; /* after the closing bracket */ - - return token; -} diff --git a/libgimpconfig/gimpconfig-utils.c b/libgimpconfig/gimpconfig-utils.c index abe56cf9f1..fee89e197b 100644 --- a/libgimpconfig/gimpconfig-utils.c +++ b/libgimpconfig/gimpconfig-utils.c @@ -266,8 +266,8 @@ gimp_config_diff (GimpConfig *a, { GList *diff; - g_return_val_if_fail (GIMP_IS_CONFIG (a), FALSE); - g_return_val_if_fail (GIMP_IS_CONFIG (b), FALSE); + g_return_val_if_fail (GIMP_IS_CONFIG (a), NULL); + g_return_val_if_fail (GIMP_IS_CONFIG (b), NULL); if (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b)) diff = gimp_config_diff_same (a, b, flags); diff --git a/libgimpconfig/gimpconfigwriter.c b/libgimpconfig/gimpconfigwriter.c index e2ec8c3738..921176b28b 100644 --- a/libgimpconfig/gimpconfigwriter.c +++ b/libgimpconfig/gimpconfigwriter.c @@ -67,6 +67,29 @@ static inline void gimp_config_writer_newline (GimpConfigWriter *writer); static gboolean gimp_config_writer_close_file (GimpConfigWriter *writer, GError **error); +static inline void +gimp_config_writer_flush (GimpConfigWriter *writer) +{ + if (write (writer->fd, writer->buffer->str, writer->buffer->len) < 0) + g_set_error (&writer->error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, + g_strerror (errno)); + + g_string_truncate (writer->buffer, 0); +} + +static inline void +gimp_config_writer_newline (GimpConfigWriter *writer) +{ + gint i; + + g_string_append_c (writer->buffer, '\n'); + + if (writer->comment) + g_string_append_len (writer->buffer, "# ", 2); + + for (i = 0; i < writer->depth; i++) + g_string_append_len (writer->buffer, " ", 4); +} /** * gimp_config_writer_new_file: @@ -565,31 +588,6 @@ gimp_config_writer_comment (GimpConfigWriter *writer, #undef LINE_LENGTH } - -static inline void -gimp_config_writer_flush (GimpConfigWriter *writer) -{ - if (write (writer->fd, writer->buffer->str, writer->buffer->len) < 0) - g_set_error (&writer->error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, - g_strerror (errno)); - - g_string_truncate (writer->buffer, 0); -} - -static inline void -gimp_config_writer_newline (GimpConfigWriter *writer) -{ - gint i; - - g_string_append_c (writer->buffer, '\n'); - - if (writer->comment) - g_string_append_len (writer->buffer, "# ", 2); - - for (i = 0; i < writer->depth; i++) - g_string_append_len (writer->buffer, " ", 4); -} - static gboolean gimp_config_writer_close_file (GimpConfigWriter *writer, GError **error) diff --git a/libgimpconfig/gimpscanner.c b/libgimpconfig/gimpscanner.c index 84ab8d8397..7a0f32488b 100644 --- a/libgimpconfig/gimpscanner.c +++ b/libgimpconfig/gimpscanner.c @@ -439,7 +439,8 @@ gimp_scanner_parse_matrix2 (GScanner *scanner, old_scope_id = g_scanner_set_scope (scanner, scope_id); if (! g_scanner_scope_lookup_symbol (scanner, scope_id, "matrix")) - g_scanner_scope_add_symbol (scanner, scope_id, "matrix", 0); + g_scanner_scope_add_symbol (scanner, scope_id, + "matrix", GINT_TO_POINTER (0)); token = G_TOKEN_LEFT_PAREN; diff --git a/libgimpthumb/gimpthumb-utils.c b/libgimpthumb/gimpthumb-utils.c index 6c0cb05c7d..62c9d70dd8 100644 --- a/libgimpthumb/gimpthumb-utils.c +++ b/libgimpthumb/gimpthumb-utils.c @@ -149,7 +149,7 @@ gimp_thumb_init (const gchar *creator, const gchar * gimp_thumb_get_thumb_dir (GimpThumbSize size) { - g_return_val_if_fail (gimp_thumb_initialized, FALSE); + g_return_val_if_fail (gimp_thumb_initialized, NULL); size = gimp_thumb_size (size); @@ -173,7 +173,7 @@ gchar * gimp_thumb_get_thumb_dir_local (const gchar *dirname, GimpThumbSize size) { - g_return_val_if_fail (gimp_thumb_initialized, FALSE); + g_return_val_if_fail (gimp_thumb_initialized, NULL); g_return_val_if_fail (dirname != NULL, NULL); g_return_val_if_fail (size > GIMP_THUMB_SIZE_FAIL, NULL); diff --git a/libgimpthumb/gimpthumbnail.c b/libgimpthumb/gimpthumbnail.c index 371489192a..232e95d199 100644 --- a/libgimpthumb/gimpthumbnail.c +++ b/libgimpthumb/gimpthumbnail.c @@ -240,7 +240,7 @@ gimp_thumbnail_init (GimpThumbnail *thumbnail) thumbnail->image_width = 0; thumbnail->image_height = 0; thumbnail->image_mimetype = NULL; - thumbnail->image_type = 0; + thumbnail->image_type = NULL; thumbnail->image_num_layers = 0; thumbnail->thumb_state = GIMP_THUMB_STATE_UNKNOWN; diff --git a/modules/cdisplay_proof.c b/modules/cdisplay_proof.c index ea0ca6200f..c994e2e16b 100644 --- a/modules/cdisplay_proof.c +++ b/modules/cdisplay_proof.c @@ -230,7 +230,7 @@ cdisplay_proof_class_init (CdisplayProofClass *klass) g_object_class_install_property (object_class, PROP_PROFILE, g_param_spec_string ("profile", NULL, NULL, - FALSE, + NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | GIMP_MODULE_PARAM_SERIALIZE)); diff --git a/plug-ins/Lighting/lighting_ui.c b/plug-ins/Lighting/lighting_ui.c index 053124d4ff..234addb9c9 100644 --- a/plug-ins/Lighting/lighting_ui.c +++ b/plug-ins/Lighting/lighting_ui.c @@ -1063,7 +1063,7 @@ save_lighting_preset (GtkWidget *widget, GList *list; gchar *dir; - list = gimp_path_parse (lighting_effects_path, 16, FALSE, 0); + list = gimp_path_parse (lighting_effects_path, 16, FALSE, NULL); dir = gimp_path_get_user_writable_dir (list); gimp_path_free (list); @@ -1198,7 +1198,7 @@ load_lighting_preset (GtkWidget *widget, GList *list; gchar *dir; - list = gimp_path_parse (lighting_effects_path, 16, FALSE, 0); + list = gimp_path_parse (lighting_effects_path, 16, FALSE, NULL); dir = gimp_path_get_user_writable_dir (list); gimp_path_free (list); diff --git a/plug-ins/common/CML_explorer.c b/plug-ins/common/CML_explorer.c index 3554f39962..0d754d5b3e 100644 --- a/plug-ins/common/CML_explorer.c +++ b/plug-ins/common/CML_explorer.c @@ -99,12 +99,14 @@ #define HCANNONIZE(p, x) (254*(((p).range_h - (p).range_l)*(x) + (p).range_l)) #define POS_IN_TORUS(i,size) ((i < 0) ? size + i : ((size <= i) ? i - size : i)) -typedef struct +typedef struct _WidgetEntry WidgetEntry; + +struct _WidgetEntry { GtkWidget *widget; gpointer value; - void (*updater) (); -} WidgetEntry; + void (*updater) (WidgetEntry *); +}; enum { diff --git a/plug-ins/common/bumpmap.c b/plug-ins/common/bumpmap.c index fc1094b5c3..f01d3a43ba 100644 --- a/plug-ins/common/bumpmap.c +++ b/plug-ins/common/bumpmap.c @@ -283,9 +283,9 @@ static bumpmap_interface_t bmint = 0, /* bm_height */ 0, /* bm_bpp */ FALSE, /* bm_has_alpha */ - { 0 }, /* src_rgn */ - { 0 }, /* bm_rgn */ - { 0 } /* params */ + { 0, }, /* src_rgn */ + { 0, }, /* bm_rgn */ + { 0, } /* params */ }; static GimpDrawable *drawable = NULL; diff --git a/plug-ins/common/csource.c b/plug-ins/common/csource.c index 1bbe8daabc..7012dcb3ab 100644 --- a/plug-ins/common/csource.c +++ b/plug-ins/common/csource.c @@ -740,7 +740,7 @@ run_save_dialog (Config *config) _("Op_acity:"), 100, 0, config->opacity, 0, 100, 1, 10, 1, TRUE, 0, 0, - FALSE, FALSE); + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_double_adjustment_update), &config->opacity); diff --git a/plug-ins/common/glasstile.c b/plug-ins/common/glasstile.c index 5c61ee074b..8da96763fd 100644 --- a/plug-ins/common/glasstile.c +++ b/plug-ins/common/glasstile.c @@ -209,7 +209,7 @@ run (const gchar *name, gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); - glasstile (drawable, FALSE); + glasstile (drawable, NULL); if (run_mode != GIMP_RUN_NONINTERACTIVE) gimp_displays_flush (); diff --git a/plug-ins/common/grid.c b/plug-ins/common/grid.c index 687ce2fab1..64e533f9e1 100644 --- a/plug-ins/common/grid.c +++ b/plug-ins/common/grid.c @@ -291,7 +291,7 @@ best_cmap_match (const guchar *cmap, return cmap_index; } -G_INLINE_FUNC void +static inline void pix_composite (guchar *p1, guchar p2[4], gint bytes, diff --git a/plug-ins/common/jigsaw.c b/plug-ins/common/jigsaw.c index 9ea7b5ca71..97b9b86c38 100644 --- a/plug-ins/common/jigsaw.c +++ b/plug-ins/common/jigsaw.c @@ -336,24 +336,7 @@ struct globals_tag typedef struct globals_tag globals_t; -static globals_t globals = -{ - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - 0, - 0, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0} -}; +static globals_t globals = { 0, }; MAIN () diff --git a/plug-ins/common/nlfilt.c b/plug-ins/common/nlfilt.c index 57436c45ff..4d4bc7ba33 100644 --- a/plug-ins/common/nlfilt.c +++ b/plug-ins/common/nlfilt.c @@ -201,205 +201,6 @@ run (const gchar *name, gimp_drawable_detach (drawable); } -static void -nlfilter (GimpDrawable *drawable, - GimpPreview *preview) -{ - GimpPixelRgn srcPr, dstPr; - guchar *srcbuf, *dstbuf; - guchar *lastrow, *thisrow, *nextrow, *temprow; - gint x1, x2, y1, y2; - guint width, height, bpp; - gint filtno, y, rowsize, exrowsize, p_update; - - if (preview) - { - gimp_preview_get_position (preview, &x1, &y1); - gimp_preview_get_size (preview, &width, &height); - x2 = x1 + width; - y2 = y1 + height; - } - else - { - gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2); - width = x2 - x1; - height = y2 - y1; - } - bpp = drawable->bpp; - - rowsize = width * bpp; - exrowsize = (width + 2) * bpp; - p_update = width / 20 + 1; - - gimp_tile_cache_ntiles (2 * (width / gimp_tile_width () + 1)); - - gimp_pixel_rgn_init (&srcPr, drawable, - x1, y1, width, height, FALSE, FALSE); - gimp_pixel_rgn_init (&dstPr, drawable, - x1, y1, width, height, - preview == NULL, TRUE); - - /* source buffer gives one pixel margin all around destination buffer */ - srcbuf = g_new0 (guchar, exrowsize * 3); - dstbuf = g_new0 (guchar, rowsize); - - /* pointers to second pixel in each source row */ - lastrow = srcbuf + bpp; - thisrow = lastrow + exrowsize; - nextrow = thisrow + exrowsize; - - filtno = nlfiltInit (nlfvals.alpha, nlfvals.radius, nlfvals.filter); - - if (!preview) - gimp_progress_init (_("NL Filter...")); - - /* first row */ - gimp_pixel_rgn_get_row (&srcPr, thisrow, x1, y1, width); - /* copy thisrow[0] to thisrow[-1], thisrow[width-1] to thisrow[width] */ - memcpy (thisrow - bpp, thisrow, bpp); - memcpy (thisrow + rowsize, thisrow + rowsize - bpp, bpp); - /* copy whole thisrow to lastrow */ - memcpy (lastrow - bpp, thisrow - bpp, exrowsize); - - for (y = y1; y < y2 - 1; y++) - { - if (((y % p_update) == 0) && !preview) - gimp_progress_update ((gdouble) y / (gdouble) height); - - gimp_pixel_rgn_get_row (&srcPr, nextrow, x1, y + 1, width); - memcpy (nextrow - bpp, nextrow, bpp); - memcpy (nextrow + rowsize, nextrow + rowsize - bpp, bpp); - nlfiltRow (lastrow, thisrow, nextrow, dstbuf, width, bpp, filtno); - gimp_pixel_rgn_set_row (&dstPr, dstbuf, x1, y, width); - /* rotate row buffers */ - temprow = lastrow; lastrow = thisrow; - thisrow = nextrow; nextrow = temprow; - } - - /* last row */ - memcpy (nextrow - bpp, thisrow - bpp, exrowsize); - nlfiltRow (lastrow, thisrow, nextrow, dstbuf, width, bpp, filtno); - gimp_pixel_rgn_set_row (&dstPr, dstbuf, x1, y2 - 1, width); - - g_free (srcbuf); - g_free (dstbuf); - - if (preview) - { - gimp_drawable_preview_draw_region (GIMP_DRAWABLE_PREVIEW (preview), - &dstPr); - } - else - { - gimp_drawable_flush (drawable); - gimp_drawable_merge_shadow (drawable->drawable_id, TRUE); - gimp_drawable_update (drawable->drawable_id, x1, y1, width, height); - gimp_displays_flush (); - } -} - -static gboolean -nlfilter_dialog (GimpDrawable *drawable) -{ - GtkWidget *dialog; - GtkWidget *main_vbox; - GtkWidget *preview; - GtkWidget *frame; - GtkWidget *alpha_trim; - GtkWidget *opt_est; - GtkWidget *edge_enhance; - GtkWidget *table; - GtkObject *adj; - gboolean run; - - gimp_ui_init ("nlfilt", TRUE); - - dialog = gimp_dialog_new (_("NL Filter"), "nlfilt", - NULL, 0, - gimp_standard_help_func, "plug-in-nlfilt", - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - main_vbox = gtk_vbox_new (FALSE, 12); - gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); - gtk_widget_show (main_vbox); - - preview = gimp_drawable_preview_new (drawable, &nlfvals.preview); - gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview); - gtk_widget_show (preview); - g_signal_connect_swapped (preview, "invalidated", - G_CALLBACK (nlfilter), - drawable); - - frame = gimp_int_radio_group_new (TRUE, _("Filter"), - G_CALLBACK (gimp_radio_button_update), - &nlfvals.filter, nlfvals.filter, - - _("_Alpha trimmed mean"), - filter_alpha_trim, &alpha_trim, - _("Op_timal estimation"), - filter_opt_est, &opt_est, - _("_Edge enhancement"), - filter_edge_enhance, &edge_enhance, - - NULL); - - gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); - gtk_widget_show (frame); - - g_signal_connect_swapped (alpha_trim, "toggled", - G_CALLBACK (gimp_preview_invalidate), - preview); - g_signal_connect_swapped (opt_est, "toggled", - G_CALLBACK (gimp_preview_invalidate), - preview); - g_signal_connect_swapped (edge_enhance, "toggled", - G_CALLBACK (gimp_preview_invalidate), - preview); - - table = gtk_table_new (2, 3, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, - _("A_lpha:"), 0, 0, - nlfvals.alpha, 0.0, 1.0, 0.05, 0.1, 2, - TRUE, 0, 0, - NULL, NULL); - g_signal_connect (adj, "value_changed", - G_CALLBACK (gimp_double_adjustment_update), - &nlfvals.alpha); - g_signal_connect_swapped (adj, "value_changed", - G_CALLBACK (gimp_preview_invalidate), - preview); - - adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("_Radius:"), 0, 0, - nlfvals.radius, 1.0 / 3.0, 1.0, 0.05, 0.1, 2, - TRUE, 0, 0, - NULL, NULL); - g_signal_connect (adj, "value_changed", - G_CALLBACK (gimp_double_adjustment_update), - &nlfvals.radius); - g_signal_connect_swapped (adj, "value_changed", - G_CALLBACK (gimp_preview_invalidate), - preview); - - gtk_widget_show (dialog); - - run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); - - gtk_widget_destroy (dialog); - - return run; -} - /* pnmnlfilt.c - 4 in 1 (2 non-linear) filter ** - smooth an anyimage ** - do alpha trimmed mean filtering on an anyimage @@ -1099,3 +900,202 @@ rectang_area (gdouble rx0, gdouble ry0, gdouble rx1, gdouble ry1, gdouble tx0, return 0.0; return (rx1 - rx0) * (ry1 - ry0); } + +static void +nlfilter (GimpDrawable *drawable, + GimpPreview *preview) +{ + GimpPixelRgn srcPr, dstPr; + guchar *srcbuf, *dstbuf; + guchar *lastrow, *thisrow, *nextrow, *temprow; + gint x1, x2, y1, y2; + guint width, height, bpp; + gint filtno, y, rowsize, exrowsize, p_update; + + if (preview) + { + gimp_preview_get_position (preview, &x1, &y1); + gimp_preview_get_size (preview, &width, &height); + x2 = x1 + width; + y2 = y1 + height; + } + else + { + gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2); + width = x2 - x1; + height = y2 - y1; + } + bpp = drawable->bpp; + + rowsize = width * bpp; + exrowsize = (width + 2) * bpp; + p_update = width / 20 + 1; + + gimp_tile_cache_ntiles (2 * (width / gimp_tile_width () + 1)); + + gimp_pixel_rgn_init (&srcPr, drawable, + x1, y1, width, height, FALSE, FALSE); + gimp_pixel_rgn_init (&dstPr, drawable, + x1, y1, width, height, + preview == NULL, TRUE); + + /* source buffer gives one pixel margin all around destination buffer */ + srcbuf = g_new0 (guchar, exrowsize * 3); + dstbuf = g_new0 (guchar, rowsize); + + /* pointers to second pixel in each source row */ + lastrow = srcbuf + bpp; + thisrow = lastrow + exrowsize; + nextrow = thisrow + exrowsize; + + filtno = nlfiltInit (nlfvals.alpha, nlfvals.radius, nlfvals.filter); + + if (!preview) + gimp_progress_init (_("NL Filter...")); + + /* first row */ + gimp_pixel_rgn_get_row (&srcPr, thisrow, x1, y1, width); + /* copy thisrow[0] to thisrow[-1], thisrow[width-1] to thisrow[width] */ + memcpy (thisrow - bpp, thisrow, bpp); + memcpy (thisrow + rowsize, thisrow + rowsize - bpp, bpp); + /* copy whole thisrow to lastrow */ + memcpy (lastrow - bpp, thisrow - bpp, exrowsize); + + for (y = y1; y < y2 - 1; y++) + { + if (((y % p_update) == 0) && !preview) + gimp_progress_update ((gdouble) y / (gdouble) height); + + gimp_pixel_rgn_get_row (&srcPr, nextrow, x1, y + 1, width); + memcpy (nextrow - bpp, nextrow, bpp); + memcpy (nextrow + rowsize, nextrow + rowsize - bpp, bpp); + nlfiltRow (lastrow, thisrow, nextrow, dstbuf, width, bpp, filtno); + gimp_pixel_rgn_set_row (&dstPr, dstbuf, x1, y, width); + /* rotate row buffers */ + temprow = lastrow; lastrow = thisrow; + thisrow = nextrow; nextrow = temprow; + } + + /* last row */ + memcpy (nextrow - bpp, thisrow - bpp, exrowsize); + nlfiltRow (lastrow, thisrow, nextrow, dstbuf, width, bpp, filtno); + gimp_pixel_rgn_set_row (&dstPr, dstbuf, x1, y2 - 1, width); + + g_free (srcbuf); + g_free (dstbuf); + + if (preview) + { + gimp_drawable_preview_draw_region (GIMP_DRAWABLE_PREVIEW (preview), + &dstPr); + } + else + { + gimp_drawable_flush (drawable); + gimp_drawable_merge_shadow (drawable->drawable_id, TRUE); + gimp_drawable_update (drawable->drawable_id, x1, y1, width, height); + gimp_displays_flush (); + } +} + +static gboolean +nlfilter_dialog (GimpDrawable *drawable) +{ + GtkWidget *dialog; + GtkWidget *main_vbox; + GtkWidget *preview; + GtkWidget *frame; + GtkWidget *alpha_trim; + GtkWidget *opt_est; + GtkWidget *edge_enhance; + GtkWidget *table; + GtkObject *adj; + gboolean run; + + gimp_ui_init ("nlfilt", TRUE); + + dialog = gimp_dialog_new (_("NL Filter"), "nlfilt", + NULL, 0, + gimp_standard_help_func, "plug-in-nlfilt", + + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + + NULL); + + main_vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); + gtk_widget_show (main_vbox); + + preview = gimp_drawable_preview_new (drawable, &nlfvals.preview); + gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview); + gtk_widget_show (preview); + g_signal_connect_swapped (preview, "invalidated", + G_CALLBACK (nlfilter), + drawable); + + frame = gimp_int_radio_group_new (TRUE, _("Filter"), + G_CALLBACK (gimp_radio_button_update), + &nlfvals.filter, nlfvals.filter, + + _("_Alpha trimmed mean"), + filter_alpha_trim, &alpha_trim, + _("Op_timal estimation"), + filter_opt_est, &opt_est, + _("_Edge enhancement"), + filter_edge_enhance, &edge_enhance, + + NULL); + + gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + g_signal_connect_swapped (alpha_trim, "toggled", + G_CALLBACK (gimp_preview_invalidate), + preview); + g_signal_connect_swapped (opt_est, "toggled", + G_CALLBACK (gimp_preview_invalidate), + preview); + g_signal_connect_swapped (edge_enhance, "toggled", + G_CALLBACK (gimp_preview_invalidate), + preview); + + table = gtk_table_new (2, 3, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (table), 6); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0); + gtk_widget_show (table); + + adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, + _("A_lpha:"), 0, 0, + nlfvals.alpha, 0.0, 1.0, 0.05, 0.1, 2, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (adj, "value_changed", + G_CALLBACK (gimp_double_adjustment_update), + &nlfvals.alpha); + g_signal_connect_swapped (adj, "value_changed", + G_CALLBACK (gimp_preview_invalidate), + preview); + + adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, + _("_Radius:"), 0, 0, + nlfvals.radius, 1.0 / 3.0, 1.0, 0.05, 0.1, 2, + TRUE, 0, 0, + NULL, NULL); + g_signal_connect (adj, "value_changed", + G_CALLBACK (gimp_double_adjustment_update), + &nlfvals.radius); + g_signal_connect_swapped (adj, "value_changed", + G_CALLBACK (gimp_preview_invalidate), + preview); + + gtk_widget_show (dialog); + + run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); + + gtk_widget_destroy (dialog); + + return run; +} diff --git a/plug-ins/common/nova.c b/plug-ins/common/nova.c index 1afe66b7d3..3147ad5880 100644 --- a/plug-ins/common/nova.c +++ b/plug-ins/common/nova.c @@ -263,7 +263,7 @@ run (const gchar *name, gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); - nova (drawable, 0); + nova (drawable, NULL); if (run_mode != GIMP_RUN_NONINTERACTIVE) gimp_displays_flush (); diff --git a/plug-ins/common/pcx.c b/plug-ins/common/pcx.c index f23c4cce05..b6efe1766f 100644 --- a/plug-ins/common/pcx.c +++ b/plug-ins/common/pcx.c @@ -530,7 +530,7 @@ save_image (const gchar *filename, GimpPixelRgn pixel_rgn; GimpDrawable *drawable; GimpImageType drawable_type; - guchar *cmap= 0, *pixels; + guchar *cmap= NULL, *pixels; gint offset_x, offset_y, width, height; gchar *message; int colors, i; diff --git a/plug-ins/common/pnm.c b/plug-ins/common/pnm.c index 0f50759f27..db11f351ae 100644 --- a/plug-ins/common/pnm.c +++ b/plug-ins/common/pnm.c @@ -955,7 +955,7 @@ pnmscanner_create (gint fd) s = g_new (PNMScanner, 1); s->fd = fd; - s->inbuf = 0; + s->inbuf = NULL; s->eof = !read(s->fd, &(s->cur), 1); return(s); } diff --git a/plug-ins/common/psd_save.c b/plug-ins/common/psd_save.c index 8ae6cad777..e2cdacefbd 100644 --- a/plug-ins/common/psd_save.c +++ b/plug-ins/common/psd_save.c @@ -159,7 +159,7 @@ MAIN() static void -query () +query (void) { static GimpParamDef save_args[] = { diff --git a/plug-ins/common/randomize.c b/plug-ins/common/randomize.c index d901b4e7b1..54d70d0b94 100644 --- a/plug-ins/common/randomize.c +++ b/plug-ins/common/randomize.c @@ -295,7 +295,7 @@ run (const gchar *name, GimpDrawable *drawable; GimpRunMode run_mode; GimpPDBStatusType status = GIMP_PDB_SUCCESS; /* assume the best! */ - gchar *rndm_type_str = '\0'; + gchar *rndm_type_str = ""; gchar prog_label[32]; static GimpParam values[1]; GRand *gr; /* The GRand object which generates the diff --git a/plug-ins/common/retinex.c b/plug-ins/common/retinex.c index 88d0b5abd0..35a7e9c5a6 100644 --- a/plug-ins/common/retinex.c +++ b/plug-ins/common/retinex.c @@ -640,7 +640,7 @@ MSRCR (guchar *src, gint width, gint height, gint bytes, gboolean preview_mode) gfloat alpha; gfloat gain; gfloat offset; - gdouble max_preview; + gdouble max_preview = 0.0; if (!preview_mode) { diff --git a/plug-ins/common/screenshot.c b/plug-ins/common/screenshot.c index 0112a1b990..e3d84d63c0 100644 --- a/plug-ins/common/screenshot.c +++ b/plug-ins/common/screenshot.c @@ -318,7 +318,7 @@ run (const gchar *name, else status = GIMP_PDB_CALLING_ERROR; - if (!gdk_init_check (0, NULL)) + if (!gdk_init_check (NULL, NULL)) status = GIMP_PDB_CALLING_ERROR; break; diff --git a/plug-ins/common/sel_gauss.c b/plug-ins/common/sel_gauss.c index 8584cdc916..8cf08d7725 100644 --- a/plug-ins/common/sel_gauss.c +++ b/plug-ins/common/sel_gauss.c @@ -266,7 +266,7 @@ sel_gauss_dialog (GimpDrawable *drawable) _("_Max. delta:"), 128, 0, bvals.maxdelta, 0, 255, 1, 8, 0, TRUE, 0, 0, - FALSE, FALSE); + NULL, NULL); g_signal_connect (adj, "value_changed", G_CALLBACK (gimp_int_adjustment_update), &bvals.maxdelta); diff --git a/plug-ins/common/spheredesigner.c b/plug-ins/common/spheredesigner.c index 3ca6ae95c8..23ffa76505 100644 --- a/plug-ins/common/spheredesigner.c +++ b/plug-ins/common/spheredesigner.c @@ -2997,7 +2997,7 @@ sphere_main (GimpDrawable *drawable) makewindow (); if (!s.com.numtexture) - sphere_response (NULL, RESPONSE_RESET, 0); + sphere_response (NULL, RESPONSE_RESET, NULL); rebuildlist (); diff --git a/plug-ins/common/unsharp.c b/plug-ins/common/unsharp.c index 1abd32746d..acfc9c9516 100644 --- a/plug-ins/common/unsharp.c +++ b/plug-ins/common/unsharp.c @@ -248,6 +248,123 @@ run (const gchar *name, #endif } +/* this function is written as if it is blurring a column at a time, + even though it can operate on rows, too. There is no difference + in the processing of the lines, at least to the blur_line function. + */ +static inline void +blur_line (gdouble *ctable, + gdouble *cmatrix, + gint cmatrix_length, + guchar *cur_col, + guchar *dest_col, + gint y, + glong bytes) +{ + gdouble scale; + gdouble sum; + gint i = 0; + gint j = 0; + gint row; + gint cmatrix_middle = cmatrix_length / 2; + + gdouble *cmatrix_p; + guchar *cur_col_p; + guchar *cur_col_p1; + guchar *dest_col_p; + gdouble *ctable_p; + + /* this first block is the same as the non-optimized version -- + * it is only used for very small pictures, so speed isn't a + * big concern. + */ + if (cmatrix_length > y) + { + for (row = 0; row < y ; row++) + { + scale=0; + /* find the scale factor */ + for (j = 0; j < y ; j++) + { + /* if the index is in bounds, add it to the scale counter */ + if ((j + cmatrix_length/2 - row >= 0) && + (j + cmatrix_length/2 - row < cmatrix_length)) + scale += cmatrix[j + cmatrix_length/2 - row]; + } + for (i = 0; i= row - cmatrix_length/2) && + (j <= row + cmatrix_length/2)) + sum += cur_col[j*bytes + i] * cmatrix[j]; + } + dest_col[row*bytes + i] = (guchar) ROUND (sum / scale); + } + } + } + else + { + /* for the edge condition, we only use available info and scale to one */ + for (row = 0; row < cmatrix_middle; row++) + { + /* find scale factor */ + scale=0; + for (j = cmatrix_middle - row; j0; j--) + { + sum += *(ctable_p + *cur_col_p1); + cur_col_p1 += bytes; + ctable_p += 256; + } + cur_col_p++; + *(dest_col_p++) = ROUND (sum); + } + } + + /* for the edge condition , we only use available info, and scale to one */ + for (; row < y; row++) + { + /* find scale factor */ + scale=0; + for (j = 0; j< y-row + cmatrix_middle; j++) + scale += cmatrix[j]; + for (i = 0; i y) - { - for (row = 0; row < y ; row++) - { - scale=0; - /* find the scale factor */ - for (j = 0; j < y ; j++) - { - /* if the index is in bounds, add it to the scale counter */ - if ((j + cmatrix_length/2 - row >= 0) && - (j + cmatrix_length/2 - row < cmatrix_length)) - scale += cmatrix[j + cmatrix_length/2 - row]; - } - for (i = 0; i= row - cmatrix_length/2) && - (j <= row + cmatrix_length/2)) - sum += cur_col[j*bytes + i] * cmatrix[j]; - } - dest_col[row*bytes + i] = (guchar) ROUND (sum / scale); - } - } - } - else - { - /* for the edge condition, we only use available info and scale to one */ - for (row = 0; row < cmatrix_middle; row++) - { - /* find scale factor */ - scale=0; - for (j = cmatrix_middle - row; j0; j--) - { - sum += *(ctable_p + *cur_col_p1); - cur_col_p1 += bytes; - ctable_p += 256; - } - cur_col_p++; - *(dest_col_p++) = ROUND (sum); - } - } - - /* for the edge condition , we only use available info, and scale to one */ - for (; row < y; row++) - { - /* find scale factor */ - scale=0; - for (j = 0; j< y-row + cmatrix_middle; j++) - scale += cmatrix[j]; - for (i = 0; ipreview); diff --git a/plug-ins/gfig/gfig-dobject.c b/plug-ins/gfig/gfig-dobject.c index 113637aab8..16b264d0da 100644 --- a/plug-ins/gfig/gfig-dobject.c +++ b/plug-ins/gfig/gfig-dobject.c @@ -200,7 +200,7 @@ d_new_object (DobjType type, } void -gfig_init_object_classes () +gfig_init_object_classes (void) { d_arc_object_class_init (); d_line_object_class_init (); @@ -459,7 +459,7 @@ object_operation_end (GdkPoint *pnt, if (move_all_pnt) { g_free (move_all_pnt); - move_all_pnt = 0; + move_all_pnt = NULL; } /* Special case - if copying mode MUST be copy when button up received */ @@ -1002,7 +1002,7 @@ get_line (gchar *buf, gint init) { gint slen; - char * ret; + char *ret; if (init) line_no = 1; @@ -1012,7 +1012,8 @@ get_line (gchar *buf, do { ret = fgets (buf, s, from); - } while (!ferror (from) && buf[0] == '#'); + } + while (!ferror (from) && buf[0] == '#'); slen = strlen (buf); @@ -1023,14 +1024,14 @@ get_line (gchar *buf, if (ferror (from)) { g_warning (_("Error reading file")); - return (0); + return NULL; } #ifdef DEBUG printf ("Processing line '%s'\n", buf); #endif /* DEBUG */ - return (ret); + return ret; } void diff --git a/plug-ins/gfig/gfig-ellipse.c b/plug-ins/gfig/gfig-ellipse.c index 4b4a9f1d68..39b43114dc 100644 --- a/plug-ins/gfig/gfig-ellipse.c +++ b/plug-ins/gfig/gfig-ellipse.c @@ -283,7 +283,7 @@ d_copy_ellipse (Dobject * obj) } void -d_ellipse_object_class_init () +d_ellipse_object_class_init (void) { DobjClass *class = &dobj_class[ELLIPSE]; diff --git a/plug-ins/gfig/gfig-line.c b/plug-ins/gfig/gfig-line.c index 0f3c69b00b..bf5559959d 100644 --- a/plug-ins/gfig/gfig-line.c +++ b/plug-ins/gfig/gfig-line.c @@ -134,7 +134,7 @@ d_paint_line (Dobject *obj) */ void -d_line_object_class_init () +d_line_object_class_init (void) { DobjClass *class = &dobj_class[LINE]; diff --git a/plug-ins/gfig/gfig-poly.c b/plug-ins/gfig/gfig-poly.c index 5ca85cad7a..38a38899a4 100644 --- a/plug-ins/gfig/gfig-poly.c +++ b/plug-ins/gfig/gfig-poly.c @@ -478,7 +478,7 @@ d_copy_poly (Dobject *obj) } void -d_poly_object_class_init () +d_poly_object_class_init (void) { DobjClass *class = &dobj_class[POLY]; diff --git a/plug-ins/gfig/gfig-spiral.c b/plug-ins/gfig/gfig-spiral.c index c8f0fc471e..078216fdba 100644 --- a/plug-ins/gfig/gfig-spiral.c +++ b/plug-ins/gfig/gfig-spiral.c @@ -276,7 +276,7 @@ d_copy_spiral (Dobject *obj) } void -d_spiral_object_class_init () +d_spiral_object_class_init (void) { DobjClass *class = &dobj_class[SPIRAL]; diff --git a/plug-ins/gfig/gfig-star.c b/plug-ins/gfig/gfig-star.c index d69f5e87f6..5fcde1b577 100644 --- a/plug-ins/gfig/gfig-star.c +++ b/plug-ins/gfig/gfig-star.c @@ -319,7 +319,7 @@ d_copy_star (Dobject *obj) } void -d_star_object_class_init () +d_star_object_class_init (void) { DobjClass *class = &dobj_class[STAR]; diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 4178bddbe0..972afb6aeb 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -656,7 +656,7 @@ load_options (GFigObj *gfig, } GString * -gfig_save_as_string () +gfig_save_as_string (void) { DAllObjs *objs; gint count = 0; @@ -698,7 +698,7 @@ gfig_save_as_string () gboolean -gfig_save_as_parasite () +gfig_save_as_parasite (void) { GimpParasite *parasite; GString *string; @@ -730,7 +730,7 @@ gfig_save_as_parasite () } GFigObj * -gfig_load_from_parasite () +gfig_load_from_parasite (void) { FILE *fp; gchar *fname; diff --git a/plug-ins/gimpressionist/gimpressionist.c b/plug-ins/gimpressionist/gimpressionist.c index fe01f4c539..f84990887b 100644 --- a/plug-ins/gimpressionist/gimpressionist.c +++ b/plug-ins/gimpressionist/gimpressionist.c @@ -232,7 +232,7 @@ create_dialog (void) create_colorpage (GTK_NOTEBOOK (notebook)); create_generalpage (GTK_NOTEBOOK (notebook)); - updatepreview (NULL, 0); + updatepreview (NULL, NULL); /* * This is to make sure the values from the pcvals will be reflected diff --git a/plug-ins/gimpressionist/orientmap.c b/plug-ins/gimpressionist/orientmap.c index ad2cee6c69..95070fd2df 100644 --- a/plug-ins/gimpressionist/orientmap.c +++ b/plug-ins/gimpressionist/orientmap.c @@ -256,7 +256,7 @@ update_vector_prev (void) } void -orientation_map_free_resources () +orientation_map_free_resources (void) { ppm_kill (&update_om_preview_nbuffer); ppm_kill (&update_vector_preview_backup); diff --git a/plug-ins/gimpressionist/placement.c b/plug-ins/gimpressionist/placement.c index c56361c28e..4f385e2f54 100644 --- a/plug-ins/gimpressionist/placement.c +++ b/plug-ins/gimpressionist/placement.c @@ -18,7 +18,7 @@ static GtkWidget *placement_center = NULL; static GtkObject *brush_density_adjust = NULL; void -place_restore () +place_restore (void) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (placement_radio[pcvals.place_type]), TRUE); @@ -35,7 +35,7 @@ place_type_input (int in) } void -place_store () +place_store (void) { pcvals.placement_center = GTK_TOGGLE_BUTTON (placement_center)->active; } diff --git a/plug-ins/gimpressionist/sizemap.c b/plug-ins/gimpressionist/sizemap.c index 5aa2b3853d..206899b74b 100644 --- a/plug-ins/gimpressionist/sizemap.c +++ b/plug-ins/gimpressionist/sizemap.c @@ -152,7 +152,7 @@ updatesmvectorprev (void) } void -size_map_free_resources () +size_map_free_resources (void) { ppm_kill (&update_vector_preview_backup); ppm_kill (&update_vector_preview_sbuffer); diff --git a/plug-ins/ifscompose/ifscompose.c b/plug-ins/ifscompose/ifscompose.c index d45cf84729..98b3a9cb88 100644 --- a/plug-ins/ifscompose/ifscompose.c +++ b/plug-ins/ifscompose/ifscompose.c @@ -1897,7 +1897,7 @@ undo_exchange (gint el) if (!elements[i]) { elements[i] = undo_ring[el].elements[i]; - undo_ring[el].elements[i] = 0; + undo_ring[el].elements[i] = NULL; } else aff_element_compute_trans (elements[i],width, height, diff --git a/plug-ins/imagemap/imap_grid.c b/plug-ins/imagemap/imap_grid.c index 481a52bebf..7903e597fe 100644 --- a/plug-ins/imagemap/imap_grid.c +++ b/plug-ins/imagemap/imap_grid.c @@ -188,7 +188,7 @@ top_changed_cb(GtkWidget *widget, gpointer data) } static GridDialog_t* -create_grid_settings_dialog() +create_grid_settings_dialog(void) { GridDialog_t *data = g_new(GridDialog_t, 1); DefaultDialog_t *dialog; diff --git a/plug-ins/imagemap/imap_main.c b/plug-ins/imagemap/imap_main.c index e80c685836..2279417a14 100644 --- a/plug-ins/imagemap/imap_main.c +++ b/plug-ins/imagemap/imap_main.c @@ -109,7 +109,7 @@ static int run_flag = 0; MAIN () -static void query() +static void query(void) { static GimpParamDef args[] = { {GIMP_PDB_INT32, "run_mode", "Interactive"}, diff --git a/plug-ins/imagemap/imap_preferences.c b/plug-ins/imagemap/imap_preferences.c index aac409e0dd..96da64a637 100644 --- a/plug-ins/imagemap/imap_preferences.c +++ b/plug-ins/imagemap/imap_preferences.c @@ -551,7 +551,7 @@ switch_page(GtkWidget *widget, GtkNotebookPage *page, gint page_num, } static PreferencesDialog_t* -create_preferences_dialog() +create_preferences_dialog(void) { PreferencesDialog_t *data = g_new(PreferencesDialog_t, 1); DefaultDialog_t *dialog; diff --git a/plug-ins/imagemap/imap_settings.c b/plug-ins/imagemap/imap_settings.c index 5c198dc432..51ed9e81dc 100644 --- a/plug-ins/imagemap/imap_settings.c +++ b/plug-ins/imagemap/imap_settings.c @@ -81,7 +81,7 @@ type_toggled_cb(GtkWidget *widget, gpointer data) } static SettingsDialog_t* -create_settings_dialog() +create_settings_dialog(void) { SettingsDialog_t *data = g_new(SettingsDialog_t, 1); GtkWidget *table, *view, *frame, *hbox, *label, *swin; diff --git a/plug-ins/maze/maze.c b/plug-ins/maze/maze.c index efbe7909ff..ec97348bbd 100644 --- a/plug-ins/maze/maze.c +++ b/plug-ins/maze/maze.c @@ -134,7 +134,7 @@ MAIN () static void -query () +query (void) { static GimpParamDef args[] = { diff --git a/plug-ins/print/gimp_main_window.c b/plug-ins/print/gimp_main_window.c index f9d4a1d634..64d81bb997 100644 --- a/plug-ins/print/gimp_main_window.c +++ b/plug-ins/print/gimp_main_window.c @@ -262,7 +262,7 @@ Combo_get_name(GtkWidget *combo, return NULL; } -static stp_param_t *printer_list = 0; +static stp_param_t *printer_list = NULL; static int printer_count = 0; static void diff --git a/plug-ins/print/print.c b/plug-ins/print/print.c index 4d388d74ca..dd0b173c2a 100644 --- a/plug-ins/print/print.c +++ b/plug-ins/print/print.c @@ -78,7 +78,7 @@ gp_plist_t *plist; /* System printers */ int saveme = FALSE; /* True if print should proceed */ int runme = FALSE; /* True if print should proceed */ -stp_printer_t current_printer = 0; /* Current printer index */ +stp_printer_t current_printer = NULL; /* Current printer index */ gint32 image_ID; /* image ID */ gchar *image_name; @@ -756,7 +756,7 @@ printrc_load (void) gp_plist_t key; /* Search key */ gint format = 0; /* rc file format version */ gint system_printers; /* printer count before reading printrc */ - gchar * current_printer = 0; /* printer to select */ + gchar * current_printer = NULL; /* printer to select */ check_plist(1); diff --git a/plug-ins/sel2path/curve.c b/plug-ins/sel2path/curve.c index c569419235..ad4b2052c4 100644 --- a/plug-ins/sel2path/curve.c +++ b/plug-ins/sel2path/curve.c @@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Return an entirely empty curve. */ curve_type -new_curve () +new_curve (void) { curve_type curve = g_new (struct curve, 1); @@ -103,7 +103,7 @@ append_point (curve_type curve, real_coordinate_type coord) /* Return an initialized but empty curve list. */ curve_list_type -new_curve_list () +new_curve_list (void) { curve_list_type curve_list; @@ -144,7 +144,7 @@ append_curve (curve_list_type *curve_list, curve_type curve) /* Return an initialized but empty curve list array. */ curve_list_array_type -new_curve_list_array () +new_curve_list_array (void) { curve_list_array_type curve_list_array; diff --git a/plug-ins/sel2path/fit.c b/plug-ins/sel2path/fit.c index 9114500aab..e14bf69e87 100644 --- a/plug-ins/sel2path/fit.c +++ b/plug-ins/sel2path/fit.c @@ -1918,7 +1918,7 @@ align (spline_list_type *l) /* Lists of array indices (well, that is what we use it for). */ static index_list_type -new_index_list () +new_index_list (void) { index_list_type index_list; diff --git a/plug-ins/sel2path/pxl-outline.c b/plug-ins/sel2path/pxl-outline.c index c3d32745f9..9a58a3105f 100644 --- a/plug-ins/sel2path/pxl-outline.c +++ b/plug-ins/sel2path/pxl-outline.c @@ -70,7 +70,7 @@ local_free_bitmap (bitmap_type *b) find these outlines and put them in a list to return. */ pixel_outline_list_type -find_outline_pixels () +find_outline_pixels (void) { pixel_outline_list_type outline_list; unsigned row, col; @@ -193,7 +193,7 @@ free_pixel_outline_list (pixel_outline_list_type *outline_list) pixel_outline_type -new_pixel_outline () +new_pixel_outline (void) { pixel_outline_type pixel_outline; diff --git a/plug-ins/sel2path/spline.c b/plug-ins/sel2path/spline.c index 884770c212..70d3c29548 100644 --- a/plug-ins/sel2path/spline.c +++ b/plug-ins/sel2path/spline.c @@ -29,7 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ garbage. */ spline_type -new_spline () +new_spline (void) { real_coordinate_type coord = { -100.0, -100.0 }; spline_type spline; @@ -113,7 +113,7 @@ evaluate_spline (spline_type s, real t) /* Return a new, empty, spline list. */ spline_list_type * -new_spline_list () +new_spline_list (void) { spline_list_type *answer = g_new (spline_list_type, 1); @@ -189,7 +189,7 @@ concat_spline_lists (spline_list_type *s1, spline_list_type s2) /* Return a new, empty, spline list array. */ spline_list_array_type -new_spline_list_array () +new_spline_list_array (void) { spline_list_array_type answer; diff --git a/plug-ins/xjt/xjt.c b/plug-ins/xjt/xjt.c index 8ffcad5c29..fd18f55f9c 100644 --- a/plug-ins/xjt/xjt.c +++ b/plug-ins/xjt/xjt.c @@ -1912,7 +1912,7 @@ cleanup: * allocate new layer_properties element and init with default values * ============================================================================ */ -t_layer_props * p_new_layer_prop() +t_layer_props * p_new_layer_prop(void) { t_layer_props *l_new_prop; @@ -1945,7 +1945,7 @@ t_layer_props * p_new_layer_prop() * allocate new channel_properties element and init with default values * ============================================================================ */ -t_channel_props * p_new_channel_prop() +t_channel_props * p_new_channel_prop(void) { t_channel_props *l_new_prop; @@ -1975,7 +1975,7 @@ t_channel_props * p_new_channel_prop() * allocate new guide_properties element and init with default values * ============================================================================ */ -t_guide_props * p_new_guide_prop() +t_guide_props * p_new_guide_prop(void) { t_guide_props *l_new_prop; @@ -1991,7 +1991,7 @@ t_guide_props * p_new_guide_prop() * allocate new parasite_properties element and init with default values * ============================================================================ */ -t_parasite_props * p_new_parasite_prop() +t_parasite_props * p_new_parasite_prop(void) { t_parasite_props *l_new_prop; @@ -2010,7 +2010,7 @@ t_parasite_props * p_new_parasite_prop() * allocate new parasite_properties element and init with default values * ============================================================================ */ -t_path_props * p_new_path_prop() +t_path_props * p_new_path_prop(void) { t_path_props *l_new_prop; @@ -2032,7 +2032,7 @@ t_path_props * p_new_path_prop() * allocate new layer_properties element and init with default values * ============================================================================ */ -t_image_props * p_new_image_prop() +t_image_props * p_new_image_prop(void) { t_image_props *l_new_prop;