[dia] [scan-build] Dead initialization (harmless)
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [scan-build] Dead initialization (harmless)
- Date: Fri, 5 Sep 2014 15:48:46 +0000 (UTC)
commit 7fa16a4b01ad5f5f37cb8930772c5f634e947317
Author: Hans Breuer <hans breuer org>
Date: Fri Sep 5 14:40:59 2014 +0200
[scan-build] Dead initialization (harmless)
Value stored to 'extra' during its initialization is never read
File: /home/hb/from-git/dia/lib/prop_sdarray_widget.c
Line: 524
-> removed variable and it's initialization
Value stored to 'elem' during its initialization is never read
File: /home/hb/from-git/dia/objects/Misc/n_gon.c
Line: 191
-> use it a little below, rather than calculating the pointer once more
Value stored to 'otype' during its initialization is never read
File: /home/hb/from-git/dia/plug-ins/svg/svg-import.c
Line: 893
-> remove intialization
Value stored to 'renderer' during its initialization is never read
File: /home/hb/from-git/dia/plug-ins/wpg/wpg.c
Line: 772
-> move intialization into the code branch using the variable
Value stored to 'hBrOld' during its initialization is never read
File: /home/hb/from-git/dia/plug-ins/wmf/wmf.cpp
Line: 1177
-> remove all the assignments to hBrOld and it's declaration
Value stored to 'renderer' during its initialization is never read
File: /home/hb/from-git/dia/plug-ins/wmf/wmf.cpp
Line: 1064
-> move intialization into the code branch using the variable
Value stored to 'wmf_renderer' during its initialization is never read
File: /home/hb/from-git/dia/plug-ins/wmf/wmf.cpp
Line: 1232
-> move deinitialization into *_finalize from end_render()
lib/prop_sdarray_widget.c | 1 -
objects/Misc/n_gon.c | 2 +-
plug-ins/svg/svg-import.c | 2 +-
plug-ins/wmf/wmf.cpp | 33 +++++++++++++++++++--------------
plug-ins/wpg/wpg.c | 4 ++--
5 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/lib/prop_sdarray_widget.c b/lib/prop_sdarray_widget.c
index 86c1df8..14b686d 100644
--- a/lib/prop_sdarray_widget.c
+++ b/lib/prop_sdarray_widget.c
@@ -521,7 +521,6 @@ _arrayprop_get_widget (ArrayProperty *prop, PropDialog *dialog)
GtkTreeStore *model;
GtkWidget *view;
GtkWidget *branch_view = NULL;
- const PropDescCommonArrayExtra *extra = prop->common.descr->extra_data;
ArrayProperty *branch_prop = NULL;
/* create */
diff --git a/objects/Misc/n_gon.c b/objects/Misc/n_gon.c
index b016590..62cb37f 100644
--- a/objects/Misc/n_gon.c
+++ b/objects/Misc/n_gon.c
@@ -203,7 +203,7 @@ _ngon_move_handle (Ngon *ng, Handle *handle,
real d1 = distance_point_point (to, &ng->center);
ng->ray_len *= (d1 / d0);
/* not sure if this is useful at all, but we must not do it with our center_handle */
- change = element_move_handle(&ng->element, handle->id, to, cp, reason, modifiers);
+ change = element_move_handle(elem, handle->id, to, cp, reason, modifiers);
}
_ngon_update_data(ng);
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index 902aa60..fa0a9a3 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -890,7 +890,7 @@ read_poly_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
GHashTable *style_ht, GHashTable *pattern_ht,
GList *list, char *object_type)
{
- DiaObjectType *otype = object_get_type(object_type);
+ DiaObjectType *otype;
DiaObject *new_obj;
Handle *h1, *h2;
MultipointCreateData *pcd;
diff --git a/plug-ins/wmf/wmf.cpp b/plug-ins/wmf/wmf.cpp
index ef7f531..b811ebb 100644
--- a/plug-ins/wmf/wmf.cpp
+++ b/plug-ins/wmf/wmf.cpp
@@ -329,10 +329,6 @@ end_render(DiaRenderer *self)
if (hEmf)
W32::DeleteEnhMetaFile(hEmf);
- if (renderer->hFont)
- W32::DeleteObject(renderer->hFont);
- if (renderer->pango_context)
- g_object_unref (renderer->pango_context);
}
static gboolean
@@ -679,7 +675,7 @@ draw_polygon(DiaRenderer *self,
hPen = UsePen(renderer, stroke);
if (fill) {
hBrush = W32::CreateSolidBrush(rgb);
- hBrOld = (W32::HBRUSH)W32::SelectObject(renderer->hFileDC, hBrush);
+ W32::SelectObject(renderer->hFileDC, hBrush);
}
W32::Polygon(renderer->hFileDC, pts, num_points);
@@ -707,10 +703,10 @@ draw_rect(DiaRenderer *self,
ul_corner->x, ul_corner->y, lr_corner->x, lr_corner->y);
if (fill) {
- W32::HGDIOBJ hBrush, hBrOld;
+ W32::HGDIOBJ hBrush;
W32::COLORREF rgb = W32COLOR(fill);
hBrush = W32::CreateSolidBrush(rgb);
- hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
+ W32::SelectObject(renderer->hFileDC, hBrush);
W32::Rectangle (renderer->hFileDC,
SCX(ul_corner->x), SCY(ul_corner->y),
SCX(lr_corner->x), SCY(lr_corner->y));
@@ -777,7 +773,7 @@ fill_arc(DiaRenderer *self,
{
WmfRenderer *renderer = WMF_RENDERER (self);
W32::HPEN hPen;
- W32::HGDIOBJ hBrush, hBrOld;
+ W32::HGDIOBJ hBrush;
W32::POINT ptStart, ptEnd;
W32::COLORREF rgb = W32COLOR(colour);
@@ -798,7 +794,8 @@ fill_arc(DiaRenderer *self,
hPen = UsePen(renderer, NULL); /* no border */
hBrush = W32::CreateSolidBrush(rgb);
- hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
+
+ W32::SelectObject(renderer->hFileDC, hBrush);
W32::Pie(renderer->hFileDC,
SCX(center->x - width / 2), /* bbox corners */
@@ -821,7 +818,7 @@ draw_ellipse(DiaRenderer *self,
{
WmfRenderer *renderer = WMF_RENDERER (self);
W32::HPEN hPen;
- W32::HGDIOBJ hBrush, hBrOld;
+ W32::HGDIOBJ hBrush;
DIAG_NOTE(renderer, "draw_ellipse %fx%f @ %f,%f\n",
width, height, center->x, center->y);
@@ -829,7 +826,7 @@ draw_ellipse(DiaRenderer *self,
if (fill) {
W32::COLORREF rgb = W32COLOR(fill);
hBrush = W32::CreateSolidBrush(rgb);
- hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
+ W32::SelectObject(renderer->hFileDC, hBrush);
}
if (stroke)
hPen = UsePen(renderer, stroke);
@@ -1017,6 +1014,8 @@ draw_string(DiaRenderer *self,
}
/* work out size of first chunk of text */
len = strlen(text);
+ if (!len)
+ return; /* nothing to do */
hOld = W32::SelectObject(renderer->hFileDC, renderer->hFont);
{
@@ -1061,10 +1060,10 @@ draw_image(DiaRenderer *self,
real width, real height,
DiaImage *image)
{
- WmfRenderer *renderer = WMF_RENDERER (self);
#ifdef DIRECT_WMF
/* not yet supported in compatibility mode */
#else
+ WmfRenderer *renderer = WMF_RENDERER (self);
W32::HBITMAP hBmp;
int iWidth, iHeight;
unsigned char* pData = NULL;
@@ -1174,7 +1173,8 @@ draw_rounded_rect (DiaRenderer *self,
if (fill) {
W32::COLORREF rgb = W32COLOR(fill);
W32::HGDIOBJ hBrush = W32::CreateSolidBrush(rgb);
- W32::HGDIOBJ hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
+
+ W32::SelectObject(renderer->hFileDC, hBrush);
W32::RoundRect (renderer->hFileDC,
SCX(ul_corner->x), SCY(ul_corner->y),
@@ -1229,7 +1229,12 @@ wmf_renderer_get_type (void)
static void
wmf_renderer_finalize (GObject *object)
{
- WmfRenderer *wmf_renderer = WMF_RENDERER (object);
+ WmfRenderer *renderer = WMF_RENDERER (object);
+
+ if (renderer->hFont)
+ W32::DeleteObject(renderer->hFont);
+ if (renderer->pango_context)
+ g_object_unref (renderer->pango_context);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
diff --git a/plug-ins/wpg/wpg.c b/plug-ins/wpg/wpg.c
index 8389426..826507d 100644
--- a/plug-ins/wpg/wpg.c
+++ b/plug-ins/wpg/wpg.c
@@ -769,8 +769,6 @@ draw_beziergon (DiaRenderer *self,
Color *fill,
Color *stroke)
{
- WpgRenderer *renderer = WPG_RENDERER (self);
-
DIAG_NOTE(g_message("draw_beziezgon %d points", numpoints));
#if 1
@@ -782,6 +780,8 @@ draw_beziergon (DiaRenderer *self,
DIA_RENDERER_CLASS(parent_class)->draw_beziergon (self, points, numpoints, fill, NULL);
#else
if (fill) {
+ WpgRenderer *renderer = WPG_RENDERER (self);
+
WriteFillAttr(renderer, fill, TRUE);
draw_bezier (self, points, numpoints, fill);
WriteFillAttr(renderer, fill, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]