[Kstars-devel] Patch for OSX build

Sean Houghton sean.houghton at gmail.com
Tue Sep 1 16:50:44 UTC 2015


Hello, I've recently started working with the INDI tools and decided to get
kstars building on my MacBook directly instead of using a VM. I ran in to a
couple compilation problems with type definitions and numerical limit
preprocessor definitions. I've attached the patch.


Here's a github pull request as well...

https://github.com/seanhoughton/kstars/pull/1



-- 
-Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kstars-devel/attachments/20150901/c6aea162/attachment.html>
-------------- next part --------------
From 5da2a2c56f6c64ba8ee360e654c1098c4becea96 Mon Sep 17 00:00:00 2001
From: Sean Houghton <sean.houghton at gmail.com>
Date: Mon, 31 Aug 2015 23:23:10 -0700
Subject: [PATCH] Type definitions work on OSX

---
 kstars/ekos/guide/common.cpp    | 15 +++++++--------
 kstars/ekos/guide/common.h      | 16 ++++++++--------
 kstars/fitsviewer/fitsdata.cpp  | 10 +++++-----
 kstars/htmesh/SkipListElement.h | 10 +++++-----
 4 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/kstars/ekos/guide/common.cpp b/kstars/ekos/guide/common.cpp
index 084f396..415ec42 100644
--- a/kstars/ekos/guide/common.cpp
+++ b/kstars/ekos/guide/common.cpp
@@ -15,14 +15,14 @@
 #include <sys/types.h>
 
 // define some colors
-const u_char DEF_BKGD_COLOR[3] 		= {0, 0, 0};
-const u_char DEF_RA_COLOR[3]		= {0, 255, 0};
-const u_char DEF_DEC_COLOR[3]		= {0, 165, 255};
-const u_char DEF_GRID_COLOR[3]		= {128, 128, 128};
-const u_char DEF_WHITE_COLOR[3]		= {255, 255, 255};
-const u_char DEF_GRID_FONT_COLOR[3]	= {0, 255, 128};
+const uint8_t DEF_BKGD_COLOR[3] 		= {0, 0, 0};
+const uint8_t DEF_RA_COLOR[3]		= {0, 255, 0};
+const uint8_t DEF_DEC_COLOR[3]		= {0, 165, 255};
+const uint8_t DEF_GRID_COLOR[3]		= {128, 128, 128};
+const uint8_t DEF_WHITE_COLOR[3]		= {255, 255, 255};
+const uint8_t DEF_GRID_FONT_COLOR[3]	= {0, 255, 128};
 
-const u_char DEF_SQR_OVL_COLOR[3]	= {0, 255, 0};
+const uint8_t DEF_SQR_OVL_COLOR[3]	= {0, 255, 0};
 
 void u_msg( const char *fmt, ...)
 {
@@ -45,4 +45,3 @@ void u_msg( const char *fmt, ...)
 
         //QMessageBox::information( this, "Info...", QString().sprintf("test = %d", 13), QMessageBox::Ok, QMessageBox::Ok );
 }
-
diff --git a/kstars/ekos/guide/common.h b/kstars/ekos/guide/common.h
index 46e81a6..ead1a10 100644
--- a/kstars/ekos/guide/common.h
+++ b/kstars/ekos/guide/common.h
@@ -19,14 +19,14 @@
 
 #include "../indi/indicommon.h"
 
-extern const u_char DEF_BKGD_COLOR[];
-extern const u_char DEF_RA_COLOR[];
-extern const u_char DEF_DEC_COLOR[];
-extern const u_char DEF_GRID_COLOR[];
-extern const u_char DEF_WHITE_COLOR[];
-extern const u_char DEF_GRID_FONT_COLOR[];
-
-extern const u_char DEF_SQR_OVL_COLOR[];
+extern const uint8_t DEF_BKGD_COLOR[];
+extern const uint8_t DEF_RA_COLOR[];
+extern const uint8_t DEF_DEC_COLOR[];
+extern const uint8_t DEF_GRID_COLOR[];
+extern const uint8_t DEF_WHITE_COLOR[];
+extern const uint8_t DEF_GRID_FONT_COLOR[];
+
+extern const uint8_t DEF_SQR_OVL_COLOR[];
 
 void u_msg( const char *fmt, ...);
 
