Bypass descryption in case that file's size is 0
authoryons.kim <yons.kim@samsung.com>
Tue, 24 Nov 2015 10:50:51 +0000 (19:50 +0900)
committeryons.kim <yons.kim@samsung.com>
Tue, 24 Nov 2015 10:50:51 +0000 (19:50 +0900)
Until now, crosswalk-tizen does descryption although the files' contents
are empty(the file size is 0). It's ineffective.
Fix code to bypass it in the case.

common/resource_manager.cc

index 8040c7e06458ce1efe1aad71c44f17c76ca143a2..fdd6fd951b78cb594af7a85ee40807576597a988 100644 (file)
@@ -580,6 +580,11 @@ std::string ResourceManager::DecryptResource(const std::string& path) {
   // Read filesize
   fseek(src, 0, SEEK_END);
   size_t src_len = ftell(src);
+  if (src_len == 0) {
+    // if the file exists and is empty, bypass it
+    fclose(src);
+    return path;
+  }
   rewind(src);
 
   // Read buffer from the source file