aboutsummaryrefslogtreecommitdiff
path: root/common/ustr.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2018-04-05 20:25:28 +0200
committerBastien Bouclet2018-05-10 08:35:46 +0200
commit955e18c64874203b6f7156835d7d8458b6fb54de (patch)
tree8a165d5aabdb7acbfabd0ca7286485f3980d4014 /common/ustr.cpp
parent82296866b4f79798d1fd5085bfd91fa2fb829d6a (diff)
downloadscummvm-rg350-955e18c64874203b6f7156835d7d8458b6fb54de.tar.gz
scummvm-rg350-955e18c64874203b6f7156835d7d8458b6fb54de.tar.bz2
scummvm-rg350-955e18c64874203b6f7156835d7d8458b6fb54de.zip
COMMON: Use nullptr instead of NULL or 0 where appropriate
Diffstat (limited to 'common/ustr.cpp')
-rw-r--r--common/ustr.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/ustr.cpp b/common/ustr.cpp
index e5c674f595..85946cda46 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -34,7 +34,7 @@ static uint32 computeCapacity(uint32 len) {
}
U32String::U32String(const value_type *str) : _size(0), _str(_storage) {
- if (str == 0) {
+ if (str == nullptr) {
_storage[0] = 0;
_size = 0;
} else {
@@ -69,7 +69,7 @@ U32String::U32String(const U32String &str)
_extern._capacity = str._extern._capacity;
_str = str._str;
}
- assert(_str != 0);
+ assert(_str != nullptr);
}
U32String::~U32String() {
@@ -265,15 +265,15 @@ void U32String::ensureCapacity(uint32 new_size, bool keep_old) {
// Set the ref count & capacity if we use an external storage.
// It is important to do this *after* copying any old content,
// else we would override data that has not yet been copied!
- _extern._refCount = 0;
+ _extern._refCount = nullptr;
_extern._capacity = newCapacity;
}
}
void U32String::incRefCount() const {
assert(!isStorageIntern());
- if (_extern._refCount == 0) {
- if (g_refCountPool == 0) {
+ if (_extern._refCount == nullptr) {
+ if (g_refCountPool == nullptr) {
g_refCountPool = new MemoryPool(sizeof(int));
assert(g_refCountPool);
}
@@ -317,9 +317,9 @@ void U32String::initWithCStr(const value_type *str, uint32 len) {
if (len >= _builtinCapacity) {
// Not enough internal storage, so allocate more
_extern._capacity = computeCapacity(len + 1);
- _extern._refCount = 0;
+ _extern._refCount = nullptr;
_str = new value_type[_extern._capacity];
- assert(_str != 0);
+ assert(_str != nullptr);
}
// Copy the string into the storage area