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

Uri Lublin uril at redhat.com
Thu May 3 08:04:35 PDT 2012


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



More information about the Spice-devel mailing list