1
0
mirror of https://github.com/wavded/js-shapefile-to-geojson synced 2024-11-23 14:34:54 +00:00

Fix precision loss

PR: https://github.com/wavded/js-shapefile-to-geojson/pull/22
This commit is contained in:
Marc Harter 2020-01-22 13:43:03 -06:00 committed by GitHub
commit 127facc607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,16 +131,13 @@ var win = self,
t = this, t = this,
val = 0.0; val = 0.0;
if(numBytes > 4){ if(numBytes > 4){
var i = Math.ceil(numBytes / 4); var buff=[]
while(i--){ var o = t.offset,
var buff = [], j = o + numBytes;
o = t.offset, while(j > o){
j = o + (numBytes >= 4 ? 4 : numBytes % 4); buff.push(t.readByteAt(--j));
while(j > o){ numBytes--;
buff.push(t.readByteAt(--j)); t.offset++;
numBytes--;
t.offset++;
}
} }
var s = new Gordon.Stream(fromCharCode.apply(String, buff)), var s = new Gordon.Stream(fromCharCode.apply(String, buff)),
sign = s.readUB(1), sign = s.readUB(1),