Fix (or disable) warnings produced by VS2015

pull/3/head
Hleb Valoshka 2019-01-19 13:09:32 +03:00
parent 3202b5242d
commit d6b9e61e86
6 changed files with 33 additions and 9 deletions

View File

@ -32,7 +32,14 @@ endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(NOT MSVC) if(NOT MSVC)
# Qt requires -fPIC, so build all code with it
add_compile_options(-fPIC) add_compile_options(-fPIC)
else()
# Disabled warnings
# C4244: implicit type conversion to a smaller type
# C4503: type truncation
# C4800: forcing value to bool
add_compile_options("/wd4244" "/wd4503" "/wd4800")
endif() endif()
if(UNIX AND (NOT APPLE) AND (NOT CYGWIN)) if(UNIX AND (NOT APPLE) AND (NOT CYGWIN))

View File

@ -132,6 +132,8 @@ class CommandGotoLongLat : public InstantaneousCommand
class CommandGotoLocation : public InstantaneousCommand class CommandGotoLocation : public InstantaneousCommand
{ {
public: public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
CommandGotoLocation(double t, CommandGotoLocation(double t,
#ifdef __CELVEC__ #ifdef __CELVEC__
const Point3d& translation, const Quatf& rotation); const Point3d& translation, const Quatf& rotation);
@ -411,6 +413,8 @@ class CommandSetPosition : public InstantaneousCommand
class CommandSetOrientation : public InstantaneousCommand class CommandSetOrientation : public InstantaneousCommand
{ {
public: public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
#ifdef __CELVEC__ #ifdef __CELVEC__
CommandSetOrientation(const Vec3f&, float); CommandSetOrientation(const Vec3f&, float);
#else #else

View File

@ -169,7 +169,7 @@ public:
CelxLua celx(l); CelxLua celx(l);
T *c = celx.getUserData<T>(CelxLua::localIndex(1)); T *c = celx.getUserData<T>(CelxLua::localIndex(1));
int i = celx.getNumber(CelxLua::localIndex(2)); int i = static_cast<int>(celx.getNumber(CelxLua::localIndex(2)));
if (i < 0) if (i < 0)
return 0; return 0;
T ret = c[i]; T ret = c[i];

View File

@ -106,9 +106,9 @@ LRESULT CALLBACK _HyperlinkProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, FALSE); SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, FALSE);
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
SetCapture(hWnd); SetCapture(hWnd);
HCURSOR hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)); HCURSOR hCursor = LoadCursor(NULL, IDC_HAND);
if (NULL == hCursor) if (NULL == hCursor)
hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); hCursor = LoadCursor(NULL, IDC_ARROW);
SetCursor(hCursor); SetCursor(hCursor);
} }
} }

View File

