FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix some trivial warnings found by MSVC. NFC. · ruevs/solvespace@f6a774d · GitHub

Commit f6a774d

Browse files
authored andcommitted
Fix some trivial warnings found by MSVC. NFC.
Found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314) A bunch of implicit casts 'double' to 'float' and one 'int64_t' to 'unsigned'. .\src\platform\guiwin.cpp(1237): warning C4701: potentially uninitialized local variable 'cursorName' used .\src\platform\guiwin.cpp(1237): warning C4703: potentially uninitialized local pointer variable 'cursorName' used .\src\solvespace.cpp(805,30): warning C4456: declaration of 'gs' hides previous local declaration .\src\solvespace.cpp(715,17): message : see declaration of 'gs' .\src\solvespace.cpp(849,47): warning C4456: declaration of 'e' hides previous local declaration .\src\solvespace.cpp(847,29): message : see declaration of 'e' .\src\render\render.h(288,51): warning C4458: declaration of 'camera' hides class member .\src\render\render.h(271,17): message : see declaration of 'SolveSpace::SurfaceRenderer::camera' .\src\render\render.h(289,57): warning C4458: declaration of 'lighting' hides class member .\src\render\render.h(272,17): message : see declaration of 'SolveSpace::SurfaceRenderer::lighting'
1 parent bae84b2 commit f6a774d

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎src/export.cpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,13 +917,13 @@ void SolveSpaceUI::ExportMeshAsQ3doTo(FILE *f, SMesh *sm) {
917917
}
918918

919919
Vector faceNormal = t.Normal();
920-
auto a = q3d::Vector3(t.a.x/s, t.a.y/s, t.a.z/s);
921-
auto b = q3d::Vector3(t.b.x/s, t.b.y/s, t.b.z/s);
922-
auto c = q3d::Vector3(t.c.x/s, t.c.y/s, t.c.z/s);
923-
auto fn = q3d::Vector3(faceNormal.x, faceNormal.y, faceNormal.x);
924-
auto n1 = q3d::Vector3(t.normals[0].x, t.normals[0].y, t.normals[0].z);
925-
auto n2 = q3d::Vector3(t.normals[1].x, t.normals[1].y, t.normals[1].z);
926-
auto n3 = q3d::Vector3(t.normals[2].x, t.normals[2].y, t.normals[2].z);
920+
auto a = q3d::Vector3((float)(t.a.x/s), (float)(t.a.y/s), (float)(t.a.z/s));
921+
auto b = q3d::Vector3((float)(t.b.x/s), (float)(t.b.y/s), (float)(t.b.z/s));
922+
auto c = q3d::Vector3((float)(t.c.x/s), (float)(t.c.y/s), (float)(t.c.z/s));
923+
auto fn = q3d::Vector3((float)faceNormal.x, (float)faceNormal.y, (float)faceNormal.x);
924+
auto n1 = q3d::Vector3((float)t.normals[0].x, (float)t.normals[0].y, (float)t.normals[0].z);
925+
auto n2 = q3d::Vector3((float)t.normals[1].x, (float)t.normals[1].y, (float)t.normals[1].z);
926+
auto n3 = q3d::Vector3((float)t.normals[2].x, (float)t.normals[2].y, (float)t.normals[2].z);
927927
auto tri = q3d::CreateTriangle(builder, &a, &b, &c, &fn, &n1, &n2, &n3);
928928
materialTriangles[color].push_back(tri);
929929
}

‎src/platform/guiwin.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ class WindowImplWin32 final : public Window {
12271227
}
12281228

12291229
void SetCursor(Cursor cursor) override {
1230-
LPWSTR cursorName;
1230+
LPWSTR cursorName = IDC_ARROW;
12311231
switch(cursor) {
12321232
case Cursor::POINTER: cursorName = IDC_ARROW; break;
12331233
case Cursor::HAND: cursorName = IDC_HAND; break;

‎src/render/render.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ class SurfaceRenderer : public ViewportCanvas {
285285
const Camera &GetCamera() const override { return camera; }
286286

287287
// ViewportCanvas interface.
288-
void SetCamera(const Camera &camera) override { this->camera = camera; }
289-
void SetLighting(const Lighting &lighting) override { this->lighting = lighting; }
288+
void SetCamera(const Camera &cam) override { this->camera = cam; }
289+
void SetLighting(const Lighting &light) override { this->lighting = light; }
290290

291291
void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override;
292292
void DrawEdges(const SEdgeList &el, hStroke hcs) override;

‎src/solvespace.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
802802
case Command::AREA: {
803803
Group *g = SK.GetGroup(SS.GW.activeGroup);
804804
SS.GW.GroupSelection();
805-
auto const &gs = SS.GW.gs;
806805

807806
if(gs.faces > 0) {
808807
std::vector<uint32_t> faces;
@@ -844,8 +843,8 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
844843
if(gs.n > 0 && gs.n == gs.entities) {
845844
double perimeter = 0.0;
846845
for(int i = 0; i < gs.entities; i++) {
847-
Entity *e = SK.entity.FindById(gs.entity[i]);
848-
SEdgeList *el = e->GetOrGenerateEdges();
846+
Entity *en = SK.entity.FindById(gs.entity[i]);
847+
SEdgeList *el = en->GetOrGenerateEdges();
849848
for(const SEdge &e : el->l) {
850849
perimeter += e.b.Minus(e.a).Magnitude();
851850
}

‎src/textscreens.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ void TextWindow::ScreenStepDimGo(int link, uint32_t v) {
604604
if(time - SS.TW.stepDim.time < STEP_MILLIS) {
605605
SS.TW.stepDim.timer->RunAfterNextFrame();
606606
} else {
607-
SS.TW.stepDim.timer->RunAfter(time - SS.TW.stepDim.time - STEP_MILLIS);
607+
SS.TW.stepDim.timer->RunAfter((unsigned)(time - SS.TW.stepDim.time - STEP_MILLIS));
608608
}
609609
SS.TW.stepDim.time = time;
610610
} else {
@@ -758,7 +758,8 @@ void TextWindow::EditControlDone(std::string s) {
758758

759759
Group *g = SK.group.FindByIdNoOops(SS.TW.shown.group);
760760
if(!g) break;
761-
g->color = RgbaColor::FromFloat(rgb.x, rgb.y, rgb.z, g->color.alphaF());
761+
g->color = RgbaColor::FromFloat((float)rgb.x, (float)rgb.y, (float)rgb.z,
762+
g->color.alphaF());
762763

763764
SS.MarkGroupDirty(g->h);
764765
SS.GW.ClearSuper();

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL