aboutsummaryrefslogtreecommitdiff
path: root/src/grids.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-02-19 22:14:15 +0100
committerKristian Evers <kristianevers@gmail.com>2020-02-20 09:57:45 +0100
commit86530f3146ec091c26652e60067088dc3e067fae (patch)
tree7189e4c3622a51f6b2262e9b320a6f7afd6e6468 /src/grids.cpp
parentdeb3ccf5bb2f304d20f3ce09be8fd07be4817510 (diff)
downloadPROJ-86530f3146ec091c26652e60067088dc3e067fae.tar.gz
PROJ-86530f3146ec091c26652e60067088dc3e067fae.zip
Fix wrong byte-swapping for NTv2 grids affecting master after RFC4 work (fixes #1938)
And add testing of both little-endian and big-endian NTv2 files
Diffstat (limited to 'src/grids.cpp')
-rw-r--r--src/grids.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/grids.cpp b/src/grids.cpp
index ec447a33..ee5ecf52 100644
--- a/src/grids.cpp
+++ b/src/grids.cpp
@@ -1899,7 +1899,10 @@ std::unique_ptr<NTv2GridSet> NTv2GridSet::open(PJ_CONTEXT *ctx,
if (must_swap) {
// 6 double values: southLat, northLat, eastLon, westLon, resLat,
// resLon
- swap_words(header + OFFSET_SOUTH_LAT, sizeof(double), 6);
+ for (int i = 0; i < 6; i++) {
+ swap_words(header + OFFSET_SOUTH_LAT + 16 * i, sizeof(double),
+ 1);
+ }
swap_words(header + OFFSET_GS_COUNT, sizeof(int), 1);
}