Change more Vector::Resize in file downloader + Add missing comments 48/271148/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Feb 2022 02:51:43 +0000 (11:51 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Feb 2022 03:31:01 +0000 (12:31 +0900)
Change more jobs with buffer-relative resizes
+
Do some missing code style relative job. actually, copyright change.

Change-Id: I9ac8b7a69ec43df552a1bc367a2a0c5abb95c07d
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/adaptor-framework/android/file-loader-impl-android.cpp
dali/internal/adaptor-framework/generic/file-loader-impl-generic.cpp
dali/internal/imaging/common/file-download.cpp
dali/internal/imaging/common/image-operations.cpp
dali/internal/imaging/common/loader-ico.cpp
dali/internal/imaging/common/loader-jpeg-turbo.cpp
dali/internal/imaging/common/loader-wbmp.cpp

index 5b08b03..a65bf92 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -90,7 +90,8 @@ int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector
     if(asset)
     {
       length = AAsset_getLength(asset);
-      memblock.Resize(length + 1); // 1 for extra zero at the end
+      memblock.ResizeUninitialized(length + 1);
+      memblock[length] = 0; // 1 for extra zero at the end
 
       char* buffer = reinterpret_cast<char*>(memblock.Begin());
       errorCode    = (AAsset_read(asset, buffer, length) != length) ? 0 : 1;
@@ -110,7 +111,6 @@ int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector
     {
       fseek(file, 0, SEEK_END);
       length = ftell(file);
-      //Dali::Vector.Resize would lead to calling PushBack for each byte, waste of CPU resource
       memblock.ResizeUninitialized(length + 1);
       //put last byte as 0, in case this is a text file without null-terminator
       memblock[length] = 0;
index 10580e9..ebd71f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -66,7 +66,7 @@ int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector
   {
     fileSize = file->tellg();
 
-    memblock.Resize(fileSize);
+    memblock.ResizeUninitialized(fileSize);
 
     file->seekg(0, std::ios::beg);
     file->read(reinterpret_cast<char*>(memblock.Begin()), fileSize);
index cee5ba2..3866e36 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -143,7 +143,7 @@ CURLcode DownloadFileDataByChunk(CURL* curlHandle, Dali::Vector<uint8_t>& dataBu
   {
     dataSize += chunks[i].data.capacity();
   }
-  dataBuffer.Resize(dataSize);
+  dataBuffer.ResizeUninitialized(dataSize);
 
   size_t offset = 0;
   for(size_t i = 0; i < chunks.size(); ++i)
index 2473d3f..0d29c47 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
index 1d10842..ac68291 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
index 73d6710..7ed1d1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -633,7 +633,7 @@ bool LoadBitmapFromJpeg(const Dali::ImageLoader::Input& input, Dali::Devel::Pixe
 #else
   if(tjDecompressHeader2(jpeg.get(), jpegBufferPtr, jpegBufferSize, &preXformImageWidth, &preXformImageHeight, &chrominanceSubsampling) == -1)
   {
-    //DALI_LOG_ERROR("%s\n", tjGetErrorStr());
+    DALI_LOG_ERROR("%s\n", tjGetErrorStr());
     // Do not set width and height to 0 or return early as this sometimes fails only on determining subsampling type.
   }
 #endif
index 643716e..f20b5ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.