diff options
author | Dan McGee <dpmcgee@gmail.com> | 2015-04-07 11:47:59 -0500 |
---|---|---|
committer | Dan McGee <dpmcgee@gmail.com> | 2015-04-07 11:47:59 -0500 |
commit | 347ae48021e32cba1bac8459cb36f88626268883 (patch) | |
tree | 87cec169455e57db07e3d6b5cdf2f30095267552 /onkyo.c | |
parent | 4bc588efc4a92dcf0e76d87bc730699270d6f178 (diff) | |
download | onkyocontrol-master.tar.gz onkyocontrol-master.zip |
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Diffstat (limited to 'onkyo.c')
-rw-r--r-- | onkyo.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -406,7 +406,7 @@ static int open_serial_device(const char *path) /* canonical input mode- end read at a line descriptor */ newtio.c_lflag = ICANON; /* add the Onkyo-used EOF char to allow canonical read */ - newtio.c_cc[VEOL] = END_RECV[strlen(END_RECV) - 1]; + newtio.c_cc[VEOL] = (cc_t)END_RECV[strlen(END_RECV) - 1]; /* clean the line and activate the settings */ ret = tcflush(rcvr->fd, TCIOFLUSH); @@ -659,7 +659,7 @@ static int process_input(struct conn *c) const char * const end_pos = &(c->recv_buf[BUF_SIZE]); int ret = 0; - int count; + ssize_t count; /* * Picture time! Let's get overly verbose since we don't do this @@ -687,6 +687,7 @@ static int process_input(struct conn *c) while(count > 0) { if(*c->recv_buf_pos == '\n') { int processret = 0; + size_t remaining; struct receiver *r; /* We have a newline. This means we should have a full command * and can attempt to interpret it. */ @@ -705,10 +706,11 @@ static int process_input(struct conn *c) } /* now move our remaining buffer to the start of our buffer */ c->recv_buf_pos++; - memmove(c->recv_buf, c->recv_buf_pos, count - 1); + remaining = (size_t)count - 1; + memmove(c->recv_buf, c->recv_buf_pos, remaining); c->recv_buf_pos = c->recv_buf; - memset(&(c->recv_buf_pos[count - 1]), 0, - end_pos - &(c->recv_buf_pos[count - 1])); + memset(&(c->recv_buf_pos[remaining]), 0, + end_pos - &(c->recv_buf_pos[remaining])); if(ret == -2) break; } |