Skip to content

Commit

Permalink
Merge pull request #102 from SirBob01/fix/compiler-warnings
Browse files Browse the repository at this point in the history
Silence compiler warnings
  • Loading branch information
SirBob01 committed May 13, 2023
2 parents 4ff998d + 370fd3e commit ba9a2f5
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 21 deletions.
3 changes: 3 additions & 0 deletions src/Graphics/Vulkan/Core/Debugger.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "./Debugger.hpp"

static PFN_vkCreateDebugUtilsMessengerEXT vk_create_debugger_dispatch;
static PFN_vkDestroyDebugUtilsMessengerEXT vk_destroy_debugger_dispatch;

VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT(
VkInstance instance,
const VkDebugUtilsMessengerCreateInfoEXT *create_info,
Expand Down
3 changes: 0 additions & 3 deletions src/Graphics/Vulkan/Core/Debugger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

#include "../../../Log/Log.hpp"

static PFN_vkCreateDebugUtilsMessengerEXT vk_create_debugger_dispatch;
static PFN_vkDestroyDebugUtilsMessengerEXT vk_destroy_debugger_dispatch;

/**
* @brief API override for instancing the debug messenger.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Graphics/Vulkan/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace Dynamo::Graphics::Vulkan {
_signal_render_done.clear();
_fences.clear();

for (i32 i = 0; i < _max_frames_processing; i++) {
for (u32 i = 0; i < _max_frames_processing; i++) {
_signal_image_ready.push_back(
std::make_unique<Semaphore>(*_device));
_signal_render_done.push_back(
Expand Down Expand Up @@ -456,7 +456,7 @@ namespace Dynamo::Graphics::Vulkan {
if (result != vk::Result::eSuccess) {
reset_swapchain();
}
} catch (vk::OutOfDateKHRError e) {
} catch (vk::OutOfDateKHRError &e) {
reset_swapchain();
}

Expand Down
6 changes: 3 additions & 3 deletions src/Math/Fourier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Dynamo::Fourier {

for (u32 k = 0; k < N; k += m) {
Complex omega(1);
for (i32 j = 0; j < half_m; j++) {
for (u32 j = 0; j < half_m; j++) {
u32 u_i = k + j;
u32 t_i = u_i + half_m;
Complex t = omega * signal[t_i];
Expand Down Expand Up @@ -62,7 +62,7 @@ namespace Dynamo::Fourier {

for (u32 k = 0; k < N; k += m) {
Complex omega(1);
for (i32 j = 0; j < half_m; j++) {
for (u32 j = 0; j < half_m; j++) {
u32 u_i = k + j;
u32 t_i = u_i + half_m;
Complex t = omega * signal[t_i];
Expand All @@ -76,7 +76,7 @@ namespace Dynamo::Fourier {

// Normalize
f32 inv_N = 1.0 / N;
for (i32 f = 0; f < N; f++) {
for (u32 f = 0; f < N; f++) {
signal[f] *= inv_N;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sound/Convolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Dynamo::Sound {
}

// Shift up the frequency delay-line by one partition
for (i32 i = _fdl.size() - 1; i >= PARTITION_LENGTH; i--) {
for (u32 i = _fdl.size() - 1; i >= PARTITION_LENGTH; i--) {
_fdl[i] = _fdl[i - PARTITION_LENGTH];
}

Expand Down
11 changes: 7 additions & 4 deletions src/Sound/Resample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ namespace Dynamo::Sound {
f64 interp = P_frac - l;

// Left wing
for (i32 i = 0; i < FILTER_HALF_LENGTH; i++) {
for (u32 i = 0; i < FILTER_HALF_LENGTH; i++) {
i32 s_i = src_f - i;
i32 h_i = l + i * filter_step;
if (s_i < 0 || h_i >= FILTER_HALF_LENGTH) break;
if (s_i < 0 || h_i >= static_cast<i32>(FILTER_HALF_LENGTH))
break;
f64 weight = FILTER_RWING[h_i] + interp * FILTER_DIFFS[h_i];
dst_sample += src[s_i] * weight;
}
Expand All @@ -48,10 +49,12 @@ namespace Dynamo::Sound {
interp = P_frac - l;

// Right wing
for (i32 i = 0; i < FILTER_HALF_LENGTH; i++) {
for (u32 i = 0; i < FILTER_HALF_LENGTH; i++) {
i32 s_i = src_f + i + 1;
i32 h_i = l + i * filter_step;
if (s_i >= time_end || h_i >= FILTER_HALF_LENGTH) break;
if (s_i >= time_end ||
h_i >= static_cast<i32>(FILTER_HALF_LENGTH))
break;
f64 weight = FILTER_RWING[h_i] + interp * FILTER_DIFFS[h_i];
dst_sample += src[s_i] * weight;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sound/Resample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <array>

#include "../Types.hpp"
#include "../Log/Log.hpp"
#include "../Types.hpp"
#include "./Sound.hpp"

namespace Dynamo::Sound {
Expand Down Expand Up @@ -94,7 +94,7 @@ namespace Dynamo::Sound {
constexpr std::array<f64, FILTER_HALF_LENGTH> construct_difference_table(
const std::array<f64, FILTER_HALF_LENGTH> &coeffs) {
std::array<f64, FILTER_HALF_LENGTH> diffs = {0};
for (i32 i = 0; i < FILTER_HALF_LENGTH - 1; i++) {
for (u32 i = 0; i < FILTER_HALF_LENGTH - 1; i++) {
diffs[i] = coeffs[i + 1] - coeffs[i];
}
return diffs;
Expand Down
5 changes: 2 additions & 3 deletions src/Sound/Sound.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "Sound.hpp"

namespace Dynamo::Sound {
WaveFrame Sound::get_frame(const u32 frame,
const u32 out_channels) {
WaveFrame Sound::get_frame(const u32 frame, const u32 out_channels) {
WaveFrame output;
output.channels = out_channels;

Expand All @@ -19,7 +18,7 @@ namespace Dynamo::Sound {
}

// Write denormalzed samples onto the output frame
for (i32 i = 0; i < samples.size(); i++) {
for (u32 i = 0; i < samples.size(); i++) {
output.samples[i] = samples[i];
}
return output;
Expand Down
8 changes: 5 additions & 3 deletions src/Utils/SparseSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ namespace Dynamo {

// Verify that the sparse and dense arrays are correlated
i32 index = _sparse[key];
if (index == -1 || index >= _dense.size() || _dense[index] != id) {
i32 dense_size = _dense.size();
if (index == -1 || index >= dense_size || _dense[index] != id) {
return -1;
}
return index;
Expand Down Expand Up @@ -142,7 +143,8 @@ namespace Dynamo {

// Verify that the sparse and dense arrays are correlated
i32 index = _sparse[key];
if (index == -1 || index >= _dense.size() || _dense[index] != id) {
i32 dense_size = _dense.size();
if (index == -1 || index >= dense_size || _dense[index] != id) {
return;
}

Expand Down Expand Up @@ -177,7 +179,7 @@ namespace Dynamo {
*/
inline T &at(i32 index) {
DYN_ASSERT(index >= 0);
DYN_ASSERT(index < _pool.size());
DYN_ASSERT(index < static_cast<i32>(_pool.size()));
return _pool[index];
}

Expand Down

0 comments on commit ba9a2f5

Please sign in to comment.