Skip to content

Commit

Permalink
Merge branch 'gz-fuel-tools8' into binreloc
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoenig authored Jun 14, 2023
2 parents 9d9d294 + f9fd649 commit edbead1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 29 deletions.
6 changes: 3 additions & 3 deletions src/ClientConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ ClientConfig::ClientConfig(const ClientConfig &_copy)
}

//////////////////////////////////////////////////
ClientConfig &ClientConfig::operator=(const ClientConfig &_rhs)
ClientConfig &ClientConfig::operator=(const ClientConfig &_copy)
{
*(this->dataPtr) = *(_rhs.dataPtr);
*(this->dataPtr) = *(_copy.dataPtr);

return *this;
}
Expand Down Expand Up @@ -526,7 +526,7 @@ std::string ClientConfig::AsString(const std::string &_prefix) const
<< _prefix << "Cache location: " << this->CacheLocation() << std::endl
<< _prefix << "Servers:" << std::endl;

for (auto s : this->Servers())
for (const auto &s : this->Servers())
{
out << _prefix << " ---" << std::endl;
out << _prefix << s.AsString(" ");
Expand Down
30 changes: 15 additions & 15 deletions src/FuelClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void FuelClient::AddServerConfigParametersToHeaders(
std::vector<std::string> &_headers) const
{
bool privateTokenDefined = false;
for (auto header : _headers)
for (const auto &header : _headers)
{
if (header.find("Private-token:") != std::string::npos)
{
Expand Down Expand Up @@ -627,7 +627,7 @@ Result FuelClient::DownloadModel(const ModelIdentifier &_id,
if(!res)
return res;

for (ModelIdentifier dep : dependencies)
for (const ModelIdentifier &dep : dependencies)
{
// Download dependency if not in the local cache
if (!this->dataPtr->cache->MatchingModel(dep))
Expand Down Expand Up @@ -787,7 +787,7 @@ Result FuelClient::ModelDependencies(
std::vector<ModelIdentifier> &_dependencies)
{
std::vector<ModelIdentifier> newDeps;
for (auto modelId : _ids)
for (const auto &modelId : _ids)
{
std::vector<ModelIdentifier> modelDeps;
auto result = this->ModelDependencies(modelId, modelDeps);
Expand Down Expand Up @@ -946,7 +946,7 @@ std::vector<FuelClient::ModelResult> FuelClient::DownloadModels(
std::lock_guard<std::mutex> lock(idsMutex);
gzdbg << "Adding " << dependencies.size()
<< " model dependencies to queue from " << id.Name() << "\n";
for (auto dep : dependencies)
for (const auto &dep : dependencies)
{
if (uniqueIds.count(dep) == 0)
{
Expand Down Expand Up @@ -1191,15 +1191,15 @@ bool FuelClient::ParseWorldUrl(const common::URI &_worldUrl,
}

//////////////////////////////////////////////////
bool FuelClient::ParseModelFileUrl(const common::URI &_fileUrl,
bool FuelClient::ParseModelFileUrl(const common::URI &_modelFileUrl,
ModelIdentifier &_id, std::string &_filePath)
{
if (!_fileUrl.Valid())
if (!_modelFileUrl.Valid())
return false;

this->dataPtr->CheckForDeprecatedUri(_fileUrl);
this->dataPtr->CheckForDeprecatedUri(_modelFileUrl);

auto urlStr = _fileUrl.Str();
auto urlStr = _modelFileUrl.Str();

std::smatch match;
std::string scheme;
Expand Down Expand Up @@ -1262,13 +1262,13 @@ bool FuelClient::ParseModelFileUrl(const common::URI &_fileUrl,
}

//////////////////////////////////////////////////
bool FuelClient::ParseWorldFileUrl(const common::URI &_fileUrl,
bool FuelClient::ParseWorldFileUrl(const common::URI &_worldFileUrl,
WorldIdentifier &_id, std::string &_filePath)
{
if (!_fileUrl.Valid())
if (!_worldFileUrl.Valid())
return false;

auto urlStr = _fileUrl.Str();
auto urlStr = _worldFileUrl.Str();

std::smatch match;
std::string scheme;
Expand Down Expand Up @@ -1935,7 +1935,7 @@ void FuelClientPrivate::CheckForDeprecatedUri(const common::URI &_uri)
{
std::string newUrl = _uri.Str();
newUrl.replace(ignFuelPos, oldServer.size(), "fuel.gazebosim.org");
ignwarn << "The " << oldServer << " URL is deprecrated. Pleasse change "
gzwarn << "The " << oldServer << " URL is deprecrated. Pleasse change "
<< _uri.Str() << " to " << newUrl << std::endl;
}
}
Expand All @@ -1959,7 +1959,7 @@ void FuelClientPrivate::ZipFromResponse(const RestResponse &_resp,
// Check for valid URI
if (common::URI::Valid(linkUri))
{
igndbg << "Downloading from a referral link [" << linkUri << "]\n";
gzdbg << "Downloading from a referral link [" << linkUri << "]\n";
// Get the zip data.
RestResponse linkResp = rest.Request(HttpMethod::GET,
// URL
Expand All @@ -1979,7 +1979,7 @@ void FuelClientPrivate::ZipFromResponse(const RestResponse &_resp,
}
else
{
ignerr << "Invalid referral link URI [" << linkUri << "]. "
gzerr << "Invalid referral link URI [" << linkUri << "]. "
<< "Unable to download.\n";
}
}
Expand All @@ -1992,7 +1992,7 @@ void FuelClientPrivate::ZipFromResponse(const RestResponse &_resp,
}
else
{
ignerr << "Invalid content-type of [" << contentTypeIter->second << "]. "
gzerr << "Invalid content-type of [" << contentTypeIter->second << "]. "
<< "Unable to download.\n";
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ namespace gz
if (!basename.empty() && basename.find(".sdf") != std::string::npos)
{
std::string extension = basename.substr(
basename.find_last_of(".") + 1);
basename.find_last_of('.') + 1);
if (extension == "sdf")
return *dirIter;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

#include "ModelPrivate.hh"

namespace ignft = gz::fuel_tools;
using namespace gz;
using namespace ignft;
using namespace fuel_tools;

//////////////////////////////////////////////////
Model::Model() : dataPtr(nullptr)
Expand Down
4 changes: 2 additions & 2 deletions src/ModelIdentifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ bool ModelIdentifier::SetName(const std::string &_name)
}

//////////////////////////////////////////////////
bool ModelIdentifier::SetOwner(const std::string &_owner)
bool ModelIdentifier::SetOwner(const std::string &_name)
{
bool success = false;
std::string owner = common::lowercase(_owner);
std::string owner = common::lowercase(_name);
if (this->dataPtr->ValidName(owner))
{
success = true;
Expand Down
3 changes: 1 addition & 2 deletions src/Model_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
#include <gtest/gtest.h>
#include "gz/fuel_tools/Model.hh"

namespace ignft = gz::fuel_tools;
using namespace gz;
using namespace ignft;
using namespace fuel_tools;

/////////////////////////////////////////////////
/// \brief Nothing crashes
Expand Down
8 changes: 4 additions & 4 deletions src/WorldIdentifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ std::string WorldIdentifier::Owner() const
}

//////////////////////////////////////////////////
bool WorldIdentifier::SetOwner(const std::string &_owner)
bool WorldIdentifier::SetOwner(const std::string &_name)
{
this->dataPtr->owner = common::lowercase(_owner);
this->dataPtr->owner = common::lowercase(_name);
return true;
}

Expand Down Expand Up @@ -177,9 +177,9 @@ std::string WorldIdentifier::LocalPath() const
}

//////////////////////////////////////////////////
bool WorldIdentifier::SetLocalPath(const std::string &_localPath)
bool WorldIdentifier::SetLocalPath(const std::string &_path)
{
this->dataPtr->localPath = _localPath;
this->dataPtr->localPath = _path;
return true;
}

Expand Down

0 comments on commit edbead1

Please sign in to comment.