@ -78,7 +78,7 @@ static int currentScreenMode = 0;
static int newScreenMode = 0; static int newScreenMode = 0;
// The last fullscreen mode set; saved and restored from the registry // The last fullscreen mode set; saved and restored from the registry
static int lastFullScreenMode = 0; static unsigned int lastFullScreenMode = 0;
// A fullscreen mode guaranteed to work // A fullscreen mode guaranteed to work
static int fallbackFullScreenMode = 0; static int fallbackFullScreenMode = 0;
static RECT windowRect; static RECT windowRect;
@ -2430,7 +2430,18 @@ static bool SetRegistryInt(HKEY key, LPCTSTR value, int intVal)
0, 0,
REG_DWORD, REG_DWORD,
reinterpret_cast<CONST BYTE*>(&intVal), reinterpret_cast<CONST BYTE*>(&intVal),
sizeof(DWORD)); sizeof(intVal));
return err == ERROR_SUCCESS;
}
static bool SetRegistryInt64(HKEY key, LPCTSTR value, uint64_t intVal)
{
LONG err = RegSetValueEx(key,
value,
0,
REG_DWORD,
reinterpret_cast<CONST BYTE*>(&intVal),
sizeof(intVal));
return err == ERROR_SUCCESS; return err == ERROR_SUCCESS;
} }
@ -2562,9 +2573,9 @@ static bool SavePreferencesToRegistry(LPTSTR regkey, AppPreferences& prefs)
SetRegistryInt(key, "Height", prefs.winHeight); SetRegistryInt(key, "Height", prefs.winHeight);
SetRegistryInt(key, "XPos", prefs.winX); SetRegistryInt(key, "XPos", prefs.winX);
SetRegistryInt(key, "YPos", prefs.winY); SetRegistryInt(key, "YPos", prefs.winY);
SetRegistryInt(key, "RenderFlags", prefs.renderFlags); SetRegistryInt64(key, "RenderFlags", prefs.renderFlags);
SetRegistryInt(key, "LabelMode", prefs.labelMode); SetRegistryInt(key, "LabelMode", prefs.labelMode);
SetRegistryInt(key, "LocationFilter", prefs.locationFilter); SetRegistryInt64(key, "LocationFilter", prefs.locationFilter);
SetRegistryInt(key, "OrbitMask", prefs.orbitMask); SetRegistryInt(key, "OrbitMask", prefs.orbitMask);
SetRegistryBin(key, "VisualMagnitude", &prefs.visualMagnitude, sizeof(prefs.visualMagnitude)); SetRegistryBin(key, "VisualMagnitude", &prefs.visualMagnitude, sizeof(prefs.visualMagnitude));
SetRegistryBin(key, "AmbientLight", &prefs.ambientLight, sizeof(prefs.ambientLight)); SetRegistryBin(key, "AmbientLight", &prefs.ambientLight, sizeof(prefs.ambientLight));
@ -3393,7 +3404,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
if (appCore->getConfig() != NULL) if (appCore->getConfig() != NULL)
{ {
if (!compareIgnoringCase(appCore->getConfig()->cursor, "arrow")) if (!compareIgnoringCase(appCore->getConfig()->cursor, "arrow"))
hDefaultCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); hDefaultCursor = LoadCursor(NULL, IDC_ARROW);
else if (!compareIgnoringCase(appCore->getConfig()->cursor, "inverting crosshair")) else if (!compareIgnoringCase(appCore->getConfig()->cursor, "inverting crosshair"))
hDefaultCursor = LoadCursor(hRes, MAKEINTRESOURCE(IDC_CROSSHAIR)); hDefaultCursor = LoadCursor(hRes, MAKEINTRESOURCE(IDC_CROSSHAIR));
else else

View File

@ -309,6 +309,7 @@ static void dlgCheck(HWND hDlg, WORD item, uint32_t flags, uint32_t f)
((flags & f) != 0) ? BST_CHECKED : BST_UNCHECKED, 0); ((flags & f) != 0) ? BST_CHECKED : BST_UNCHECKED, 0);
} }
void ViewOptionsDialog::SetControls(HWND hDlg) void ViewOptionsDialog::SetControls(HWND hDlg)
{ {
uint64_t renderFlags = appCore->getRenderer()->getRenderFlags(); uint64_t renderFlags = appCore->getRenderer()->getRenderFlags();
@ -347,7 +348,8 @@ void ViewOptionsDialog::SetControls(HWND hDlg)
(renderFlags & Renderer::ShowOpenClusters)? BST_CHECKED:BST_UNCHECKED, 0); (renderFlags & Renderer::ShowOpenClusters)? BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_SHOWNIGHTSIDELIGHTS, BM_SETCHECK, SendDlgItemMessage(hDlg, IDC_SHOWNIGHTSIDELIGHTS, BM_SETCHECK,
(renderFlags & Renderer::ShowNightMaps)? BST_CHECKED:BST_UNCHECKED, 0); (renderFlags & Renderer::ShowNightMaps)? BST_CHECKED:BST_UNCHECKED, 0);
dlgCheck(hDlg, IDC_SHOWORBITS, renderFlags, Renderer::ShowOrbits); SendDlgItemMessage(hDlg, IDC_SHOWORBITS, BM_SETCHECK,
(renderFlags & Renderer::ShowOrbits) != 0 ? BST_CHECKED : BST_UNCHECKED, 0);
dlgCheck(hDlg, IDC_PLANETORBITS, orbitMask, Body::Planet); dlgCheck(hDlg, IDC_PLANETORBITS, orbitMask, Body::Planet);
dlgCheck(hDlg, IDC_DWARFPLANETORBITS,orbitMask, Body::DwarfPlanet); dlgCheck(hDlg, IDC_DWARFPLANETORBITS,orbitMask, Body::DwarfPlanet);
dlgCheck(hDlg, IDC_MOONORBITS, orbitMask, Body::Moon); dlgCheck(hDlg, IDC_MOONORBITS, orbitMask, Body::Moon);