From 255c65f83c1515a7e3fc4609b36e72acc08a79e4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 15 Mar 2013 17:30:24 +0100 Subject: [PATCH] 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 "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 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/gtypes.h b/glib/gtypes.h index 57829e23f..c18e0bffe 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__)