Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

error fixes

tilakpatel224c9c1ba62d52
diff --git a/fincept-cpp/scripts/lint.sh b/fincept-cpp/scripts/lint.sh
index c53e045c9..2d87eb42b 100644
--- a/fincept-cpp/scripts/lint.sh
+++ b/fincept-cpp/scripts/lint.sh
@@ -33,6 +33,7 @@ run_cppcheck() {
--enable=warning,performance,portability \
--suppress=missingIncludeSystem \
--suppress=unusedFunction \
+ --suppress=*:*/vendor/* \
--inline-suppr \
--std=c++20 \
-I "$SRC_DIR" \
diff --git a/fincept-cpp/src/app.cpp b/fincept-cpp/src/app.cpp
index 376c1bb49..82f497fa1 100644
--- a/fincept-cpp/src/app.cpp
+++ b/fincept-cpp/src/app.cpp
@@ -205,7 +205,7 @@ void App::render_top_bar() {
time_t now = time(nullptr);
if (now != cached_topbar_time) {
cached_topbar_time = now;
- struct tm t_buf;
+ struct tm t_buf{};
#ifdef _WIN32
localtime_s(&t_buf, &now);
#else
@@ -566,7 +566,7 @@ void App::render_command_bar() {
for (auto& c : name_lower) c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
if (name_lower == query) score = 100;
- else if (name_lower.find(query) == 0) score = 90;
+ else if (name_lower.starts_with(query)) score = 90;
else if (name_lower.find(query) != std::string::npos) score = 80;
if (score == 0) {
@@ -744,7 +744,7 @@ void App::render_footer() {
time_t now = time(nullptr);
if (now != cached_footer_time) {
cached_footer_time = now;
- struct tm t_buf;
+ struct tm t_buf{};
#ifdef _WIN32
localtime_s(&t_buf, &now);
#else
diff --git a/fincept-cpp/src/main.cpp b/fincept-cpp/src/main.cpp
index 8725563e9..e6b19af48 100644
--- a/fincept-cpp/src/main.cpp
+++ b/fincept-cpp/src/main.cpp
@@ -60,8 +60,8 @@ int main(int /*argc*/, char** /*argv*/) {
// Redirect stdout/stderr to a log file so output survives crashes
{
FILE* dummy = nullptr;
- freopen_s(&dummy, "fincept_stdout.log", "w", stdout);
- freopen_s(&dummy, "fincept_stderr.log", "w", stderr);
+ (void)freopen_s(&dummy, "fincept_stdout.log", "w", stdout);
+ (void)freopen_s(&dummy, "fincept_stderr.log", "w", stderr);
// Disable buffering so output is flushed immediately
if (stdout) setvbuf(stdout, nullptr, _IONBF, 0);
if (stderr) setvbuf(stderr, nullptr, _IONBF, 0);
diff --git a/fincept-cpp/src/screens/ai_chat/ai_chat_screen.cpp b/fincept-cpp/src/screens/ai_chat/ai_chat_screen.cpp
index 1687c0cfb..d5f0acfc0 100644
--- a/fincept-cpp/src/screens/ai_chat/ai_chat_screen.cpp
+++ b/fincept-cpp/src/screens/ai_chat/ai_chat_screen.cpp
@@ -485,6 +485,7 @@ void AIChatScreen::render_navbar(float width) {
if (ImGui::BeginPopup("##prov_popup")) {
ImGui::TextColored(TEXT_DIM, "SELECT PROVIDER");
ImGui::Separator();
+ std::string pending_provider;
for (auto& cfg : all_configs_) {
bool is_active = (cfg.provider == active_config_.provider);
std::string label = cfg.provider;
@@ -492,11 +493,14 @@ void AIChatScreen::render_navbar(float width) {
if (is_active) label += " [ACTIVE]";
if (ImGui::Selectable(label.c_str(), is_active)) {
- switch_provider(cfg.provider);
+ pending_provider = cfg.provider;
ImGui::CloseCurrentPopup();
}
ImGui::TextColored(TEXT_DIM, " Model: %s", cfg.model.c_str());
}
+ if (!pending_provider.empty()) {
+ switch_provider(pending_provider);
+ }
if (all_configs_.empty()) {
ImGui::TextColored(TEXT_DIM, "No providers configured.");
}
diff --git a/fincept-cpp/src/screens/akshare/akshare_screen.cpp b/fincept-cpp/src/screens/akshare/akshare_screen.cpp
index 63d5a2d80..73c88e052 100644
--- a/fincept-cpp/src/screens/akshare/akshare_screen.cpp
+++ b/fincept-cpp/src/screens/akshare/akshare_screen.cpp
@@ -172,7 +172,7 @@ static constexpr int PERIOD_COUNT = 3;
static std::string timestamp_to_str(int64_t ts) {
time_t t = static_cast<time_t>(ts / 1000); // ms -> s
- struct tm tm_buf;
+ struct tm tm_buf{};
#ifdef _WIN32
localtime_s(&tm_buf, &t);
#else
diff --git a/fincept-cpp/src/screens/algo_trading/algo_trading_screen.cpp b/fincept-cpp/src/screens/algo_trading/algo_trading_screen.cpp
index deb0b01ad..3a12d6bb0 100644
--- a/fincept-cpp/src/screens/algo_trading/algo_trading_screen.cpp
+++ b/fincept-cpp/src/screens/algo_trading/algo_trading_screen.cpp
@@ -358,6 +358,7 @@ void AlgoTradingScreen::render_strategies(float w, float h) {
ImGui::TableHeadersRow();
std::lock_guard lock(data_mutex_);
+ std::string pending_delete_strategy;
for (auto& s : strategies_) {
ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::Text("%s", s.name.c_str());
@@ -379,12 +380,15 @@ void AlgoTradingScreen::render_strategies(float w, float h) {
if (ImGui::SmallButton("Backtest")) run_backtest(s.id);
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f,0.1f,0.1f,1));
- if (ImGui::SmallButton("Del")) delete_strategy(s.id);
+ if (ImGui::SmallButton("Del")) pending_delete_strategy = s.id;
ImGui::PopStyleColor();
ImGui::PopID();
}
ImGui::EndTable();
+ if (!pending_delete_strategy.empty()) {
+ delete_strategy(pending_delete_strategy);
+ }
}
// Deployments section
@@ -404,6 +408,7 @@ void AlgoTradingScreen::render_strategies(float w, float h) {
ImGui::TableHeadersRow();
std::lock_guard lock(data_mutex_);
+ std::string pending_delete_deploy;
for (auto& d : deployments_) {
ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::Text("%s", d.strategy_name.c_str());
@@ -426,12 +431,15 @@ void AlgoTradingScreen::render_strategies(float w, float h) {
ImGui::PopStyleColor();
} else {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.5f,0.1f,0.1f,1));
- if (ImGui::SmallButton("Delete")) delete_deployment_action(d.id);
+ if (ImGui::SmallButton("Delete")) pending_delete_deploy = d.id;
ImGui::PopStyleColor();
}
ImGui::PopID();
}
ImGui::EndTable();
+ if (!pending_delete_deploy.empty()) {
+ delete_deployment_action(pending_delete_deploy);
+ }
}
// Backtest results (shown inline after running a backtest)
diff --git a/fincept-cpp/src/screens/asia_markets/asia_markets_screen.cpp b/fincept-cpp/src/screens/asia_markets/asia_markets_screen.cpp
index 9432f70da..c7d1d264b 100644
--- a/fincept-cpp/src/screens/asia_markets/asia_markets_screen.cpp
+++ b/fincept-cpp/src/screens/asia_markets/asia_markets_screen.cpp
@@ -72,7 +72,7 @@ static int64_t now_ms() {
static std::string timestamp_to_str(int64_t ts) {
time_t t = static_cast<time_t>(ts / 1000);
- struct tm tm_buf;
+ struct tm tm_buf{};
#ifdef _WIN32
localtime_s(&tm_buf, &t);
#else
diff --git a/fincept-cpp/src/screens/dashboard/dashboard_data.cpp b/fincept-cpp/src/screens/dashboard/dashboard_data.cpp
index b7da01e0a..67cbd8903 100644
--- a/fincept-cpp/src/screens/dashboard/dashboard_data.cpp
+++ b/fincept-cpp/src/screens/dashboard/dashboard_data.cpp
@@ -467,7 +467,7 @@ void DashboardData::fetch_news_feeds() {
}
time_t ts = static_cast<time_t>(ni.sort_ts);
- struct tm lt_buf;
+ struct tm lt_buf{};
#ifdef _WIN32
localtime_s(&lt_buf, &ts);
#else
diff --git a/fincept-cpp/src/screens/dashboard/dashboard_screen.cpp b/fincept-cpp/src/screens/dashboard/dashboard_screen.cpp
index 375af7177..9c87476d0 100644
--- a/fincept-cpp/src/screens/dashboard/dashboard_screen.cpp
+++ b/fincept-cpp/src/screens/dashboard/dashboard_screen.cpp
@@ -313,7 +313,7 @@ void DashboardScreen::render_header_bar(float width) {
time_t now = time(nullptr);
if (now != cached_time) {
cached_time = now;
- struct tm t_buf;
+ struct tm t_buf{};
#ifdef _WIN32
localtime_s(&t_buf, &now);
#else
diff --git a/fincept-cpp/src/screens/dashboard/status_bar.cpp b/fincept-cpp/src/screens/dashboard/status_bar.cpp
index 903d0eca2..ff3cb9f30 100644
--- a/fincept-cpp/src/screens/dashboard/status_bar.cpp
+++ b/fincept-cpp/src/screens/dashboard/status_bar.cpp
@@ -57,7 +57,7 @@ void StatusBar::render() {
time_t now = time(nullptr);
if (now != cached_sb_time) {
cached_sb_time = now;
- struct tm t_buf;
+ struct tm t_buf{};
#ifdef _WIN32
localtime_s(&t_buf, &now);
#else
diff --git a/fincept-cpp/src/screens/data_sources/data_sources_screen.cpp b/fincept-cpp/src/screens/data_sources/data_sources_screen.cpp
index dd7137a22..7702e78a3 100644
--- a/fincept-cpp/src/screens/data_sources/data_sources_screen.cpp
+++ b/fincept-cpp/src/screens/data_sources/data_sources_screen.cpp
@@ -738,7 +738,7 @@ void DataSourcesScreen::render_connections_table(float w, float h) {
char del_id[64];
std::snprintf(del_id, sizeof(del_id), "DEL##cd_%d", row);
if (ImGui::SmallButton(del_id)) {
- delete_connection(conn.id);
+ pending_delete_conn_ = conn.id;
}
ImGui::PopStyleColor(3);
@@ -746,6 +746,10 @@ void DataSourcesScreen::render_connections_table(float w, float h) {
ImGui::PopID();
row++;
}
+ if (!pending_delete_conn_.empty()) {
+ delete_connection(pending_delete_conn_);
+ pending_delete_conn_.clear();
+ }
ImGui::EndTable();
}
diff --git a/fincept-cpp/src/screens/data_sources/data_sources_screen.h b/fincept-cpp/src/screens/data_sources/data_sources_screen.h
index b7507839a..e39316f38 100644
--- a/fincept-cpp/src/screens/data_sources/data_sources_screen.h
+++ b/fincept-cpp/src/screens/data_sources/data_sources_screen.h
@@ -49,6 +49,7 @@ private:
std::string editing_id_;
std::map<std::string, std::string> form_data_;
std::string save_error_;
+ std::string pending_delete_conn_; // deferred delete to avoid iterator invalidation
// Connection testing state
bool testing_ = false;
diff --git a/fincept-cpp/src/screens/economics/economics_screen.cpp b/fincept-cpp/src/screens/economics/economics_screen.cpp
index 1ea269384..5aabc2472 100644
--- a/fincept-cpp/src/screens/economics/economics_screen.cpp
+++ b/fincept-cpp/src/screens/economics/economics_screen.cpp
@@ -29,7 +29,7 @@ namespace fincept::economics {
static void compute_date_range(int preset_idx, char* start, char* end) {
time_t now = time(nullptr);
- struct tm t_end;
+ struct tm t_end{};
#ifdef _WIN32
localtime_s(&t_end, &now);
#else
diff --git a/fincept-cpp/src/screens/markets/markets_screen.cpp b/fincept-cpp/src/screens/markets/markets_screen.cpp
index 99daf77c4..5feb84a5e 100644
--- a/fincept-cpp/src/screens/markets/markets_screen.cpp
+++ b/fincept-cpp/src/screens/markets/markets_screen.cpp
@@ -89,7 +89,7 @@ void MarketsScreen::render_header() {
static char tb[32] = {};
if (now != cached_mkt_time) {
cached_mkt_time = now;
- struct tm t_buf;
+ struct tm t_buf{};
#ifdef _WIN32
localtime_s(&t_buf, &now);
#else