Removing warnings from module: archive.
authorAnna Niznik <a.niznik@samsung.com>
Tue, 21 Jul 2015 11:43:10 +0000 (13:43 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Mon, 3 Aug 2015 13:49:17 +0000 (22:49 +0900)
Using cppcheck (with --enable=all flag).

[Verification] TCT result:
Before: 100.00%
After:  100.00%

Change-Id: Ia660f9794277ee50300c6000a32dc6ac6a1ae572
Signed-off-by: Anna Niznik <a.niznik@samsung.com>
src/archive/archive_callback_data.cc
src/archive/filesystem_file.cc
src/archive/filesystem_file.h
src/archive/filesystem_node.cc
src/archive/un_zip.cc
src/archive/un_zip.h
src/archive/un_zip_extract_request.cc

index d57b7b26816b30c1cb8e58548fcec2b33fcf0222..79e9355fb5f435e84bd8372fd4345dab6e0d4e36 100755 (executable)
@@ -13,7 +13,7 @@
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
+
 #include "archive_callback_data.h"
 
 #include "common/logger.h"
index 04e963e958c20a0ea78d73eab6be198ce080cc72..cbd8de7e64feebcf9c99878f765c4d45719e9907 100755 (executable)
@@ -22,7 +22,7 @@ namespace extension {
 namespace filesystem {
 
 File::File(NodePtr node, const File::PermissionList &parentPermissions,
-        const std::string original_location) :
+        const std::string& original_location) :
     m_node(node),
     m_parentPerms(parentPermissions)
 {
index 40c86f5dffa8a14ead13a81048f7e71956de858c..26401f29fcaddc050e6fac155d6e1fcd4da572bf 100755 (executable)
@@ -13,7 +13,7 @@
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
+
 #ifndef _TIZEN_FILESYSTEM_FILE_H_
 #define _TIZEN_FILESYSTEM_FILE_H_
 
@@ -38,7 +38,7 @@ public:
 
     File(NodePtr node,
             const PermissionList &parentPermissions,
-            const std::string original_location = std::string());
+            const std::string& original_location = std::string());
     virtual ~File();
 
     NodePtr getNode() const;
index 7c266d12722680b5e088ddc8febeae0fcddb3976..4e2744b50006e73f9217492e01026742637798cf 100755 (executable)
@@ -147,7 +147,7 @@ PlatformResult Node::resolve(const PathPtr& path, NodePtr* node)
         }
     }
 
-    if (!S_ISDIR(info.st_mode) & !S_ISREG(info.st_mode) && !S_ISLNK(info.st_mode)) {
+    if ((!S_ISDIR(info.st_mode)) & (!S_ISREG(info.st_mode)) && !S_ISLNK(info.st_mode)) {
         LoggerE("throw IOException for file:[%s]", path->getFullPath().c_str());
         return PlatformResult(ErrorCode::IO_ERR, "Platform node is of unsupported type.");
     }
@@ -599,11 +599,10 @@ PlatformResult Node::removeAsDirectory(const PathPtr& path, bool recursive)
             LoggerE("throw IOException");
             return PlatformResult(ErrorCode::IO_ERR, "Node does not exist or access denied.");
         }
-        int err = 0;
         struct dirent entry = {0};
         struct dirent* result = nullptr;
         PlatformResult platform_result(ErrorCode::NO_ERROR);
-        while ((0 == (err = readdir_r(dir, &entry, &result))) && result) {
+        while ((0 == (readdir_r(dir, &entry, &result))) && result) {
             if (!strcmp(entry.d_name, ".") || !strncmp(entry.d_name, "..", 2)) {
                 continue;
             }
index 51724c220a375190e35c12cc3e03f521390911f9..5ce5ddd0931d5a7e1a97fa36833491da2ad03695 100755 (executable)
@@ -319,7 +319,6 @@ PlatformResult UnZip::extractItFunction(const std::string& file_name, unz_file_i
         LoggerE("Error: %s", result.message().c_str());
         return result;
     }
-
     return PlatformResult(ErrorCode::NO_ERROR);
 }
 
@@ -438,7 +437,7 @@ PlatformResult generateArchiveStatistics(const std::string& file_name, unz_file_
 
 PlatformResult UnZip::updateCallbackWithArchiveStatistics(ExtractAllProgressCallback* callback,
         unz_global_info& out_global_info,
-        const std::string optional_filter)
+        const std::string& optional_filter)
 {
     LoggerD("Enter");
     int err = unzGetGlobalInfo(m_unzip, &out_global_info);
index 30dc9e3aeddc0c197ad68c054a287463af0196a0..187d9c5b1c1b1f5ab6b5d0a89091344ba71e7e0e 100755 (executable)
@@ -83,7 +83,7 @@ private:
 
     PlatformResult updateCallbackWithArchiveStatistics(ExtractAllProgressCallback* callback,
             unz_global_info& out_global_info,
-            const std::string optional_filter = std::string());
+            const std::string& optional_filter = std::string());
 
     std::string m_zipfile_name;
     unzFile m_unzip;
index aeebcd8ea88fc86d602b85efaec1439b440c03fe..df320dd97033281a3725d5b1f02ec5c745ab82ae 100755 (executable)
@@ -13,7 +13,7 @@
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
+
 #include "un_zip_extract_request.h"
 
 #include <cstdio>
@@ -421,7 +421,6 @@ PlatformResult UnZipExtractRequest::handleFileEntry()
     }
     m_delete_output_file = true;
 
-    int read_size = 0;
     bool marked_as_finished = false;
 
     LoggerD("Started extracting: [%s] uncompressed size: %d - %s", m_filename_inzip,
@@ -448,7 +447,7 @@ PlatformResult UnZipExtractRequest::handleFileEntry()
             return PlatformResult(ErrorCode::OPERATION_CANCELED_ERR);
         }
 
-        read_size = unzReadCurrentFile(m_owner.m_unzip, m_buffer, buffer_size);
+        int read_size = unzReadCurrentFile(m_owner.m_unzip, m_buffer, buffer_size);
         if (read_size < 0) {
             LoggerE("unzReadCurrentFile failed with error code:%d for file:%s", read_size,
                     m_filename_inzip);