Skip to content

Commit 7f0673b

Browse files
committed
Fix GCC syntax warnings
1 parent f4509d5 commit 7f0673b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

newlisp.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ switch(sig)
459459
}
460460
#endif /* no EMSCRIPTEN */
461461

462-
char * which(char * name, char * buff)
462+
char * which(char * name, char* buff /*char[PATH_MAX]*/)
463463
{
464464
char *path_list, *test, *tmp, *path_parsed;
465465
struct stat filestat;
@@ -495,7 +495,7 @@ for (i = 0; i < count; i++)
495495
len = strlen(test);
496496
if((len + nlen + 2) > PATH_MAX)
497497
return(NULL);
498-
strncpy(buff, test, len + 1);
498+
strncpy(buff, test, PATH_MAX);
499499
buff[len] = '/';
500500
memcpy(buff + len + 1, name, nlen);
501501
buff[len + 1 + nlen] = 0;
@@ -557,7 +557,7 @@ else
557557
if(strchr(name, '/') == NULL)
558558
if((name = which(name, alloca(PATH_MAX))) == NULL)
559559
{
560-
printf("%s: %s\n", strerror(ENOENT), name);
560+
printf("%s: exepath is NULL\n", strerror(ENOENT));
561561
exit(ENOENT);
562562
}
563563
loadFile(name, *(unsigned int *)linkOffset, 1, mainContext);
@@ -2721,9 +2721,10 @@ while(size--)
27212721
case '"': varPrintf(device,"\\%c",'"'); break;
27222722
default:
27232723
if((unsigned char)chr < 32 || (stringOutputRaw && (unsigned char)chr > 126))
2724-
varPrintf(device,"\\%03u", (unsigned char)chr);
2725-
else
2726-
varPrintf(device,"%c",chr); break;
2724+
varPrintf(device,"\\%03u", (unsigned char)chr);
2725+
else
2726+
varPrintf(device,"%c",chr);
2727+
break;
27272728
}
27282729
}
27292730
varPrintf(device,"\"");
@@ -3156,7 +3157,7 @@ char * errorMessage[] =
31563157
void errorMissingPar(STREAM * stream)
31573158
{
31583159
char str[48];
3159-
snprintf(str, 40, "...%.40s", ((char *)((stream->ptr - stream->buffer) > 40 ? stream->ptr - 40 : stream->buffer)));
3160+
snprintf(str, 44, "...%.40s", ((char *)((stream->ptr - stream->buffer) > 40 ? stream->ptr - 40 : stream->buffer)));
31603161
errorProcExt2(ERR_MISSING_PAR, stuffString(str));
31613162
}
31623163

@@ -5136,13 +5137,12 @@ SYMBOL * symbol;
51365137
CELL * next;
51375138

51385139
for(;;)
5139-
{
5140+
{
51405141
params = getSymbol(params, &symbol);
51415142
next = params->next;
5142-
if(params == nilCell)
5143-
return(errorProc(ERR_MISSING_ARGUMENT));
5143+
if (params == nilCell) return errorProc(ERR_MISSING_ARGUMENT);
51445144
pushResultFlag = TRUE;
5145-
if(next == nilCell) return(setDefine(symbol, params, SET_SET));
5145+
if (next == nilCell) return setDefine(symbol, params, SET_SET);
51465146
setDefine(symbol, params, SET_SET);
51475147
params = next;
51485148
}
@@ -6646,7 +6646,7 @@ else
66466646
else
66476647
return(errorProcExt(ERR_CONTEXT_EXPECTED, params));
66486648

6649-
overWriteFlag = (evaluateExpression(next)->type != CELL_NIL);
6649+
overWriteFlag = (evaluateExpression(next)->type != CELL_NIL);
66506650

66516651
/* allow symbols to be converted to contexts */
66526652
if(symbolType(toContext) != CELL_CONTEXT)

0 commit comments

Comments
 (0)