diff --git a/core/src/config.cpp b/core/src/config.cpp index d5ea33f6..66bf4d75 100644 --- a/core/src/config.cpp +++ b/core/src/config.cpp @@ -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); diff --git a/core/src/core.cpp b/core/src/core.cpp index c68d978e..dee1f226 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -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) { diff --git a/core/src/dsp/buffer.h b/core/src/dsp/buffer.h index ece1daab..f46e08f1 100644 --- a/core/src/dsp/buffer.h +++ b/core/src/dsp/buffer.h @@ -288,7 +288,6 @@ namespace dsp { { std::lock_guard 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); diff --git a/core/src/gui/colormaps.cpp b/core/src/gui/colormaps.cpp index 48161176..b66d519b 100644 --- a/core/src/gui/colormaps.cpp +++ b/core/src/gui/colormaps.cpp @@ -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); diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 68f8c4ea..45cde988 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -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; } diff --git a/core/src/gui/menus/vfo_color.cpp b/core/src/gui/menus/vfo_color.cpp index b3b33777..00afe8c1 100644 --- a/core/src/gui/menus/vfo_color.cpp +++ b/core/src/gui/menus/vfo_color.cpp @@ -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); } diff --git a/core/src/gui/tuner.cpp b/core/src/gui/tuner.cpp index 16382612..d6aa6f34 100644 --- a/core/src/gui/tuner.cpp +++ b/core/src/gui/tuner.cpp @@ -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) { diff --git a/core/src/gui/widgets/constellation_diagram.cpp b/core/src/gui/widgets/constellation_diagram.cpp index 5da4d1a5..f2733c7d 100644 --- a/core/src/gui/widgets/constellation_diagram.cpp +++ b/core/src/gui/widgets/constellation_diagram.cpp @@ -9,11 +9,9 @@ namespace ImGui { std::lock_guard 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; } diff --git a/core/src/gui/widgets/frequency_select.cpp b/core/src/gui/widgets/frequency_select.cpp index 261dfc22..ff3f2992 100644 --- a/core/src/gui/widgets/frequency_select.cpp +++ b/core/src/gui/widgets/frequency_select.cpp @@ -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; diff --git a/core/src/gui/widgets/image.cpp b/core/src/gui/widgets/image.cpp index 974d14ab..c452c8c4 100644 --- a/core/src/gui/widgets/image.cpp +++ b/core/src/gui/widgets/image.cpp @@ -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)) { diff --git a/core/src/gui/widgets/line_push_image.cpp b/core/src/gui/widgets/line_push_image.cpp index 6c553898..225bac27 100644 --- a/core/src/gui/widgets/line_push_image.cpp +++ b/core/src/gui/widgets/line_push_image.cpp @@ -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; } diff --git a/core/src/gui/widgets/snr_meter.cpp b/core/src/gui/widgets/snr_meter.cpp index 74c5fd86..4941ee42 100644 --- a/core/src/gui/widgets/snr_meter.cpp +++ b/core/src/gui/widgets/snr_meter.cpp @@ -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; diff --git a/core/src/gui/widgets/symbol_diagram.cpp b/core/src/gui/widgets/symbol_diagram.cpp index 608f4fbd..fded9f6f 100644 --- a/core/src/gui/widgets/symbol_diagram.cpp +++ b/core/src/gui/widgets/symbol_diagram.cpp @@ -18,11 +18,9 @@ namespace ImGui { std::lock_guard 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; diff --git a/core/src/gui/widgets/volume_meter.cpp b/core/src/gui/widgets/volume_meter.cpp index b0b8a8a0..0b586233 100644 --- a/core/src/gui/widgets/volume_meter.cpp +++ b/core/src/gui/widgets/volume_meter.cpp @@ -14,8 +14,6 @@ namespace ImGui { avg = std::clamp(avg, val_min, val_max); peak = std::clamp(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); diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index aaf05dd4..670c460f 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -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)); diff --git a/core/src/gui/widgets/waterfall.h b/core/src/gui/widgets/waterfall.h index 8f69bbee..7f687da8 100644 --- a/core/src/gui/widgets/waterfall.h +++ b/core/src/gui/widgets/waterfall.h @@ -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; diff --git a/core/src/utils/networking.cpp b/core/src/utils/networking.cpp index 08f9d264..ea67cd21 100644 --- a/core/src/utils/networking.cpp +++ b/core/src/utils/networking.cpp @@ -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());