Mercurial > hg > early-roguelike
comparison arogue5/xcrypt.c @ 304:e52a8a7ad4c5
Fix many compiler warnings.
There should only be two changes in behavior:
arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly
applied to characters who are not monks instead of monks who are not
empty-handed.
urogue/fight.c: fixed an interaction with the "debug" macro that could
cause the wrong message to be displayed.
author | John "Elwin" Edwards |
---|---|
date | Wed, 14 Apr 2021 18:55:33 -0400 |
parents | 56e748983fa8 |
children |
comparison
equal
deleted
inserted
replaced
303:e06ebc407615 | 304:e52a8a7ad4c5 |
---|---|
599 q = (unsigned char *) keybuf; | 599 q = (unsigned char *) keybuf; |
600 while ((q - (unsigned char *) keybuf) < sizeof(keybuf)) { | 600 while ((q - (unsigned char *) keybuf) < sizeof(keybuf)) { |
601 if ((*q++ = *key << 1)) | 601 if ((*q++ = *key << 1)) |
602 key++; | 602 key++; |
603 } | 603 } |
604 if (des_setkey((unsigned char *) keybuf)) | 604 if (des_setkey((char *) keybuf)) |
605 return(NULL); | 605 return(NULL); |
606 | 606 |
607 if (*setting == _PASSWORD_EFMT1) { | 607 if (*setting == _PASSWORD_EFMT1) { |
608 /* | 608 /* |
609 * "new"-style: | 609 * "new"-style: |
618 | 618 |
619 while (*key) { | 619 while (*key) { |
620 /* | 620 /* |
621 * Encrypt the key with itself. | 621 * Encrypt the key with itself. |
622 */ | 622 */ |
623 if (des_cipher((unsigned char*)keybuf, (unsigned char*)keybuf, 0, 1)) | 623 if (des_cipher((char*)keybuf, (char*)keybuf, 0, 1)) |
624 return(NULL); | 624 return(NULL); |
625 /* | 625 /* |
626 * And XOR with the next 8 characters of the key. | 626 * And XOR with the next 8 characters of the key. |
627 */ | 627 */ |
628 q = (unsigned char *) keybuf; | 628 q = (unsigned char *) keybuf; |
629 while (((q - (unsigned char *) keybuf) < sizeof(keybuf)) && | 629 while (((q - (unsigned char *) keybuf) < sizeof(keybuf)) && |
630 *key) | 630 *key) |
631 *q++ ^= *key++ << 1; | 631 *q++ ^= *key++ << 1; |
632 | 632 |
633 if (des_setkey((unsigned char *) keybuf)) | 633 if (des_setkey((char *) keybuf)) |
634 return(NULL); | 634 return(NULL); |
635 } | 635 } |
636 strncpy((char *)output, setting, 9); | 636 strncpy((char *)output, setting, 9); |
637 | 637 |
638 /* | 638 /* |