Fixing 4 SVACE errors 60/221560/2
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 3 Jan 2020 11:47:05 +0000 (11:47 +0000)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 3 Jan 2020 13:58:20 +0000 (13:58 +0000)
Dereference of null pointer
Asserts if unsigned ints not greater or equal to zero

Change-Id: Ief535cdd8fe70e2e0deed3f721e612bb2a7facb0

dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/visual-factory-impl.cpp

index d73ee6a..525e031 100755 (executable)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -721,7 +721,7 @@ struct Engine::Impl
         // Convert the character in the visual order into the glyph in the visual order.
         const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex ) + index;
 
         // Convert the character in the visual order into the glyph in the visual order.
         const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex ) + index;
 
-        DALI_ASSERT_DEBUG( 0u <= glyphIndex && glyphIndex < layoutParameters.textModel->mVisualModel->mGlyphs.Count() );
+        DALI_ASSERT_DEBUG( glyphIndex < layoutParameters.textModel->mVisualModel->mGlyphs.Count() );
 
         const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
         Vector2& position = *( glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex );
 
         const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
         Vector2& position = *( glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex );
index f8598ab..ae66146 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -256,7 +256,7 @@ void VectorAnimationTask::SetPlayRange( Property::Array& playRange )
   }
 
   // Make sure the range specified is between 0 and the total frame number
   }
 
   // Make sure the range specified is between 0 and the total frame number
-  if( startFrame >= 0 && startFrame < mTotalFrame && endFrame >= 0 && endFrame < mTotalFrame )
+  if( startFrame < mTotalFrame && endFrame < mTotalFrame )
   {
     // If the range is not in order swap values
     if( startFrame > endFrame )
   {
     // If the range is not in order swap values
     if( startFrame > endFrame )
index 2c8183c..dcc997b 100644 (file)
@@ -1,5 +1,5 @@
  /*
  /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -281,11 +281,15 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
                  Scripting::GetEnumerationName<Toolkit::DevelVisual::Type>( visualType,
                                                                             VISUAL_TYPE_TABLE,
                                                                             VISUAL_TYPE_TABLE_COUNT ),
                  Scripting::GetEnumerationName<Toolkit::DevelVisual::Type>( visualType,
                                                                             VISUAL_TYPE_TABLE,
                                                                             VISUAL_TYPE_TABLE_COUNT ),
-                 visualType==Toolkit::DevelVisual::IMAGE?"url:":"",
-                 visualType==Toolkit::DevelVisual::IMAGE ?
-                 propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME)->Get<std::string>().c_str()
-                 :"" );
-
+                 ( visualType == Toolkit::DevelVisual::IMAGE ) ? "url:" : "",
+                 ( visualType == Toolkit::DevelVisual::IMAGE ) ?
+                             ( ([&] (){
+                                        // Return URL if present in PropertyMap else return "not found message"
+                                        Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
+                                        return ( imageURLValue ) ? imageURLValue->Get<std::string>().c_str() : "url not found in PropertyMap";
+                                      })()
+                             )
+                             : "" );
 
   if( !visualPtr )
   {
 
   if( !visualPtr )
   {