Merge "Fix prevent issue - Unsigned compared against 0" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / common / dali-vector.cpp
index 643c89f..084515e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,7 @@
 #include <dali/public-api/common/dali-vector.h>
 
 // EXTERNAL INCLUDES
-#include <stdlib.h>
-#include <memory.h>
+#include <cstring> // for memcpy & memmove
 
 namespace Dali
 {
@@ -77,6 +76,8 @@ void VectorBase::Reserve( SizeType capacity, SizeType elementSize )
   {
     const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize;
     void* wholeData = (void*)malloc( wholeAllocation );
+    DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" );
+
 #if defined( DEBUG_ENABLED )
     // in debug build this will help identify a vector of uninitialized data
     memset( wholeData, 0xaa, wholeAllocation );