Skip to content

Commit ff890b1

Browse files
committed
common: fix bug in cList constructor #1229
1 parent af74b04 commit ff890b1

File tree

5 files changed

+13
-29
lines changed

5 files changed

+13
-29
lines changed

apps/Viewer/FirstPersonControls.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -157,36 +157,22 @@ void FirstPersonControls::processMovement(double deltaTime) {
157157
Eigen::Vector3d right = getRight();
158158
Eigen::Vector3d up = Eigen::Vector3d(0, 1, 0); // World up for flying
159159

160-
bool moved = false;
161-
162160
// WASD movement
163-
if (keys[GLFW_KEY_W]) {
161+
if (keys[GLFW_KEY_W])
164162
move(forward, velocity);
165-
moved = true;
166-
}
167-
if (keys[GLFW_KEY_S]) {
163+
if (keys[GLFW_KEY_S])
168164
move(-forward, velocity);
169-
moved = true;
170-
}
171-
if (keys[GLFW_KEY_A]) {
165+
if (keys[GLFW_KEY_A])
172166
move(-right, velocity);
173-
moved = true;
174-
}
175-
if (keys[GLFW_KEY_D]) {
167+
if (keys[GLFW_KEY_D])
176168
move(right, velocity);
177-
moved = true;
178-
}
179169

180170
// Vertical movement (flying)
181171
if (keys[GLFW_KEY_Q] || keys[GLFW_KEY_E]) {
182-
if (keys[GLFW_KEY_Q]) {
172+
if (keys[GLFW_KEY_Q])
183173
move(-up, velocity);
184-
moved = true;
185-
}
186-
if (keys[GLFW_KEY_E]) {
174+
if (keys[GLFW_KEY_E])
187175
move(up, velocity);
188-
moved = true;
189-
}
190176
}
191177
}
192178

apps/Viewer/Renderer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,6 @@ void Renderer::RenderCameras(const Window& window) {
11321132

11331133
cameraShader->Use();
11341134

1135-
// Get the currently selected camera from the window's camera
1136-
MVS::IIndex selectedCamID = window.GetCamera().GetCurrentCamID();
1137-
11381135
cameraVAO->Bind();
11391136
cameraEBO->Bind();
11401137

apps/Viewer/UI.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,8 @@ void UI::ShowHelpDialog() {
748748
// Detect macOS for platform-specific shortcuts
749749
#ifdef __APPLE__
750750
const bool isMacOS = true;
751-
const char* cmdKey = "Cmd";
752751
#else
753752
const bool isMacOS = false;
754-
const char* cmdKey = "Ctrl";
755753
#endif
756754

757755
// File Operations

libs/Common/List.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ class cList
137137

138138
// construct a list from the contents of the range [first, last)
139139
template <class InputIt>
140-
cList(InputIt first, InputIt last, bool /*dummy*/) : _size(std::distance(first, last)), _vectorSize(_size), _vector((TYPE*)operator new[](static_cast<size_t>(_size) * sizeof(TYPE)))
140+
cList(InputIt first, InputIt last, bool /*dummy*/) : _size(0), _vectorSize(std::distance(first, last)), _vector(NULL)
141141
{
142+
if (_vectorSize == 0)
143+
return;
144+
_vector = (TYPE*)(operator new[] (static_cast<size_t>(_vectorSize) * sizeof(TYPE)));
142145
while (first != last)
143146
Insert(*first++);
144147
}

libs/MVS/Scene.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ bool Scene::EstimatePointCloudNormals(bool bRefine)
802802
// estimate normals using the views per point
803803
#ifdef SCENE_USE_OPENMP
804804
#pragma omp parallel for
805-
for (int64_t _ID=0; _ID<pointcloud.points.size(); ++_ID) {
805+
for (int64_t _ID=0; _ID<(int64_t)pointcloud.points.size(); ++_ID) {
806806
const IIndex ID(static_cast<IIndex>(_ID));
807807
#else
808808
FOREACH(ID, pointcloud.points) {
@@ -836,7 +836,7 @@ bool Scene::EstimatePointCloudNormals(bool bRefine)
836836
bool bImagesReloaded(false);
837837
#ifdef SCENE_USE_OPENMP
838838
#pragma omp parallel for
839-
for (int64_t _idx=0; _idx<images.size(); ++_idx) {
839+
for (int64_t _idx=0; _idx<(int64_t)images.size(); ++_idx) {
840840
const IIndex idx(static_cast<IIndex>(_idx));
841841
#else
842842
FOREACH(idx, images) {
@@ -952,7 +952,7 @@ bool Scene::EstimatePointCloudNormals(bool bRefine)
952952

953953
#ifdef SCENE_USE_OPENMP
954954
#pragma omp parallel for
955-
for (int64_t _ID=0; _ID<pointcloud.points.size(); ++_ID) {
955+
for (int64_t _ID=0; _ID<(int64_t)pointcloud.points.size(); ++_ID) {
956956
const IIndex ID(static_cast<IIndex>(_ID));
957957
#else
958958
FOREACH(ID, pointcloud.points) {

0 commit comments

Comments
 (0)