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) {
            ~~~~~~~ ^ ~
This commit is contained in:
Ben Chan
2014-02-13 12:42:11 -08:00
committed by Aleksander Morgado
parent d278f381d2
commit ccbd5a2e2d

View File

@@ -606,10 +606,11 @@ port_serial_process_command (MMPortSerial *self,
/* Socket based setup */ /* Socket based setup */
else if (self->priv->socket) { else if (self->priv->socket) {
GError *inner_error = NULL; GError *inner_error = NULL;
gssize bytes_sent;
/* Send N bytes of the command */ /* Send N bytes of the command */
written = g_socket_send (self->priv->socket, p, send_len, NULL, &inner_error); bytes_sent = g_socket_send (self->priv->socket, p, send_len, NULL, &inner_error);
if (written < 0) { if (bytes_sent < 0) {
/* Non-EWOULDBLOCK error? */ /* Non-EWOULDBLOCK error? */
if (!g_error_matches (inner_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { if (!g_error_matches (inner_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
g_propagate_error (error, inner_error); g_propagate_error (error, inner_error);
@@ -634,7 +635,8 @@ port_serial_process_command (MMPortSerial *self,
/* Just keep on, will retry... */ /* Just keep on, will retry... */
written = 0; written = 0;
} } else
written = bytes_sent;
ctx->idx += written; ctx->idx += written;
} else } else