diff --git a/kstars/fitsviewer/fitsdata.cpp b/kstars/fitsviewer/fitsdata.cpp
index e1d1824..af90cfc 100644
--- a/kstars/fitsviewer/fitsdata.cpp
+++ b/kstars/fitsviewer/fitsdata.cpp
@@ -302,7 +302,7 @@ bool FITSData::loadFITS ( const QString &inFilename, QProgressDialog *progress )
     if (mode == FITS_NORMAL && progress)
         progress->setValue(80);
 
-    qApp->processEvents();    
+    qApp->processEvents();
 
     if (mode == FITS_NORMAL)
     {
@@ -1131,7 +1131,7 @@ void FITSData::applyFilter(FITSScale type, float *image, double min, double max)
       break;
 
      case FITS_HIGH_CONTRAST:
-     {        
+     {
         min = stats.average + stats.stddev;
         if (min < 0)
             min =0;
@@ -1999,7 +1999,7 @@ bool FITSData::checkDebayer()
       return false;
 
   fits_read_key(fptr, TINT, "XBAYROFF", &debayerParams.offsetX, NULL, &status);
-  fits_read_key(fptr, TINT, "YBAYROFF", &debayerParams.offsetY, NULL, &status); 
+  fits_read_key(fptr, TINT, "YBAYROFF", &debayerParams.offsetY, NULL, &status);
 
   delete[] bayer_buffer;
   bayer_buffer = new float[stats.size * channels];
@@ -2106,10 +2106,10 @@ double FITSData::getADUPercentage()
              return (stats.average / INT_MAX) * 100.0;
              break;
         case 64:
-             return (stats.average / ULONG_LONG_MAX) * 100.0;
+             return (stats.average / ULLONG_MAX) * 100.0;
              break;
         case -64:
-             return (stats.average / LONG_LONG_MAX) * 100.0;
+             return (stats.average / LLONG_MAX) * 100.0;
         default:
             return 0;
             break;
diff --git a/kstars/htmesh/SkipListElement.h b/kstars/htmesh/SkipListElement.h
index b085b0d..228a5ae 100644
--- a/kstars/htmesh/SkipListElement.h
+++ b/kstars/htmesh/SkipListElement.h
@@ -3,7 +3,7 @@
 
 /** \file SkipListElement.h
   Interface for skip list elements
-  See William Pugh's paper: 
+  See William Pugh's paper:
     Skip Lists: A Probabilistic Alternative to Balanced Trees
   \author: Bruno Grossniklaus, 13.11.97
   \version: 1.0
@@ -19,7 +19,7 @@
 #ifdef _WIN32
 #define KEY_MAX _I64_MAX
 #else
-#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || ( defined(__SUNPRO_CC) && defined(__sun) )
+#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || ( defined(__SUNPRO_CC) && defined(__sun) ) || defined(__APPLE__)
 #    define KEY_MAX LLONG_MAX
 #  else
 #    define KEY_MAX LONG_LONG_MAX
@@ -39,7 +39,7 @@ public:
     Key getKey() const   { return myKey; };
     /** set key of element */
     void setKey(Key key) { myKey = key; };
-  
+
     /** get value of element */
     Value getValue() const     { return myValue;}
     /** set value of element */
@@ -51,10 +51,10 @@ public:
     void setLevel(long level) { myLevel = level; }
 
     /** get next element in level */
-    SkipListElement* getElement(long level); 
+    SkipListElement* getElement(long level);
     /** set next element in level */
     void setElement(long level, SkipListElement* element);
-  
+
 private:
     long myLevel;  // level of element
     Key myKey;     // key of element
-- 
2.5.0.windows.1



More information about the Kstars-devel mailing list