Fix all mis-used types about large file support
[platform/core/security/ode.git] / server / engine / encryption / ext4-engine.cpp
old mode 100644 (file)
new mode 100755 (executable)
index d0a0cb2..a48cb2f
@@ -188,24 +188,24 @@ bool hasPolicy(const std::string& dir)
        return true;
 }
 
-unsigned long long getUsedSpace(const std::string& mountPoint)
+off_t getUsedSpace(const std::string& mountPoint)
 {
        struct statfs statbuf;
        if (::statfs(mountPoint.c_str(), &statbuf)) {
                throw runtime::Exception("Failed to access " + mountPoint);
        }
 
-       return (unsigned long long)(statbuf.f_blocks - statbuf.f_bfree) * statbuf.f_bsize;
+       return (off_t)(statbuf.f_blocks - statbuf.f_bfree) * statbuf.f_bsize;
 }
 
-unsigned long long getAvailableSpace(const std::string& mountPoint)
+off_t getAvailableSpace(const std::string& mountPoint)
 {
        struct statfs statbuf;
        if (::statfs(mountPoint.c_str(), &statbuf)) {
                throw runtime::Exception("Failed to access " + mountPoint);
        }
 
-       return (unsigned long long)statbuf.f_bfree * statbuf.f_bsize;
+       return (off_t)statbuf.f_bfree * statbuf.f_bsize;
 }
 
 static void copyDac(const std::string& srcPath, const std::string& destPath)
@@ -243,7 +243,7 @@ static void copyMac(const std::string& srcPath, const std::string& destPath)
 
 bool isEnoughToCopyInPlace(const std::string& path)
 {
-       unsigned long long availableSpace = getAvailableSpace(path);
+       off_t availableSpace = getAvailableSpace(path);
 
        std::function<bool(const std::string &path)> check;
        check = [&check, availableSpace](const std::string &path) {
@@ -264,7 +264,7 @@ bool isEnoughToCopyInPlace(const std::string& path)
 }
 
 void copyInPlace(const std::string& source, const std::string& destination,
-                                       const std::function<void(unsigned long long)> &addProgress)
+                                       const std::function<void(off_t)> &addProgress)
 {
        for (runtime::DirectoryIterator iter(source), end; iter != end; ++iter) {
                if (iter->getPath() == destination) {
@@ -350,9 +350,9 @@ void Ext4Engine::encrypt(const Ext4Engine::data& key, unsigned int options)
        encrypted.makeDirectory();
        setPolicy(encrypted.getPath(), sanitizedKey);
 
-       unsigned long long totalSize = getUsedSpace(source), current = 0;
+       off_t totalSize = getUsedSpace(source), current = 0;
        copyInPlace(destination, encrypted.getPath(),
-                               [&current, &totalSize, this](unsigned long long size) {
+                               [&current, &totalSize, this](off_t size) {
                                        current += size;
                                        this->progress.update(current, totalSize, 1);
                                });
@@ -378,9 +378,9 @@ void Ext4Engine::decrypt(const Ext4Engine::data& key, unsigned int options)
 
        runtime::File encrypted(destination + "/" ENCRYPTION_DIR);
 
-       unsigned long long totalSize = getUsedSpace(source), current = 0;
+       off_t totalSize = getUsedSpace(source), current = 0;
        copyInPlace(encrypted.getPath(), destination,
-                               [&current, &totalSize, this](unsigned long long size) {
+                               [&current, &totalSize, this](off_t size) {
                                        current += size;
                                        this->progress.update(current, totalSize, 1);
                                });