[Spice-devel,usbredir,2/6] usbredirhost: undef ERROR if already defined

Submitted by Uri Lublin on May 3, 2012, 3:04 p.m.

Details

Message ID 1336057479-22629-3-git-send-email-uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin May 3, 2012, 3:04 p.m.
On Windows (mingw), ERROR is already defined (to i0)

This fixes the following compiler warning:
  warning: "ERROR" redefined [enabled by default]
---
 usbredirhost/usbredirhost.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 1dfaee1..068ea1d 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -142,6 +142,9 @@  static void va_log(struct usbredirhost *host, int level,
     host->log_func(host->func_priv, level, buf);
 }

+#ifdef ERROR /* defined on WIN32 */
+#undef ERROR
+#endif
 #define ERROR(...)   va_log(host, usbredirparser_error, \
                             "usbredirhost error: " __VA_ARGS__)
 #define WARNING(...) va_log(host, usbredirparser_warning, \
@@ -447,6 +450,7 @@  static int usbredirhost_claim(struct usbredirhost *host, int initial_claim)
         ERROR("could not get descriptors for active configuration: %d", r);
         return libusb_status_or_error_to_redir_status(host, r);
     }
+
     if (host->config && host->config->bNumInterfaces > MAX_INTERFACES) {
         ERROR("usb decriptor has too much intefaces (%d > %d)",
               (int)host->config->bNumInterfaces, MAX_INTERFACES);

Comments

There's an unrelated white space change in there, apart from this, ACK

Christophe

On Thu, May 03, 2012 at 06:04:35PM +0300, Uri Lublin wrote:
> On Windows (mingw), ERROR is already defined (to i0)
> 
> This fixes the following compiler warning:
>   warning: "ERROR" redefined [enabled by default]
> ---
>  usbredirhost/usbredirhost.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
> index 1dfaee1..068ea1d 100644
> --- a/usbredirhost/usbredirhost.c
> +++ b/usbredirhost/usbredirhost.c
> @@ -142,6 +142,9 @@ static void va_log(struct usbredirhost *host, int level,
>      host->log_func(host->func_priv, level, buf);
>  }
> 
> +#ifdef ERROR /* defined on WIN32 */
> +#undef ERROR
> +#endif
>  #define ERROR(...)   va_log(host, usbredirparser_error, \
>                              "usbredirhost error: " __VA_ARGS__)
>  #define WARNING(...) va_log(host, usbredirparser_warning, \
> @@ -447,6 +450,7 @@ static int usbredirhost_claim(struct usbredirhost *host, int initial_claim)
>          ERROR("could not get descriptors for active configuration: %d", r);
>          return libusb_status_or_error_to_redir_status(host, r);
>      }
> +
>      if (host->config && host->config->bNumInterfaces > MAX_INTERFACES) {
>          ERROR("usb decriptor has too much intefaces (%d > %d)",
>                (int)host->config->bNumInterfaces, MAX_INTERFACES);
> -- 
> 1.7.7.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel