Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the errors/warnings from using the MSVC toolchain #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions miracle_grue.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ isEmpty(BUILD_NUMBER) {
BUILD_NUMBER = 'manual_build'
}

win32 {
QMAKE_LFLAGS += -static -static-ligbcc -static-libstdc++
win32 & !win32-msvc* {
QMAKE_LFLAGS += -static -static-ligbcc -static-libstdc++
}

MAJOR=0
Expand Down
13 changes: 7 additions & 6 deletions src/mgl/JsonConverter.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "log.h"
#include "JsonConverter.h"

//"polygon" collides with the one defined in wingdi.h
using namespace mgl;
using namespace Json;
using namespace std;
Expand Down Expand Up @@ -44,9 +45,9 @@ bool JsonConverter::loadJsonFromVector3(Value& ,//val,
}


bool JsonConverter::loadJsonFromPolygon(Value& val, Polygon& input)
bool JsonConverter::loadJsonFromPolygon(Value& val, mgl::Polygon& input)
{
for(Polygon::iterator i = input.begin(); i < input.end(); i++)
for(mgl::Polygon::iterator i = input.begin(); i < input.end(); i++)
{
//const std::pair<Scalar, unsigned int>& seg = *it;
const Vector2& vec = *i;
Expand All @@ -58,7 +59,7 @@ bool JsonConverter::loadJsonFromPolygon(Value& val, Polygon& input)
return true;
}

bool JsonConverter::loadPolygonFromJson(Polygon& poly,Value& input)
bool JsonConverter::loadPolygonFromJson(mgl::Polygon& poly,Value& input)
{
if(input.size() < 1)
return false;
Expand All @@ -82,7 +83,7 @@ bool JsonConverter::loadPolygonsFromJson(Polygons& polys,Value& input)
if(input.size() < 1)
return false;
for ( size_t index = 0; index < input.size(); ++index ) {
Polygon poly;
mgl::Polygon poly;
Value tmp = input[(int)index];
bool ok = loadPolygonFromJson(poly,tmp);
if (ok == false){
Expand All @@ -100,8 +101,8 @@ bool JsonConverter::loadJsonFromPolygons(Value& val, Polygons& input)
for(Polygons::iterator i = input.begin(); i < input.end(); i++)
{
Value polys;
Polygon& polyList = *i;
for(Polygon::iterator j = polyList.begin(); j < polyList.end(); j++)
mgl::Polygon& polyList = *i;
for(mgl::Polygon::iterator j = polyList.begin(); j < polyList.end(); j++)
{
//const std::pair<Scalar, unsigned int>& seg = *it;
const Vector2& vec = *j;
Expand Down
3 changes: 3 additions & 0 deletions src/mgl/abstractable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ using namespace std;

#include <fstream>

#define UNREFERENCED_PARAMETER(P) (P)


std::ostream &MyComputer::log()
{
return cout;
Expand Down
4 changes: 2 additions & 2 deletions src/mgl/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ void mgl::loadSlicerConfigFromFile( const Configuration &config, SlicerConfig &s
slicerCfg.insetDistanceMultiplier = doubleCheck(config["slicer"]["insetDistanceMultiplier"], "slicer.insetDistanceMultiplier");
slicerCfg.insetCuttOffMultiplier = doubleCheck(config["slicer"]["insetCuttOffMultiplier"], "slicer.insetCuttOffMultiplier");

slicerCfg.roofLayerCount = doubleCheck(config["slicer"]["roofLayerCount"], "slicer.roofLayerCount");
slicerCfg.floorLayerCount = doubleCheck(config["slicer"]["roofLayerCount"], "slicer.floorLayerCount");
slicerCfg.roofLayerCount = uintCheck(config["slicer"]["roofLayerCount"], "slicer.roofLayerCount");
slicerCfg.floorLayerCount = uintCheck(config["slicer"]["roofLayerCount"], "slicer.floorLayerCount");

slicerCfg.writeDebugScadFiles = boolCheck(config["slicer"]["writeDebugScadFiles"], "slicer.writeDebugScadFiles");
}
2 changes: 1 addition & 1 deletion src/mgl/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Configuration {
};

class GCoderConfig;
class SlicerConfig;
struct SlicerConfig;

void loadGCoderConfigFromFile(const Configuration& conf, GCoderConfig &gcoder);
void loadSlicerConfigFromFile( const Configuration &config, SlicerConfig &slicer);
Expand Down
1 change: 1 addition & 0 deletions src/mgl/gcoder_gantry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void Gantry::writeSwitchExtruder(ostream& ss, Extruder &extruder) {
Scalar Gantry::volumetricE( const Extruder &extruder,
const Extrusion &extrusion,
Scalar vx, Scalar vy, Scalar vz ) const {
UNREFERENCED_PARAMETER(vz);
//There isn't yet a LineSegment3, so for now I'm assuming that only 2d
//segments get extruded
LineSegment2 seg(Vector2(get_x(), get_y()), Vector2(vx, vy));
Expand Down
68 changes: 34 additions & 34 deletions src/mgl/grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Scalar GRID_RANGE_TOL = 0.0;


ostream& operator << (std::ostream &os,const ScalarRange &p) {
cout << "[" << p.min << ", " << p.max << "]";
cout << "[" << p.m_min << ", " << p.m_max << "]";
return os;
}

Expand Down Expand Up @@ -215,15 +215,15 @@ void polygonsFromScalarRangesAlongAxis( const ScalarRangeTable &rays, // the
for (vector<ScalarRange>::const_iterator j = ray.begin();
j != ray.end(); j++) {

assert(j->min != j->max);
assert(j->m_min != j->m_max);

if (axis == X_AXIS) {
points.push_back(Vector2(j->min, val));
points.push_back(Vector2(j->max, val));
points.push_back(Vector2(j->m_min, val));
points.push_back(Vector2(j->m_max, val));
}
else {
points.push_back(Vector2(val, j->min));
points.push_back(Vector2(val, j->max));
points.push_back(Vector2(val, j->m_min));
points.push_back(Vector2(val, j->m_max));
}

points_remaining[points.size() - 2] = points.size() - 1;
Expand All @@ -243,7 +243,7 @@ void polygonsFromScalarRangesAlongAxis( const ScalarRangeTable &rays, // the
//handle last point
if (points_remaining.empty()) break;

Scalar closest_dist = numeric_limits<int>::max();
Scalar closest_dist = (numeric_limits<int>::max)();
int closest;

//find the remaining point closest to this point
Expand Down Expand Up @@ -310,15 +310,15 @@ vector< ScalarRange >::const_iterator subRangeTersect(

while(it != itEnd) {
const ScalarRange &currentRange = *it;
if( (currentRange.min >= range.max) )
if( (currentRange.m_min >= range.m_max) )
{
// cout << " subrange done" << endl; // << currentRange << endl;
return it;
}

ScalarRange intersection;
// cout << " second="<< currentRange << endl;
if( intersectRange(range.min, range.max, currentRange.min, currentRange.max, intersection.min, intersection.max) )
if( intersectRange(range.m_min, range.m_max, currentRange.m_min, currentRange.m_max, intersection.m_min, intersection.m_max) )
{
// cout << " Intersect: [" << range.min << ", " << range.max << "]"<< endl;
result.push_back(intersection);
Expand Down Expand Up @@ -371,14 +371,14 @@ bool scalarRangeUnion(const ScalarRange& range0,
const ScalarRange& range1, ScalarRange &resultRange)
{
//cout << " union( " << range0 << ", " << range1 << ")=";
if( (range1.min > range0.max) || (range0.min > range1.max) )
if( (range1.m_min > range0.m_max) || (range0.m_min > range1.m_max) )
{
// cout << "0" << endl;
return false;
}

resultRange.min = range0.min < range1.min?range0.min:range1.min;
resultRange.max = range0.max > range1.max?range0.max:range1.max;
resultRange.m_min = range0.m_min < range1.m_min?range0.m_min:range1.m_min;
resultRange.m_max = range0.m_max > range1.m_max?range0.m_max:range1.m_max;

// cout << resultRange<<endl;
return true;
Expand All @@ -399,7 +399,7 @@ vector< ScalarRange >::const_iterator subRangeUnion(const ScalarRange &initialR
while(it != itEnd)
{
const ScalarRange &itRange = *it;
if( (itRange.min > range.max) )
if( (itRange.m_min > range.m_max) )
{
// cout << " -PUSH" << range << endl;
result.push_back(range);
Expand Down Expand Up @@ -456,10 +456,10 @@ void rangeUnion( const vector< ScalarRange > &firstLine,
{
ScalarRange &lastUnion = unionLine.back();
// cout << "LAST RANGE UPDATE COMPARE: last=" << lastUnion << " range=" << range;
if(range.min <= lastUnion.max && lastUnion.max >= range.max)
if(range.m_min <= lastUnion.m_max && lastUnion.m_max >= range.m_max)
{
//cout << " !UPDATE ONLY" << endl;
lastUnion.max = range.max;
lastUnion.m_max = range.m_max;
itOne++;
continue;
}
Expand All @@ -486,46 +486,46 @@ bool scalarRangeDifference(const ScalarRange& diffRange,
{
//cout << srcRange << " - " << diffRange << " = ";
// the diffRange is left of srcRange ... no result
if(diffRange.max <= srcRange.min)
if(diffRange.m_max <= srcRange.m_min)
{
//cout << "0 (before)" << endl;
return false;
}

// the diff covers the src
// the src is (partially) occluded
if(diffRange.min <= srcRange.min)
if(diffRange.m_min <= srcRange.m_min)
{
if(diffRange.max >= srcRange.max )
if(diffRange.m_max >= srcRange.m_max )
{
srcRange.min = srcRange.max;
srcRange.m_min = srcRange.m_max;
//cout << "0 (occlusion)" << endl;
return false;
}
// else... adjust the srcRange and make it smaller
srcRange.min = diffRange.max;
srcRange.m_min = diffRange.m_max;
//cout << "0 partial occlusion, leftover = " << srcRange << endl;
return false;

}

// intersection of the ranges
if( (diffRange.min >= srcRange.min) )
if( (diffRange.m_min >= srcRange.m_min) )
{
resultRange.min = srcRange.min;
resultRange.max = diffRange.min;
resultRange.m_min = srcRange.m_min;
resultRange.m_max = diffRange.m_min;

// left over on the right side
if(diffRange.max <= srcRange.max)
if(diffRange.m_max <= srcRange.m_max)
{
srcRange.min = diffRange.max;
srcRange.m_min = diffRange.m_max;
}
else
{
srcRange.min = srcRange.max;
srcRange.m_min = srcRange.m_max;
}
// cout << resultRange << " (intersection!) leftover " << srcRange << endl;
if (tequals(resultRange.max, resultRange.min, GRID_RANGE_TOL)) {
if (tequals(resultRange.m_max, resultRange.m_min, GRID_RANGE_TOL)) {
return false;
}

Expand All @@ -535,13 +535,13 @@ bool scalarRangeDifference(const ScalarRange& diffRange,
// srcRange is not occluded by diffRange which
// is right of scrRange
// there is nothing to remove: the result is the range
if(diffRange.min >= srcRange.max)
if(diffRange.m_min >= srcRange.m_max)
{
resultRange = srcRange;

// remove srcRange so it is
// not used twice
srcRange.min = srcRange.max;
srcRange.m_min = srcRange.m_max;
// cout << resultRange << " (all in!) leftover " << srcRange << endl;
return true;
}
Expand All @@ -563,9 +563,9 @@ vector< ScalarRange >::const_iterator subRangeDifference(
{
const ScalarRange &itRange = *it;
// cout << " itRange=" << itRange << endl;
if( (itRange.min >= range.max))
if( (itRange.m_min >= range.m_max))
{
if (!tequals(range.min, range.max, GRID_RANGE_TOL))
if (!tequals(range.m_min, range.m_max, GRID_RANGE_TOL))
result.push_back(range);
//cout << "subRangeDifference return" << endl;
return it;
Expand All @@ -577,7 +577,7 @@ vector< ScalarRange >::const_iterator subRangeDifference(
// cout << " PUSHx " << difference << endl;
result.push_back(difference);
}
if(range.min >= range.max) // the leftover range has no length
if(range.m_min >= range.m_max) // the leftover range has no length
{
// cout << "no left over" << endl;
return it;
Expand All @@ -586,7 +586,7 @@ vector< ScalarRange >::const_iterator subRangeDifference(
it ++;
}
// add the left over (if any)
if(range.max > range.min && !tequals(range.min, range.max, GRID_RANGE_TOL))
if(range.m_max > range.m_min && !tequals(range.m_min, range.m_max, GRID_RANGE_TOL))
{
// cout << "add_left_over =" << range << endl;
result.push_back(range);
Expand Down Expand Up @@ -804,7 +804,7 @@ void rangeTrim(const vector<ScalarRange> &src, Scalar cutOff, vector<ScalarRange
for(size_t i=0; i < src.size(); i++ )
{
const ScalarRange range = src[i];
if( !tequals(range.max, range.min, cutOff) )
if( !tequals(range.m_max, range.m_min, cutOff) )
{
result.push_back(range);
}
Expand Down
14 changes: 7 additions & 7 deletions src/mgl/grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ namespace mgl

class ScalarRange {
public:
Scalar min;
Scalar max;
ScalarRange(Scalar a = 0, Scalar b = 0) : min(a), max(b) {}
Scalar m_min;
Scalar m_max;
ScalarRange(Scalar a = 0, Scalar b = 0) : m_min(a), m_max(b) {}
ScalarRange(const ScalarRange& original) {
this->min = original.min;
this->max = original.max;
this->m_min = original.m_min;
this->m_max = original.m_max;
}
ScalarRange& operator = (const ScalarRange& next) {
if( &next != this) {
this->min = next.min;
this->max = next.max;
this->m_min = next.m_min;
this->m_max = next.m_max;
}
return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/mgl/insets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ void mglToClipper(const SegmentVector &segmentTable, ClipperLib::Polygons &out_
size_t reverseIndex = loop.size()-1 -j;
const LineSegment2 &seg = loop[reverseIndex];
ClipperLib::IntPoint p;
p.X = seg.a[0] * DBLTOINT;
p.Y = seg.a[1] * DBLTOINT;
p.X = (UINT64)(seg.a[0] * DBLTOINT);
p.Y = (UINT64)(seg.a[1] * DBLTOINT);
poly.push_back(p);
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/mgl/mgl.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ win32 {
OBJECTS_DIR=.
QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
TARGET=../../../lib/mgl
DEFINES += _CRT_SECURE_NO_WARNINGS
}

mac {
INCLUDEPATH += /System/Library/Frameworks/CoreFoundation.framework/Versions/Current/Headers
LIBS += -framework CoreFoundation
}

QMAKE_CXXFLAGS += -fopenmp
!win32-msvc* {
QMAKE_CXXFLAGS += -fopenmp
}

SUBMODULES = ../../submodule

Expand Down
1 change: 1 addition & 0 deletions src/mgl/shrinky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ void mgl::createShellsForSliceUsingShrinky(const SegmentVector & outlinesSegment
}
catch(ShrinkyException &messup)
{
UNREFERENCED_PARAMETER(messup);
if(scadFile != 0x00)
{
static int counter =0;
Expand Down
9 changes: 6 additions & 3 deletions src/miracle_grue/miracle_grue.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ win32 {
DESTDIR=.
OBJECTS_DIR=.
TARGET=../../../bin/miracle_grue
QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
!win32-msvc* {
QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
}
DEFINES += _CRT_SECURE_NO_WARNINGS
}
target.path = /usr/bin

Expand Down Expand Up @@ -47,6 +50,6 @@ include($$OPTIONPARSER_BASE/optionparser.pro.inc)
// submodule/clp-parser

SOURCES += miracle_grue.cc
LIBS += ../../lib/libmgl.a


win32: LIBS += ../../lib/mgl.lib -lshell32
!win32: LIBS+= ../../lib/mgl.a