aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-17 23:03:10 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-17 23:03:31 +0800
commitc269b8dcae08221f1752faf1ecc7dae4d7eed40c (patch)
tree2916e757c7590703d028dc9c5466cc98a72d1fb7 /src
parentd8fc390bd04a69f43983fc355026a2f216410318 (diff)
downloadrneovim-c269b8dcae08221f1752faf1ecc7dae4d7eed40c.tar.gz
rneovim-c269b8dcae08221f1752faf1ecc7dae4d7eed40c.tar.bz2
rneovim-c269b8dcae08221f1752faf1ecc7dae4d7eed40c.zip
vim-patch:8.2.3498: recover test may fail on some systems
Problem: Recover test may fail on some systems. Solution: Adjust the little endian and 64 bit detection. (James McCoy, closes vim/vim#8941) https://github.com/vim/vim/commit/37f341d7236ff8a1e886bbb0f0ba0700ad589373 Co-authored-by: James McCoy <jamessan@jamessan.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_recover.vim8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_recover.vim b/src/nvim/testdir/test_recover.vim
index 9d38b0ebea..f4710c4357 100644
--- a/src/nvim/testdir/test_recover.vim
+++ b/src/nvim/testdir/test_recover.vim
@@ -213,9 +213,11 @@ func Test_recover_corrupted_swap_file()
" Not all fields are written in a system-independent manner. Detect whether
" the test is running on a little or big-endian system, so the correct
" corruption values can be set.
- let little_endian = b[1008:1011] == 0z33323130
- " The swap file header fields can be either 32-bit or 64-bit.
- let system_64bit = b[1012:1015] == 0z00000000
+ " The B0_MAGIC_LONG field may be 32-bit or 64-bit, depending on the system,
+ " even though the value stored is only 32-bits. Therefore, need to check
+ " both the high and low 32-bits to compute these values.
+ let little_endian = (b[1008:1011] == 0z33323130) || (b[1012:1015] == 0z33323130)
+ let system_64bit = little_endian ? (b[1012:1015] == 0z00000000) : (b[1008:1011] == 0z00000000)
" clear the B0_MAGIC_LONG field
if system_64bit