Ticket #21912: byteswap-osx.patch

File byteswap-osx.patch, 2.5 KB (added by jeremy.laine@…, 15 years ago)
  • kstars/kstars/binfilehelper.cpp

    old new  
    3838#define bswap_16(x) bswap16(x)
    3939#define bswap_32(x) bswap32(x)
    4040#else
     41#if defined(Q_OS_MAC)
     42#include <libkern/OSByteOrder.h>
     43#define bswap_16(x) OSSwapInt16(x)
     44#define bswap_32(x) OSSwapInt32(x)
     45#else
    4146#include <byteswap.h>
    4247#endif
    4348#endif
     49#endif
    4450
    4551class BinFileHelper;
    4652
  • kstars/kstars/skycomponents/starcomponent.cpp

    old new  
    3838#include "binfilehelper.h"
    3939#include "starblockfactory.h"
    4040
     41// Byte-swapping support.
     42//
     43// bswap_16 is a linuxism, use BSWAP_16 define on Solaris,
     44// probably need to usw BSD's swap16() on FreeBSD. This could
     45// use some cmake checks to actually check for the supported
     46// include files and which form of byte swapping to use.
     47//
     48#ifdef Q_OS_SOLARIS
     49#include <sys/byteorder.h>
     50#define bswap_16(x) BSWAP_16(x)
     51#define bswap_32(x) BSWAP_32(x)
     52#else
    4153#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
    4254#include <sys/endian.h>
    4355#define bswap_16(x) bswap16(x)
    4456#define bswap_32(x) bswap32(x)
    4557#else
     58#if defined(Q_OS_MAC)
     59#include <libkern/OSByteOrder.h>
     60#define bswap_16(x) OSSwapInt16(x)
     61#define bswap_32(x) OSSwapInt32(x)
     62#else
    4663#include <byteswap.h>
    4764#endif
     65#endif
     66#endif
    4867
    4968#include <kde_file.h>
    5069
  • kstars/kstars/skycomponents/deepstarcomponent.cpp

    old new  
    5353#define bswap_16(x) bswap16(x)
    5454#define bswap_32(x) bswap32(x)
    5555#else
     56#if defined(Q_OS_MAC)
     57#include <libkern/OSByteOrder.h>
     58#define bswap_16(x) OSSwapInt16(x)
     59#define bswap_32(x) OSSwapInt32(x)
     60#else
    5661#include <byteswap.h>
    5762#endif
    5863#endif
     64#endif
    5965
    6066DeepStarComponent::DeepStarComponent( SkyComponent *parent, QString fileName, float trigMag, bool staticstars )
    6167    : ListComponent(parent), m_reindexNum( J2000 ), triggerMag( trigMag ), m_FaintMagnitude(-5.0),