ZoneArray.cpp   ZoneArray.cpp 
skipping to change at line 22 skipping to change at line 22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QDir>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <io.h> #include <io.h>
#include <windows.h> #include <windows.h>
#endif #endif
#include "ZoneArray.hpp" #include "ZoneArray.hpp"
#include "renderer/StelRenderer.hpp" #include "renderer/StelRenderer.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelGeodesicGrid.hpp" #include "StelGeodesicGrid.hpp"
skipping to change at line 86 skipping to change at line 87
if (star_position_scale < h) star_position_scale = h; if (star_position_scale < h) star_position_scale = h;
} }
static inline int ReadInt(QFile& file, unsigned int &x) static inline int ReadInt(QFile& file, unsigned int &x)
{ {
const int rval = (4 == file.read((char*)&x, 4)) ? 0 : -1; const int rval = (4 == file.read((char*)&x, 4)) ? 0 : -1;
return rval; return rval;
} }
#if (!defined(__GNUC__)) #if (!defined(__GNUC__))
#ifndef _MSC_BUILD
#warning Star catalogue loading has only been tested with gcc #warning Star catalogue loading has only been tested with gcc
#endif #endif
#endif
ZoneArray* ZoneArray::create(const QString& catalogFilePath, bool use_mmap) ZoneArray* ZoneArray::create(const QString& catalogFilePath, bool use_mmap)
{ {
QString dbStr; // for debugging output. QString dbStr; // for debugging output.
QFile* file = new QFile(catalogFilePath); QFile* file = new QFile(catalogFilePath);
if (!file->open(QIODevice::ReadOnly)) if (!file->open(QIODevice::ReadOnly))
{ {
qWarning() << "Error while loading " << catalogFilePath << " : failed to open file."; qWarning() << "Error while loading " << QDir::toNativeSepara tors(catalogFilePath) << ": failed to open file.";
return 0; return 0;
} }
dbStr = "Loading \"" + catalogFilePath + "\": "; dbStr = "Loading \"" + QDir::toNativeSeparators(catalogFilePath) + " \": ";
unsigned int magic,major,minor,type,level,mag_min,mag_range,mag_step s; unsigned int magic,major,minor,type,level,mag_min,mag_range,mag_step s;
if (ReadInt(*file,magic) < 0 || if (ReadInt(*file,magic) < 0 ||
ReadInt(*file,type) < 0 || ReadInt(*file,type) < 0 ||
ReadInt(*file,major) < 0 || ReadInt(*file,major) < 0 ||
ReadInt(*file,minor) < 0 || ReadInt(*file,minor) < 0 ||
ReadInt(*file,level) < 0 || ReadInt(*file,level) < 0 ||
ReadInt(*file,mag_min) < 0 || ReadInt(*file,mag_min) < 0 ||
ReadInt(*file,mag_range) < 0 || ReadInt(*file,mag_range) < 0 ||
ReadInt(*file,mag_steps) < 0) ReadInt(*file,mag_steps) < 0)
{ {
skipping to change at line 141 skipping to change at line 144
major = stel_bswap_32(major); major = stel_bswap_32(major);
minor = stel_bswap_32(minor); minor = stel_bswap_32(minor);
level = stel_bswap_32(level); level = stel_bswap_32(level);
mag_min = stel_bswap_32(mag_min); mag_min = stel_bswap_32(mag_min);
mag_range = stel_bswap_32(mag_range); mag_range = stel_bswap_32(mag_range);
mag_steps = stel_bswap_32(mag_steps); mag_steps = stel_bswap_32(mag_steps);
} }
else if (magic == FILE_MAGIC) else if (magic == FILE_MAGIC)
{ {
// ok, FILE_MAGIC // ok, FILE_MAGIC
#if (!defined(__GNUC__)) #if (!defined(__GNUC__) && !defined(_MSC_BUILD))
if (use_mmap) if (use_mmap)
{ {
// mmap only with gcc: // mmap only with gcc:
dbStr += "warning - you must convert catalogue " dbStr += "warning - you must convert catalogue to na
+= "to native format before mmap loading"; tive format before mmap loading";
qDebug(qPrintable(dbStr)); qDebug(qPrintable(dbStr));
return 0; return 0;
} }
#endif #endif
} }
else if (magic == FILE_MAGIC_NATIVE) else if (magic == FILE_MAGIC_NATIVE)
{ {
// ok, will work for any architecture and any compiler // ok, will work for any architecture and any compiler
} }
skipping to change at line 198 skipping to change at line 200
if (major > MAX_MAJOR_FILE_VERSION) if (major > MAX_MAJOR_FILE_VERSION)
{ {
dbStr += "warning - unsupported version "; dbStr += "warning - unsupported version ";
} }
else else
{ {
// When this assertion fails you must redefine Star2 // When this assertion fails you must redefine Star2
// for your compiler. // for your compiler.
// Because your compiler does not pack the data, // Because your compiler does not pack the data,
// which is crucial for this application. // which is crucial for this application.
#ifndef _MSC_BUILD
Q_ASSERT(sizeof(Star2) == 10); Q_ASSERT(sizeof(Star2) == 10);
#endif
rval = new SpecialZoneArray<Star2>(file, byte_swap, use_mmap, level, mag_min, mag_range, mag_steps); rval = new SpecialZoneArray<Star2>(file, byte_swap, use_mmap, level, mag_min, mag_range, mag_steps);
if (rval == 0) if (rval == 0)
{ {
dbStr += "error - no memory "; dbStr += "error - no memory ";
} }
} }
break; break;
case 2: case 2:
if (major > MAX_MAJOR_FILE_VERSION) if (major > MAX_MAJOR_FILE_VERSION)
{ {
dbStr += "warning - unsupported version "; dbStr += "warning - unsupported version ";
} }
else else
{ {
// When this assertion fails you must redefine Star3 // When this assertion fails you must redefine Star3
// for your compiler. // for your compiler.
// Because your compiler does not pack the data, // Because your compiler does not pack the data,
// which is crucial for this application. // which is crucial for this application.
#ifndef _MSC_BUILD
Q_ASSERT(sizeof(Star3) == 6); Q_ASSERT(sizeof(Star3) == 6);
#endif
rval = new SpecialZoneArray<Star3>(file, byte_swap, use_mmap, level, mag_min, mag_range, mag_steps); rval = new SpecialZoneArray<Star3>(file, byte_swap, use_mmap, level, mag_min, mag_range, mag_steps);
if (rval == 0) if (rval == 0)
{ {
dbStr += "error - no memory "; dbStr += "error - no memory ";
} }
} }
break; break;
default: default:
dbStr += "error - bad file type "; dbStr += "error - bad file type ";
break; break;
 End of changes. 11 change blocks. 
5 lines changed or deleted 12 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/