[Kstars-devel] branches/kstars/summer/kstars

Prakash Mohan prak902000 at gmail.com
Mon Jun 8 12:57:06 CEST 2009


SVN commit 978850 by prakash:

More of code merging with trunk.

CCMAIL: kstars-devel at kde.org


 _M            . (directory)  
 M  +10 -0     kstars/skycomponents/deepstarcomponent.cpp  
 M  +7 -0      kstars/skycomponents/starcomponent.cpp  
 M  +3 -0      kstars/skycomponents/starcomponent.h  


** branches/kstars/summer/kstars #property svnmerge-integrated
   - /trunk/KDE/kdeedu/kstars:1-978804 /branches/kstars/unfrozen/kstars:1-822093,823176-826602,826607-826609,826612,826614-826640,826642-827470,827472-827647,827649-829108,829110-829310,829312-829464
   + /trunk/KDE/kdeedu/kstars:1-978838 /branches/kstars/unfrozen/kstars:1-822093,823176-826602,826607-826609,826612,826614-826640,826642-827470,827472-827647,827649-829108,829110-829310,829312-829464
--- branches/kstars/summer/kstars/kstars/skycomponents/deepstarcomponent.cpp #978849:978850
@@ -74,10 +74,16 @@
     qint16 faintmag;
     quint8 htm_level;
     quint16 t_MSpT;
+
     fread( &faintmag, 2, 1, dataFile );
+    if( starReader.getByteSwap() )
+        bswap_16( faintmag );
     fread( &htm_level, 1, 1, dataFile );
     fread( &t_MSpT, 2, 1, dataFile ); // Unused
+    if( starReader.getByteSwap() )
+        bswap_16( faintmag );
 
+
     // TODO: Read the multiplying factor from the dataFile
     m_FaintMagnitude = faintmag / 100.0;
 
@@ -329,6 +335,8 @@
         qint16 faintmag;
         quint8 htm_level;
         fread( &faintmag, 2, 1, starReader.getFileHandle() );
+        if( starReader.getByteSwap() )
+            bswap_16( faintmag );
         if( starReader.guessRecordSize() == 16 )
             m_FaintMagnitude = faintmag / 1000.0;
         else
@@ -344,6 +352,8 @@
         }
         meshLevel = htm_level;
         fread( &MSpT, 2, 1, starReader.getFileHandle() );
+        if( starReader.getByteSwap() )
+            bswap_16( MSpT );
         fileOpened = true;
         kDebug() << "  Sky Mesh Size: " << m_skyMesh->size();
         for (long int i = 0; i < m_skyMesh->size(); i++) {
--- branches/kstars/summer/kstars/kstars/skycomponents/starcomponent.cpp #978849:978850
@@ -457,9 +457,14 @@
     quint16 t_MSpT;
 
     fread( &faintmag, 2, 1, dataFile );
+    if( swapBytes )
+        bswap_16( faintmag );
     fread( &htm_level, 1, 1, dataFile );
     fread( &t_MSpT, 2, 1, dataFile ); // Unused
+    if( swapBytes )
+        bswap_16( faintmag );
 
+
     if( faintmag / 100.0 > m_FaintMagnitude )
         m_FaintMagnitude = faintmag / 100.0;
 
@@ -572,6 +577,8 @@
             return 0;
         FILE *dataFile;
         KDE_fseek( hdidxFile, (HDnum - 1) * 4, SEEK_SET );
+        // TODO: Offsets need to be byteswapped if this is a big endian machine.
+        // This means that the Henry Draper Index needs a endianness indicator.
         fread( &offset, 4, 1, hdidxFile );
         if( offset <= 0 )
             return 0;
--- branches/kstars/summer/kstars/kstars/skycomponents/starcomponent.h #978849:978850
@@ -165,6 +165,9 @@
 
     SkyObject* findByHDIndex( int HDnum );
 
+    // TODO: Make byteSwap a template method and put it in byteswap.h
+    // It should ideally handle 32-bit, 16-bit fields and starData and
+    // deepStarData fields
     static void byteSwap( starData *stardata );
 
 private:


More information about the Kstars-devel mailing list