comparison src/testdir/test_recover.vim @ 25929:51a1ff50bd24 v8.2.3498

patch 8.2.3498: recover test may fail on some systems Commit: https://github.com/vim/vim/commit/37f341d7236ff8a1e886bbb0f0ba0700ad589373 Author: James McCoy <jamessan@jamessan.com> Date: Mon Oct 11 21:04:37 2021 +0100 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 #8941)
author Bram Moolenaar <Bram@vim.org>
date Mon, 11 Oct 2021 22:15:03 +0200
parents 2db73f521d49
children 485c7c4afeb7
comparison
equal deleted inserted replaced
25928:49310ee63371 25929:51a1ff50bd24
206 bw! 206 bw!
207 207
208 " Not all fields are written in a system-independent manner. Detect whether 208 " Not all fields are written in a system-independent manner. Detect whether
209 " the test is running on a little or big-endian system, so the correct 209 " the test is running on a little or big-endian system, so the correct
210 " corruption values can be set. 210 " corruption values can be set.
211 let little_endian = b[1008:1011] == 0z33323130 211 " The B0_MAGIC_LONG field may be 32-bit or 64-bit, depending on the system,
212 " The swap file header fields can be either 32-bit or 64-bit. 212 " even though the value stored is only 32-bits. Therefore, need to check
213 let system_64bit = b[1012:1015] == 0z00000000 213 " both the high and low 32-bits to compute these values.
214 let little_endian = (b[1008:1011] == 0z33323130) || (b[1012:1015] == 0z33323130)
215 let system_64bit = little_endian ? (b[1012:1015] == 0z00000000) : (b[1008:1011] == 0z00000000)
214 216
215 " clear the B0_MAGIC_LONG field 217 " clear the B0_MAGIC_LONG field
216 if system_64bit 218 if system_64bit
217 let b[1008:1015] = 0z00000000.00000000 219 let b[1008:1015] = 0z00000000.00000000
218 else 220 else