Fixes build
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-05-14 12:06:19 +02:00
parent dad30a05f0
commit 64108448bc
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 9 additions and 3 deletions

View File

@ -22,10 +22,16 @@ namespace ArbUt {
public:
__ConstStringCharHolder(const char* non_null value, size_t length) : _value(new char[length + 1]) {
EnsureNotNull(value);
// For GCC we need to disable a diagnostic that does not like this.
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
strncpy(_value, value, length);
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
_value[length] = 0;
}
~__ConstStringCharHolder() noexcept { delete[] _value; }