Applied initial patches for wx2.8 compatibility
[ctsim.git] / libctsupport / fnetorderstream.cpp
index ffa26f0a6a5b6f7363a9dc267b9521340500d171..57bcb46cc4752bc7bc357c3444bd4a3476221a9c 100644 (file)
@@ -1,3 +1,23 @@
+/*****************************************************************************
+**  This is part of the CTSim program
+**  Copyright (c) 1983-2001 Kevin Rosenberg
+**
+**  $Id$
+**
+**  This program is free software; you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License (version 2) as
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
 #include "fnetorderstream.h"
 
 
-void 
+void
 ConvertNetworkOrder (void* buffer, size_t bytes)
 {
 #ifndef WORDS_BIGENDIAN
     if (bytes < 2)
-       return;
+        return;
 
     char* start = static_cast<char*>(buffer);
     char* end = start + bytes - 1;   // last byte
     size_t nSwap = bytes / 2;
-    
+
     while (nSwap-- > 0) {
-       unsigned char c = *start;
-       *start++ = *end;
-       *end-- = c;
+        unsigned char c = *start;
+        *start++ = *end;
+        *end-- = c;
     }
-#endif    
+#endif
 }
 
-void 
+void
 ConvertReverseNetworkOrder (void* buffer, size_t bytes)
 {
 #ifdef WORDS_BIGENDIAN
     if (bytes < 2)
-       return;
+        return;
 
     char* start = static_cast<char*>(buffer);
-    char* end = start + bytes - 1;  // last byte 
+    char* end = start + bytes - 1;  // last byte
     size_t nSwap = bytes / 2;
-    
+
     while (nSwap-- > 0) {
-       unsigned char c = *start;
-       *start++ = *end;
-       *end-- = c;
+        unsigned char c = *start;
+        *start++ = *end;
+        *end-- = c;
     }
-#endif    
+#endif
 }
 
-void\r
+void
 fnetorderstream::writeInt16 (kuint16 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes2 (&n);
@@ -56,7 +76,7 @@ fnetorderstream::writeInt16 (kuint16 n) {
   write (reinterpret_cast<const char*>(&n), 2);
 }
 
-void\r
+void
 fnetorderstream::writeInt32 (kuint32 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes4(&n);
@@ -64,7 +84,7 @@ fnetorderstream::writeInt32 (kuint32 n) {
   write (reinterpret_cast<const char*>(&n), 4);
 }
 
-void\r
+void
 fnetorderstream::writeFloat32 (kfloat32 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes4 (&n);
@@ -72,7 +92,7 @@ fnetorderstream::writeFloat32 (kfloat32 n) {
   write (reinterpret_cast<const char*>(&n), 4);
 }
 
-void\r
+void
 fnetorderstream::writeFloat64 (kfloat64 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes8 (&n);
@@ -80,7 +100,7 @@ fnetorderstream::writeFloat64 (kfloat64 n) {
   write (reinterpret_cast<const char*>(&n), 8);
 }
 
-void\r
+void
 fnetorderstream::readInt16 (kuint16& n) {
   read (reinterpret_cast<char*>(&n), 2);
 #ifndef WORDS_BIGENDIAN
@@ -88,7 +108,7 @@ fnetorderstream::readInt16 (kuint16& n) {
 #endif
 }
 
-void\r
+void
 fnetorderstream::readInt32 (kuint32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifndef WORDS_BIGENDIAN
@@ -96,7 +116,7 @@ fnetorderstream::readInt32 (kuint32& n) {
 #endif
 }
 
-void\r
+void
 fnetorderstream::readFloat32 (kfloat32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifndef WORDS_BIGENDIAN
@@ -104,7 +124,7 @@ fnetorderstream::readFloat32 (kfloat32& n) {
 #endif
 }
 
-void\r
+void
 fnetorderstream::readFloat64 (kfloat64& n) {
   read (reinterpret_cast<char*>(&n), 8);
 #ifndef WORDS_BIGENDIAN
@@ -114,7 +134,7 @@ fnetorderstream::readFloat64 (kfloat64& n) {
 
 
 
-void\r
+void
 frnetorderstream::writeInt16 (kuint16 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes2 (&n);
@@ -122,7 +142,7 @@ frnetorderstream::writeInt16 (kuint16 n) {
   write (reinterpret_cast<char*>(&n), 2);
 }
 
-void\r
+void
 frnetorderstream::writeInt32 (kuint32 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes4(&n);
@@ -130,7 +150,7 @@ frnetorderstream::writeInt32 (kuint32 n) {
   write (reinterpret_cast<char*>(&n), 4);
 }
 
-void \r
+void
 frnetorderstream::writeFloat32 (kfloat32 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes4 (&n);
@@ -138,7 +158,7 @@ frnetorderstream::writeFloat32 (kfloat32 n) {
   write (reinterpret_cast<char*>(&n), 4);
 }
 
-void \r
+void
 frnetorderstream::writeFloat64 (kfloat64 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes8 (&n);
@@ -146,7 +166,7 @@ frnetorderstream::writeFloat64 (kfloat64 n) {
   write (reinterpret_cast<char*>(&n), 8);
 }
 
-void \r
+void
 frnetorderstream::readInt16 (kuint16& n) {
   read (reinterpret_cast<char*>(&n), 2);
 #ifdef WORDS_BIGENDIAN
@@ -154,7 +174,7 @@ frnetorderstream::readInt16 (kuint16& n) {
 #endif
 }
 
-void \r
+void
 frnetorderstream::readInt32 (kuint32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifdef WORDS_BIGENDIAN
@@ -162,7 +182,7 @@ frnetorderstream::readInt32 (kuint32& n) {
 #endif
 }
 
-void\r
+void
 frnetorderstream::readFloat32 (kfloat32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifdef WORDS_BIGENDIAN
@@ -170,7 +190,7 @@ frnetorderstream::readFloat32 (kfloat32& n) {
 #endif
 }
 
-void\r
+void
 frnetorderstream::readFloat64 (kfloat64& n) {
   read (reinterpret_cast<char*>(&n), 8);
 #ifdef WORDS_BIGENDIAN