[glib/glib-2-34] gmacros: Ensure GUINT32/64_SWAP_LE_BE macros parenthesize arguments



commit 575a9694fe5fed0d62f521fab98ced23eca46217
Author: Stephan Bergmann <sbergman redhat com>
Date:   Fri Mar 15 17:30:24 2013 +0100

    gmacros: Ensure GUINT32/64_SWAP_LE_BE macros parenthesize arguments
    
    Like all macros, we need to parenthesize arguments to ensure the order
    of operations is correct.
    
    See the mail thread starting at
    <http://lists.fedoraproject.org/pipermail/devel/2013-March/180302.html>
    "GCC produced wrong code in gvfs-1.14.2-3.fc18.x86_64" for how this
    caused trouble with GVFS (which in turn caused trouble with
    LibreOffice, where running "soffice sftp://.../.../test.odt"; to access
    an .odt file via GVFS failed to properly type-detect that file as a
    Writer document and produced bogus error messages about the file being
    broken).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695925

 glib/gtypes.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gtypes.h b/glib/gtypes.h
index 7e4c8ea..22f0538 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -183,8 +183,8 @@ typedef const gchar *   (*GTranslateFunc)       (const gchar   *str,
 #if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
 
 #  if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3
-#    define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((gint32) val))
-#    define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((gint64) val))
+#    define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((gint32) (val)))
+#    define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((gint64) (val)))
 #  endif
 
 #  if defined (__i386__)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]