Skip to content

Commit

Permalink
Fix more src lints
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Jan 23, 2025
1 parent 0fe7198 commit 9476f5f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,15 @@ namespace
CFRelease(error);
return false;
}
assert(decoder.get());

data.reset(CFDataCreateWithBytesNoCopy(
kCFAllocatorDefault,
reinterpret_cast<const uint8_t*>(checksum.c_str()),
static_cast<CFIndex>(checksum.size()),
kCFAllocatorNull));

assert(decoder.get());
// NOLINTNEXTLINE(clang-analyzer-nullability.NullablePassedToNonnull)
SecTransformSetAttribute(decoder.get(), kSecTransformInputAttributeName, data.get(), &error);
if (error)
{
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/Ice/HttpParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace
{
assert(begin);
assert(end);

// NOLINTNEXTLINE(clang-analyzer-cplusplus.StringChecker)
return string{reinterpret_cast<const char*>(begin), reinterpret_cast<const char*>(end)};
}
}
Expand Down
13 changes: 8 additions & 5 deletions cpp/src/Ice/NetworkProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace
class SOCKSNetworkProxy final : public NetworkProxy
{
public:
SOCKSNetworkProxy(const string&, int);
SOCKSNetworkProxy(string, int);
SOCKSNetworkProxy(const Address&);

void beginWrite(const Address&, Buffer&) final;
Expand All @@ -37,7 +37,7 @@ namespace
class HTTPNetworkProxy final : public NetworkProxy
{
public:
HTTPNetworkProxy(const string&, int);
HTTPNetworkProxy(string, int);
HTTPNetworkProxy(const Address&, ProtocolSupport);

void beginWrite(const Address&, Buffer&) final;
Expand All @@ -58,7 +58,10 @@ namespace
};
}

SOCKSNetworkProxy::SOCKSNetworkProxy(const string& host, int port) : _host(host), _port(port) { assert(!host.empty()); }
SOCKSNetworkProxy::SOCKSNetworkProxy(string host, int port) : _host(std::move(host)), _port(port)
{
assert(!_host.empty());
}

SOCKSNetworkProxy::SOCKSNetworkProxy(const Address& addr) : _port(0), _address(addr) {}

Expand Down Expand Up @@ -168,9 +171,9 @@ SOCKSNetworkProxy::getProtocolSupport() const
return EnableIPv4;
}

HTTPNetworkProxy::HTTPNetworkProxy(const string& host, int port) : _host(host), _port(port), _protocol(EnableBoth)
HTTPNetworkProxy::HTTPNetworkProxy(string host, int port) : _host(std::move(host)), _port(port), _protocol(EnableBoth)
{
assert(!host.empty());
assert(!_host.empty());
}

HTTPNetworkProxy::HTTPNetworkProxy(const Address& addr, ProtocolSupport protocol)
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/IceGrid/DescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1631,10 +1631,10 @@ IceBoxHelper::print(const shared_ptr<Ice::Communicator>& communicator, Output& o
printImpl(communicator, out, info);
out << nl << "services";
out << sb;
for (auto p = _desc->services.begin(); p != _desc->services.end(); ++p)
for (const auto& service : _desc->services)
{
assert(p->descriptor);
out << nl << p->descriptor->name;
assert(server.descriptor);
out << nl << service.descriptor->name;
}
out << eb;
out << eb;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/IceStorm/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ IceStormInternal::compareSubscriberRecordKey(const MDB_val* v1, const MDB_val* v
IceStormElection::LogUpdate
IceStormInternal::getIncrementedLLU(const IceDB::ReadWriteTxn& txn, LLUMap& lluMap)
{
IceStormElection::LogUpdate llu;
IceStormElection::LogUpdate llu{0, 0};
[[maybe_unused]] bool ok = lluMap.get(txn, lluDbKey, llu);
assert(ok);

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/icegriddb/IceGridDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ run(const Ice::StringSeq& args)
}

string mapSizeStr = opts.optArg("mapsize");
size_t mapSize = IceDB::getMapSize(atoi(mapSizeStr.c_str()));
size_t mapSize = IceDB::getMapSize(stoi(mapSizeStr));
string serverVersion = opts.optArg("server-version");

try
Expand Down

0 comments on commit 9476f5f

Please sign in to comment.