Fix svace issues 66/283466/1
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 27 Oct 2022 09:34:22 +0000 (18:34 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Thu, 27 Oct 2022 09:34:22 +0000 (18:34 +0900)
Added some castings.

Change-Id: I97589cdb15e2f70844111cef3b02e73e09547496
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali/devel-api/text-abstraction/font-client.cpp
dali/internal/text/text-abstraction/bidirectional-support-impl.cpp
dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp

index 74e6487..27c9160 100644 (file)
@@ -118,7 +118,7 @@ size_t FontClient::GlyphBufferData::Compress(const uint8_t* const __restrict__ i
   {
     case TextAbstraction::FontClient::GlyphBufferData::CompressionType::NO_COMPRESSION:
     {
-      bufferSize = outBufferData.width * outBufferData.height * Pixel::GetBytesPerPixel(outBufferData.format);
+      bufferSize = static_cast<size_t>(outBufferData.width) * static_cast<size_t>(outBufferData.height) * static_cast<size_t>(Pixel::GetBytesPerPixel(outBufferData.format));
 
       compressedBuffer = (uint8_t*)malloc(bufferSize);
       if(DALI_UNLIKELY(compressedBuffer == nullptr))
@@ -138,7 +138,7 @@ size_t FontClient::GlyphBufferData::Compress(const uint8_t* const __restrict__ i
       const bool     considerPadding = (widthByte & 1) ? true : false;
 
       // For BIT_PER_PIXEL_4 type, we can know final compressed buffer size immediatly.
-      bufferSize       = outBufferData.height * (componentCount + (considerPadding ? 1 : 0));
+      bufferSize       = static_cast<size_t>(outBufferData.height) * static_cast<size_t>(componentCount + (considerPadding ? 1 : 0));
       compressedBuffer = (uint8_t*)malloc(bufferSize);
       if(DALI_UNLIKELY(compressedBuffer == nullptr))
       {
index a451de9..afa9d7e 100644 (file)
@@ -224,8 +224,8 @@ struct BidirectionalSupport::Plugin
     }
 
     // Copy embedded levels as fribidi_reorder_line() may change them.
-    const uint32_t embeddedLevelsSize = numberOfCharacters * sizeof(FriBidiLevel);
-    FriBidiLevel*  embeddedLevels     = reinterpret_cast<FriBidiLevel*>(malloc(embeddedLevelsSize));
+    const size_t  embeddedLevelsSize = static_cast<std::size_t>(numberOfCharacters) * sizeof(FriBidiLevel);
+    FriBidiLevel* embeddedLevels     = reinterpret_cast<FriBidiLevel*>(malloc(embeddedLevelsSize));
     if(embeddedLevels)
     {
       memcpy(embeddedLevels, bidirectionalInfo->embeddedLevels + firstCharacterIndex, embeddedLevelsSize);
index 2a44fde..6715e54 100644 (file)
@@ -1043,7 +1043,7 @@ FontId FontClient::Plugin::CreateFont(const FontPath& path,
       int             fixedSizeIndex  = 0;
       for(; fixedSizeIndex < ftFace->num_fixed_sizes; ++fixedSizeIndex)
       {
-        const PointSize26Dot6 fixedSize = ftFace->available_sizes[fixedSizeIndex].size;
+        const PointSize26Dot6 fixedSize = static_cast<PointSize26Dot6>(ftFace->available_sizes[fixedSizeIndex].size);
         DALI_LOG_INFO(gFontClientLogFilter, Debug::Verbose, "  size index : %d, size : %d\n", fixedSizeIndex, fixedSize);
 
         if(fixedSize >= requestedPointSize)
@@ -1057,7 +1057,7 @@ FontId FontClient::Plugin::CreateFont(const FontPath& path,
       {
         // The requested point size is bigger than the bigest fixed size.
         fixedSizeIndex  = ftFace->num_fixed_sizes - 1;
-        actualPointSize = ftFace->available_sizes[fixedSizeIndex].size;
+        actualPointSize = static_cast<PointSize26Dot6>(ftFace->available_sizes[fixedSizeIndex].size);
       }
 
       DALI_LOG_INFO(gFontClientLogFilter, Debug::Verbose, "  size index : %d, actual size : %d\n", fixedSizeIndex, actualPointSize);