Skip to content

Commit d7477e9

Browse files
committed
fix A LOT of compilation warnings
1 parent 2434741 commit d7477e9

20 files changed

+187
-180
lines changed

CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ include_directories(ext/fmt/include) # why needed ?
3636
# GraphCutOptimization
3737
add_subdirectory(ext/GraphCutOptimization)
3838
include_directories(ext/GraphCutOptimization/src) # why needed ?
39-
set_source_files_properties(ext/GraphCutOptimization/src/GCoptimization.h PROPERTIES COMPILE_OPTIONS "-Wnon-virtual-dtor;-Wunused-parameter")
4039

4140
# nlohmann/json
4241
add_subdirectory(ext/json)
@@ -57,44 +56,44 @@ add_compile_definitions(WINDOW_SIZE="3840x2160")
5756
# EXECUTABLES
5857
#################
5958

60-
add_executable(automatic_polycube ${SRCFILES} app/automatic_polycube)
59+
add_executable(automatic_polycube ${SRCFILES} app/automatic_polycube.cpp)
6160
target_link_libraries(automatic_polycube geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
6261

63-
add_executable(hex_mesh_viewer ${SRCFILES} app/hex_mesh_viewer)
62+
add_executable(hex_mesh_viewer ${SRCFILES} app/hex_mesh_viewer.cpp)
6463
target_link_libraries(hex_mesh_viewer geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
6564

66-
add_executable(labeling_viewer ${SRCFILES} app/labeling_viewer)
65+
add_executable(labeling_viewer ${SRCFILES} app/labeling_viewer.cpp)
6766
target_link_libraries(labeling_viewer geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
6867

69-
add_executable(labeling_painter ${SRCFILES} app/labeling_painter)
68+
add_executable(labeling_painter ${SRCFILES} app/labeling_painter.cpp)
7069
target_link_libraries(labeling_painter geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
7170

72-
add_executable(extract_surface ${SRCFILES} app/extract_surface)
71+
add_executable(extract_surface ${SRCFILES} app/extract_surface.cpp)
7372
target_link_libraries(extract_surface geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
7473

75-
add_executable(volume_labeling ${SRCFILES} app/volume_labeling)
74+
add_executable(volume_labeling ${SRCFILES} app/volume_labeling.cpp)
7675
target_link_libraries(volume_labeling geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
7776

78-
add_executable(naive_labeling ${SRCFILES} app/naive_labeling)
77+
add_executable(naive_labeling ${SRCFILES} app/naive_labeling.cpp)
7978
target_link_libraries(naive_labeling geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
8079

81-
add_executable(graphcut_labeling ${SRCFILES} app/graphcut_labeling)
80+
add_executable(graphcut_labeling ${SRCFILES} app/graphcut_labeling.cpp)
8281
target_link_libraries(graphcut_labeling geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
8382

84-
add_executable(ovm_io ${SRCFILES} app/ovm_io)
83+
add_executable(ovm_io ${SRCFILES} app/ovm_io.cpp)
8584
target_link_libraries(ovm_io geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
8685

87-
add_executable(areas_to_tilt ${SRCFILES} app/areas_to_tilt)
86+
add_executable(areas_to_tilt ${SRCFILES} app/areas_to_tilt.cpp)
8887
target_link_libraries(areas_to_tilt geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
8988

90-
add_executable(mesh_stats ${SRCFILES} app/mesh_stats)
89+
add_executable(mesh_stats ${SRCFILES} app/mesh_stats.cpp)
9190
target_link_libraries(mesh_stats geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
9291

93-
add_executable(labeling_stats ${SRCFILES} app/labeling_stats)
92+
add_executable(labeling_stats ${SRCFILES} app/labeling_stats.cpp)
9493
target_link_libraries(labeling_stats geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
9594

96-
add_executable(halfedge_movements ${SRCFILES} app/halfedge_movements)
95+
add_executable(halfedge_movements ${SRCFILES} app/halfedge_movements.cpp)
9796
target_link_libraries(halfedge_movements geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)
9897

99-
add_executable(flip_normals ${SRCFILES} app/flip_normals)
98+
add_executable(flip_normals ${SRCFILES} app/flip_normals.cpp)
10099
target_link_libraries(flip_normals geogram geogram_gfx ${GLFW_LIBRARIES} fmt::fmt gco nlohmann_json)

app/graphcut_labeling.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -144,44 +144,44 @@ class GraphCutLabelingApp : public LabelingViewerApp {
144144
ImGui::SliderFloat("+X",&new_data_cost_[0],0.0f,new_data_cost_upper_bound_);
145145
ImGui::PopStyleColor();
146146
ImGui::SameLine();
147-
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",selected_chart_data_cost_stats_.min[0],
148-
selected_chart_data_cost_stats_.max[0],
149-
selected_chart_data_cost_stats_.avg[0]);
147+
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",(double) selected_chart_data_cost_stats_.min[0],
148+
(double) selected_chart_data_cost_stats_.max[0],
149+
(double) selected_chart_data_cost_stats_.avg[0]);
150150
ImGui::PushStyleColor(ImGuiCol_Text, labeling_colors_.color_as_ImVec4( (std::size_t) 1)); // change the text color
151151
ImGui::SliderFloat("-X",&new_data_cost_[1],0.0f,new_data_cost_upper_bound_);
152152
ImGui::PopStyleColor();
153153
ImGui::SameLine();
154-
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",selected_chart_data_cost_stats_.min[1],
155-
selected_chart_data_cost_stats_.max[1],
156-
selected_chart_data_cost_stats_.avg[1]);
154+
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",(double) selected_chart_data_cost_stats_.min[1],
155+
(double) selected_chart_data_cost_stats_.max[1],
156+
(double) selected_chart_data_cost_stats_.avg[1]);
157157
ImGui::PushStyleColor(ImGuiCol_Text, labeling_colors_.color_as_ImVec4( (std::size_t) 2)); // change the text color
158158
ImGui::SliderFloat("+Y",&new_data_cost_[2],0.0f,new_data_cost_upper_bound_);
159159
ImGui::PopStyleColor();
160160
ImGui::SameLine();
161-
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",selected_chart_data_cost_stats_.min[2],
162-
selected_chart_data_cost_stats_.max[2],
163-
selected_chart_data_cost_stats_.avg[2]);
161+
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",(double) selected_chart_data_cost_stats_.min[2],
162+
(double) selected_chart_data_cost_stats_.max[2],
163+
(double) selected_chart_data_cost_stats_.avg[2]);
164164
ImGui::PushStyleColor(ImGuiCol_Text, labeling_colors_.color_as_ImVec4( (std::size_t) 3)); // change the text color
165165
ImGui::SliderFloat("-Y",&new_data_cost_[3],0.0f,new_data_cost_upper_bound_);
166166
ImGui::PopStyleColor();
167167
ImGui::SameLine();
168-
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",selected_chart_data_cost_stats_.min[3],
169-
selected_chart_data_cost_stats_.max[3],
170-
selected_chart_data_cost_stats_.avg[3]);
168+
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",(double) selected_chart_data_cost_stats_.min[3],
169+
(double) selected_chart_data_cost_stats_.max[3],
170+
(double) selected_chart_data_cost_stats_.avg[3]);
171171
ImGui::PushStyleColor(ImGuiCol_Text, labeling_colors_.color_as_ImVec4( (std::size_t) 4)); // change the text color
172172
ImGui::SliderFloat("+Z",&new_data_cost_[4],0.0f,new_data_cost_upper_bound_);
173173
ImGui::PopStyleColor();
174174
ImGui::SameLine();
175-
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",selected_chart_data_cost_stats_.min[4],
176-
selected_chart_data_cost_stats_.max[4],
177-
selected_chart_data_cost_stats_.avg[4]);
175+
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",(double) selected_chart_data_cost_stats_.min[4],
176+
(double) selected_chart_data_cost_stats_.max[4],
177+
(double) selected_chart_data_cost_stats_.avg[4]);
178178
ImGui::PushStyleColor(ImGuiCol_Text, labeling_colors_.color_as_ImVec4( (std::size_t) 5)); // change the text color
179179
ImGui::SliderFloat("-Z",&new_data_cost_[5],0.0f,new_data_cost_upper_bound_);
180180
ImGui::PopStyleColor();
181181
ImGui::SameLine();
182-
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",selected_chart_data_cost_stats_.min[5],
183-
selected_chart_data_cost_stats_.max[5],
184-
selected_chart_data_cost_stats_.avg[5]);
182+
ImGui::Text("min:%6.2f max:%6.2f avg:%6.2f",(double) selected_chart_data_cost_stats_.min[5],
183+
(double) selected_chart_data_cost_stats_.max[5],
184+
(double) selected_chart_data_cost_stats_.avg[5]);
185185
if(ImGui::Button("Apply")) {
186186
std::array<float,6> per_label_shift = {
187187
new_data_cost_[0] - selected_chart_data_cost_stats_.avg[0],
@@ -196,7 +196,7 @@ class GraphCutLabelingApp : public LabelingViewerApp {
196196
gcl.neighbors__set__compactness_based(compactness_coeff_);
197197
for(index_t f : static_labeling_graph_.charts[selected_chart_].facets) { // for each facet of the current chart
198198
FOR(l,6) {
199-
GraphCutLabeling::shift_data_cost(data_cost_,f,l,per_label_shift[l]); // modify the local data cost vector
199+
GraphCutLabeling::shift_data_cost(data_cost_,(GCoptimization::SiteID) f,l,per_label_shift[l]); // modify the local data cost vector
200200
}
201201
}
202202
gcl.data_cost__set__all_at_once(data_cost_); // use the local data cost vector in the optimization

ext/GraphCutOptimization/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SET(GCO_HEADERS
77
src/graph.h
88
src/block.h
99
src/GCoptimization.h
10+
src/energy.h
1011
)
1112

1213
SET(GCO_SOURCES

ext/GraphCutOptimization/src/GCoptimization.cpp

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -89,36 +89,38 @@ void GCException::Report()
8989
GCoptimization::GCoptimization(SiteID nSites, LabelID nLabels)
9090
: m_num_labels(nLabels)
9191
, m_num_sites(nSites)
92+
, m_labeling(new LabelID[nSites])
93+
, m_lookupSiteVar(new SiteID[nSites])
94+
, m_labelTable(new LabelID[nLabels])
95+
, m_stepsThisCycle(0)
96+
, m_stepsThisCycleTotal(0)
97+
, m_random_label_order(false)
9298
, m_datacostIndividual(0)
9399
, m_smoothcostIndividual(0)
100+
, m_labelingDataCosts(new EnergyTermType[nSites])
101+
, m_labelCounts(new SiteID[nLabels])
102+
, m_activeLabelCounts(new SiteID[m_num_labels])
94103
, m_labelcostsAll(0)
95104
, m_labelcostsByLabel(0)
96105
, m_labelcostCount(0)
97-
, m_smoothcostFn(0)
106+
, m_labelingInfoDirty(true)
107+
, m_verbosity(0)
98108
, m_datacostFn(0)
109+
, m_smoothcostFn(0)
110+
, m_beforeExpansionEnergy(0)
111+
, m_numNeighbors(0)
99112
, m_numNeighborsTotal(0)
113+
, m_giveSmoothEnergyInternal(0)
100114
, m_queryActiveSitesExpansion(&GCoptimization::queryActiveSitesExpansion<DataCostFnFromArray>)
101-
, m_setupDataCostsSwap(0)
102115
, m_setupDataCostsExpansion(0)
103-
, m_setupSmoothCostsSwap(0)
104116
, m_setupSmoothCostsExpansion(0)
117+
, m_setupDataCostsSwap(0)
118+
, m_setupSmoothCostsSwap(0)
105119
, m_applyNewLabeling(0)
106120
, m_updateLabelingDataCosts(0)
107-
, m_giveSmoothEnergyInternal(0)
108-
, m_solveSpecialCases(&GCoptimization::solveSpecialCases<DataCostFnFromArray>)
109121
, m_datacostFnDelete(0)
110122
, m_smoothcostFnDelete(0)
111-
, m_random_label_order(false)
112-
, m_verbosity(0)
113-
, m_labelingInfoDirty(true)
114-
, m_lookupSiteVar(new SiteID[nSites])
115-
, m_labeling(new LabelID[nSites])
116-
, m_labelTable(new LabelID[nLabels])
117-
, m_labelingDataCosts(new EnergyTermType[nSites])
118-
, m_labelCounts(new SiteID[nLabels])
119-
, m_activeLabelCounts(new SiteID[m_num_labels])
120-
, m_stepsThisCycle(0)
121-
, m_stepsThisCycleTotal(0)
123+
, m_solveSpecialCases(&GCoptimization::solveSpecialCases<DataCostFnFromArray>)
122124
{
123125
if ( nLabels <= 1 ) handleError("Number of labels must be >= 2");
124126
if ( nSites <= 0 ) handleError("Number of sites must be >= 1");
@@ -132,8 +134,8 @@ GCoptimization::GCoptimization(SiteID nSites, LabelID nLabels)
132134
handleError("Not enough memory.");
133135
}
134136

135-
memset(m_labeling, 0, m_num_sites*sizeof(LabelID));
136-
memset(m_lookupSiteVar,-1,m_num_sites*sizeof(SiteID));
137+
memset(m_labeling, 0, (size_t) m_num_sites * sizeof(LabelID));
138+
memset(m_lookupSiteVar,-1, (size_t) m_num_sites * sizeof(SiteID));
137139
setLabelOrder(false);
138140
specializeSmoothCostFunctor(SmoothCostFnPotts());
139141
}
@@ -739,7 +741,7 @@ void GCoptimization::setDataCost(SiteID s, LabelID l, EnergyTermType e) {
739741
if ( !m_datacostIndividual )
740742
{
741743
EnergyTermType* table = new EnergyTermType[m_num_sites*m_num_labels];
742-
memset(table, 0, m_num_sites*m_num_labels*sizeof(EnergyTermType));
744+
memset(table, 0, (size_t) m_num_sites * (size_t) m_num_labels * sizeof(EnergyTermType));
743745
specializeDataCostFunctor(DataCostFnFromArray(table, m_num_labels));
744746
m_datacostIndividual = table;
745747
m_labelingInfoDirty = true;
@@ -807,7 +809,7 @@ void GCoptimization::setSmoothCost(LabelID l1, LabelID l2, EnergyTermType e){
807809
if ( !m_smoothcostIndividual )
808810
{
809811
EnergyTermType* table = new EnergyTermType[m_num_labels*m_num_labels];
810-
memset(table, 0, m_num_labels*m_num_labels*sizeof(EnergyTermType));
812+
memset(table, 0, (size_t) m_num_labels * (size_t) m_num_labels * sizeof(EnergyTermType));
811813
specializeSmoothCostFunctor(SmoothCostFnFromArray(table, m_num_labels));
812814
m_smoothcostIndividual = table;
813815
}
@@ -864,13 +866,13 @@ void GCoptimization::setLabelSubsetCost(LabelID* labels, LabelID numLabels, Ener
864866

865867
if ( !m_labelcostsByLabel ) {
866868
m_labelcostsByLabel = new LabelCostIter*[m_num_labels];
867-
memset(m_labelcostsByLabel, 0, m_num_labels*sizeof(void*));
869+
memset(m_labelcostsByLabel, 0, (size_t) m_num_labels*sizeof(void*));
868870
}
869871

870872
// If this particular subset already has a cost, simply replace it.
871873
for ( LabelCostIter* lci = m_labelcostsByLabel[labels[0]]; lci; lci = lci->next ) {
872874
if ( numLabels == lci->node->numLabels ) {
873-
if ( !memcmp(labels, lci->node->labels, numLabels*sizeof(LabelID)) ) {
875+
if ( !memcmp(labels, lci->node->labels, (size_t) numLabels * sizeof(LabelID)) ) {
874876
// This label subset already exists, so just update the cost and return
875877
lci->node->cost = cost;
876878
return;
@@ -889,7 +891,7 @@ void GCoptimization::setLabelSubsetCost(LabelID* labels, LabelID numLabels, Ener
889891
lc->aux = -1;
890892
lc->numLabels = numLabels;
891893
lc->labels = new LabelID[numLabels];
892-
memcpy(lc->labels, labels, numLabels*sizeof(LabelID));
894+
memcpy(lc->labels, labels, (size_t) numLabels * sizeof(LabelID));
893895
slist_prepend(m_labelcostsAll, lc);
894896
for ( LabelID i = 0; i < numLabels; ++i ) {
895897
LabelCostIter* lci = new LabelCostIter;
@@ -903,7 +905,7 @@ void GCoptimization::setLabelSubsetCost(LabelID* labels, LabelID numLabels, Ener
903905
void GCoptimization::whatLabel(SiteID start, SiteID count, LabelID* labeling)
904906
{
905907
assert(start >= 0 && start+count <= m_num_sites);
906-
memcpy(labeling, m_labeling+start, count*sizeof(LabelID));
908+
memcpy(labeling, m_labeling+start, (size_t) count * sizeof(LabelID));
907909
}
908910

909911
//-------------------------------------------------------------------
@@ -1062,8 +1064,8 @@ void GCoptimization::setLabelOrder(const LabelID* order, LabelID size)
10621064
if ( order[i] < 0 || order[i] >= m_num_labels )
10631065
handleError("Invalid label id in setLabelOrder");
10641066
m_random_label_order = false;
1065-
memcpy(m_labelTable,order,size*sizeof(LabelID));
1066-
memset(m_labelTable+size,-1,(m_num_labels-size)*sizeof(LabelID));
1067+
memcpy(m_labelTable,order, (size_t) size * sizeof(LabelID));
1068+
memset(m_labelTable+size,-1, (size_t) (m_num_labels-size) * sizeof(LabelID));
10671069
}
10681070

10691071
//------------------------------------------------------------------
@@ -1103,7 +1105,7 @@ GCoptimization::EnergyType GCoptimization::setupLabelCostsExpansion(SiteID size,
11031105
{
11041106
// For sparse data costs, things are more complicated, because we must ensure that
11051107
// no label cost for a fixed (non-active) non-alpha label is encoded in the graph.
1106-
memset(m_activeLabelCounts,0,m_num_labels*sizeof(SiteID));
1108+
memset(m_activeLabelCounts,0, (size_t) m_num_labels * sizeof(SiteID));
11071109
for ( SiteID i = 0; i < size; ++i )
11081110
m_activeLabelCounts[m_labeling[activeSites[i]]]++;
11091111

@@ -1164,7 +1166,7 @@ void GCoptimization::updateLabelingInfo(bool updateCounts, bool updateActive, bo
11641166
{
11651167
if ( updateCounts )
11661168
{
1167-
memset(m_labelCounts,0,m_num_labels*sizeof(SiteID));
1169+
memset(m_labelCounts,0, (size_t) m_num_labels * sizeof(SiteID));
11681170
for ( SiteID i = 0; i < m_num_sites; ++i )
11691171
m_labelCounts[m_labeling[i]]++;
11701172
}
@@ -1173,8 +1175,7 @@ void GCoptimization::updateLabelingInfo(bool updateCounts, bool updateActive, bo
11731175
{
11741176
for ( LabelCost* lc = m_labelcostsAll; lc; lc = lc->next )
11751177
lc->active = false;
1176-
1177-
EnergyType energy = 0;
1178+
11781179
for ( LabelID l = 0; l < m_num_labels; ++l )
11791180
if ( m_labelCounts[l] )
11801181
for ( LabelCostIter* lci = m_labelcostsByLabel[l]; lci; lci = lci->next )
@@ -1187,7 +1188,7 @@ void GCoptimization::updateLabelingInfo(bool updateCounts, bool updateActive, bo
11871188
if (m_updateLabelingDataCosts)
11881189
(this->*m_updateLabelingDataCosts)();
11891190
else
1190-
memset(m_labelingDataCosts,0,m_num_sites*sizeof(EnergyTermType));
1191+
memset(m_labelingDataCosts,0, (size_t) m_num_sites * sizeof(EnergyTermType));
11911192
}
11921193
}
11931194

@@ -1776,14 +1777,14 @@ void GCoptimization::DataCostFnSparse::set(LabelID l, const SparseDataCost* cost
17761777
//
17771778
if (!m_buckets) {
17781779
m_buckets = new DataCostBucket[m_num_labels*m_buckets_per_label];
1779-
memset(m_buckets, 0, m_num_labels*m_buckets_per_label*sizeof(DataCostBucket));
1780+
memset(m_buckets, 0, (size_t) m_num_labels * (size_t) m_buckets_per_label * sizeof(DataCostBucket));
17801781
}
17811782

17821783
DataCostBucket* b = &m_buckets[l*m_buckets_per_label];
17831784
if (b->begin)
17841785
delete [] b->begin;
17851786
SparseDataCost* next = new SparseDataCost[count];
1786-
memcpy(next,costs,count*sizeof(SparseDataCost));
1787+
memcpy(next,costs, (size_t) count * sizeof(SparseDataCost));
17871788

17881789
//
17891790
// Scan the list of costs and remember pointers to delimit the 'buckets', i.e. where

ext/GraphCutOptimization/src/GCoptimization.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@
110110
#include "graph.cpp"
111111
#include "maxflow.cpp"
112112

113+
// remove compiler warning about unused parameter
114+
template <class T>
115+
inline void ignore_unused(const T&) {}
116+
113117
/////////////////////////////////////////////////////////////////////
114118
// Utility functions, classes, and macros
115119
/////////////////////////////////////////////////////////////////////
@@ -212,6 +216,7 @@ class GCoptimization
212216
void setDataCostFunctor(DataCostFunctor* f);
213217
struct DataCostFunctor {
214218
virtual EnergyTermType compute(SiteID s, LabelID l) = 0;
219+
virtual ~DataCostFunctor() = default; // fixes -Wnon-virtual-dtor
215220
};
216221
// Set cost of assigning 'l' to a specific subset of sites.
217222
// The sites are listed as (SiteID,cost) pairs.
@@ -230,6 +235,7 @@ class GCoptimization
230235
void setSmoothCostFunctor(SmoothCostFunctor* f);
231236
struct SmoothCostFunctor {
232237
virtual EnergyTermType compute(SiteID s1, SiteID s2, LabelID l1, LabelID l2) = 0;
238+
virtual ~SmoothCostFunctor() = default; // fixes -Wnon-virtual-dtor
233239
};
234240

235241
// Sets the cost of using label in the solution.
@@ -358,7 +364,7 @@ class GCoptimization
358364
struct SmoothCostFnFromArray {
359365
SmoothCostFnFromArray(EnergyTermType* theArray, LabelID num_labels)
360366
: m_array(theArray), m_num_labels(num_labels){}
361-
OLGA_INLINE EnergyTermType compute(SiteID s1, SiteID s2, LabelID l1, LabelID l2){return m_array[l1*m_num_labels+l2];}
367+
OLGA_INLINE EnergyTermType compute(SiteID s1, SiteID s2, LabelID l1, LabelID l2){ignore_unused(s1); ignore_unused(s2); return m_array[l1*m_num_labels+l2];}
362368
private:
363369
const EnergyTermType* const m_array;
364370
const LabelID m_num_labels;
@@ -489,7 +495,7 @@ class GCoptimization
489495
class GreedyIter {
490496
public:
491497
GreedyIter(DataCostT& dc, SiteID numSites)
492-
: m_dc(dc), m_site(0), m_numSites(numSites), m_label(0), m_lbegin(0), m_lend(0)
498+
: m_site(0), m_dc(dc), m_numSites(numSites), m_label(0), m_lbegin(0), m_lend(0)
493499
{ }
494500

495501
OLGA_INLINE void start(const LabelID* labels, LabelID labelCount=1)

ext/GraphCutOptimization/src/LinkedBlockList.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ void LinkedBlockList::addFront(ListType item) {
1515
m_head_block_size = 0;
1616
}
1717

18-
m_head ->m_item[m_head_block_size] = item;
18+
m_head ->m_item[(unsigned char) m_head_block_size] = item;
1919
m_head_block_size++;
2020
}
2121

2222
/*********************************************************************/
2323

2424
ListType LinkedBlockList::next()
2525
{
26-
ListType toReturn = m_cursor -> m_item[m_cursor_ind];
26+
ListType toReturn = m_cursor -> m_item[(unsigned char) m_cursor_ind];
2727

2828
m_cursor_ind++;
2929

0 commit comments

Comments
 (0)