Skip to content

Commit

Permalink
MSVC: fix warnings and build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 23, 2023
1 parent 15b11bc commit 5a81fcd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/App/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# include <pwd.h>
# include <sys/types.h>
# elif defined(__MINGW32__)
# undef WINVER
# define WINVER 0x502 // needed for SetDllDirectory
# include <Windows.h>
# endif
Expand Down
26 changes: 16 additions & 10 deletions src/Gui/NaviCube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,16 +969,22 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) {
angle *= -1;
}

static const float pi = boost::math::constants::pi<float>();
static const float pi2 = boost::math::constants::two_pi<float>();
static const float pi1_2 = boost::math::constants::half_pi<float>();
static const float pi1_3 = boost::math::constants::third_pi<float>();
static const float pi2_3 = boost::math::constants::two_thirds_pi<float>();

// Make angle positive
if (angle < 0) {
angle += 2 * M_PI;
angle += pi2;
}

// f is a small value used to control orientation priority when the camera is almost exactly between two
// orientations (e.g. +45 and -45 degrees). The standard orientation is preferred compared to
// +90 and -90 degree orientations and the +90 and -90 degree orientations are preferred compared to an
// upside down standard orientation
float f = 0.00001;
float f = 0.00001F;

// Find the angle to rotate to the nearest orientation
if (m_Faces[pickId].type == ShapeId::Corner) {
Expand All @@ -987,19 +993,19 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) {
angle = 0;
}
else if (angle <= (M_PI_2 + f)) {
angle = M_PI / 3;
angle = pi1_3;
}
else if (angle < (5 * M_PI / 6 - f)) {
angle = 2 * M_PI / 3;
angle = pi2_3;
}
else if (angle <= (M_PI + M_PI / 6 + f)) {
angle = M_PI;
angle = pi;
}
else if (angle < (M_PI + M_PI_2 - f)) {
angle = M_PI + M_PI / 3;
angle = pi + pi1_3;
}
else if (angle < (M_PI + 5 * M_PI / 6 - f)) {
angle = M_PI + 2 * M_PI / 3;
angle = pi + pi2_3;
}
else {
angle = 0;
Expand All @@ -1011,13 +1017,13 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) {
angle = 0;
}
else if (angle <= (3 * M_PI_4 + f)) {
angle = M_PI_2;
angle = pi1_2;
}
else if (angle < (M_PI + M_PI_4 - f)) {
angle = M_PI;
angle = pi;
}
else if (angle < (M_PI + 3 * M_PI_4 - f)) {
angle = M_PI + M_PI_2;
angle = pi + pi1_2;
}
else {
angle = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/Gui/SoFCCSysDragger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ SoGroup* TDragger::buildGeometry()
cylinderSeparator->addChild(cylinder);

//cone
float coneBottomRadius = 0.8;
float coneBottomRadius = 0.8F;
float coneHeight = 2.5;
auto coneSeparator = new SoSeparator();
root->addChild(coneSeparator);
Expand Down Expand Up @@ -779,7 +779,7 @@ SoGroup* RDragger::buildGeometry()
root->addChild(sphereTranslation);

auto sphere = new SoSphere();
sphere->radius.setValue(0.8);
sphere->radius.setValue(0.8F);
root->addChild(sphere);

return root;
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/Mesh/Gui/ViewProviderPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
***************************************************************************/


#include "ViewProviderPython.h"
// clang-format off
#include "PreCompiled.h"
#include "ViewProviderPython.h"
// clang-format on

namespace Gui
{
Expand Down
4 changes: 4 additions & 0 deletions src/Mod/Sketcher/App/planegcs/Constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* *
***************************************************************************/

#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif

#include <algorithm>
#define DEBUG_DERIVS 0
#if DEBUG_DERIVS
Expand Down
4 changes: 4 additions & 0 deletions src/Mod/Sketcher/App/planegcs/SubSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* *
***************************************************************************/

#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif

#include <iostream>
#include <iterator>

Expand Down

0 comments on commit 5a81fcd

Please sign in to comment.