Permalink
Browse files

thanks to new clang warning (comparison of constant with expression o…

…f type 'bool' is always false) fix a few faulty argument checks
  • Loading branch information...
1 parent 62f24b1 commit da53440b12f60c1b4172c6f08a40c1fae531d1ca Dane Springmeyer committed Sep 27, 2012
Showing with 11 additions and 12 deletions.
  1. +1 −1 src/mapnik_grid.cpp
  2. +2 −3 src/mapnik_image.cpp
  3. +6 −6 src/mapnik_map.cpp
  4. +1 −1 src/mapnik_proj_transform.cpp
  5. +1 −1 test/proj_transform.test.js
View
@@ -196,7 +196,7 @@ Handle<Value> Grid::view(const Arguments& args)
{
HandleScope scope;
- if ( (!args.Length() == 4) || (!args[0]->IsNumber() && !args[1]->IsNumber() && !args[2]->IsNumber() && !args[3]->IsNumber() ))
+ if ( (args.Length() != 4) || (!args[0]->IsNumber() && !args[1]->IsNumber() && !args[2]->IsNumber() && !args[3]->IsNumber() ))
return ThrowException(Exception::TypeError(
String::New("requires 4 integer arguments: x, y, width, height")));
View
@@ -469,7 +469,7 @@ Handle<Value> Image::view(const Arguments& args)
{
HandleScope scope;
- if ( (!args.Length() == 4) || (!args[0]->IsNumber() && !args[1]->IsNumber() && !args[2]->IsNumber() && !args[3]->IsNumber() ))
+ if ( (args.Length() != 4) || (!args[0]->IsNumber() && !args[1]->IsNumber() && !args[2]->IsNumber() && !args[3]->IsNumber() ))
return ThrowException(Exception::TypeError(
String::New("requires 4 integer arguments: x, y, width, height")));
@@ -545,8 +545,7 @@ Handle<Value> Image::composite(const Arguments& args)
{
HandleScope scope;
- // accept custom format
- if (!args.Length() >= 2){
+ if (args.Length() < 2){
return ThrowException(Exception::TypeError(
String::New("requires two arguments: an image mask and a compositeOp")));
}
View
@@ -347,7 +347,7 @@ void Map::set_prop(Local<String> property,
String::New("Must provide an array of: [minx,miny,maxx,maxy]")));
} else {
Local<Array> arr = Local<Array>::Cast(value);
- if (!arr->Length() == 4) {
+ if (arr->Length() != 4) {
ThrowException(Exception::Error(
String::New("Must provide an array of: [minx,miny,maxx,maxy]")));
} else {
@@ -484,7 +484,7 @@ Handle<Value> Map::queryPoint(const Arguments& args)
Handle<Value> Map::abstractQueryPoint(const Arguments& args, bool geo_coords)
{
HandleScope scope;
- if (!args.Length() >= 3)
+ if (args.Length() < 3)
{
return ThrowException(Exception::TypeError(
String::New("requires at least three arguments, a x,y query and a callback")));
@@ -812,7 +812,7 @@ Handle<Value> Map::resize(const Arguments& args)
{
HandleScope scope;
- if (!args.Length() == 2)
+ if (args.Length() != 2)
return ThrowException(Exception::Error(
String::New("Please provide width and height")));
@@ -841,7 +841,7 @@ Handle<Value> Map::load(const Arguments& args)
{
HandleScope scope;
- if (!args.Length() >= 2)
+ if (args.Length() < 2)
return ThrowException(Exception::Error(
String::New("please provide a stylesheet path, options, and callback")));
@@ -1075,7 +1075,7 @@ Handle<Value> Map::fromString(const Arguments& args)
{
HandleScope scope;
- if (!args.Length() >= 2)
+ if (args.Length() < 2)
return ThrowException(Exception::Error(
String::New("please provide a stylesheet string, options, and callback")));
@@ -1291,7 +1291,7 @@ Handle<Value> Map::render(const Arguments& args)
HandleScope scope;
// ensure at least 2 args
- if (!args.Length() >= 2) {
+ if (args.Length() < 2) {
return ThrowException(Exception::TypeError(
String::New("requires at least two arguments, a renderable mapnik object, and a callback")));
}
@@ -35,7 +35,7 @@ Handle<Value> ProjTransform::New(const Arguments& args)
if (!args.IsConstructCall())
return ThrowException(String::New("Cannot call constructor as function, you need to use 'new' keyword"));
- if (!args.Length() == 2 || !args[0]->IsObject() || !args[1]->IsObject()) {
+ if (args.Length() != 2 || !args[0]->IsObject() || !args[1]->IsObject()) {
return ThrowException(Exception::TypeError(
String::New("please provide two arguments: a pair of mapnik.Projection objects")));
}
@@ -8,7 +8,7 @@ describe('mapnik.ProjTransform ', function() {
assert.throws(function() { new mapnik.ProjTransform('+init=epsg:foo'); });
assert.throws(function() { new mapnik.ProjTransform('+proj +foo'); });
assert.throws(function() { new mapnik.ProjTransform(1,1); });
- //assert.throws(function() { new mapnik.ProjTransform({},{}); });
+ assert.throws(function() { new mapnik.ProjTransform({},{}); });
});
it('should initialize properly', function() {

0 comments on commit da53440

Please sign in to comment.