summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-10-19 11:45:12 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-10-24 22:42:07 +0800
commit62e557ec650006f2d3dd614f84804ed1b5cd4349 (patch)
tree369b8c0d95bb3235eaacd520cc6c7aba1d0f5568 /src
parent6f4cb23385f8818f4373c939f241f1a20596870a (diff)
downloadunity-window-decorator-62e557ec650006f2d3dd614f84804ed1b5cd4349.tar.gz
unity-window-decorator-62e557ec650006f2d3dd614f84804ed1b5cd4349.tar.bz2
core: general code cleanup (static analysis)
Diffstat (limited to 'src')
-rw-r--r--src/action.cpp3
-rw-r--r--src/option.cpp9
-rw-r--r--src/propertywriter.cpp5
-rw-r--r--src/screen.cpp4
-rw-r--r--src/window.cpp10
5 files changed, 21 insertions, 10 deletions
diff --git a/src/action.cpp b/src/action.cpp
index f487ec9..ab8cfb5 100644
--- a/src/action.cpp
+++ b/src/action.cpp
@@ -484,6 +484,9 @@ CompAction::operator== (const CompAction& val)
CompAction &
CompAction::operator= (const CompAction &action)
{
+ if (this == &action)
+ return *this;
+
delete priv;
priv = new PrivateAction (*action.priv);
diff --git a/src/option.cpp b/src/option.cpp
index 1fb69f0..2de2f9e 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -409,6 +409,9 @@ CompOption::Value::operator!= (const CompOption::Value &val)
CompOption::Value &
CompOption::Value::operator= (const CompOption::Value &val)
{
+ if (this == &val)
+ return *this;
+
delete priv;
priv = new PrivateValue (*val.priv);
@@ -581,6 +584,9 @@ CompOption::Restriction::inRange (float f)
CompOption::Restriction &
CompOption::Restriction::operator= (const CompOption::Restriction &rest)
{
+ if (this == &rest)
+ return *this;
+
delete priv;
priv = new PrivateRestriction (*rest.priv);
return *this;
@@ -800,6 +806,9 @@ CompOption::isAction ()
CompOption &
CompOption::operator= (const CompOption &option)
{
+ if (this == &option)
+ return *this;
+
delete priv;
priv = new PrivateOption (*option.priv);
return *this;
diff --git a/src/propertywriter.cpp b/src/propertywriter.cpp
index 9c0eea4..44e7990 100644
--- a/src/propertywriter.cpp
+++ b/src/propertywriter.cpp
@@ -135,8 +135,7 @@ PropertyWriter::readProperty (Window id)
Atom type;
int retval, fmt;
unsigned long nitems, exbyte;
- long int *data;
- int count = 0;
+ long int *data;
if (mPropertyValues.empty ())
return mPropertyValues;
@@ -148,6 +147,8 @@ PropertyWriter::readProperty (Window id)
if (retval == Success && !mPropertyValues.empty ())
{
+ int count = 0;
+
if (type == XA_CARDINAL && fmt == 32 &&
nitems == mPropertyValues.size ())
{
diff --git a/src/screen.cpp b/src/screen.cpp
index d38e13f..4e5fc2e 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -4098,7 +4098,7 @@ CompScreen::init (const char *name)
Window rootReturn, parentReturn;
Window *children;
unsigned int nchildren;
- int defaultDepth, nvisinfo;
+ int nvisinfo;
XSetWindowAttributes attrib;
CompOption::Value::Vector vList;
@@ -4335,8 +4335,6 @@ CompScreen::init (const char *name)
return false;
}
- defaultDepth = visinfo->depth;
-
black.red = black.green = black.blue = 0;
if (!XAllocColor (dpy, priv->colormap, &black))
diff --git a/src/window.cpp b/src/window.cpp
index f04282e..6f58335 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -4103,7 +4103,6 @@ CompWindow::getIcon (int width,
for (i = 0; i + 2 < n; i += iw * ih + 2)
{
unsigned long *idata = (unsigned long *) data;
- unsigned long j;
iw = idata[i];
ih = idata[i + 1];
@@ -4116,6 +4115,7 @@ CompWindow::getIcon (int width,
if (iw && ih)
{
+ unsigned long j;
icon = new CompIcon (screen, iw, ih);
if (!icon)
continue;
@@ -5414,12 +5414,12 @@ CompWindow::mwmFunc ()
void
CompWindow::updateFrameRegion ()
{
- CompRect r;
- int x, y;
-
- if (priv->frame && priv->serverGeometry.width () == priv->geometry.width () &&
+ if (priv->frame && priv->serverGeometry.width () == priv->geometry.width () &&
priv->serverGeometry.height () == priv->geometry.height ())
{
+ CompRect r;
+ int x, y;
+
priv->frameRegion = CompRegion ();
updateFrameRegion (priv->frameRegion);