Commit ed0261fe authored by Davis King's avatar Davis King

Changed code slightly to avoid a bunch of compiler warnings from gcc 4.3

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402638
parent e1a0626b
...@@ -254,8 +254,8 @@ namespace dlib ...@@ -254,8 +254,8 @@ namespace dlib
) )
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_CASSERT(nc_ > 0 && nr_ > 0 || DLIB_CASSERT((nc_ > 0 && nr_ > 0) ||
nc_ == 0 && nr_ == 0, (nc_ == 0 && nr_ == 0),
"\tvoid array2d::set_size(long nr_, long nc_)" "\tvoid array2d::set_size(long nr_, long nc_)"
<< "\n\tYou have to give a non zero nc and nr or just make both zero." << "\n\tYou have to give a non zero nc and nr or just make both zero."
<< "\n\tthis: " << this << "\n\tthis: " << this
......
...@@ -143,7 +143,7 @@ namespace dlib ...@@ -143,7 +143,7 @@ namespace dlib
} }
for (unsigned char i = 0; i < 64; ++i) for (unsigned char i = 0; i < 64; ++i)
{ {
decode_table[encode_table[i]] = i; decode_table[(unsigned char)encode_table[i]] = i;
} }
} }
......
...@@ -51,7 +51,7 @@ namespace dlib ...@@ -51,7 +51,7 @@ namespace dlib
r(static_cast<long>(w)-1), r(static_cast<long>(w)-1),
b(static_cast<long>(h)-1) b(static_cast<long>(h)-1)
{ {
DLIB_ASSERT(w > 0 && h > 0 || w == 0 && h == 0, DLIB_ASSERT((w > 0 && h > 0) || (w == 0 && h == 0),
"\trectangle(width,height)" "\trectangle(width,height)"
<< "\n\twidth and height must be > 0 or both == 0" << "\n\twidth and height must be > 0 or both == 0"
<< "\n\twidth: " << w << "\n\twidth: " << w
......
...@@ -380,9 +380,9 @@ namespace dlib ...@@ -380,9 +380,9 @@ namespace dlib
!*/ !*/
{ {
is_printable = true; is_printable = true;
if (keycode <= 'z' && keycode >= 'a' || if ((keycode <= 'z' && keycode >= 'a') ||
keycode <= 'Z' && keycode >= 'A' || (keycode <= 'Z' && keycode >= 'A') ||
keycode <= '9' && keycode >= '0') (keycode <= '9' && keycode >= '0'))
{ {
result = keycode; result = keycode;
} }
......
...@@ -2814,7 +2814,7 @@ namespace dlib ...@@ -2814,7 +2814,7 @@ namespace dlib
unsigned long height unsigned long height
) )
{ {
DLIB_ASSERT(width > 0 && height > 0 || width == 0 && height == 0, DLIB_ASSERT((width > 0 && height > 0) || (width == 0 && height == 0),
"\tvoid scrollable_region::set_total_rect_size(width,height)" "\tvoid scrollable_region::set_total_rect_size(width,height)"
<< "\n\twidth and height must be > 0 or both == 0" << "\n\twidth and height must be > 0 or both == 0"
<< "\n\twidth: " << width << "\n\twidth: " << width
......
...@@ -205,7 +205,7 @@ namespace dlib ...@@ -205,7 +205,7 @@ namespace dlib
for (long j = area.top(); j <= area.bottom(); ++j) for (long j = area.top(); j <= area.bottom(); ++j)
{ {
canvas::pixel& p = c[j - c.top()][i - c.left()]; canvas::pixel& p = c[j - c.top()][i - c.left()];
if (j&0x1 ^ i&0x1) if ((j&0x1) ^ (i&0x1))
{ {
assign_pixel(p,pixel1); assign_pixel(p,pixel1);
} }
......
...@@ -2314,7 +2314,7 @@ namespace dlib ...@@ -2314,7 +2314,7 @@ namespace dlib
if (display_rect().contains(x,y) && btn == base_window::LEFT && enabled && !hidden ) if (display_rect().contains(x,y) && btn == base_window::LEFT && enabled && !hidden )
{ {
if ( ms_enabled == false || if ( ms_enabled == false ||
(!(state&base_window::CONTROL)) && !(state&base_window::SHIFT)) ((!(state&base_window::CONTROL)) && !(state&base_window::SHIFT)))
{ {
items.reset(); items.reset();
while (items.move_next()) while (items.move_next())
......
...@@ -165,13 +165,13 @@ namespace ...@@ -165,13 +165,13 @@ namespace
{ {
for (unsigned long j = 0; j < a.node(i).number_of_neighbors(); ++j) for (unsigned long j = 0; j < a.node(i).number_of_neighbors(); ++j)
{ {
if (i == 0 && a.node(i).neighbor(j).index() == e2 || if ((i == 0 && a.node(i).neighbor(j).index() == e2) ||
i == e2 && a.node(i).neighbor(j).index() == 0 ) (i == e2 && a.node(i).neighbor(j).index() == 0) )
{ {
DLIB_CASSERT(a.node(i).edge(j) == 'n',""); DLIB_CASSERT(a.node(i).edge(j) == 'n',"");
} }
else if (i == 1 && a.node(i).neighbor(j).index() == e1 || else if ((i == 1 && a.node(i).neighbor(j).index() == e1) ||
i == e1 && a.node(i).neighbor(j).index() == 1) (i == e1 && a.node(i).neighbor(j).index() == 1))
{ {
DLIB_CASSERT(a.node(i).edge(j) == 'a',""); DLIB_CASSERT(a.node(i).edge(j) == 'a',"");
} }
...@@ -227,9 +227,9 @@ namespace ...@@ -227,9 +227,9 @@ namespace
for (unsigned long j = 0; j < a.number_of_nodes(); ++j) for (unsigned long j = 0; j < a.number_of_nodes(); ++j)
{ {
if (a.node(i).data == 1 && a.node(j).data == 1 || if ((a.node(i).data == 1 && a.node(j).data == 1) ||
a.node(i).data == 1 && a.node(j).data == 3 || (a.node(i).data == 1 && a.node(j).data == 3) ||
a.node(i).data == 3 && a.node(j).data == 1) (a.node(i).data == 3 && a.node(j).data == 1))
{ {
DLIB_CASSERT(a.has_edge(i,j) == true,""); DLIB_CASSERT(a.has_edge(i,j) == true,"");
++count; ++count;
......
...@@ -377,8 +377,8 @@ namespace ...@@ -377,8 +377,8 @@ namespace
{ {
for (long c = 0; c < img2.nc(); ++c) for (long c = 0; c < img2.nc(); ++c)
{ {
if (r == 5 && c == 5 || if ((r == 5 && c == 5) ||
r == 7 && c == 7) (r == 7 && c == 7))
{ {
DLIB_CASSERT(img2[r][c] == 255, ""); DLIB_CASSERT(img2[r][c] == 255, "");
} }
......
...@@ -350,8 +350,8 @@ namespace ...@@ -350,8 +350,8 @@ namespace
{ {
DLIB_CASSERT(test == test2,""); DLIB_CASSERT(test == test2,"");
DLIB_CASSERT(test < test2 == false,""); DLIB_CASSERT((test < test2) == false,"");
DLIB_CASSERT(test2 < test == false,""); DLIB_CASSERT((test2 < test) == false,"");
int a = 3, b = 3; int a = 3, b = 3;
test.add(a); test.add(a);
...@@ -360,10 +360,10 @@ namespace ...@@ -360,10 +360,10 @@ namespace
DLIB_CASSERT(test == test2,""); DLIB_CASSERT(test == test2,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test.move_next(); test.move_next();
DLIB_CASSERT(test < test2 == false,""); DLIB_CASSERT((test < test2) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test.move_next(); test.move_next();
DLIB_CASSERT(test2 < test == false,""); DLIB_CASSERT((test2 < test) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
a = 2; b = 5; a = 2; b = 5;
...@@ -374,10 +374,10 @@ namespace ...@@ -374,10 +374,10 @@ namespace
DLIB_CASSERT((test == test2) == false,""); DLIB_CASSERT((test == test2) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test2.move_next(); test2.move_next();
DLIB_CASSERT(test < test2 == true,""); DLIB_CASSERT((test < test2) == true,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test2.move_next(); test2.move_next();
DLIB_CASSERT(test2 < test == false,""); DLIB_CASSERT((test2 < test) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
...@@ -388,10 +388,10 @@ namespace ...@@ -388,10 +388,10 @@ namespace
DLIB_CASSERT((test == test2) == false,""); DLIB_CASSERT((test == test2) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test2.move_next(); test2.move_next();
DLIB_CASSERT(test < test2 == false,""); DLIB_CASSERT((test < test2) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test2.move_next(); test2.move_next();
DLIB_CASSERT(test2 < test == true,""); DLIB_CASSERT((test2 < test) == true,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test.clear(); test.clear();
...@@ -401,10 +401,10 @@ namespace ...@@ -401,10 +401,10 @@ namespace
DLIB_CASSERT((test == test2) == false,""); DLIB_CASSERT((test == test2) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test2.move_next(); test2.move_next();
DLIB_CASSERT(test < test2 == true,""); DLIB_CASSERT((test < test2) == true,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
test2.move_next(); test2.move_next();
DLIB_CASSERT(test2 < test == false,""); DLIB_CASSERT((test2 < test) == false,"");
DLIB_CASSERT(test.at_start() && test2.at_start(),""); DLIB_CASSERT(test.at_start() && test2.at_start(),"");
......
...@@ -32,7 +32,7 @@ namespace dlib ...@@ -32,7 +32,7 @@ namespace dlib
template <typename T> unichar surrogate_pair_to_unichar(T first, T second) template <typename T> unichar surrogate_pair_to_unichar(T first, T second)
{ {
return ((first & SURROGATE_CLEARING_MASK) << VALID_BITS) | (second & SURROGATE_CLEARING_MASK) + SMP_TOP; return ((first & SURROGATE_CLEARING_MASK) << VALID_BITS) | ((second & SURROGATE_CLEARING_MASK) + SMP_TOP);
} }
//110110 0000000000 //110110 0000000000
//110111 0000000000 //110111 0000000000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment