mirror of
https://github.com/sebastiandine/Card-Collection-Manager-3.git
synced 2026-08-28 23:01:09 +00:00
fix: sonarqube security hotspot fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Card Collection Manager 3
|
# Card Collection Manager 3
|
||||||
|
|
||||||
[](https://sonarcloud.io/summary/new_code?id=sebastiandine_Card-Collection-Manager-3)
|
[](https://sonarcloud.io/summary/new_code?id=sebastiandine_Card-Collection-Manager-3)
|
||||||
|
|
||||||
Card Collection Manager 3 is an extensible desktop application for managing trading card game collections. It is designed as a practical way to track cards and manage per-card images for large collections, with local per-game data, set synchronization workflows, and a desktop-first UX. The app preserves the established JSON layout from earlier CCM versions so existing collections stay compatible.
|
Card Collection Manager 3 is an extensible desktop application for managing trading card game collections. It is designed as a practical way to track cards and manage per-card images for large collections, with local per-game data, set synchronization workflows, and a desktop-first UX. The app preserves the established JSON layout from earlier CCM versions so existing collections stay compatible.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
@@ -68,12 +67,14 @@ namespace {
|
|||||||
|
|
||||||
// Substitute every "@FILL@" occurrence in `tmpl` with `fill`.
|
// Substitute every "@FILL@" occurrence in `tmpl` with `fill`.
|
||||||
std::string applyFill(const char* tmpl, const char* fill) {
|
std::string applyFill(const char* tmpl, const char* fill) {
|
||||||
std::string s(tmpl);
|
std::string s = tmpl != nullptr ? tmpl : "";
|
||||||
constexpr std::string_view kPlaceholder = "@FILL@";
|
constexpr std::string_view kPlaceholder = "@FILL@";
|
||||||
|
const std::string_view fillView = fill != nullptr ? std::string_view(fill)
|
||||||
|
: std::string_view{};
|
||||||
for (std::string::size_type pos = s.find(kPlaceholder);
|
for (std::string::size_type pos = s.find(kPlaceholder);
|
||||||
pos != std::string::npos;
|
pos != std::string::npos;
|
||||||
pos = s.find(kPlaceholder, pos + std::strlen(fill))) {
|
pos = s.find(kPlaceholder, pos + fillView.size())) {
|
||||||
s.replace(pos, kPlaceholder.size(), fill);
|
s.replace(pos, kPlaceholder.size(), fillView);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user