[geos-commits] r2853 - in trunk: capi include/geos include/geos/io include/geos/util

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Jan 16 13:14:41 EST 2010


Author: mloskot
Date: 2010-01-16 13:14:41 -0500 (Sat, 16 Jan 2010)
New Revision: 2853

Added:
   trunk/include/geos/util/Machine.h
Modified:
   trunk/capi/geos_ts_c.cpp
   trunk/include/geos/io/ByteOrderDataInStream.inl
   trunk/include/geos/io/WKBWriter.h
   trunk/include/geos/platform.h.in
   trunk/include/geos/platform.h.vc
Log:
Moved getMachineByteOrder from include/geos/platform.h to include/geos/util/Machine.h. This function is universal for non-Windows and Windows platforms

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2010-01-16 17:03:36 UTC (rev 2852)
+++ trunk/capi/geos_ts_c.cpp	2010-01-16 18:14:41 UTC (rev 2853)
@@ -52,6 +52,7 @@
 #include <geos/linearref/LengthIndexedLine.h>
 #include <geos/geom/BinaryOp.h>
 #include <geos/util/IllegalArgumentException.h>
+#include <geos/util/Machine.h>
 #include <geos/version.h> 
 #include <geos/platform.h>  // for FINITE
 

Modified: trunk/include/geos/io/ByteOrderDataInStream.inl
===================================================================
--- trunk/include/geos/io/ByteOrderDataInStream.inl	2010-01-16 17:03:36 UTC (rev 2852)
+++ trunk/include/geos/io/ByteOrderDataInStream.inl	2010-01-16 18:14:41 UTC (rev 2853)
@@ -24,7 +24,7 @@
 #include <geos/io/ParseException.h>
 #include <geos/io/ByteOrderDataInStream.h>
 #include <geos/io/ByteOrderValues.h>
-#include <geos/platform.h> // for getMachineByteOrder
+#include <geos/util/Machine.h> // for getMachineByteOrder
 
 #include <iostream> // ostream, istream 
 

Modified: trunk/include/geos/io/WKBWriter.h
===================================================================
--- trunk/include/geos/io/WKBWriter.h	2010-01-16 17:03:36 UTC (rev 2852)
+++ trunk/include/geos/io/WKBWriter.h	2010-01-16 18:14:41 UTC (rev 2853)
@@ -23,7 +23,7 @@
 
 #include <geos/export.h>
 
-#include <geos/platform.h> // for getMachineByteOrder
+#include <geos/util/Machine.h> // for getMachineByteOrder
 #include <iosfwd>
 
 // Forward declarations

Modified: trunk/include/geos/platform.h.in
===================================================================
--- trunk/include/geos/platform.h.in	2010-01-16 17:03:36 UTC (rev 2852)
+++ trunk/include/geos/platform.h.in	2010-01-16 18:14:41 UTC (rev 2853)
@@ -95,10 +95,4 @@
 # endif
 #endif
 
-inline int getMachineByteOrder() {
-	static int endian_check = 1; // don't modify !!
-	return *((char *)&endian_check); // 0 == big_endian | xdr,
-					 // 1 == little_endian | ndr
-}
-
 #endif

Modified: trunk/include/geos/platform.h.vc
===================================================================
--- trunk/include/geos/platform.h.vc	2010-01-16 17:03:36 UTC (rev 2852)
+++ trunk/include/geos/platform.h.vc	2010-01-16 18:14:41 UTC (rev 2853)
@@ -56,9 +56,4 @@
 
 #define INT64_CONST_IS_I64 1
 
-inline int getMachineByteOrder() {
-        static int endian_check = 1; // don't modify !!
-        return *((char *)&endian_check); // 0 == big_endian | xdr,
-                                         // 1 == little_endian | ndr
-}
 #endif

Added: trunk/include/geos/util/Machine.h
===================================================================
--- trunk/include/geos/util/Machine.h	                        (rev 0)
+++ trunk/include/geos/util/Machine.h	2010-01-16 18:14:41 UTC (rev 2853)
@@ -0,0 +1,28 @@
+/**********************************************************************
+ * $Id$
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.refractions.net
+ *
+ * Copyright (C) 2001-2009 Vivid Solutions Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU Lesser General Public Licence as published
+ * by the Free Software Foundation. 
+ * See the COPYING file for more information.
+ *
+ **********************************************************************/
+#ifndef GEOS_UTIL_MACHINE_H_INCLUDED
+#define GEOS_UTIL_MACHINE_H_INCLUDED
+
+/**
+ * Check endianness of current machine.
+ * @return 0 for big_endian | xdr; 1 == little_endian | ndr
+ */
+inline int getMachineByteOrder()
+{
+	static int endian_check = 1; // don't modify !!
+	return *((char *)&endian_check);
+}
+
+#endif



More information about the geos-commits mailing list