From 86530f3146ec091c26652e60067088dc3e067fae Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 19 Feb 2020 22:14:15 +0100 Subject: 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 --- src/grids.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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::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); } -- cgit v1.2.3