Skip to content

Commit

Permalink
Unused pointer.
Browse files Browse the repository at this point in the history
More ref usages.
Prefer type over auto where a copy is needed to prevent analysers suggesting making a ref.
Remove duplicate include.
  • Loading branch information
David Lowndes authored and David Lowndes committed Nov 23, 2024
1 parent 9ad1f54 commit 9ee6d76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/common/PatchDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct LockedException : public Exception
int rc;
};

void Exec(sqlite3 *h, const std::string &statement)
static void Exec(sqlite3 *h, const std::string &statement)
{
char *emsg;
auto rc = sqlite3_exec(h, statement.c_str(), nullptr, nullptr, &emsg);
Expand Down Expand Up @@ -471,7 +471,6 @@ CREATE TABLE IF NOT EXISTS Favorites (
// storage->reportError(e.what(), "SQLLite3 Startup Error");
}

char *emsg;
if (rebuild)
{
#if TRACE_DB
Expand Down Expand Up @@ -669,7 +668,7 @@ CREATE TABLE IF NOT EXISTS Favorites (
if (keepRunning)
{
auto b = pathQ.begin();
auto e = (pathQ.size() < transChunkSize) ? pathQ.end()
const auto &e = (pathQ.size() < transChunkSize) ? pathQ.end()
: pathQ.begin() + transChunkSize;
std::copy(b, e, std::back_inserter(doThis));
pathQ.erase(b, e);
Expand Down Expand Up @@ -859,7 +858,7 @@ CREATE TABLE IF NOT EXISTS Favorites (
parentFiles.erase(parentFiles.end() - 1);
}

for (auto pf : parentFiles)
for (const auto &pf : parentFiles)
{
searchName << pf.u8string() << " ";
}
Expand Down Expand Up @@ -911,9 +910,9 @@ CREATE TABLE IF NOT EXISTS Favorites (
"\"feature_type\", \"feature_ivalue\", \"feature_svalue\" ) "
"VALUES ( ?1, ?2, ?3, ?4, ?5 )");
auto feat = extractFeaturesFromXML(xmlData.data());
for (auto f : feat)
for (const auto &f : feat)
{
auto ftype = std::get<0>(f);
const auto &ftype = std::get<0>(f);
ins.bindi64(1, patchid);
ins.bind(2, std::get<0>(f));
ins.bind(3, (int)std::get<1>(f));
Expand Down Expand Up @@ -1473,7 +1472,7 @@ std::string PatchDB::sqlWhereClauseFor(const std::unique_ptr<PatchDBQueryParser:
{
auto protect = [](const std::string &s) -> std::string {
std::vector<std::pair<std::string, std::string>> replacements{{"'", "''"}, {"%", "%%"}};
auto res = s;
std::string res = s;
for (const auto &[search, replace] : replacements)
{
size_t pos = res.find(search);
Expand Down
1 change: 0 additions & 1 deletion src/common/PatchDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <condition_variable>
#include "filesystem/import.h"
#include <iostream>
#include <vector>
#include <functional>

class SurgeStorage;
Expand Down

0 comments on commit 9ee6d76

Please sign in to comment.