Skip to content

Commit

Permalink
Merge pull request #10 from CartoDB/twkb-reader-hotfix
Browse files Browse the repository at this point in the history
Fixed issue when TWKB does not paint geometries in high zoom levels (>18)
  • Loading branch information
pramsey committed Nov 10, 2015
2 parents 9d40bb2 + 1a0c1ff commit a22b3e5
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions plugins/input/postgis/postgis_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,25 @@ struct twkb_reader : mapnik::noncopyable
uint8_t nByte;

/* Check so we don't read beyond the twkb */
while( pos_ < size_ )
while ( pos_ < size_ )
{
nByte = twkb_[pos_];
/* Hibit is set, so this isn't the last byte */
if (nByte & 0x80)
{
/* We get here when there is more to read in the input varInt */
/* Here we take the least significant 7 bits of the read */
/* byte and put it in the most significant place in the result variable. */
nVal |= ((uint64_t)(nByte & 0x7f)) << nShift;
/* move the "cursor" of the input buffer step (8 bits) */
pos_++;
/* move the cursor in the resulting variable (7 bits) */
nShift += 7;
}
else

/* We get here when there is more to read in the input varInt */
/* Here we take the least significant 7 bits of the read */
/* byte and put it in the most significant place in the result variable. */
nVal |= ((uint64_t)(nByte & 0x7f)) << nShift;

/* move the "cursor" of the input buffer step (8 bits) */
pos_++;

/* move the cursor in the resulting variable (7 bits) */
nShift += 7;

/* Hibit isn't set, so this is the last byte */
if ( !(nByte & 0x80) )
{
/* move the "cursor" one step */
pos_++;
/* Move the last read byte to the most significant */
/* place in the result and return the whole result */
//*size = ptr - the_start;
return nVal | (uint64_t)(nByte << nShift);
return nVal;
}
}

Expand Down

0 comments on commit a22b3e5

Please sign in to comment.