comparison src/blowfish.c @ 31804:50555279168b

patch 9.0.1234: the code style has to be checked manually Commit: https://github.com/vim/vim/commit/ebfec1c531f32d424bb2aca6e7391ef3bfcbfe20 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 22 21:14:53 2023 +0000 patch 9.0.1234: the code style has to be checked manually Problem: The code style has to be checked manually. Solution: Add basic code style checks in a test. Fix or avoid uncovered problems.
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 Jan 2023 22:15:04 +0100
parents 6ee19c6ae8a2
children 3d4e28569a6d
comparison
equal deleted inserted replaced
31803:7a9569aecc51 31804:50555279168b
515 CLEAR_FIELD(state); 515 CLEAR_FIELD(state);
516 state.cfb_len = BF_MAX_CFB_LEN; 516 state.cfb_len = BF_MAX_CFB_LEN;
517 517
518 // We can't simply use sizeof(UINT32_T), it would generate a compiler 518 // We can't simply use sizeof(UINT32_T), it would generate a compiler
519 // warning. 519 // warning.
520 if (ui != 0xffffffffUL || ui + 1 != 0) { 520 if (ui != 0xffffffffUL || ui + 1 != 0)
521 {
521 err++; 522 err++;
522 emsg(_(e_sizeof_uint32_isnot_four)); 523 emsg(_(e_sizeof_uint32_isnot_four));
523 } 524 }
524 525
525 if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) 526 if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a))
571 for (i = 0; i < mi; i++) 572 for (i = 0; i < mi; i++)
572 bfs->cfb_buffer[i % bfs->cfb_len] ^= seed[i % seed_len]; 573 bfs->cfb_buffer[i % bfs->cfb_len] ^= seed[i % seed_len];
573 } 574 }
574 } 575 }
575 576
576 #define BF_CFB_UPDATE(bfs, c) { \ 577 #define BF_CFB_UPDATE(bfs, c) \
578 { \
577 bfs->cfb_buffer[bfs->update_offset] ^= (char_u)c; \ 579 bfs->cfb_buffer[bfs->update_offset] ^= (char_u)c; \
578 if (++bfs->update_offset == bfs->cfb_len) \ 580 if (++bfs->update_offset == bfs->cfb_len) \
579 bfs->update_offset = 0; \ 581 bfs->update_offset = 0; \
580 } 582 }
581 583
582 #define BF_RANBYTE(bfs, t) { \ 584 #define BF_RANBYTE(bfs, t) \
585 { \
583 if ((bfs->randbyte_offset & BF_BLOCK_MASK) == 0) \ 586 if ((bfs->randbyte_offset & BF_BLOCK_MASK) == 0) \
584 bf_e_cblock(bfs, &(bfs->cfb_buffer[bfs->randbyte_offset])); \ 587 bf_e_cblock(bfs, &(bfs->cfb_buffer[bfs->randbyte_offset])); \
585 t = bfs->cfb_buffer[bfs->randbyte_offset]; \ 588 t = bfs->cfb_buffer[bfs->randbyte_offset]; \
586 if (++bfs->randbyte_offset == bfs->cfb_len) \ 589 if (++bfs->randbyte_offset == bfs->cfb_len) \
587 bfs->randbyte_offset = 0; \ 590 bfs->randbyte_offset = 0; \