CodeFactor review
This commit is contained in:
@@ -35,6 +35,9 @@ namespace Image::GraphicsMagick
|
||||
|
||||
std::unique_ptr<IRawImage> decodeImage(const std::filesystem::path& path)
|
||||
{
|
||||
return std::make_unique<RawImage>(path)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
init(const std::filesystem::path& path)
|
||||
|
||||
@@ -28,27 +28,24 @@
|
||||
#include "utils/NetAddress.hpp"
|
||||
#include "utils/Exception.hpp"
|
||||
|
||||
namespace Auth {
|
||||
|
||||
class LoginThrottler
|
||||
namespace Auth
|
||||
{
|
||||
public:
|
||||
LoginThrottler(std::size_t maxEntries) : _maxEntries {maxEntries} {}
|
||||
class LoginThrottler
|
||||
{
|
||||
public:
|
||||
LoginThrottler(std::size_t maxEntries) : _maxEntries {maxEntries} {}
|
||||
|
||||
// user must lock these calls to avoid races
|
||||
bool isClientThrottled(const boost::asio::ip::address& address) const;
|
||||
void onBadClientAttempt(const boost::asio::ip::address& address);
|
||||
void onGoodClientAttempt(const boost::asio::ip::address& address);
|
||||
// user must lock these calls to avoid races
|
||||
bool isClientThrottled(const boost::asio::ip::address& address) const;
|
||||
void onBadClientAttempt(const boost::asio::ip::address& address);
|
||||
void onGoodClientAttempt(const boost::asio::ip::address& address);
|
||||
|
||||
private:
|
||||
|
||||
void removeOutdatedEntries();
|
||||
|
||||
const std::size_t _maxEntries;
|
||||
|
||||
std::unordered_map<boost::asio::ip::address, Wt::WDateTime> _attemptsInfo;
|
||||
};
|
||||
private:
|
||||
void removeOutdatedEntries();
|
||||
|
||||
const std::size_t _maxEntries;
|
||||
|
||||
std::unordered_map<boost::asio::ip::address, Wt::WDateTime> _attemptsInfo;
|
||||
};
|
||||
} // Auth
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace Database
|
||||
, _expiry {expiry}
|
||||
, _user {getDboPtr(user)}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AuthToken::pointer
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
class WhereClause
|
||||
{
|
||||
public:
|
||||
|
||||
WhereClause() {}
|
||||
WhereClause(const std::string& clause) { _clause = clause; }
|
||||
|
||||
@@ -40,7 +39,6 @@ class WhereClause
|
||||
const std::list<std::string>& getBindArgs(void) const {return _bindArgs;}
|
||||
|
||||
private:
|
||||
|
||||
std::string _clause; // WHERE clause
|
||||
std::list<std::string> _bindArgs;
|
||||
|
||||
@@ -49,7 +47,6 @@ class WhereClause
|
||||
class InnerJoinClause
|
||||
{
|
||||
public:
|
||||
|
||||
InnerJoinClause() {}
|
||||
InnerJoinClause(const std::string& clause);
|
||||
|
||||
@@ -57,7 +54,6 @@ class InnerJoinClause
|
||||
std::string get() const { return _clause;}
|
||||
|
||||
private:
|
||||
|
||||
std::string _clause;
|
||||
};
|
||||
|
||||
@@ -87,14 +83,12 @@ class SelectStatement
|
||||
std::string get() const;
|
||||
|
||||
private:
|
||||
|
||||
std::list<std::string> _statement;
|
||||
};
|
||||
|
||||
class FromClause
|
||||
{
|
||||
public:
|
||||
|
||||
FromClause() {}
|
||||
FromClause(const std::string& clause);
|
||||
|
||||
@@ -103,15 +97,12 @@ class FromClause
|
||||
std::string get() const;
|
||||
|
||||
private:
|
||||
|
||||
std::list<std::string> _clause;
|
||||
|
||||
};
|
||||
|
||||
class SqlQuery
|
||||
{
|
||||
public:
|
||||
|
||||
SelectStatement& select(void) { return _selectStatement;}
|
||||
SelectStatement& select(const std::string& statement) { _selectStatement = SelectStatement(statement); return _selectStatement; }
|
||||
FromClause& from(void) { return _fromClause; }
|
||||
@@ -122,10 +113,9 @@ class SqlQuery
|
||||
GroupByStatement& groupBy(void) { return _groupByStatement; }
|
||||
const GroupByStatement& groupBy(void) const { return _groupByStatement; }
|
||||
|
||||
std::string get(void) const;
|
||||
std::string get() const;
|
||||
|
||||
private:
|
||||
|
||||
SelectStatement _selectStatement; // SELECT statement
|
||||
InnerJoinClause _innerJoinClause; // INNER JOIN
|
||||
FromClause _fromClause; // FROM tables
|
||||
|
||||
@@ -41,7 +41,6 @@ TrackList::TrackList(std::string_view name, Type type, bool isPublic, ObjectPtr<
|
||||
_isPublic {isPublic},
|
||||
_user {getDboPtr(user)}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TrackList::pointer
|
||||
|
||||
@@ -122,7 +122,6 @@ class Artist : public Object<Artist, ArtistId>
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const std::size_t _maxNameLength = 128;
|
||||
|
||||
std::string _name;
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace Database
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string _value;
|
||||
Wt::WDateTime _expiry;
|
||||
Wt::Dbo::ptr<User> _user;
|
||||
|
||||
@@ -112,7 +112,6 @@ class ClusterType : public Object<ClusterType, ClusterTypeId>
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const std::size_t _maxNameLength = 128;
|
||||
|
||||
std::string _name;
|
||||
|
||||
@@ -31,7 +31,6 @@ class Session;
|
||||
class Db
|
||||
{
|
||||
public:
|
||||
|
||||
Db(const std::filesystem::path& dbPath, std::size_t connectionCount = 10);
|
||||
~Db();
|
||||
|
||||
@@ -68,7 +67,6 @@ class Db
|
||||
std::unique_ptr<Wt::Dbo::SqlConnection> _connection;
|
||||
};
|
||||
|
||||
|
||||
RecursiveSharedMutex _sharedMutex;
|
||||
std::unique_ptr<Wt::Dbo::SqlConnectionPool> _connectionPool;
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ class ScanSettings : public Object<ScanSettings, ScanSettingsId>
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int _scanVersion {};
|
||||
std::string _mediaDirectory;
|
||||
Wt::WTime _startTime = Wt::WTime {0,0,0};
|
||||
|
||||
@@ -71,7 +71,6 @@ class TrackBookmark : public Object<TrackBookmark, TrackBookmarkId>
|
||||
Wt::Dbo::belongsTo(a, _user, "user", Wt::Dbo::OnDeleteCascade);
|
||||
}
|
||||
private:
|
||||
|
||||
static const std::size_t _maxCommentLength = 128;
|
||||
|
||||
std::chrono::duration<int, std::milli> _offset;
|
||||
|
||||
@@ -121,7 +121,6 @@ class TrackList : public Object<TrackList, TrackListId>
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string _name;
|
||||
Type _type {Type::Playlist};
|
||||
bool _isPublic {false};
|
||||
@@ -158,7 +157,6 @@ class TrackListEntry : public Object<TrackListEntry, TrackListEntryId>
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Wt::WDateTime _dateTime; // optional date time
|
||||
Wt::Dbo::ptr<Track> _track;
|
||||
Wt::Dbo::ptr<TrackList> _tracklist;
|
||||
|
||||
@@ -130,7 +130,6 @@ TEST_F(DatabaseFixture, SingleTrackListMultipleTrackRecentlyPlayed)
|
||||
TrackArtistLink::create(session, track2.get(), artist2.get(), TrackArtistLinkType::Artist);
|
||||
}
|
||||
{
|
||||
|
||||
auto transaction {session.createSharedTransaction()};
|
||||
|
||||
bool moreResults {};
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace Http
|
||||
void sendRequest(std::unique_ptr<ClientRequest> request);
|
||||
|
||||
private:
|
||||
|
||||
void sendNextQueuedRequest();
|
||||
bool sendRequest(const ClientRequest& request);
|
||||
void onClientDone(Wt::AsioWrapper::error_code ec, const Wt::Http::Message& msg);
|
||||
|
||||
Reference in New Issue
Block a user