Mercurial > hg > early-roguelike
comparison xrogue/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 | 3def5e487faa |
children |
comparison
equal
deleted
inserted
replaced
303:e06ebc407615 | 304:e52a8a7ad4c5 |
---|---|
596 q = (unsigned char *) keybuf; | 596 q = (unsigned char *) keybuf; |
597 while ((q - (unsigned char *) keybuf) < sizeof(keybuf)) { | 597 while ((q - (unsigned char *) keybuf) < sizeof(keybuf)) { |
598 if ((*q++ = *key << 1)) | 598 if ((*q++ = *key << 1)) |
599 key++; | 599 key++; |
600 } | 600 } |
601 if (des_setkey((unsigned char *) keybuf)) | 601 if (des_setkey((char *) keybuf)) |
602 return(NULL); | 602 return(NULL); |
603 | 603 |
604 if (*setting == _PASSWORD_EFMT1) { | 604 if (*setting == _PASSWORD_EFMT1) { |
605 /* | 605 /* |
606 * "new"-style: | 606 * "new"-style: |
615 | 615 |
616 while (*key) { | 616 while (*key) { |
617 /* | 617 /* |
618 * Encrypt the key with itself. | 618 * Encrypt the key with itself. |
619 */ | 619 */ |
620 if (des_cipher((unsigned char*)keybuf, (unsigned char*)keybuf, 0, 1)) | 620 if (des_cipher((char*)keybuf, (char*)keybuf, 0, 1)) |
621 return(NULL); | 621 return(NULL); |
622 /* | 622 /* |
623 * And XOR with the next 8 characters of the key. | 623 * And XOR with the next 8 characters of the key. |
624 */ | 624 */ |
625 q = (unsigned char *) keybuf; | 625 q = (unsigned char *) keybuf; |
626 while (((q - (unsigned char *) keybuf) < sizeof(keybuf)) && | 626 while (((q - (unsigned char *) keybuf) < sizeof(keybuf)) && |
627 *key) | 627 *key) |
628 *q++ ^= *key++ << 1; | 628 *q++ ^= *key++ << 1; |
629 | 629 |
630 if (des_setkey((unsigned char *) keybuf)) | 630 if (des_setkey((char *) keybuf)) |
631 return(NULL); | 631 return(NULL); |
632 } | 632 } |
633 strncpy((char *)output, setting, 9); | 633 strncpy((char *)output, setting, 9); |
634 | 634 |
635 /* | 635 /* |