From ccbd5a2e2da263de35917d841fdf3bc44a776e52 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Thu, 13 Feb 2014 12:42:11 -0800 Subject: port-serial: fix gsize/gssize type mismatch This patch fixes the following type mismatch in MMPortSerial::port_serial_process_command(): mm-port-serial.c:612:21: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (written < 0) { ~~~~~~~ ^ ~ --- src/mm-port-serial.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mm-port-serial.c') diff --git a/src/mm-port-serial.c b/src/mm-port-serial.c index 47ce482c..e41beefa 100644 --- a/src/mm-port-serial.c +++ b/src/mm-port-serial.c @@ -606,10 +606,11 @@ port_serial_process_command (MMPortSerial *self, /* Socket based setup */ else if (self->priv->socket) { GError *inner_error = NULL; + gssize bytes_sent; /* Send N bytes of the command */ - written = g_socket_send (self->priv->socket, p, send_len, NULL, &inner_error); - if (written < 0) { + bytes_sent = g_socket_send (self->priv->socket, p, send_len, NULL, &inner_error); + if (bytes_sent < 0) { /* Non-EWOULDBLOCK error? */ if (!g_error_matches (inner_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { g_propagate_error (error, inner_error); @@ -634,7 +635,8 @@ port_serial_process_command (MMPortSerial *self, /* Just keep on, will retry... */ written = 0; - } + } else + written = bytes_sent; ctx->idx += written; } else -- cgit v1.2.3-70-g09d2