From faa437a5d29ae9f23b3502e6404683f22d258146 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Wed, 2 Dec 2020 09:56:19 +0000 Subject: [PATCH] Fixed SVACE errors Change-Id: I8ba9c64b7e20cd58834bc9ca8280840dfa8ea7ef --- dali/internal/common/const-string.cpp | 14 +++++++++++--- dali/public-api/animation/alpha-function.cpp | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dali/internal/common/const-string.cpp b/dali/internal/common/const-string.cpp index 486fcf9..058cc1d 100644 --- a/dali/internal/common/const-string.cpp +++ b/dali/internal/common/const-string.cpp @@ -25,6 +25,9 @@ #include #include +// INTERNAL INCLUDES +#include + // local namespace namespace { @@ -188,8 +191,10 @@ private: * So we allocate one memory and treat 1st segment as a array of StringEntry* and the second segment as array of * unsigned*. */ - mTable = static_cast(calloc(newBuckets + 1, sizeof(StringEntry**) + sizeof(unsigned))); - mBuckets = newBuckets; + mTable = static_cast(calloc(newBuckets + 1, sizeof(StringEntry**) + sizeof(unsigned))); + DALI_ASSERT_ALWAYS(mTable && "calloc returned nullptr"); + + mBuckets = newBuckets; } unsigned FindBucket(std::string_view name) @@ -244,8 +249,11 @@ private: return bucketNumber; } unsigned newBucketNumber = bucketNumber; + // Allocate one extra bucket which will always be non-empty. auto newTable = static_cast(calloc(newSize + 1, sizeof(StringEntry*) + sizeof(unsigned))); + DALI_ASSERT_ALWAYS(newTable && "calloc returned nullptr"); + // point to the start of the hashvalue segment. as the pointer is of type StringEntry* , but the // second segment keeps only unsigned data hence the reinterpret_cast. unsigned* newHashTable = reinterpret_cast(newTable + newSize + 1); @@ -320,4 +328,4 @@ void Dali::Internal::ConstString::SetString(std::string_view str) { mString = StringPool::Instance().Intern(str); } -} \ No newline at end of file +} diff --git a/dali/public-api/animation/alpha-function.cpp b/dali/public-api/animation/alpha-function.cpp index 0e8ea04..990cd8f 100644 --- a/dali/public-api/animation/alpha-function.cpp +++ b/dali/public-api/animation/alpha-function.cpp @@ -36,6 +36,7 @@ AlphaFunction::AlphaFunction(BuiltinFunction function) AlphaFunction::AlphaFunction(AlphaFunctionPrototype function) : mMode(CUSTOM_FUNCTION), + mBuiltin(DEFAULT), mCustom(function) { } -- 2.7.4