summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-05-12 11:16:29 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-05-12 11:16:29 +0000
commitadc17549c5f0485a30a87e7674c7779ef3155d6c (patch)
tree5d7600ee04a17673e9af977637c4cd89fe5e4938 /src/widgets
parentFix for externally reported patch by Juergen Weigert, Bug #993500 (inkscape s... (diff)
downloadinkscape-adc17549c5f0485a30a87e7674c7779ef3155d6c.tar.gz
inkscape-adc17549c5f0485a30a87e7674c7779ef3155d6c.zip
syntx of null pointer dereference checks
(bzr r11358)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/gradient-vector.cpp20
-rw-r--r--src/widgets/sp-color-icc-selector.cpp88
2 files changed, 56 insertions, 52 deletions
diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp
index 8348f7045..60436c404 100644
--- a/src/widgets/gradient-vector.cpp
+++ b/src/widgets/gradient-vector.cpp
@@ -109,13 +109,13 @@ static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass
parent_class = static_cast<GtkVBoxClass*>(g_type_class_peek_parent(klass));
signals[VECTOR_SET] = g_signal_new( "vector_set",
- G_TYPE_FROM_CLASS(object_class),
- G_SIGNAL_RUN_LAST,
+ G_TYPE_FROM_CLASS(object_class),
+ G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(SPGradientVectorSelectorClass, vector_set),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
object_class->destroy = sp_gradient_vector_selector_destroy;
}
@@ -605,7 +605,7 @@ static void sp_grad_edit_combo_box_changed (GtkComboBox * /*widget*/, GtkWidget
blocked = TRUE;
- SPColorSelector *csel = (SPColorSelector*)g_object_get_data(G_OBJECT(tbl), "cselector");
+ SPColorSelector *csel = static_cast<SPColorSelector*>(g_object_get_data(G_OBJECT(tbl), "cselector"));
// set its color, from the stored array
csel->base->setColorAlpha( stop->getEffectiveColor(), stop->opacity );
GtkWidget *offspin = GTK_WIDGET(g_object_get_data(G_OBJECT(tbl), "offspn"));
@@ -1137,10 +1137,10 @@ static void sp_gradient_vector_widget_destroy(GtkObject *object, gpointer /*data
release_connection->disconnect();
modified_connection->disconnect();
sp_signal_disconnect_by_data(gradient, object);
- }
- if (gradient && gradient->getRepr()) {
- sp_repr_remove_listener_by_data(gradient->getRepr(), object);
+ if (gradient->getRepr()) {
+ sp_repr_remove_listener_by_data(gradient->getRepr(), object);
+ }
}
}
diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp
index 844ba0020..0c40eff66 100644
--- a/src/widgets/sp-color-icc-selector.cpp
+++ b/src/widgets/sp-color-icc-selector.cpp
@@ -447,7 +447,7 @@ sp_color_icc_selector_new (void)
{
SPColorICCSelector *csel;
- csel = (SPColorICCSelector*)g_object_new (SP_TYPE_COLOR_ICC_SELECTOR, NULL);
+ csel = static_cast<SPColorICCSelector*>(g_object_new (SP_TYPE_COLOR_ICC_SELECTOR, NULL));
return GTK_WIDGET (csel);
}
@@ -653,30 +653,32 @@ void ColorICCSelector::_colorChanged()
_fixupNeeded = 0;
gtk_widget_set_sensitive( _fixupBtn, FALSE );
- if ( _prof && _prof->getTransfToSRGB8() ) {
- cmsUInt16Number tmp[4];
- for ( guint i = 0; i < _profChannelCount; i++ ) {
- gdouble val = 0.0;
- if ( _color.icc->colors.size() > i ) {
- if ( _fooScales[i] == 256 ) {
- val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_fooScales[i]);
- } else {
- val = _color.icc->colors[i] / static_cast<gdouble>(_fooScales[i]);
+ if (_prof) {
+ if (_prof->getTransfToSRGB8() ) {
+ cmsUInt16Number tmp[4];
+ for ( guint i = 0; i < _profChannelCount; i++ ) {
+ gdouble val = 0.0;
+ if ( _color.icc->colors.size() > i ) {
+ if ( _fooScales[i] == 256 ) {
+ val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_fooScales[i]);
+ } else {
+ val = _color.icc->colors[i] / static_cast<gdouble>(_fooScales[i]);
+ }
}
+ tmp[i] = val * 0x0ffff;
}
- tmp[i] = val * 0x0ffff;
- }
- guchar post[4] = {0,0,0,0};
- cmsHTRANSFORM trans = _prof->getTransfToSRGB8();
- if ( trans ) {
- cmsDoTransform( trans, tmp, post, 1 );
- guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 );
- if ( other != _color.toRGBA32(255) ) {
- _fixupNeeded = other;
- gtk_widget_set_sensitive( _fixupBtn, TRUE );
+ guchar post[4] = {0,0,0,0};
+ cmsHTRANSFORM trans = _prof->getTransfToSRGB8();
+ if ( trans ) {
+ cmsDoTransform( trans, tmp, post, 1 );
+ guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 );
+ if ( other != _color.toRGBA32(255) ) {
+ _fixupNeeded = other;
+ gtk_widget_set_sensitive( _fixupBtn, TRUE );
#ifdef DEBUG_LCMS
- g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 );
+ g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 );
#endif // DEBUG_LCMS
+ }
}
}
}
@@ -790,30 +792,32 @@ void ColorICCSelector::_updateSliders( gint ignore )
gtk_adjustment_set_value( _fooAdj[i], val );
}
- if ( _prof && _prof->getTransfToSRGB8() ) {
- for ( guint i = 0; i < _profChannelCount; i++ ) {
- if ( static_cast<gint>(i) != ignore ) {
- cmsUInt16Number* scratch = getScratch();
- cmsUInt16Number filler[4] = {0, 0, 0, 0};
- for ( guint j = 0; j < _profChannelCount; j++ ) {
- filler[j] = 0x0ffff * ColorScales::getScaled( _fooAdj[j] );
- }
-
- cmsUInt16Number* p = scratch;
- for ( guint x = 0; x < 1024; x++ ) {
+ if ( _prof) {
+ if (_prof->getTransfToSRGB8() ) {
+ for ( guint i = 0; i < _profChannelCount; i++ ) {
+ if ( static_cast<gint>(i) != ignore ) {
+ cmsUInt16Number* scratch = getScratch();
+ cmsUInt16Number filler[4] = {0, 0, 0, 0};
for ( guint j = 0; j < _profChannelCount; j++ ) {
- if ( j == i ) {
- *p++ = x * 0x0ffff / 1024;
- } else {
- *p++ = filler[j];
+ filler[j] = 0x0ffff * ColorScales::getScaled( _fooAdj[j] );
+ }
+
+ cmsUInt16Number* p = scratch;
+ for ( guint x = 0; x < 1024; x++ ) {
+ for ( guint j = 0; j < _profChannelCount; j++ ) {
+ if ( j == i ) {
+ *p++ = x * 0x0ffff / 1024;
+ } else {
+ *p++ = filler[j];
+ }
}
}
- }
-
- cmsHTRANSFORM trans = _prof->getTransfToSRGB8();
- if ( trans ) {
- cmsDoTransform( trans, scratch, _fooMap[i], 1024 );
- sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] );
+
+ cmsHTRANSFORM trans = _prof->getTransfToSRGB8();
+ if ( trans ) {
+ cmsDoTransform( trans, scratch, _fooMap[i], 1024 );
+ sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] );
+ }
}
}
}