kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warning in termios.c:
rodzic
cb2c757c62
commit
12c2434dc7
|
@ -808,29 +808,27 @@ int win32_serial_close(int fd)
|
|||
first_tl = NULL;
|
||||
}
|
||||
|
||||
if (index)
|
||||
{
|
||||
if (index->rol.hEvent) { CloseHandle(index->rol.hEvent); }
|
||||
if (index->rol.hEvent) { CloseHandle(index->rol.hEvent); }
|
||||
|
||||
if (index->wol.hEvent) { CloseHandle(index->wol.hEvent); }
|
||||
if (index->wol.hEvent) { CloseHandle(index->wol.hEvent); }
|
||||
|
||||
if (index->sol.hEvent) { CloseHandle(index->sol.hEvent); }
|
||||
if (index->sol.hEvent) { CloseHandle(index->sol.hEvent); }
|
||||
|
||||
if (index->hComm) { CloseHandle(index->hComm); }
|
||||
if (index->hComm) { CloseHandle(index->hComm); }
|
||||
|
||||
if (index->ttyset) { free(index->ttyset); }
|
||||
if (index->ttyset) { free(index->ttyset); }
|
||||
|
||||
if (index->astruct) { free(index->astruct); }
|
||||
if (index->astruct) { free(index->astruct); }
|
||||
|
||||
if (index->sstruct) { free(index->sstruct); }
|
||||
if (index->sstruct) { free(index->sstruct); }
|
||||
|
||||
if (index->sis) { free(index->sis); }
|
||||
if (index->sis) { free(index->sis); }
|
||||
|
||||
/* had problems with strdup
|
||||
if ( index->filename ) free( index->filename );
|
||||
*/
|
||||
free(index);
|
||||
}
|
||||
/* had problems with strdup
|
||||
if ( index->filename ) free( index->filename );
|
||||
*/
|
||||
free(index);
|
||||
|
||||
|
||||
LEAVE("serial_close");
|
||||
return 0;
|
||||
|
@ -1740,7 +1738,7 @@ int win32_serial_read(int fd, void *vb, int size)
|
|||
}
|
||||
}
|
||||
|
||||
sprintf(message, "end nBytes=%ld] ", nBytes);
|
||||
sprintf(message, "end nBytes=%lu] ", nBytes);
|
||||
report(message);
|
||||
/*
|
||||
hl_usleep(1000);
|
||||
|
@ -2497,8 +2495,10 @@ int tcgetattr(int fd, struct termios *s_termios)
|
|||
s_termios->c_cflag &= ~(PARENB | PARODD | CMSPAR);
|
||||
myDCB.fParity = 1;
|
||||
|
||||
#if 0 // redundant
|
||||
if (myDCB.fParity)
|
||||
{
|
||||
#endif
|
||||
report("tcgetattr getting parity\n");
|
||||
s_termios->c_cflag |= PARENB;
|
||||
|
||||
|
@ -2524,11 +2524,13 @@ int tcgetattr(int fd, struct termios *s_termios)
|
|||
{
|
||||
s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB);
|
||||
}
|
||||
#if 0 // see redundant above
|
||||
}
|
||||
else
|
||||
{
|
||||
s_termios->c_cflag &= ~PARENB;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* CSIZE */
|
||||
s_termios->c_cflag |= bytesize_to_termios(myDCB.ByteSize);
|
||||
|
@ -2752,11 +2754,11 @@ int tcsetattr(int fd, int when, struct termios *s_termios)
|
|||
|
||||
if (dcb.EofChar != '\0')
|
||||
{
|
||||
dcb.fBinary = 0;
|
||||
dcb.fBinary = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dcb.fBinary = 1;
|
||||
dcb.fBinary = TRUE;
|
||||
}
|
||||
|
||||
if (EV_BREAK | EV_CTS | EV_DSR | EV_ERR | EV_RING | (EV_RLSD & EV_RXFLAG))
|
||||
|
@ -3536,38 +3538,10 @@ int win32_serial_ioctl(int fd, int request, ...)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (sistruct->frame != index->sis->frame)
|
||||
{
|
||||
sistruct->frame = index->sis->frame;
|
||||
/*
|
||||
printf( "---------------frame = %i\n", sistruct->frame++ );
|
||||
*/
|
||||
}
|
||||
|
||||
if (sistruct->overrun != index->sis->overrun)
|
||||
{
|
||||
/*
|
||||
printf( "---------------overrun\n" );
|
||||
*/
|
||||
sistruct->overrun = index->sis->overrun;
|
||||
/* ErrCode &= ~CE_OVERRUN; */
|
||||
}
|
||||
|
||||
if (sistruct->parity != index->sis->parity)
|
||||
{
|
||||
/*
|
||||
printf( "---------------parity\n" );
|
||||
*/
|
||||
sistruct->parity = index->sis->parity;
|
||||
}
|
||||
|
||||
if (sistruct->brk != index->sis->brk)
|
||||
{
|
||||
/*
|
||||
printf( "---------------brk\n" );
|
||||
*/
|
||||
sistruct->brk = index->sis->brk;
|
||||
}
|
||||
sistruct->frame = index->sis->frame;
|
||||
sistruct->overrun = index->sis->overrun;
|
||||
sistruct->parity = index->sis->parity;
|
||||
sistruct->brk = index->sis->brk;
|
||||
|
||||
va_end(ap);
|
||||
return 0;
|
||||
|
@ -3777,7 +3751,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
|
|||
termios_setflags(fd, eventflags);
|
||||
}
|
||||
|
||||
if (!index || !index->event_flag)
|
||||
if (!index->event_flag)
|
||||
{
|
||||
/* still setting up the port? hold off for a Sec so
|
||||
things can fire up
|
||||
|
|
Ładowanie…
Reference in New Issue