[Spice-devel] [PATCH 13/24] mingw32 build: fixed using -1 as uninitialized value for unsigned variables

Hans de Goede hdegoede at redhat.com
Wed Dec 8 00:40:08 PST 2010


Ack.

On 12/07/2010 10:28 PM, Alon Levy wrote:
> ---
>   client/red_client.cpp |    4 ++--
>   client/red_client.h   |    2 +-
>   client/red_peer.cpp   |    6 +++---
>   3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/client/red_client.cpp b/client/red_client.cpp
> index 4923f29..c632a21 100644
> --- a/client/red_client.cpp
> +++ b/client/red_client.cpp
> @@ -351,7 +351,7 @@ RedClient::RedClient(Application&  application)
>       , _mouse_mode (SPICE_MOUSE_MODE_SERVER)
>       , _notify_disconnect (false)
>       , _auto_display_res (false)
> -    , _agent_reply_wait_type (-1)
> +    , _agent_reply_wait_type (VD_AGENT_END_MESSAGE)
>       , _aborting (false)
>       , _agent_connected (false)
>       , _agent_mon_config_sent (false)
> @@ -1060,7 +1060,7 @@ void RedClient::on_agent_reply(VDAgentReply* reply)
>           if (_agent_reply_wait_type == reply->type) {
>               post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS));
>               _application.deactivate_interval_timer(*_agent_timer);
> -            _agent_reply_wait_type = -1;
> +            _agent_reply_wait_type = VD_AGENT_END_MESSAGE;
>           }
>           break;
>       default:
> diff --git a/client/red_client.h b/client/red_client.h
> index ae52d9f..7b04d08 100644
> --- a/client/red_client.h
> +++ b/client/red_client.h
> @@ -318,7 +318,7 @@ private:
>       bool _notify_disconnect;
>       bool _auto_display_res;
>       DisplaySetting _display_setting;
> -    int _agent_reply_wait_type;
> +    uint32_t _agent_reply_wait_type;
>
>       bool _aborting;
>
> diff --git a/client/red_peer.cpp b/client/red_peer.cpp
> index 08176d0..6ff5844 100644
> --- a/client/red_peer.cpp
> +++ b/client/red_peer.cpp
> @@ -91,7 +91,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
>               THROW_ERR(SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED, "cannot resolve host address %s", host);
>           }
>           Lock lock(_lock);
> -        _peer = -1;
> +        _peer = INVALID_SOCKET;
>           for (e = result; e != NULL; e = e->ai_next) {
>               if ((_peer = socket(e->ai_family, e->ai_socktype, e->ai_protocol)) == INVALID_SOCKET) {
>                   int err = sock_error();
> @@ -112,7 +112,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
>                   LOG_INFO("Connect failed: %s (%d)",
>                            sock_err_message(err), err);
>                   closesocket(_peer);
> -                _peer = -1;
> +                _peer = INVALID_SOCKET;
>                   continue;
>               }
>               LOG_INFO("Connected to %s %s", uaddr, uport);
> @@ -120,7 +120,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
>           }
>           lock.unlock();
>           freeaddrinfo(result);
> -        if (_peer == -1) {
> +        if (_peer == INVALID_SOCKET) {
>               THROW_ERR(SPICEC_ERROR_CODE_CONNECT_FAILED, "failed to connect: %s (%d)",
>                         sock_err_message(err), err);
>           }


More information about the Spice-devel mailing list