SCP: Cleanup gcc compiler flagged potential issues
Compiler warnings about undeclared case fall throughs, and potential buffer overruns,
This commit is contained in:
parent
3cca0cf90b
commit
cb9876ce65
5 changed files with 17 additions and 10 deletions
5
scp.c
5
scp.c
|
@ -13062,10 +13062,9 @@ for (hblock = astrings; (htext = *hblock) != NULL; hblock++) {
|
|||
}
|
||||
break;
|
||||
case 'D':
|
||||
if (dptr) {
|
||||
if (dptr)
|
||||
appendText (topic, dptr->name, strlen (dptr->name));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
appendText (topic, sim_name, strlen (sim_name));
|
||||
break;
|
||||
|
|
|
@ -1570,6 +1570,7 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
|
|||
case '\n':
|
||||
if (rem->buf_ptr == 0)
|
||||
break;
|
||||
/* fall through */
|
||||
case '\r':
|
||||
tmxr_linemsg (lp, "\r\n");
|
||||
if (rem->buf_ptr+1 >= rem->buf_size) {
|
||||
|
@ -2580,7 +2581,8 @@ while (*cptr != 0) { /* do all mods */
|
|||
if (serport != INVALID_HANDLE) {
|
||||
sim_close_serial (serport);
|
||||
if (r == SCPE_OK) {
|
||||
char cbuf[CBUFSIZE];
|
||||
char cbuf[CBUFSIZE+10];
|
||||
|
||||
if ((sim_con_tmxr.master) || /* already open? */
|
||||
(sim_con_ldsc.serport))
|
||||
sim_set_noserial (0, NULL); /* close first */
|
||||
|
@ -2662,7 +2664,7 @@ else {
|
|||
if (!*pref)
|
||||
return SCPE_MEM;
|
||||
get_glyph_nc (filename, gbuf, 0); /* reparse */
|
||||
strncpy ((*pref)->name, gbuf, sizeof((*pref)->name)-1);
|
||||
strlcpy ((*pref)->name, gbuf, sizeof((*pref)->name));
|
||||
if (sim_switches & SWMASK ('N')) /* if a new log file is requested */
|
||||
*pf = sim_fopen (gbuf, (binary ? "w+b" : "w+"));/* then open an empty file */
|
||||
else /* otherwise */
|
||||
|
@ -3388,6 +3390,7 @@ ControlHandler(DWORD dwCtrlType)
|
|||
case CTRL_LOGOFF_EVENT: // User is logging off
|
||||
if (!GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &Mode))
|
||||
return TRUE; // Not our User, so ignore
|
||||
/* fall through */
|
||||
case CTRL_SHUTDOWN_EVENT: // System is shutting down
|
||||
int_handler(0);
|
||||
return TRUE;
|
||||
|
|
|
@ -3464,15 +3464,16 @@ if ((sDynamic) &&
|
|||
else
|
||||
ParentName[i/2] = Pdata[i] ? Pdata[i] : Pdata[i+1];
|
||||
free (Pdata);
|
||||
memset (CheckPath, 0, sizeof (CheckPath));
|
||||
if (0 == memcmp (sDynamic->ParentLocatorEntries[j].PlatformCode, "W2ku", 4))
|
||||
strncpy (CheckPath, ParentName, sizeof (CheckPath)-1);
|
||||
strlcpy (CheckPath, ParentName, sizeof (CheckPath));
|
||||
else
|
||||
if (0 == memcmp (sDynamic->ParentLocatorEntries[j].PlatformCode, "W2ru", 4)) {
|
||||
const char *c;
|
||||
|
||||
if ((c = strrchr (szVHDPath, '\\'))) {
|
||||
memcpy (CheckPath, szVHDPath, c-szVHDPath+1);
|
||||
strncpy (CheckPath+strlen(CheckPath), ParentName, sizeof (CheckPath)-(strlen (CheckPath)+1));
|
||||
strlcat (CheckPath, ParentName, sizeof (CheckPath));
|
||||
}
|
||||
}
|
||||
VhdPathToHostPath (CheckPath, CheckPath, sizeof (CheckPath));
|
||||
|
|
|
@ -889,7 +889,8 @@ if ((hFind = FindFirstFileA (cptr, &File)) != INVALID_HANDLE_VALUE) {
|
|||
sprintf (&DirName[strlen (DirName)], "%c", *pathsep);
|
||||
do {
|
||||
FileSize = (((t_int64)(File.nFileSizeHigh)) << 32) | File.nFileSizeLow;
|
||||
sprintf (FileName, "%s%s", DirName, File.cFileName);
|
||||
strlcpy (FileName, DirName, sizeof (FileName));
|
||||
strlcat (FileName, File.cFileName, sizeof (FileName));
|
||||
stat (FileName, &filestat);
|
||||
entry (DirName, File.cFileName, FileSize, &filestat, context);
|
||||
} while (FindNextFile (hFind, &File));
|
||||
|
|
|
@ -517,10 +517,10 @@ memset (lp->rbr, 0, lp->rxbsz); /* clear break status ar
|
|||
static void tmxr_report_connection (TMXR *mp, TMLN *lp)
|
||||
{
|
||||
int32 unwritten, psave;
|
||||
char cmsg[80];
|
||||
char cmsg[160];
|
||||
char dmsg[80] = "";
|
||||
char lmsg[80] = "";
|
||||
char msgbuf[256] = "";
|
||||
char msgbuf[512] = "";
|
||||
|
||||
if ((!lp->notelnet) || (sim_switches & SWMASK ('V'))) {
|
||||
sprintf (cmsg, "\n\r\nConnected to the %s simulator ", sim_name);
|
||||
|
@ -2024,6 +2024,7 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */
|
|||
lp->telnet_sent_opts[tmp] |= TNOS_DONT;/* Record DONT sent */
|
||||
}
|
||||
}
|
||||
/* fall through */
|
||||
case TNS_WONT: /* IAC+WILL/WONT prev */
|
||||
if (tmp == TN_BIN) { /* BIN? */
|
||||
if (lp->tsta == TNS_WILL) {
|
||||
|
@ -2103,6 +2104,7 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */
|
|||
lp->telnet_sent_opts[tmp] |= TNOS_WONT;/* Record WONT sent */
|
||||
}
|
||||
}
|
||||
/* fall through */
|
||||
case TNS_SKIP: default: /* skip char */
|
||||
tmxr_rmvrc (lp, j); /* remove char */
|
||||
lp->tsta = TNS_NORM; /* next normal */
|
||||
|
@ -5389,6 +5391,7 @@ if ((dptr) && (dbits & dptr->dctrl)) {
|
|||
i += (tmxr_buf_debug_telnet_options ((u_char *)(&buf[i]), bufsize-i) - 1);
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
if (isprint((u_char)buf[i]))
|
||||
tmxr_buf_debug_char (buf[i]);
|
||||
|
|
Loading…
Add table
Reference in a new issue