1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives

This commit is contained in:
Craig Robbins 2015-03-06 20:21:51 +10:00
parent a603a76787
commit ced6d20295
62 changed files with 299 additions and 294 deletions

View file

@ -641,6 +641,7 @@ content_t CNodeDefManager::allocateId()
// IWritableNodeDefManager
content_t CNodeDefManager::set(const std::string &name, const ContentFeatures &def)
{
// Pre-conditions
assert(name != "");
assert(name == def.name);
@ -690,7 +691,7 @@ content_t CNodeDefManager::set(const std::string &name, const ContentFeatures &d
content_t CNodeDefManager::allocateDummy(const std::string &name)
{
assert(name != "");
assert(name != ""); // Pre-condition
ContentFeatures f;
f.name = name;
return set(name, f);
@ -993,7 +994,9 @@ void CNodeDefManager::serialize(std::ostream &os, u16 protocol_version)
f->serialize(wrapper_os, protocol_version);
os2<<serializeString(wrapper_os.str());
assert(count + 1 > count); // must not overflow
// must not overflow
u16 next = count + 1;
FATAL_ERROR_IF(next < count, "Overflow");
count++;
}
writeU16(os, count);