summaryrefslogtreecommitdiff
path: root/doctest/parts
diff options
context:
space:
mode:
Diffstat (limited to 'doctest/parts')
-rw-r--r--doctest/parts/doctest_fwd.h2
-rw-r--r--doctest/parts/doctest_impl.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
index 0a97be1..156c3d1 100644
--- a/doctest/parts/doctest_fwd.h
+++ b/doctest/parts/doctest_fwd.h
@@ -731,11 +731,13 @@ public:
return data.ptr;
}
+ DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wmaybe-uninitialized")
unsigned size() const {
if(isOnStack())
return last - (unsigned(buf[last]) & 31); // using "last" would work only if "len" is 32
return data.size;
}
+ DOCTEST_GCC_SUPPRESS_WARNING_POP
unsigned capacity() const {
if(isOnStack())
diff --git a/doctest/parts/doctest_impl.h b/doctest/parts/doctest_impl.h
index b1c822c..a17a767 100644
--- a/doctest/parts/doctest_impl.h
+++ b/doctest/parts/doctest_impl.h
@@ -292,21 +292,21 @@ void String::copy(const String& other) {
data.size = other.data.size;
data.capacity = data.size + 1;
data.ptr = new char[data.capacity];
- memcpy(data.ptr, other.data.ptr, data.size + 1u);
+ memcpy(data.ptr, other.data.ptr, size_t(data.size + 1));
}
}
String::String(const char* in) {
unsigned in_len = strlen(in);
if(in_len <= last) {
- memcpy(buf, in, in_len + 1u);
+ memcpy(buf, in, size_t(in_len + 1));
setLast(last - in_len);
} else {
setOnHeap();
data.size = in_len;
data.capacity = data.size + 1;
data.ptr = new char[data.capacity];
- memcpy(data.ptr, in, in_len + 1u);
+ memcpy(data.ptr, in, size_t(in_len + 1));
}
}