From 8b6943ab1c3862d217e89e1c91582c905c71fbd0 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 15 Apr 2011 21:35:51 +0200 Subject: Fix a couple of "comparison between signed and unsigned" warnings --- src/tests/testRectangleUtil.cc | 12 +++++------- src/tests/texturetest.cc | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/tests/testRectangleUtil.cc b/src/tests/testRectangleUtil.cc index 2da2a4e..455f124 100644 --- a/src/tests/testRectangleUtil.cc +++ b/src/tests/testRectangleUtil.cc @@ -35,12 +35,11 @@ int test_insideBorder() { { { 0, 0, 10, 10 }, 20, 20, 2, false } // outside for sure }; - int i; - for (i = 0; i < sizeof(tests)/sizeof(_t); ++i) { + for (unsigned int i = 0; i < sizeof(tests)/sizeof(_t); ++i) { const _t& t = tests[i]; int result = RectangleUtil::insideBorder(t.rect, t.x, t.y, t.bw); - printf(" %d: is (%02d|%02d) inside [%d %d]-[%d %d] with border %d: %s, %s\n", + printf(" %u: is (%02d|%02d) inside [%d %d]-[%d %d] with border %d: %s, %s\n", i, t.x, t.y, t.rect.x(), t.rect.y(), @@ -66,11 +65,11 @@ int test_overlapRectangles() { }; struct _test { - bool operator()(const Rect& a, const Rect& b, int truth, int i) { + bool operator()(const Rect& a, const Rect& b, int truth, unsigned int i) { int result = RectangleUtil::overlapRectangles(a, b); - printf(" %d: [%2d %2d]-[%2d %2d] %s [%2d %2d]-[%2d %2d]: %s\n", + printf(" %u: [%2d %2d]-[%2d %2d] %s [%2d %2d]-[%2d %2d]: %s\n", i, a.x(), a.y(), a.x() + (int)a.width(), @@ -100,8 +99,7 @@ int test_overlapRectangles() { _test test; - int i; - for (i = 0; i < sizeof(tests)/sizeof(_t); ++i) { + for (unsigned int i = 0; i < sizeof(tests)/sizeof(_t); ++i) { test(tests[i].a, tests[i].b, tests[i].truth, i); test(tests[i].b, tests[i].a, tests[i].truth, i); } diff --git a/src/tests/texturetest.cc b/src/tests/texturetest.cc index 93680c0..3736493 100644 --- a/src/tests/texturetest.cc +++ b/src/tests/texturetest.cc @@ -79,8 +79,8 @@ private: m_gc.setForeground(Color("black", screenNumber())); const int step_size = m_box_size + 5; - int next_x = 5; - int next_y = 5; + unsigned int next_x = 5; + unsigned int next_y = 5; TestTheme tm(screenNumber()); std::auto_ptr > text; -- cgit v0.11.2