use char, not signed char

This commit is contained in:
Michael Jarvis 2017-06-01 17:45:29 -05:00
parent dbe02a31a2
commit 40ccd3d80d
3 changed files with 13 additions and 16 deletions

View file

@ -21,7 +21,7 @@ const char ascii_to_advent[] = {0, 74, 75, 76, 77, 78, 79, 80, 81, 82, 0, 0, 85,
// Global variables for use in functions below that can gradually disappear as code is cleaned up
long LNLENG;
long LNPOSN;
signed char INLINE[LINESIZE+1];
char INLINE[LINESIZE+1];
long I;
long K;
long KK;
@ -197,10 +197,10 @@ void MAPLIN(FILE *OPENED) {
while (!feof(OPENED) && INLINE[1] == '#');
LNLENG = 0;
for (int i = 1; i <= sizeof(INLINE) && INLINE[i] != 0; ++i)
for (size_t i = 1; i <= sizeof(INLINE) && INLINE[i] != 0; ++i)
{
char val = INLINE[i] + 1;
INLINE[i] = ascii_to_advent[val];
INLINE[i] = ascii_to_advent[(unsigned)val];
if (INLINE[i] != 0)
LNLENG = i;
}
@ -528,11 +528,8 @@ void write_files(FILE* c_file, FILE* header_file)
write_hints(c_file, header_file, HINTS, HNTSIZ + 1, 5, "HINTS");
}
int main(int argc, char** argv)
int main()
{
argc = argc;
argv = argv;
FILE* database = fopen("adventure.text", "r");
read_database(database);
fclose(database);

4
main.c
View file

@ -18,7 +18,7 @@ long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
LINK[201], LNLENG, LNPOSN,
PARMS[26], PLACE[101],
SETUP = 0;
signed char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
@ -149,7 +149,7 @@ L1: SETUP= -1;
score(1);
}
static bool fallback_handler(signed char *buf)
static bool fallback_handler(char *buf)
/* fallback handler for commands not handled by FORTRANish parser */
{
long sv;

2
main.h
View file

@ -10,7 +10,7 @@ typedef struct lcg_state
extern long ABB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
LINK[], LNLENG, LNPOSN,
PARMS[], PLACE[];
extern signed char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[], MAP2[];
extern char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[], MAP2[];
extern FILE *logfp;
extern bool oldstyle;
extern lcg_state lcgstate;