mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 05:43:33 +08:00
strcmp() --> strncmp()
This commit is contained in:
@@ -545,7 +545,7 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return std::strcmp(Base::c_str(), ch) == 0;
|
||||
return std::strncmp(Base::c_str(), ch, MaxSize) == 0;
|
||||
}
|
||||
|
||||
template <typename R> bool operator!=(const R& rhs) const { return !operator==(rhs); }
|
||||
|
||||
@@ -87,7 +87,8 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d
|
||||
{
|
||||
return RegistResultCollision;
|
||||
}
|
||||
if (!std::strcmp(p->descriptor.getFullName(), dtd->descriptor.getFullName())) // Name collision
|
||||
if (!std::strncmp(p->descriptor.getFullName(), dtd->descriptor.getFullName(),
|
||||
DataTypeDescriptor::MaxFullNameLen)) // Name collision
|
||||
{
|
||||
return RegistResultCollision;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ const unsigned DataTypeDescriptor::MaxFullNameLen;
|
||||
|
||||
bool DataTypeDescriptor::match(DataTypeKind kind, const char* name) const
|
||||
{
|
||||
return (kind_ == kind) && !std::strcmp(full_name_, name);
|
||||
return (kind_ == kind) && !std::strncmp(full_name_, name, MaxFullNameLen);
|
||||
}
|
||||
|
||||
bool DataTypeDescriptor::match(DataTypeKind kind, DataTypeID id) const
|
||||
|
||||
Reference in New Issue
Block a user