Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #52 from mapbox/warnless
Browse files Browse the repository at this point in the history
Clean up some type warnings
  • Loading branch information
yhahn committed May 9, 2016
2 parents bde20d9 + 151208d commit 555578f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ script:
# only run unit tests (not benchmarks) when built with coverage/debug
# because otherwise the benchmarks will fail since they are slow in debug
- if [[ ${COVERAGE} == true ]]; then
./node_modules/.bin/tape test/cache.test.js test/coalesce.test.js;
./node_modules/.bin/tape test/cache.test.js test/coalesce.test.js test/merge.test.js;
else
npm test;
fi
Expand Down
21 changes: 9 additions & 12 deletions src/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,30 +850,30 @@ ZXY bxy2zxy(unsigned z, unsigned x, unsigned y, unsigned target_z, bool max=fals
}

// zoom conversion multiplier
float mult = pow(2,zDist);
float mult = static_cast<float>(std::pow(2,zDist));

// zoom in min
if (zDist > 0 && !max) {
zxy.x = x * mult;
zxy.y = y * mult;
zxy.x = static_cast<unsigned>(static_cast<float>(x) * mult);
zxy.y = static_cast<unsigned>(static_cast<float>(y) * mult);
return zxy;
}
// zoom in max
else if (zDist > 0 && max) {
zxy.x = x * mult + (mult - 1);
zxy.y = y * mult + (mult - 1);
zxy.x = static_cast<unsigned>(static_cast<float>(x) * mult + (mult - 1));
zxy.y = static_cast<unsigned>(static_cast<float>(y) * mult + (mult - 1));
return zxy;
}
// zoom out
else {
unsigned mod = pow(2,target_z);
unsigned mod = static_cast<unsigned>(std::pow(2,target_z));
unsigned xDiff = x % mod;
unsigned yDiff = y % mod;
unsigned newX = x - xDiff;
unsigned newY = y - yDiff;

zxy.x = newX * mult;
zxy.y = newY * mult;
zxy.x = static_cast<unsigned>(static_cast<float>(newX) * mult);
zxy.y = static_cast<unsigned>(static_cast<float>(newY) * mult);
return zxy;
}
}
Expand Down Expand Up @@ -917,7 +917,7 @@ struct CoalesceBaton : carmen::noncopyable {
// Simulates 40 mile cutoff in carmen.
double scoredist(unsigned zoom, double distance, double score) {
if (distance == 0.0) distance = 0.01;
double scoredist;
double scoredist = 0;
if (zoom >= 14) scoredist = 32.0 / distance;
if (zoom == 13) scoredist = 16.0 / distance;
if (zoom == 12) scoredist = 8.0 / distance;
Expand Down Expand Up @@ -980,19 +980,16 @@ void coalesceSingle(uv_work_t* req) {

// bbox (optional)
bool bbox = !baton->bboxzxy.empty();
unsigned bboxz;
unsigned minx;
unsigned miny;
unsigned maxx;
unsigned maxy;
if (bbox) {
bboxz = baton->bboxzxy[0];
minx = baton->bboxzxy[1];
miny = baton->bboxzxy[2];
maxx = baton->bboxzxy[3];
maxy = baton->bboxzxy[4];
} else {
bboxz = 0;
minx = 0;
miny = 0;
maxx = 0;
Expand Down

0 comments on commit 555578f

Please sign in to comment.