diff mbox

[3/5] qga: use wide-chars constants for wchar_t comparisons

Message ID 1455727675-20625-4-git-send-email-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Feb. 17, 2016, 4:47 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qga/commands-win32.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Roth Feb. 24, 2016, 3:35 p.m. UTC | #1
Quoting marcandre.lureau@redhat.com (2016-02-17 10:47:53)
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>

> ---
>  qga/commands-win32.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> index e5afc5d..b20f107 100644
> --- a/qga/commands-win32.c
> +++ b/qga/commands-win32.c
> @@ -1266,8 +1266,10 @@ get_net_error_message(gint error)
>      if (msg != NULL) {
>          nchars = wcslen(msg);
> 
> -        if (nchars > 2 && msg[nchars-1] == '\n' && msg[nchars-2] == '\r') {
> -            msg[nchars-2] = '\0';
> +        if (nchars > 2 &&
> +            msg[nchars - 1] == L'\n' &&
> +            msg[nchars - 2] == L'\r') {
> +            msg[nchars - 2] = L'\0';
>          }
> 
>          retval = g_utf16_to_utf8(msg, -1, NULL, NULL, NULL);
> -- 
> 2.5.0
>
diff mbox

Patch

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index e5afc5d..b20f107 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1266,8 +1266,10 @@  get_net_error_message(gint error)
     if (msg != NULL) {
         nchars = wcslen(msg);
 
-        if (nchars > 2 && msg[nchars-1] == '\n' && msg[nchars-2] == '\r') {
-            msg[nchars-2] = '\0';
+        if (nchars > 2 &&
+            msg[nchars - 1] == L'\n' &&
+            msg[nchars - 2] == L'\r') {
+            msg[nchars - 2] = L'\0';
         }
 
         retval = g_utf16_to_utf8(msg, -1, NULL, NULL, NULL);