Fixed SVACE errors 08/248808/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 2 Dec 2020 09:56:19 +0000 (09:56 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 2 Dec 2020 09:56:19 +0000 (09:56 +0000)
Change-Id: I8ba9c64b7e20cd58834bc9ca8280840dfa8ea7ef

dali/internal/common/const-string.cpp
dali/public-api/animation/alpha-function.cpp

index 486fcf9..058cc1d 100644 (file)
@@ -25,6 +25,9 @@
 #include <vector>
 #include <mutex>
 
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
 // 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<StringEntry**>(calloc(newBuckets + 1, sizeof(StringEntry**) + sizeof(unsigned)));
-    mBuckets            = newBuckets;
+    mTable = static_cast<StringEntry**>(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<StringEntry**>(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<unsigned*>(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
+}
index 0e8ea04..990cd8f 100644 (file)
@@ -36,6 +36,7 @@ AlphaFunction::AlphaFunction(BuiltinFunction function)
 
 AlphaFunction::AlphaFunction(AlphaFunctionPrototype function)
 : mMode(CUSTOM_FUNCTION),
+  mBuiltin(DEFAULT),
   mCustom(function)
 {
 }