Fix:mapdriver:Fixing the fallback (no byteswap available) case so it compiles|
authorsteven_s <steven_s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 3 Feb 2009 04:15:09 +0000 (04:15 +0000)
committersteven_s <steven_s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 3 Feb 2009 04:15:09 +0000 (04:15 +0000)
This version of bswap from the GNU headers both compiles & seems to work.

git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1991 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/endianess.h
navit/map/binfile/binfile.c

index 33fcc6f..e9da1c8 100644 (file)
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA  02110-1301, USA.
  */
-
 #ifndef __ENDIANESS_HANDLER__
 
   /* The following is based on xorg/xserver/GL/glx/glxbyteorder.h 
    * which is (c) IBM Corp. 2006,2007 and originally licensed under the following
    * BSD-license. All modifications in navit are licensed under the GNU GPL as 
    * described in file "COPYRIGHT".
+   *
+   * Portions also from GNU C Library include/bits/byteswap.h Also licsend
+   * under the GPL.
+   *
    * --------------------------
    * Permission is hereby granted, free of charge, to any person obtaining a
    * copy of this software and associated documentation files (the "Software"),
@@ -43,7 +46,6 @@
    * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
    * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    */
-
 #if HAVE_BYTESWAP_H
   /* machine dependent versions of byte swapping functions.  GNU extension.*/
   #include <byteswap.h>
   #define __LITTLE_ENDIAN 1234
   #define __BYTE_ORDER __LITTLE_ENDIAN
 #else
-  #define __bswap_16(value)  \
-      ((((value) & 0xff) << 8) | ((value) >> 8))
-  #define __bswap_32(value) \
-      (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
-      (uint32_t)bswap_16((uint16_t)((value) >> 16)))
-  #define __bswap_64(value) \
-      (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
-         << 32) | \
-      (uint64_t)bswap_32((uint32_t)((value) >> 32)))
+  #define __bswap_16(__bsx) ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8))
+  #define __bswap_32(__bsx) ((((__bsx) & 0xff000000) >> 24) | \
+                            (((__bsx) & 0x00ff0000) >>  8) |\
+                            (((__bsx) & 0x0000ff00) <<  8) | \
+                            (((__bsx) & 0x000000ff) << 24))
+
+
 #endif
 
 #if  __BYTE_ORDER == __BIG_ENDIAN 
index 7a6409e..c518d81 100644 (file)
@@ -394,7 +394,7 @@ binfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
        }
        if (!mr->label && (attr_type == attr_any || attr_type == attr_label)) {
                for (i = 0 ; i < sizeof(mr->label_attr)/sizeof(int *) ; i++) {
-                       if (le32_to_cpu(mr->label_attr[i])) {
+                       if (mr->label_attr[i]) {
                                mr->label=1;
                                attr->type=attr_label;
                                attr_data_set_le(attr,mr->label_attr[i]+1);