mirror of
https://github.com/tbamud/tbamud.git
synced 2026-03-02 19:10:17 +01:00
Resolve Wrestrict warnings on GCC 8.1.1 (#51)
* Fix several misleading indentation warnings on GCC 8.1.1 * Fix reliance on undefined strcpy/sprintf behavior (-Wrestrict warnings) The standard states that strcpy results in undefined behavior when the source and destination buffers overlap. I resolved this with a combination of memmove and strlen. Note that the resulting code is slightly less efficient. Similarly, sprintf's behavior is undefined when copying takes place between objects that overlap. I replaced most of these with a simple strcat, though one required a temp buffer. * Fix format in improved-edit.c to match surrounding code
This commit is contained in:
parent
f9903c05b3
commit
5cca63a01c
4 changed files with 7 additions and 4 deletions
|
|
@ -2593,7 +2593,7 @@ distance, int door)
|
|||
if (!*buf)
|
||||
sprintf(buf, "You see %s", GET_NAME(i));
|
||||
else
|
||||
sprintf(buf, "%s%s", buf, GET_NAME(i));
|
||||
strcat(buf, GET_NAME(i));
|
||||
if (--count > 1)
|
||||
strcat(buf, ", ");
|
||||
else if (count == 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue