1
0
Fork 0

Codefix: Change method to take const pointer instead of using const_cast. (#13525)

pull/13528/head
Peter Nelson 2025-02-10 22:10:36 +00:00 committed by GitHub
parent 7fbfaa1b54
commit e80992fc47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -173,7 +173,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet &p)
ConstContentVector parents;
this->ReverseLookupTreeDependency(parents, ci);
for (const ContentInfo *ici : parents) {
this->CheckDependencyState(const_cast<ContentInfo *>(ici));
this->CheckDependencyState(ici);
}
this->OnReceiveContentInfo(ci);
@ -973,7 +973,7 @@ void ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(ConstContent
* Check the dependencies (recursively) of this content info
* @param ci the content info to check the dependencies of
*/
void ClientNetworkContentSocketHandler::CheckDependencyState(ContentInfo *ci)
void ClientNetworkContentSocketHandler::CheckDependencyState(const ContentInfo *ci)
{
if (ci->IsSelected() || ci->state == ContentInfo::ALREADY_HERE) {
/* Selection is easy; just walk all children and set the

View File

@ -130,7 +130,7 @@ public:
void ReverseLookupDependency(ConstContentVector &parents, const ContentInfo *child) const;
void ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const;
void CheckDependencyState(ContentInfo *ci);
void CheckDependencyState(const ContentInfo *ci);
/** Get the number of content items we know locally. */
uint Length() const { return (uint)this->infos.size(); }