Mercurial > vim
comparison src/blowfish.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 27b9a84395b5 |
children | 7fad90423bd2 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
417 | 417 |
418 /* Convert the key from 64 hex chars to 32 binary chars. */ | 418 /* Convert the key from 64 hex chars to 32 binary chars. */ |
419 keylen = (int)STRLEN(key) / 2; | 419 keylen = (int)STRLEN(key) / 2; |
420 if (keylen == 0) | 420 if (keylen == 0) |
421 { | 421 { |
422 IEMSG(_("E831: bf_key_init() called with empty password")); | 422 iemsg(_("E831: bf_key_init() called with empty password")); |
423 return; | 423 return; |
424 } | 424 } |
425 for (i = 0; i < keylen; i++) | 425 for (i = 0; i < keylen; i++) |
426 { | 426 { |
427 sscanf((char *)&key[i * 2], "%2x", &u); | 427 sscanf((char *)&key[i * 2], "%2x", &u); |
520 | 520 |
521 /* We can't simply use sizeof(UINT32_T), it would generate a compiler | 521 /* We can't simply use sizeof(UINT32_T), it would generate a compiler |
522 * warning. */ | 522 * warning. */ |
523 if (ui != 0xffffffffUL || ui + 1 != 0) { | 523 if (ui != 0xffffffffUL || ui + 1 != 0) { |
524 err++; | 524 err++; |
525 EMSG(_("E820: sizeof(uint32_t) != 4")); | 525 emsg(_("E820: sizeof(uint32_t) != 4")); |
526 } | 526 } |
527 | 527 |
528 if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) | 528 if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) |
529 err++; | 529 err++; |
530 | 530 |
541 memcpy(bk.uc, bf_test_data[i].plaintxt, 8); | 541 memcpy(bk.uc, bf_test_data[i].plaintxt, 8); |
542 bf_e_cblock(&state, bk.uc); | 542 bf_e_cblock(&state, bk.uc); |
543 if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) | 543 if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) |
544 { | 544 { |
545 if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) | 545 if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) |
546 EMSG(_("E817: Blowfish big/little endian use wrong")); | 546 emsg(_("E817: Blowfish big/little endian use wrong")); |
547 err++; | 547 err++; |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
551 return err > 0 ? FAIL : OK; | 551 return err > 0 ? FAIL : OK; |
667 int | 667 int |
668 blowfish_self_test(void) | 668 blowfish_self_test(void) |
669 { | 669 { |
670 if (sha256_self_test() == FAIL) | 670 if (sha256_self_test() == FAIL) |
671 { | 671 { |
672 EMSG(_("E818: sha256 test failed")); | 672 emsg(_("E818: sha256 test failed")); |
673 return FAIL; | 673 return FAIL; |
674 } | 674 } |
675 if (bf_self_test() == FAIL) | 675 if (bf_self_test() == FAIL) |
676 { | 676 { |
677 EMSG(_("E819: Blowfish test failed")); | 677 emsg(_("E819: Blowfish test failed")); |
678 return FAIL; | 678 return FAIL; |
679 } | 679 } |
680 return OK; | 680 return OK; |
681 } | 681 } |
682 | 682 |