summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2010-04-04 13:23:36 +0200
committerDanny Baumann <dannybaumann@web.de>2010-04-04 13:23:36 +0200
commitcf77c69a0498da863ac53b366c37e7eca07e10e8 (patch)
tree3f717b02e865978aac9db988dfa7aff356dcfbf4 /src
parent8b66ef0543fc8f3c3f8fa01ab19320b1b216cf1d (diff)
downloadzcomp-cf77c69a0498da863ac53b366c37e7eca07e10e8.tar.gz
zcomp-cf77c69a0498da863ac53b366c37e7eca07e10e8.tar.bz2
Avoid excessive casting.
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 19f36a0..6072f96 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -4064,14 +4064,14 @@ CompWindow::getIcon (int width,
if (result == Success && data)
{
- CARD32 *p;
- CARD32 alpha, red, green, blue;
- int iw, ih;
- unsigned long j;
+ CARD32 *p;
+ CARD32 alpha, red, green, blue;
+ unsigned long iw, ih;
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];
@@ -4079,10 +4079,7 @@ CompWindow::getIcon (int width,
/* iw * ih may be larger than the value range of unsigned
* long, so better do some checking for extremely weird
* icon sizes first */
- if ((unsigned int) iw > 2048 || (unsigned int)
- ih > 2048 || (unsigned int) iw *
- (unsigned int) ih + 2 > (unsigned int) n -
- (unsigned int) i)
+ if (iw > 2048 || ih > 2048 || iw * ih + 2 > n - i)
break;
if (iw && ih)
@@ -4098,8 +4095,7 @@ CompWindow::getIcon (int width,
/* EWMH doesn't say if icon data is premultiplied or
not but most applications seem to assume data should
be unpremultiplied. */
- for (j = 0; j < (unsigned int) iw *
- (unsigned int) ih; j++)
+ for (j = 0; j < iw * ih; j++)
{
alpha = (idata[i + j + 2] >> 24) & 0xff;
red = (idata[i + j + 2] >> 16) & 0xff;