Skip to content

Commit d1f0648

Browse files
committed
addressing build warnings on windows
1 parent 58ef703 commit d1f0648

23 files changed

+238
-218
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173173

174174
build_windows:
175-
name: Build on Windows
175+
name: Build on ${{ matrix.config.name }}
176176
runs-on: ${{ matrix.config.os }}
177177
strategy:
178178
fail-fast: false

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ list(APPEND CMD "-D" "EMSCRIPTEN=${EMSCRIPTEN}")
128128
list(APPEND CMD "-D" "HDRVIEW_TARGET_ARCH=${HDRVIEW_TARGET_ARCH}")
129129
list(APPEND CMD "-P" "${CMAKE_SOURCE_DIR}/cmake/generate_version.cmake")
130130
add_custom_command(
131-
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp ${CMAKE_CURRENT_BINARY_DIR}/src/_version.cpp
131+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp ${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp
132132
COMMAND ${CMD}
133133
COMMENT "Generating git version file"
134134
)

src/app-file-io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ void HDRViewApp::close_image(int index)
591591
{
592592
parent_path = fs::weakly_canonical(parent_path);
593593
}
594-
catch (const std::exception &e)
594+
catch (const std::exception &)
595595
{
596596
// path probably doesn't exist anymore
597597
parent_path = fs::path();
@@ -677,6 +677,6 @@ void HDRViewApp::close_all_images()
677677
m_current = -1;
678678
m_reference = -1;
679679
m_active_directories.clear();
680-
m_image_loader.remove_watched_directories([](const fs::path &path) { return true; });
680+
m_image_loader.remove_watched_directories([](const fs::path &) { return true; });
681681
update_visibility(); // this also calls set_image_textures();
682682
}

src/app-windows.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void HDRViewApp::draw_developer_windows()
146146
if (spectrum.values.empty())
147147
continue;
148148
string name{white_point_name(wp)};
149-
ImPlot::PlotLine(name.c_str(), spectrum.values.data(), spectrum.values.size(),
149+
ImPlot::PlotLine(name.c_str(), spectrum.values.data(), (int)spectrum.values.size(),
150150
(spectrum.max_wavelength - spectrum.min_wavelength) /
151151
(spectrum.values.size() - 1),
152152
spectrum.min_wavelength);
@@ -169,11 +169,11 @@ void HDRViewApp::draw_developer_windows()
169169

170170
auto &xyz = CIE_XYZ_spectra();
171171
auto increment = (xyz.max_wavelength - xyz.min_wavelength) / xyz.values.size();
172-
ImPlot::PlotLine("X", (const float *)&xyz.values[0].x, xyz.values.size(), increment,
172+
ImPlot::PlotLine("X", (const float *)&xyz.values[0].x, (int)xyz.values.size(), increment,
173173
xyz.min_wavelength, ImPlotLineFlags_None, 0, sizeof(float3));
174-
ImPlot::PlotLine("Y", (const float *)&xyz.values[0].y, xyz.values.size(), increment,
174+
ImPlot::PlotLine("Y", (const float *)&xyz.values[0].y, (int)xyz.values.size(), increment,
175175
xyz.min_wavelength, ImPlotLineFlags_None, 0, sizeof(float3));
176-
ImPlot::PlotLine("Z", (const float *)&xyz.values[0].z, xyz.values.size(), increment,
176+
ImPlot::PlotLine("Z", (const float *)&xyz.values[0].z, (int)xyz.values.size(), increment,
177177
xyz.min_wavelength, ImPlotLineFlags_None, 0, sizeof(float3));
178178

179179
ImPlot::PopStyleVar(3);
@@ -580,16 +580,16 @@ void HDRViewApp::draw_file_window()
580580
bool use_clipper = m_file_list_mode == 0;
581581
ImGuiListClipper clipper;
582582
if (use_clipper)
583-
clipper.Begin(m_visible_images.size());
583+
clipper.Begin((int)m_visible_images.size());
584584
// the loop conditions here are to execute this outer loop once if we are not using the clipper, and execute it
585585
// as long as clipper.Step() returns true otherwise
586586
for (int iter = 0; (!use_clipper && iter < 1) || (use_clipper && clipper.Step()); ++iter)
587587
{
588588
int start = use_clipper ? clipper.DisplayStart : 0;
589-
int end = use_clipper ? clipper.DisplayEnd : m_visible_images.size();
589+
int end = use_clipper ? clipper.DisplayEnd : (int)m_visible_images.size();
590590
for (int vi = start; vi < end; ++vi)
591591
{
592-
int i = m_visible_images[vi];
592+
int i = (int)m_visible_images[vi];
593593
auto &img = m_images[i];
594594
bool is_current = m_current == i;
595595
bool is_reference = m_reference == i;
@@ -640,9 +640,9 @@ void HDRViewApp::draw_file_window()
640640
std::string menu_label = fmt::format(reveal_in_file_manager_text(), file_manager_name());
641641
if (ImGui::MenuItem(menu_label.c_str()))
642642
{
643-
string filename, entry_fn;
644-
split_zip_entry(img->filename, filename, entry_fn);
645-
show_in_file_manager(filename.c_str());
643+
string fn, entry_fn;
644+
split_zip_entry(img->filename, fn, entry_fn);
645+
show_in_file_manager(fn.c_str());
646646
}
647647
#endif
648648
// Select as current image

src/app-zoom.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int HDRViewApp::next_visible_image_index(int index, Direction_ direction) const
199199

200200
int HDRViewApp::nth_visible_image_index(int n) const
201201
{
202-
return n < (int)m_visible_images.size() ? m_visible_images[n] : m_images.size();
202+
return int(n < (int)m_visible_images.size() ? m_visible_images[n] : m_images.size());
203203
// nth_matching_index(m_images, (size_t)n, [](size_t, const ImagePtr &img) { return img->visible; });
204204
}
205205

src/app.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ HDRViewApp::HDRViewApp(optional<float> force_exposure, optional<float> force_gam
606606
float4 bilerp = c00 * (1 - u) * (1 - v) + c10 * u * (1 - v) +
607607
c01 * (1 - u) * v + c11 * u * v;
608608

609-
for (size_t c = 0; c < img->channels.size(); ++c)
609+
for (int c = 0; c < (int)img->channels.size(); ++c)
610610
img->channels[c](x, y) =
611611
levels > 1 ? dither_quantize(bilerp[c], levels, x, y, dither) /
612612
(levels - 1.f)

src/box.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
/*!
1616
Box is an N-D interval.
1717
*/
18-
template <typename Vec_, typename Value_, size_t Dims_>
18+
template <typename Vec_, typename Value_, int Dims_>
1919
class Box
2020
{
2121
public:
22-
static constexpr size_t Dims = Dims_;
23-
using Value = Value_;
24-
using Vec = Vec_;
25-
using BoxT = Box<Vec, Value, Dims>;
22+
static constexpr int Dims = Dims_;
23+
using Value = Value_;
24+
using Vec = Vec_;
25+
using BoxT = Box<Vec, Value, Dims>;
2626

2727
Vec min; //!< The lower-bound of the interval
2828
Vec max; //!< The upper-bound of the interval
@@ -66,7 +66,7 @@ class Box
6666
/// Ensures that min[i] <= max[i] for each dimension i.
6767
BoxT &make_valid()
6868
{
69-
for (size_t i = 0; i < Dims; ++i)
69+
for (int i = 0; i < Dims; ++i)
7070
if (min[i] > max[i])
7171
std::swap(min[i], max[i]);
7272
return *this;
@@ -96,7 +96,7 @@ class Box
9696
}
9797
BoxT &enclose(const Vec &point)
9898
{
99-
for (size_t i = 0; i < Dims; ++i)
99+
for (int i = 0; i < Dims; ++i)
100100
{
101101
min[i] = std::min(point[i], min[i]);
102102
max[i] = std::max(point[i], max[i]);
@@ -105,7 +105,7 @@ class Box
105105
}
106106
BoxT &enclose(const BoxT &box)
107107
{
108-
for (size_t i = 0; i < Dims; ++i)
108+
for (int i = 0; i < Dims; ++i)
109109
{
110110
min[i] = std::min(box.min[i], min[i]);
111111
max[i] = std::max(box.max[i], max[i]);
@@ -114,7 +114,7 @@ class Box
114114
}
115115
BoxT &intersect(const BoxT &box)
116116
{
117-
for (size_t i = 0; i < Dims; ++i)
117+
for (int i = 0; i < Dims; ++i)
118118
{
119119
min[i] = std::max(box.min[i], min[i]);
120120
max[i] = std::min(box.max[i], max[i]);
@@ -150,22 +150,22 @@ class Box
150150
Vec center() const { return (max + min) / Value(2); }
151151
Vec clamp(Vec point) const
152152
{
153-
for (size_t i = 0; i < Dims; ++i) point[i] = std::min(std::max(point[i], min[i]), max[i]);
153+
for (int i = 0; i < Dims; ++i) point[i] = std::min(std::max(point[i], min[i]), max[i]);
154154
return point;
155155
}
156156
template <bool Inclusive = false>
157157
bool contains(const Vec &point) const
158158
{
159159
if constexpr (Inclusive)
160160
{
161-
for (size_t i = 0; i < Dims; ++i)
161+
for (int i = 0; i < Dims; ++i)
162162
if (point[i] <= min[i] || point[i] >= max[i])
163163
return false;
164164
return true;
165165
}
166166
else
167167
{
168-
for (size_t i = 0; i < Dims; ++i)
168+
for (int i = 0; i < Dims; ++i)
169169
if (point[i] < min[i] || point[i] > max[i])
170170
return false;
171171
return true;
@@ -176,14 +176,14 @@ class Box
176176
{
177177
if constexpr (Inclusive)
178178
{
179-
for (size_t i = 0; i < Dims; ++i)
179+
for (int i = 0; i < Dims; ++i)
180180
if (box.max[i] <= min[i] || box.min[i] >= max[i])
181181
return false;
182182
return true;
183183
}
184184
else
185185
{
186-
for (size_t i = 0; i < Dims; ++i)
186+
for (int i = 0; i < Dims; ++i)
187187
if (box.max[i] < min[i] || box.min[i] > max[i])
188188
return false;
189189
return true;
@@ -193,23 +193,23 @@ class Box
193193
{
194194
Value ret_val(1);
195195
Vec s = size();
196-
for (size_t i = 0; i < Dims; ++i) ret_val *= s[i];
196+
for (int i = 0; i < Dims; ++i) ret_val *= s[i];
197197
return ret_val;
198198
}
199199
Value area() const
200200
{
201201
Value ret_val(0);
202202
Vec s = size();
203-
for (size_t i = 0; i < Dims; ++i)
204-
for (size_t j = i + 1; j < Dims; j++) ret_val += s[i] * s[j];
203+
for (int i = 0; i < Dims; ++i)
204+
for (int j = i + 1; j < Dims; j++) ret_val += s[i] * s[j];
205205
return 2 * ret_val;
206206
}
207-
size_t major_axis() const
207+
int major_axis() const
208208
{
209-
size_t major = 0;
210-
Vec s = size();
209+
int major = 0;
210+
Vec s = size();
211211

212-
for (size_t i = 1; i < Dims; ++i)
212+
for (int i = 1; i < Dims; ++i)
213213
if (s[i] > s[major])
214214
major = i;
215215
return major;
@@ -226,22 +226,22 @@ class Box
226226
//-----------------------------------------------------------------------
227227
bool has_volume() const
228228
{
229-
for (size_t i = 0; i < Dims; ++i)
229+
for (int i = 0; i < Dims; ++i)
230230
if (max[i] <= min[i])
231231
return false;
232232
return true;
233233
}
234234
bool is_empty() const
235235
{
236-
for (size_t i = 0; i < Dims; ++i)
236+
for (int i = 0; i < Dims; ++i)
237237
if (max[i] < min[i])
238238
return true;
239239
return false;
240240
}
241241
//@}
242242
};
243243

244-
template <typename Vec, typename Value, size_t Dims>
244+
template <typename Vec, typename Value, int Dims>
245245
inline std::ostream &operator<<(std::ostream &o, const Box<Vec, Value, Dims> &b)
246246
{
247247
return o << "[(" << b.min << "),(" << b.max << ")]";

src/colormap.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void Colormap::initialize()
2222
{
2323
s_values[cmap].resize(ImPlot::GetColormapSize(cmap));
2424
for (size_t i = 0; i < s_values[cmap].size(); ++i)
25-
s_values[cmap][i] = ImGui::ColorConvertFloat4ToU32(ImPlot::GetColormapColor(i, cmap));
25+
s_values[cmap][i] = ImGui::ColorConvertFloat4ToU32(ImPlot::GetColormapColor((int)i, cmap));
2626
}
2727

2828
cmap = Colormap_Inferno;
@@ -113,7 +113,7 @@ void Colormap::initialize()
113113
IM_COL32(245, 248, 145, 255), IM_COL32(246, 250, 149, 255), IM_COL32(247, 251, 153, 255),
114114
IM_COL32(249, 252, 157, 255), IM_COL32(250, 253, 160, 255), IM_COL32(252, 254, 164, 255),
115115
};
116-
ImPlot::AddColormap("Inferno", (const ImU32 *)s_values[cmap].data(), s_values[cmap].size(), false);
116+
ImPlot::AddColormap("Inferno", (const ImU32 *)s_values[cmap].data(), (int)s_values[cmap].size(), false);
117117

118118
cmap = Colormap_Turbo;
119119
s_values[cmap] = vector<ImU32>{
@@ -203,7 +203,7 @@ void Colormap::initialize()
203203
IM_COL32(139, 9, 1, 255), IM_COL32(135, 8, 1, 255), IM_COL32(132, 7, 1, 255),
204204
IM_COL32(129, 6, 2, 255), IM_COL32(125, 5, 2, 255), IM_COL32(122, 4, 2, 255),
205205
};
206-
ImPlot::AddColormap("Turbo", (const ImU32 *)s_values[cmap].data(), s_values[cmap].size(), false);
206+
ImPlot::AddColormap("Turbo", (const ImU32 *)s_values[cmap].data(), (int)s_values[cmap].size(), false);
207207

208208
cmap = Colormap_IceFire;
209209
s_values[cmap] = vector<ImU32>{
@@ -293,7 +293,7 @@ void Colormap::initialize()
293293
IM_COL32(252, 198, 153, 255), IM_COL32(252, 200, 157, 255), IM_COL32(253, 203, 161, 255),
294294
IM_COL32(253, 206, 164, 255), IM_COL32(254, 209, 168, 255), IM_COL32(254, 211, 172, 255),
295295
};
296-
ImPlot::AddColormap("IceFire", (const ImU32 *)s_values[cmap].data(), s_values[cmap].size(), false);
296+
ImPlot::AddColormap("IceFire", (const ImU32 *)s_values[cmap].data(), (int)s_values[cmap].size(), false);
297297

298298
cmap = Colormap_CoolWarm;
299299
s_values[cmap] = {
@@ -383,16 +383,16 @@ void Colormap::initialize()
383383
IM_COL32(187, 26, 43, 255), IM_COL32(185, 22, 42, 255), IM_COL32(184, 17, 41, 255),
384384
IM_COL32(182, 13, 40, 255), IM_COL32(181, 8, 39, 255), IM_COL32(179, 3, 38, 255),
385385
};
386-
ImPlot::AddColormap("CoolWarm", (const ImU32 *)s_values[cmap].data(), s_values[cmap].size(), false);
386+
ImPlot::AddColormap("CoolWarm", (const ImU32 *)s_values[cmap].data(), (int)s_values[cmap].size(), false);
387387

388388
cmap = Colormap_AbsGreys;
389389
s_values[cmap] = {IM_COL32(255, 255, 255, 255), IM_COL32(0, 0, 0, 255), IM_COL32(255, 255, 255, 255)};
390-
ImPlot::AddColormap("Abs Grey", (const ImU32 *)s_values[cmap].data(), s_values[cmap].size(), false);
390+
ImPlot::AddColormap("Abs Grey", (const ImU32 *)s_values[cmap].data(), (int)s_values[cmap].size(), false);
391391

392392
for (cmap = 0; cmap < Colormap_COUNT; ++cmap)
393393
{
394394
s_textures[cmap] = std::make_unique<Texture>(
395-
Texture::PixelFormat::RGBA, Texture::ComponentFormat::UInt8, int2(s_values[cmap].size(), 1),
395+
Texture::PixelFormat::RGBA, Texture::ComponentFormat::UInt8, int2((int)s_values[cmap].size(), 1),
396396
Texture::InterpolationMode::Nearest,
397397
cmap <= ImPlotColormap_Paired ? Texture::InterpolationMode::Nearest : Texture::InterpolationMode::Bilinear,
398398
Texture::WrapMode::ClampToEdge, 1, Texture::TextureFlags::ShaderRead);
@@ -420,6 +420,6 @@ const std::vector<ImU32> &Colormap::values(Colormap_ idx)
420420

421421
ImVec4 Colormap::sample(Colormap_ idx, float t)
422422
{
423-
float cmap_size = Colormap::values(idx).size();
423+
float cmap_size = (float)Colormap::values(idx).size();
424424
return ImPlot::SampleColormap(saturate(lerp(0.5f / cmap_size, (cmap_size - 0.5f) / cmap_size, t)), idx);
425425
}

src/colorspace.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,14 @@ static const TabulatedSpectrum<float> s_Illuminant_A = {
343343

344344
static const TabulatedSpectrum<float> s_Illuminant_B = {
345345
{// CIE standard illuminant B (obsolete)
346-
2.40, 4.00, 5.60, 7.60, 9.60, 12.40, 15.20, 18.80, 22.40, 26.85, 31.30, 36.18, 41.30,
347-
46.62, 52.10, 57.70, 63.20, 68.37, 73.10, 77.31, 80.80, 83.44, 85.40, 86.88, 88.30, 90.08,
348-
92.00, 93.75, 95.20, 96.23, 96.50, 95.71, 94.20, 92.37, 90.70, 89.65, 89.50, 90.43, 92.20,
349-
94.46, 96.90, 99.16, 101.00, 102.20, 102.80, 102.92, 102.60, 101.90, 101.00, 100.07, 99.20, 98.44,
350-
98.00, 98.08, 98.50, 99.06, 99.70, 100.36, 101.00, 101.56, 102.20, 103.05, 103.90, 104.59, 105.00,
351-
105.08, 104.90, 104.55, 103.90, 102.84, 101.60, 100.38, 99.10, 97.70, 96.20, 94.60, 92.90, 91.10,
352-
89.40, 88.00, 86.90, 85.90, 85.20, 84.80, 84.70, 84.90, 85.40},
346+
2.40f, 4.00f, 5.60f, 7.60f, 9.60f, 12.40f, 15.20f, 18.80f, 22.40f, 26.85f, 31.30f,
347+
36.18f, 41.30f, 46.62f, 52.10f, 57.70f, 63.20f, 68.37f, 73.10f, 77.31f, 80.80f, 83.44f,
348+
85.40f, 86.88f, 88.30f, 90.08f, 92.00f, 93.75f, 95.20f, 96.23f, 96.50f, 95.71f, 94.20f,
349+
92.37f, 90.70f, 89.65f, 89.50f, 90.43f, 92.20f, 94.46f, 96.90f, 99.16f, 101.00f, 102.20f,
350+
102.80f, 102.92f, 102.60f, 101.90f, 101.00f, 100.07f, 99.20f, 98.44f, 98.00f, 98.08f, 98.50f,
351+
99.06f, 99.70f, 100.36f, 101.00f, 101.56f, 102.20f, 103.05f, 103.90f, 104.59f, 105.00f, 105.08f,
352+
104.90f, 104.55f, 103.90f, 102.84f, 101.60f, 100.38f, 99.10f, 97.70f, 96.20f, 94.60f, 92.90f,
353+
91.10f, 89.40f, 88.00f, 86.90f, 85.90f, 85.20f, 84.80f, 84.70f, 84.90f, 85.40f},
353354
340.f,
354355
770.f};
355356

0 commit comments

Comments
 (0)