fix a lot of warnings about unused variables, or maybe uninitialized variables

This commit is contained in:
kistlin 2022-01-16 08:28:57 +01:00
parent 1185e4e114
commit 174158233b
17 changed files with 11 additions and 41 deletions

View File

@ -36,7 +36,7 @@ void ConfigManager::load(json def, bool lock) {
file >> conf;
file.close();
}
catch (std::exception e) {
catch (const std::exception& e) {
spdlog::error("Config file '{0}' is corrupted, resetting it", path);
conf = def;
save(false);

View File

@ -337,7 +337,7 @@ int sdrpp_main(int argc, char* argv[]) {
#else
const char* glsl_version = "#version 120";
GLFWmonitor* monitor = NULL;
for (int i = 0; i < OPENGL_VERSION_COUNT; i++) {
for (size_t i = 0; i < OPENGL_VERSION_COUNT; i++) {
glsl_version = OPENGL_VERSIONS_GLSL[i];
glfwWindowHint(GLFW_CLIENT_API, OPENGL_VERSIONS_IS_ES[i] ? GLFW_OPENGL_ES_API : GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, OPENGL_VERSIONS_MAJOR[i]);
@ -450,8 +450,12 @@ int sdrpp_main(int argc, char* argv[]) {
bandplan::loadColorTable(bandColors);
bool _maximized = maximized;
int fsWidth, fsHeight, fsPosX, fsPosY;
int _winWidth, _winHeight;
int fsWidth = 0;
int fsHeight = 0;
int fsPosX = 0;
int fsPosY = 0;
int _winWidth = 0;
int _winHeight = 0;
glfwGetWindowSize(core::window, &_winWidth, &_winHeight);
if (fullScreen) {

View File

@ -288,7 +288,6 @@ namespace dsp {
{
std::lock_guard<std::mutex> lck(bufMtx);
memcpy(buffers[writeCur], _in->readBuf, count * sizeof(T));
uintptr_t ptr = (uintptr_t)buffers[writeCur];
sizes[writeCur] = count;
writeCur++;
writeCur = ((writeCur) % TEST_BUFFER_SIZE);

View File

@ -37,7 +37,6 @@ namespace colormaps {
map.map = new float[mapTxt.size() * 3];
int i = 0;
for (auto const& col : mapTxt) {
uint8_t r, g, b, a;
map.map[i * 3] = std::stoi(col.substr(1, 2), NULL, 16);
map.map[(i * 3) + 1] = std::stoi(col.substr(3, 2), NULL, 16);
map.map[(i * 3) + 2] = std::stoi(col.substr(5, 2), NULL, 16);

View File

@ -354,12 +354,6 @@ void MainWindow::draw() {
core::configManager.release(true);
}
ImVec2 vMin = ImGui::GetWindowContentRegionMin();
ImVec2 vMax = ImGui::GetWindowContentRegionMax();
int width = vMax.x - vMin.x;
int height = vMax.y - vMin.y;
// To Bar
ImGui::PushID(ImGui::GetID("sdrpp_menu_btn"));
if (ImGui::ImageButton(icons::MENU, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(GLFW_KEY_MENU, false)) {
@ -489,12 +483,11 @@ void MainWindow::draw() {
ImGui::SetColumnWidth(1, winSize.x - menuWidth - 60);
ImGui::SetColumnWidth(2, 60);
ImGui::BeginChild("Left Column");
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
if (gui::menu.draw(firstMenuRender)) {
core::configManager.acquire();
json arr = json::array();
for (int i = 0; i < gui::menu.order.size(); i++) {
for (size_t i = 0; i < gui::menu.order.size(); i++) {
arr[i]["name"] = gui::menu.order[i].name;
arr[i]["open"] = gui::menu.order[i].open;
}

View File

@ -104,7 +104,6 @@ namespace vfo_color_menu {
vfoColors[name] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
vfo->color = IM_COL32(255, 255, 255, 50);
core::configManager.acquire();
char buf[16];
core::configManager.conf["vfoColors"][name] = "#FFFFFF";
core::configManager.release(true);
}

View File

@ -44,7 +44,6 @@ namespace tuner {
double viewBottom = view - (viewBW / 2.0);
double viewTop = view + (viewBW / 2.0);
double wholeFreq = gui::waterfall.getCenterFrequency();
double bottom = -(BW / 2.0);
double top = (BW / 2.0);
@ -78,7 +77,6 @@ namespace tuner {
if (delta < 0) {
double newViewOff = vfoTop - (viewBW / 2.0) + (viewBW / 10.0);
double newViewBottom = newViewOff - (viewBW / 2.0);
double newViewTop = newViewOff + (viewBW / 2.0);
if (newViewBottom > bottom) {
gui::waterfall.setViewOffset(newViewOff);
@ -94,7 +92,6 @@ namespace tuner {
}
else {
double newViewOff = vfoBottom + (viewBW / 2.0) - (viewBW / 10.0);
double newViewBottom = newViewOff - (viewBW / 2.0);
double newViewTop = newViewOff + (viewBW / 2.0);
if (newViewTop < top) {

View File

@ -9,11 +9,9 @@ namespace ImGui {
std::lock_guard<std::mutex> lck(bufferMtx);
ImGuiWindow* window = GetCurrentWindow();
ImGuiStyle& style = GetStyle();
float pad = style.FramePadding.y;
ImVec2 min = window->DC.CursorPos;
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), CalcItemWidth());
ImRect bb(min, ImVec2(min.x + size.x, min.y + size.y));
float lineHeight = size.y;
ItemSize(size, style.FramePadding.y);
if (!ItemAdd(bb, 0)) {
@ -22,7 +20,6 @@ namespace ImGui {
window->DrawList->AddRectFilled(min, ImVec2(min.x + size.x, min.y + size.y), IM_COL32(0, 0, 0, 255));
ImU32 col = ImGui::GetColorU32(ImGuiCol_CheckMark, 0.7f);
float increment = size.x / 1024.0f;
for (int i = 0; i < 1024; i++) {
if (buffer[i].re > 1.5f || buffer[i].re < -1.5f) { continue; }
if (buffer[i].im > 1.5f || buffer[i].im < -1.5f) { continue; }

View File

@ -119,7 +119,6 @@ void FrequencySelect::draw() {
ImVec2 digitSz = ImGui::CalcTextSize("0");
ImVec2 commaSz = ImGui::CalcTextSize(".");
int digitHeight = digitSz.y;
int digitWidth = digitSz.x;
int commaOffset = 0;
bool zeros = true;

View File

@ -22,7 +22,6 @@ namespace ImGui {
ImGuiWindow* window = GetCurrentWindow();
ImGuiStyle& style = GetStyle();
float pad = style.FramePadding.y;
ImVec2 min = window->DC.CursorPos;
// Calculate scale
@ -31,7 +30,6 @@ namespace ImGui {
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), height);
ImRect bb(min, ImVec2(min.x + size.x, min.y + size.y));
float lineHeight = size.y;
ItemSize(size, style.FramePadding.y);
if (!ItemAdd(bb, 0)) {

View File

@ -15,7 +15,6 @@ namespace ImGui {
ImGuiWindow* window = GetCurrentWindow();
ImGuiStyle& style = GetStyle();
float pad = style.FramePadding.y;
ImVec2 min = window->DC.CursorPos;
// Calculate scale
@ -24,7 +23,6 @@ namespace ImGui {
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), height);
ImRect bb(min, ImVec2(min.x + size.x, min.y + size.y));
float lineHeight = size.y;
// If there are no lines, there is no point in drawing anything
if (_lineCount == 0) { return; }

View File

@ -11,16 +11,12 @@ namespace ImGui {
ImGuiWindow* window = GetCurrentWindow();
ImGuiStyle& style = GImGui->Style;
float pad = style.FramePadding.y;
ImVec2 min = window->DC.CursorPos;
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), 26);
ImRect bb(min, min + size);
ImU32 text = ImGui::GetColorU32(ImGuiCol_Text);
float lineHeight = size.y;
ItemSize(size, style.FramePadding.y);
if (!ItemAdd(bb, 0)) {
return;

View File

@ -18,11 +18,9 @@ namespace ImGui {
std::lock_guard<std::mutex> lck(bufferMtx);
ImGuiWindow* window = GetCurrentWindow();
ImGuiStyle& style = GetStyle();
float pad = style.FramePadding.y;
ImVec2 min = window->DC.CursorPos;
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), 100);
ImRect bb(min, ImVec2(min.x + size.x, min.y + size.y));
float lineHeight = size.y;
ItemSize(size, style.FramePadding.y);
if (!ItemAdd(bb, 0)) {
@ -31,7 +29,6 @@ namespace ImGui {
window->DrawList->AddRectFilled(min, ImVec2(min.x + size.x, min.y + size.y), IM_COL32(0, 0, 0, 255));
ImU32 col = ImGui::GetColorU32(ImGuiCol_CheckMark, 0.7f);
ImU32 col2 = ImGui::GetColorU32(ImGuiCol_CheckMark, 0.7f);
float increment = size.x / (float)sampleCount;
float val;

View File

@ -14,8 +14,6 @@ namespace ImGui {
avg = std::clamp<float>(avg, val_min, val_max);
peak = std::clamp<float>(peak, val_min, val_max);
float pad = style.FramePadding.y;
ImVec2 min = window->DC.CursorPos;
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (GImGui->FontSize / 2) + style.FramePadding.y);
ImRect bb(min, min + size);

View File

@ -1155,7 +1155,6 @@ namespace ImGui {
}
void WaterfallVFO::updateDrawingVars(double viewBandwidth, float dataWidth, double viewOffset, ImVec2 widgetPos, int fftHeight) {
double width = (bandwidth / viewBandwidth) * (double)dataWidth;
int center = roundf((((centerOffset - viewOffset) / (viewBandwidth / 2.0)) + 1.0) * ((double)dataWidth / 2.0));
int left = roundf((((lowerOffset - viewOffset) / (viewBandwidth / 2.0)) + 1.0) * ((double)dataWidth / 2.0));
int right = roundf((((upperOffset - viewOffset) / (viewBandwidth / 2.0)) + 1.0) * ((double)dataWidth / 2.0));

View File

@ -109,9 +109,8 @@ namespace ImGui {
float sFactor = ceilf(factor);
float uFactor;
float id = offset;
float val, maxVal;
float maxVal;
int sId;
uint32_t maxId;
for (int i = 0; i < outWidth; i++) {
maxVal = -INFINITY;
sId = (int)id;

View File

@ -91,7 +91,6 @@ namespace net {
int ret;
if (_udp) {
int fromLen = sizeof(remoteAddr);
ret = sendto(_sock, (char*)buf, count, 0, (struct sockaddr*)&remoteAddr, sizeof(remoteAddr));
}
else {
@ -289,7 +288,7 @@ namespace net {
}
entry.handler(std::move(client), entry.ctx);
}
catch (std::exception e) {
catch (const std::exception& e) {
listening = false;
return;
}
@ -442,7 +441,6 @@ namespace net {
throw std::runtime_error("Could get address from host");
return NULL;
}
uint32_t* naddr = (uint32_t*)_host->h_addr_list[0];
// Get address from remote hostname/ip
hostent* _remoteHost = gethostbyname(remoteHost.c_str());