Skip to content

Instantly share code, notes, and snippets.

@scriptum
Created February 8, 2014 18:12
Show Gist options
  • Save scriptum/8887716 to your computer and use it in GitHub Desktop.
Save scriptum/8887716 to your computer and use it in GitHub Desktop.
cppcheck-gimp-1
void
gimp_context_get_foreground (GimpContext *context,
GimpRGB *color)
{
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (color != NULL);
*color = context->foreground;
}
...
gboolean
gimp_drawable_bucket_fill (GimpDrawable *drawable,
GimpContext *context,
GimpBucketFillMode fill_mode,
gint paint_mode,
gdouble opacity,
gboolean fill_transparent,
GimpSelectCriterion fill_criterion,
gdouble threshold,
gboolean sample_merged,
gdouble x,
gdouble y,
GError **error)
{
GimpRGB color;
GimpPattern *pattern = NULL;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (fill_mode == GIMP_FG_BUCKET_FILL)
{
gimp_context_get_foreground (context, &color);
}
else if (fill_mode == GIMP_BG_BUCKET_FILL)
{
gimp_context_get_background (context, &color);
}
else if (fill_mode == GIMP_PATTERN_BUCKET_FILL)
{
pattern = gimp_context_get_pattern (context);
if (! pattern)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("No patterns available for this operation."));
return FALSE;
}
}
else
{
g_warning ("%s: invalid fill_mode passed", G_STRFUNC);
return FALSE;
}
// Uninitialized variable: color
gimp_drawable_bucket_fill_internal (drawable,
fill_mode,
paint_mode, opacity,
fill_transparent, fill_criterion,
threshold, sample_merged,
x, y,
&color, pattern);
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment