Fix bugs found through gcc's warnings.

This commit is contained in:
Shpoike 2020-07-19 01:48:32 +01:00
parent bc684222fc
commit 78fee72c50
2 changed files with 4 additions and 2 deletions

View file

@ -578,7 +578,7 @@ void Key_Console (int key)
// If the last two lines are identical, skip storing this line in history
// by not incrementing edit_line
if (strcmp(workline, key_lines[(edit_line-1)&31]))
edit_line = (edit_line + 1) & 31;
edit_line = (edit_line + 1) & (CMDLINES - 1);
history_line = edit_line;
key_lines[edit_line][0] = ']';
@ -779,6 +779,8 @@ void Char_Console (int key)
workline[MAXCMDLINE - 2] = 0;
workline += key_linepos;
len = strlen(workline) + 1;
if (len > MAXCMDLINE-2)
len = MAXCMDLINE-2;
memmove (workline + 1, workline, len);
*workline = key;
}

View file

@ -556,7 +556,7 @@ int WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr)
{
static const in_addr6_t in6addr_any;// = IN6ADDR_ANY_INIT;
if (!memcmp(&((struct sockaddr_in6 *)addr)->sin6_addr, &in6addr_any, sizeof(in_addr6_t)))
memcpy(&((struct sockaddr_in6 *)addr)->sin6_addr, &myAddrv6, sizeof(struct sockaddr_in6));
memcpy(&((struct sockaddr_in6 *)addr)->sin6_addr, &myAddrv6, sizeof(in_addr6_t));
}
#endif