Skip to content

Commit

Permalink
Merge pull request xbmc#24436 from Rechi/clang-tidy/performance
Browse files Browse the repository at this point in the history
[clang-tidy] fix modernize-* and performance-* warnings
  • Loading branch information
Rechi authored Jan 12, 2024
2 parents 39d7860 + 0657b2d commit a4fc27b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion xbmc/filesystem/Directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ bool CDirectory::GetDirectory(const CURL& url,
}

bool CDirectory::EnumerateDirectory(const std::string& path,
DirectoryEnumerationCallback callback,
const DirectoryEnumerationCallback& callback,
bool fileOnly /* = false */,
const std::string& mask /* = "" */,
int flags /* = DIR_FLAG_DEFAULTS */)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/filesystem/Directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CDirectory
using DirectoryEnumerationCallback = std::function<void(const std::shared_ptr<CFileItem>& item)>;

static bool EnumerateDirectory(const std::string& path,
DirectoryEnumerationCallback callback,
const DirectoryEnumerationCallback& callback,
bool fileOnly = false,
const std::string& mask = "",
int flags = DIR_FLAG_DEFAULTS);
Expand Down
1 change: 0 additions & 1 deletion xbmc/network/upnp/UPnPPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ class CUPnPPlayerController : public PLT_MediaControllerDelegate
CUPnPPlayer::CUPnPPlayer(IPlayerCallback& callback, const char* uuid)
: IPlayer(callback),
CThread("UPnPPlayer"),
m_control(nullptr),
m_logger(CServiceBroker::GetLogging().GetLogger(StringUtils::Format("CUPnPPlayer[{}]", uuid)))
{
m_control = CUPnP::GetInstance()->m_MediaController;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/network/upnp/UPnPPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CUPnPPlayer : public IPlayer, public CThread
void Process() override;
void OnExit() override;

PLT_MediaController* m_control;
PLT_MediaController* m_control = nullptr;
std::unique_ptr<CUPnPPlayerController> m_delegate;
std::string m_current_uri;
std::string m_current_meta;
Expand Down
9 changes: 4 additions & 5 deletions xbmc/video/VideoDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11869,7 +11869,7 @@ void CVideoDatabase::InitializeVideoVersionTypeTable(int schemaVersion)

for (int id = VIDEO_VERSION_ID_BEGIN; id <= VIDEO_VERSION_ID_END; ++id)
{
const std::string type{g_localizeStrings.Get(id)};
const std::string& type{g_localizeStrings.Get(id)};
if (schemaVersion < 127)
{
m_pDS->exec(
Expand Down Expand Up @@ -11901,7 +11901,7 @@ void CVideoDatabase::UpdateVideoVersionTypeTable()

for (int id = VIDEO_VERSION_ID_BEGIN; id <= VIDEO_VERSION_ID_END; ++id)
{
std::string type = g_localizeStrings.Get(id);
const std::string& type = g_localizeStrings.Get(id);
m_pDS->exec(PrepareSQL("UPDATE videoversiontype SET name = '%s', owner = %i WHERE id = '%i'",
type.c_str(), VideoAssetTypeOwner::SYSTEM, id));
}
Expand Down Expand Up @@ -11991,9 +11991,8 @@ void CVideoDatabase::GetVideoVersions(VideoDbContentType itemType,

while (!m_pDS2->eof())
{
versions.push_back(std::make_tuple(m_pDS2->fv("name").get_asString(),
m_pDS2->fv("id").get_asInt(),
m_pDS2->fv("idFile").get_asInt()));
versions.emplace_back(m_pDS2->fv("name").get_asString(), m_pDS2->fv("id").get_asInt(),
m_pDS2->fv("idFile").get_asInt());
m_pDS2->next();
}
m_pDS2->close();
Expand Down
2 changes: 1 addition & 1 deletion xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ bool CGUIDialogVideoManagerVersions::GetSimilarMovies(const std::shared_ptr<CFil
}

bool CGUIDialogVideoManagerVersions::AddSimilarMovieAsVersion(
const std::shared_ptr<CFileItem> itemMovie)
const std::shared_ptr<CFileItem>& itemMovie)
{
// A movie with versions cannot be turned into a version
if (itemMovie->GetVideoInfoTag()->HasVideoVersions())
Expand Down
2 changes: 1 addition & 1 deletion xbmc/video/dialogs/GUIDialogVideoManagerVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class CGUIDialogVideoManagerVersions : public CGUIDialogVideoManager
* \param itemMovie Movie to convert
* \return True for success, false otherwse
*/
bool AddSimilarMovieAsVersion(const std::shared_ptr<CFileItem> itemMovie);
bool AddSimilarMovieAsVersion(const std::shared_ptr<CFileItem>& itemMovie);

/*!
* \brief Populates a list with all movies of the libray, excluding the item provided as parameter.
Expand Down

0 comments on commit a4fc27b

Please sign in to comment.