From: Piotr Kosko
Date: Mon, 10 Jul 2017 09:46:02 +0000 (+0200)
Subject: [Filesystem] Support for 2GB+ files added
X-Git-Tag: submit/tizen_3.0/20170712.103254~4
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c92d0b126ad6ba3e86976708879ceacbd1b0cb3;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Filesystem] Support for 2GB+ files added
[Feature] Plugins are build with '-D_FILE_OFFSET_BITS=64' flag to
support files larger that 2GB.
[Verification] Code compiles without errors.
TCT passrate 100%.
Checked in console with code:
// bigfiletest contains 4GB file
tizen.filesystem.resolve(
'images/bigfiletest',
function(dir) {
function onsuccess(files) {
for (var i = 0; i < files.length; i++) {
console.log(files[i].name + " size: " + files[i].fileSize );
}
}
dir.listFiles(onsuccess);
}, function(e) {
console.log("Error: " + e.message);
}, "r"
);
/// result
// BIG.txt size: 4294967296
Change-Id: I21513b533eeee0294267888d416ec3d0a85c91bf
Signed-off-by: Piotr Kosko
---
diff --git a/src/filesystem/filesystem.gyp b/src/filesystem/filesystem.gyp
index 0ab91520..9a3c7379 100644
--- a/src/filesystem/filesystem.gyp
+++ b/src/filesystem/filesystem.gyp
@@ -30,6 +30,9 @@
'filesystem_utils.cc',
'filesystem_utils.h',
],
+ 'cflags': [
+ '-D_FILE_OFFSET_BITS=64',
+ ],
'conditions': [
[ 'tizen == 1', {
'variables': { 'packages': [
diff --git a/src/filesystem/filesystem_stat.h b/src/filesystem/filesystem_stat.h
index 87e7e478..a984ab1d 100755
--- a/src/filesystem/filesystem_stat.h
+++ b/src/filesystem/filesystem_stat.h
@@ -39,7 +39,12 @@ class FilesystemStat {
bool readOnly;
std::time_t ctime;
std::time_t mtime;
- size_t size;
+
+#ifndef __USE_FILE_OFFSET64
+ __off_t size;
+#else
+ __off64_t size;
+#endif
size_t nlink;
picojson::value toJSON() const;