Commit f075756a authored by Csaba Kertesz's avatar Csaba Kertesz

Fix compiler warnings

parent b6d848b8
......@@ -17,6 +17,7 @@
/* Project Includes */
#include "testcachingdms.h"
#include "nan.h"
/* KDE Includes */
......@@ -300,6 +301,7 @@ void TestCachingDms::testFailsafeUseOfBaseClassPtr()
dms x(b.x);
dms y(0.0);
*d = x + y;
break;
}
case 6:
default:
......
include_directories(
${kstars_SOURCE_DIR}/kstars
${kstars_SOURCE_DIR}/kstars/tools
${kstars_SOURCE_DIR}/kstars/skyobjects
${kstars_SOURCE_DIR}/kstars/skycomponents
......
......@@ -26,6 +26,7 @@ if(MSVC)
endif()
include_directories(
${kstars_SOURCE_DIR}/kstars
${kstars_SOURCE_DIR}/kstars/skyobjects
${kstars_SOURCE_DIR}/kstars/skycomponents
${kstars_SOURCE_DIR}/kstars/auxiliary
......
......@@ -94,7 +94,8 @@ enum BinFileHelper::Errors BinFileHelper::__readHeader()
{
qint16 endian_id, i;
char ASCII_text[125];
dataElement *de;
dataElement *de = nullptr;
int ret = 0;
// Read the preamble
if (!fileHandle)
......@@ -104,7 +105,7 @@ enum BinFileHelper::Errors BinFileHelper::__readHeader()
// Read the first 124 bytes of the binary file which contains a general text about the binary data.
// e.g. "KStars Star Data v1.0. To be read using the 32-bit starData structure only"
fread(ASCII_text, 124, 1, fileHandle);
ret = fread(ASCII_text, 124, 1, fileHandle);
ASCII_text[124] = '\0';
headerText = ASCII_text;
......@@ -112,17 +113,17 @@ enum BinFileHelper::Errors BinFileHelper::__readHeader()
// Therefore, in the binary file it is written as 53 4B (little endian as least significant byte is stored first),
// and when read on a little endian machine then it results in 0x4B53 (least significant byte is stored first in memory),
// whereas a big endian machine would read it as 0x534B (most significant byte is stored first in memory).
fread(&endian_id, 2, 1, fileHandle);
ret = fread(&endian_id, 2, 1, fileHandle);
if (endian_id != 0x4B53)
byteswap = 1;
else
byteswap = 0;
fread(&versionNumber, 1, 1, fileHandle);
ret = fread(&versionNumber, 1, 1, fileHandle);
preambleUpdated = true;
// Read the field descriptor table
fread(&nfields, 2, 1, fileHandle);
ret = fread(&nfields, 2, 1, fileHandle);
if (byteswap)
nfields = bswap_16(nfields);
fields.clear();
......@@ -154,7 +155,7 @@ enum BinFileHelper::Errors BinFileHelper::__readHeader()
FDUpdated = true;
// Read the index table
fread(&indexSize, 4, 1, fileHandle);
ret = fread(&indexSize, 4, 1, fileHandle);
if (byteswap)
indexSize = bswap_32(indexSize);
......
......@@ -80,7 +80,7 @@ void CachingDms::setUsing_atan2(const double &y, const double &x)
*
*/
dms::setRadians(atan2(y, x));
register double r = sqrt(y * y + x * x);
double r = sqrt(y * y + x * x);
m_cos = x / r;
m_sin = y / r;
......
......@@ -17,12 +17,10 @@
#include "dms.h"
#include <KLocalizedString>
#include <QLocale>
#include <QRegExp>
#include <cstdlib>
#ifdef COUNT_DMS_SINCOS_CALLS
long unsigned dms::dms_constructor_calls = 0;
long unsigned dms::dms_with_sincos_called = 0;
......
......@@ -15,12 +15,10 @@
* *
***************************************************************************/
#ifndef DMS_H_
#define DMS_H_
#pragma once
#include "../nan.h"
#include <QDebug>
#include <QString>
#include <cmath>
......@@ -475,5 +473,3 @@ inline bool operator==(const dms &a1, const dms &a2)
{
return a1.Degrees() == a2.Degrees();
}
#endif
......@@ -24,16 +24,30 @@
*(it is impossible to instantiate a KSUtils object; just use the static functions).
*/
#ifndef KSTARS_KSUTILS_H__
#define KSTARS_KSUTILS_H__
#pragma once
#include <cstddef>
#include <Eigen/Core>
#include <QPointF>
#include "dms.h"
#include <QPointF>
#include <QSharedPointer>
#if __GNUC__ > 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-attributes"
#endif
#if __GNUC__ > 6
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#endif
#include <Eigen/Core>
#if __GNUC__ > 5
#pragma GCC diagnostic pop
#endif
#include <cstddef>
class QFile;
class QString;
class QTextStream;
class SkyPoint;
class SkyObject;
class StarObject;
......@@ -252,5 +266,3 @@ struct JPLFilter
*/
QByteArray getJPLQueryString(const QByteArray &kind, const QByteArray &dataFields, const QVector<JPLFilter> &filters);
}
#endif
......@@ -16,29 +16,23 @@
***************************************************************************/
#include "thumbnailpicker.h"
#include "thumbnaileditor.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QTextStream>
#include <QPainter>
#include <QUrlQuery>
#include <QUrl>
#include <QTemporaryFile>
#include <QPushButton>
#include <QLineEdit>
#include <QPointer>
#include "ksutils.h"
#include "thumbnaileditor.h"
#include "dialogs/detaildialog.h"
#include "skyobjects/skyobject.h"
#include <KIO/CopyJob>
#include <KMessageBox>
#include <KUrlRequester>
#include <KLocalizedString>
#include <KIO/FileCopyJob>
#include <KJobUiDelegate>
#include "ksutils.h"
#include "dialogs/detaildialog.h"
#include "skyobjects/skyobject.h"
#include <QDebug>
#include <QDesktopWidget>
#include <QLineEdit>
#include <QPainter>
#include <QPointer>
#include <QTextStream>
#include <QUrlQuery>
ThumbnailPickerUI::ThumbnailPickerUI(QWidget *parent) : QFrame(parent)
{
......
......@@ -15,20 +15,17 @@
* *
***************************************************************************/
#ifndef THUMBNAILPICKER_H_
#define THUMBNAILPICKER_H_
#pragma once
#include <QPixmap>
#include <QDialog>
#include "ui_thumbnailpicker.h"
#include <KJob>
#include <KLocalizedString>
#include <KIO/Job>
#include "ui_thumbnailpicker.h"
#include <QDialog>
#include <QPixmap>
class QPixmap;
class QRect;
class KJob;
class DetailDialog;
class SkyObject;
......@@ -80,5 +77,3 @@ class ThumbnailPicker : public QDialog
bool bImageFound;
QRect *ImageRect;
};
#endif
......@@ -8,8 +8,11 @@
*/
#include "rotatorsettings.h"
#include <indicom.h>
#include <math.h>
RotatorSettings::RotatorSettings(QWidget *parent) : QDialog(parent)
{
setupUi(this);
......
......@@ -8,13 +8,14 @@
*/
#ifndef ROTATORSETTINGS_H
#define ROTATORSETTINGS_H
#pragma once
#include <QDialog>
#include "indi/indistd.h"
#include "ui_rotatorsettings.h"
#include "indi/indistd.h"
#include <QDialog>
class RotatorSettings : public QDialog, public Ui::RotatorDialog
{
Q_OBJECT
......@@ -45,5 +46,3 @@ private:
ISD::GDInterface *currentRotator=nullptr;
double ticksPerDegree=0;
};
#endif // ROTATORSETTINGS_H
......@@ -7,11 +7,14 @@
version 2 of the License, or (at your option) any later version.
*/
#include "imageautoguiding.h"
#include <QtGlobal>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "imageautoguiding.h"
#define SWAP(a, b) \
tempr = (a); \
......@@ -215,7 +218,7 @@ void rlft3NR(float ***data, float **speq, unsigned long nn1, unsigned long nn2,
float c1, c2, h1r, h1i, h2r, h2i;
float wi, wr;
if (1 + &data[nn1][nn2][nn3] - &data[1][1][1] != nn1 * nn2 * nn3)
if ((unsigned long)(1 + &data[nn1][nn2][nn3] - &data[1][1][1]) != nn1 * nn2 * nn3)
nrerrorNR();
c1 = 0.5;
c2 = -0.5 * isign;
......@@ -289,7 +292,7 @@ void fournNR(float data[], unsigned long nn[], long ndim, long isign)
{
long idim;
unsigned long i1, i2rev, i3rev, ip1, ip2, ip3, ifp1, ifp2;
register unsigned long i2, i3;
unsigned long i2, i3;
unsigned long ibit, k1, k2, n, nprev, nrem, ntot;
float wi, wr, tempi, tempr;
double theta, wpi, wpr, wtemp;
......@@ -440,6 +443,8 @@ float ***f3tensorSP(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
void free_matrixSP(float **m, long nrl, long nrh, long ncl, long nch)
/* free a float matrix allocated by matrix() */
{
Q_UNUSED(nrh);
Q_UNUSED(nch);
free((FREE_ARG)(m[nrl] + ncl - NR_END));
free((FREE_ARG)(m + nrl - NR_END));
}
......@@ -447,6 +452,9 @@ void free_matrixSP(float **m, long nrl, long nrh, long ncl, long nch)
void free_f3tensorSP(float ***t, long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
/* free a float f3tensor allocated by f3tensor() */
{
Q_UNUSED(nrh);
Q_UNUSED(nch);
Q_UNUSED(ndh);
free((FREE_ARG)(t[nrl][ncl] + ndl - NR_END));
free((FREE_ARG)(t[nrl] + ncl - NR_END));
free((FREE_ARG)(t + nrl - NR_END));
......
......@@ -1334,7 +1334,7 @@ void Scheduler::evaluateJobs()
job->getStartupCondition() != SchedulerJob::START_AT)
continue;
double timeBetweenJobs = fabs(firstStartTime.secsTo(job->getStartupTime()));
double timeBetweenJobs = (double)std::abs(firstStartTime.secsTo(job->getStartupTime()));
// If there are within 5 minutes of each other, try to advance scheduling time of the lower altitude one
if (timeBetweenJobs < (Options::leadTime()) * 60)
......@@ -1349,11 +1349,13 @@ void Scheduler::evaluateJobs()
// FIXME: After changing time we are not evaluating job again when we should.
if (otherjob_time >= preDawnDateTime.addDays(daysCount))
{
QDateTime date;
daysCount++;
lastStartTime = job->getStartupTime().addDays(daysCount);
job->setStartupTime(lastStartTime);
lastStartTime.addSecs(delayJob);
date = lastStartTime.addSecs(delayJob);
}
else
{
......@@ -4999,8 +5001,8 @@ bool Scheduler::loadSequenceQueue(const QString &fileURL, SchedulerJob *schedJob
SequenceJob *Scheduler::processJobInfo(XMLEle *root, SchedulerJob *schedJob)
{
XMLEle *ep;
XMLEle *subEP;
XMLEle *ep = nullptr;
XMLEle *subEP = nullptr;
const QMap<QString, CCDFrameType> frameTypes = {
{ "Light", FRAME_LIGHT }, { "Dark", FRAME_DARK }, { "Bias", FRAME_BIAS }, { "Flat", FRAME_FLAT }
......
......@@ -21,11 +21,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "bayer.h"
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "bayer.h"
#define CLIP(in, out) \
in = in < 0 ? 0 : in; \
......@@ -1764,9 +1765,9 @@ dc1394error_t dc1394_bayer_VNG(const uint8_t *restrict bayer, uint8_t *restrict
weight = *cp++;
grads = *cp++;
color = FC(row + y1, col + x1);
if (FC(row + y2, col + x2) != color)
if ((int)FC(row + y2, col + x2) != color)
continue;
diag = (FC(row, col + 1) == color && FC(row + 1, col) == color) ? 2 : 1;
diag = ((int)FC(row, col + 1) == color && (int)FC(row + 1, col) == color) ? 2 : 1;
if (abs(y1 - y2) == diag && abs(x1 - x2) == diag)
continue;
*ip++ = (y1 * width + x1) * 3 + color; /* [FD] */
......@@ -1784,7 +1785,7 @@ dc1394error_t dc1394_bayer_VNG(const uint8_t *restrict bayer, uint8_t *restrict
x = *cp++;
*ip++ = (y * width + x) * 3; /* [FD] */
color = FC(row, col);
if (FC(row + y, col + x) != color && FC(row + y * 2, col + x * 2) == color)
if ((int)FC(row + y, col + x) != color && (int)FC(row + y * 2, col + x * 2) == color)
*ip++ = (y * width + x) * 6 + color; /* [FD] */
else
*ip++ = 0;
......@@ -1909,9 +1910,9 @@ dc1394error_t dc1394_bayer_VNG_uint16(const uint16_t *restrict bayer, uint16_t *
weight = *cp++;
grads = *cp++;
color = FC(row + y1, col + x1);
if (FC(row + y2, col + x2) != color)
if ((int)FC(row + y2, col + x2) != color)
continue;
diag = (FC(row, col + 1) == color && FC(row + 1, col) == color) ? 2 : 1;
diag = ((int)FC(row, col + 1) == color && (int)FC(row + 1, col) == color) ? 2 : 1;
if (abs(y1 - y2) == diag && abs(x1 - x2) == diag)
continue;
*ip++ = (y1 * width + x1) * 3 + color; /* [FD] */
......@@ -1929,7 +1930,7 @@ dc1394error_t dc1394_bayer_VNG_uint16(const uint16_t *restrict bayer, uint16_t *
x = *cp++;
*ip++ = (y * width + x) * 3; /* [FD] */
color = FC(row, col);
if (FC(row + y, col + x) != color && FC(row + y * 2, col + x * 2) == color)
if ((int)FC(row + y, col + x) != color && (int)FC(row + y * 2, col + x * 2) == color)
*ip++ = (y * width + x) * 6 + color; /* [FD] */
else
*ip++ = 0;
......
......@@ -21,8 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BAYER_H
#define BAYER_H
#pragma once
#include <stdint.h>
......@@ -276,5 +275,3 @@ dc1394error_t dc1394_bayer_decoding_16bit(const uint16_t *bayer, uint16_t *rgb,
#ifdef __cplusplus
}
#endif
#endif /* BAYER_H */
......@@ -18,33 +18,21 @@
***************************************************************************/
#include "fitsdata.h"
#include "skymapcomposite.h"
#include "kstarsdata.h"
#include <cmath>
#include <cstdlib>
#include <climits>
#include <float.h>
#include "auxiliary/ksnotification.h"
#include "kstarsdata.h"
#include "ksutils.h"
#include "Options.h"
#include "skymapcomposite.h"
#include <QApplication>
#include <QStringList>
#include <QLocale>
#include <QFile>
#include <QTime>
#include <QProgressDialog>
#ifndef KSTARS_LITE
#ifdef HAVE_WCSLIB
#if !defined(KSTARS_LITE) && defined(HAVE_WCSLIB)
#include <wcshdr.h>
#include <wcsfix.h>
#endif
#endif
#include <KLocalizedString>
#include "auxiliary/ksnotification.h"
#include "ksutils.h"
#include "Options.h"
#include <float.h>
#define ZOOM_DEFAULT 100.0
#define ZOOM_MIN 10
......@@ -207,6 +195,7 @@ bool FITSData::loadFITS(const QString &inFilename, bool silent)
case DOUBLE_IMG:
data_type = TDOUBLE;
stats.bytesPerPixel = sizeof(double);
break;
default:
errMessage = i18n("Bit depth %1 is not supported.", stats.bitpix);
if (silent == false)
......
......@@ -17,30 +17,26 @@
* See http://members.aol.com/pkirchg for more details. *
***************************************************************************/
#ifndef FITSDATA_H_
#define FITSDATA_H_
#pragma once
#include <config-kstars.h>
#include <QFrame>
#include <QImage>
#include <QPixmap>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QPaintEvent>
#include <QScrollArea>
#include <QLabel>
#include <QStringList>
#include "bayer.h"
#include "dms.h"
#include "fitscommon.h"
#include "skyobject.h"
#include "skypoint.h"
#include <fitsio.h>
#ifndef KSTARS_LITE
#include "fitshistogram.h"
#include <kxmlguiwindow.h>
#ifdef HAVE_WCSLIB
#include <wcs.h>
#endif
#include <kxmlguiwindow.h>
#include "fitshistogram.h"
#endif
#ifdef WIN32
......@@ -48,13 +44,6 @@
#include <windows.h>
#endif
#include <fitsio.h>
#include "fitscommon.h"
#include "skypoint.h"
#include "dms.h"
#include "bayer.h"
#define MINIMUM_PIXEL_RANGE 5
#define MINIMUM_STDVAR 5
......@@ -380,5 +369,3 @@ class FITSData
QString lastError;
};
#endif
......@@ -5,9 +5,10 @@
//# Modification History: # # Oct 18, 2001 : Dennis C. Dinge --
//Replaced ValVec with std::vector
#include "SpatialGeneral.h"
#include "RangeConvex.h"
#include "SpatialGeneral.h"
#define N(n) index_->nodes_[(n)]
#define NC(n, m) index_->nodes_[(n)].childID_[(m)] // the children n->m
#define NV(m) index_->nodes_[id].v_[(m)] // the vertices of n
......@@ -42,7 +43,7 @@ RangeConvex::RangeConvex(const SpatialVector *v1, const SpatialVector *v2, const
float64 s2 = a2 * (*v2);
float64 s3 = a3 * (*v3);
if (s1 * s2 * s3) // this is nonzero if not on one line
if (s1 * s2 * s3 != 0) // this is nonzero if not on one line
{
if (s1 < 0.0L)
a1 = (-1) * a1; // change sign if necessary
......
......@@ -11,26 +11,19 @@
#include <QDebug>
#include <KMessageBox>
#include <QStatusBar>
#include <basedevice.h>
#include "indilistener.h"
#include "indicommon.h"
#include "inditelescope.h"
#include "indifocuser.h"
#include "clientmanager.h"
#include "deviceinfo.h"
#include "indicap.h"
#include "indiccd.h"
#include "indidome.h"
#include "indiweather.h"
#include "indicap.h"
#include "indilightbox.h"
#include "indifilter.h"
#include "clientmanager.h"
#include "driverinfo.h"
#include "deviceinfo.h"
#include "fitsviewer/fitsviewer.h"
#include "indifocuser.h"
#include "indilightbox.h"
#include "indilistener.h"
#include "inditelescope.h"
#include "indiweather.h"
#include "kstars.h"
#include "Options.h"
......
......@@ -9,13 +9,13 @@
Handle INDI Standard properties.
*/
#ifndef INDILISETNER_H
#define INDILISETNER_H
#pragma once
#include "indi/indistd.h"
#include <indiproperty.h>
#include <QObject>
#include "indi/indistd.h"
#include <QObject>
class ClientManager;
class FITSViewer;
......@@ -23,11 +23,14 @@ class DeviceInfo;
/**
* @class INDIListener
* INDIListener is responsible for creating ISD::GDInterface generic devices as new devices arrive from ClientManager. It can support multiple ClientManagers
* and will first create a generic INDI device. Upon arrival of INDI properties, INDIListener can create specialized devices (e.g. Telescope) if it detects key Standard INDI
* property that signifies a particular device family. The generic device functionality is extended via the Decorator design pattern.
* INDIListener is responsible for creating ISD::GDInterface generic devices as new devices arrive from
* ClientManager. It can support multiple ClientManagers and will first create a generic INDI device.
* Upon arrival of INDI properties, INDIListener can create specialized devices (e.g. Telescope) if it
* detects key Standard INDI property that signifies a particular device family. The generic device
* functionality is extended via the Decorator design pattern.
*
* INDIListener also delegates INDI properties as they are received from ClientManager to the appropriate device to be processed.
* INDIListener also delegates INDI properties as they are received from ClientManager to the appropriate
* device to be processed.