libgsf r981 - in trunk: . gsf



Author: mortenw
Date: Sun Apr 13 23:35:11 2008
New Revision: 981
URL: http://svn.gnome.org/viewvc/libgsf?rev=981&view=rev

Log:
2008-04-13  Morten Welinder  <terra gnome org>

	* gsf/gsf-utils.c (gsf_init): Run-time test for gsf_le_get_double.
	Might save __arm__ people some head scratching.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/gsf/gsf-utils.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sun Apr 13 23:35:11 2008
@@ -6,6 +6,7 @@
 Morten:
 	* Use g_base64_-routines from glib when available.
 	* Prepare for using gio to simulate gnome-vfs interface.
+	* Add self-check for the benefit of __arm__.
 
 --------------------------------------------------------------------------
 libgsf 1.14.8

Modified: trunk/gsf/gsf-utils.c
==============================================================================
--- trunk/gsf/gsf-utils.c	(original)
+++ trunk/gsf/gsf-utils.c	Sun Apr 13 23:35:11 2008
@@ -147,6 +147,21 @@
 #else
 	gsf_init_dynamic (NULL);
 #endif
+
+	{
+		/* Little-endian representation of M_PI.  */
+		static guint8 pibytes[8] = {
+			0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40
+		};
+
+		/*
+		 * If this fails, see
+		 *   http://bugzilla.gnome.org/show_bug.cgi?id=350973
+		 */
+		double pi = gsf_le_get_double (pibytes);
+		if (!(pi > 3.14 && pi < 3.15))
+			g_error ("Compilation trouble with endianess.");
+	}
 }
 
 /**



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