strcmp() --> strncmp()

This commit is contained in:
Pavel Kirienko
2014-04-19 16:42:39 +04:00
parent 799846de02
commit efb2251ef8
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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