changeset 101:8463601a34a7

Corrections for file sizes >2GB
author joachim99
date Sat, 31 Jul 2010 21:17:57 +0000
parents 519e1cf2dab9
children 4bac4535ea7f
files kdiff3/src-QT4/fileaccess.cpp kdiff3/src-QT4/fileaccess.h
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/kdiff3/src-QT4/fileaccess.cpp	Sun Jul 04 20:49:23 2010 +0000
+++ b/kdiff3/src-QT4/fileaccess.cpp	Sat Jul 31 21:17:57 2010 +0000
@@ -314,7 +314,7 @@
 bool FileAccess::isDir() const         {   return m_bDir;        }
 bool FileAccess::isSymLink() const     {   return m_bSymLink;    }
 bool FileAccess::exists() const        {   return m_bExists;     }
-long FileAccess::size() const          {   return m_size;        }
+qint64 FileAccess::size() const        {   return m_size;        }
 KUrl FileAccess::url() const           {   return m_url;         }
 bool FileAccess::isLocal() const       {   return m_bLocal;      }
 bool FileAccess::isReadable() const    {   return m_bReadable;   }
@@ -556,7 +556,7 @@
 }
 
 // If the size couldn't be determined by stat() then the file is copied to a local temp file.
-long FileAccess::sizeForReading()
+qint64 FileAccess::sizeForReading()
 {
    if ( m_size == 0 && !isLocal() )
    {
@@ -698,7 +698,7 @@
    }
    else
    {
-      long length = min2( long(newData.size()), m_maxLength - m_transferredBytes );
+      qint64 length = min2( qint64(newData.size()), m_maxLength - m_transferredBytes );
       ::memcpy( m_pTransferBuffer + m_transferredBytes, newData.data(), newData.size() );
       m_transferredBytes += length;
    }
@@ -735,8 +735,8 @@
    }
    else
    {
-      long maxChunkSize = 100000;
-      long length = min2( maxChunkSize, m_maxLength - m_transferredBytes );
+      qint64 maxChunkSize = 100000;
+      qint64 length = min2( maxChunkSize, m_maxLength - m_transferredBytes );
       data.resize( length );
       if ( data.size()==length )
       {
@@ -1285,7 +1285,7 @@
                }
                bFirst = false;
                FileAccess fa;
-               fa.m_size = findData.nFileSizeLow ;//+ findData.nFileSizeHigh;
+               fa.m_size = ( qint64( findData.nFileSizeHigh ) << 32 ) + findData.nFileSizeLow;
 
                FILETIME ft;
                SYSTEMTIME t;
--- a/kdiff3/src-QT4/fileaccess.h	Sun Jul 04 20:49:23 2010 +0000
+++ b/kdiff3/src-QT4/fileaccess.h	Sat Jul 31 21:17:57 2010 +0000
@@ -40,8 +40,8 @@
    bool isDir() const;
    bool isSymLink() const;
    bool exists() const;
-   long size() const;            // Size as returned by stat().
-   long sizeForReading();  // If the size can't be determined by stat() then the file is copied to a local temp file.
+   qint64 size() const;            // Size as returned by stat().
+   qint64 sizeForReading();  // If the size can't be determined by stat() then the file is copied to a local temp file.
    bool isReadable() const;
    bool isWritable() const;
    bool isExecutable() const;
@@ -89,7 +89,7 @@
    bool m_bLocal;
    bool m_bValidData;
 
-   unsigned long m_size;
+   qint64 m_size;
    QDateTime m_modificationTime;
    QDateTime m_accessTime;
    QDateTime m_creationTime;
@@ -143,9 +143,9 @@
    bool m_bSuccess;
 
    // Data needed during Job
-   long m_transferredBytes;
+   qint64 m_transferredBytes;
    char* m_pTransferBuffer;  // Needed during get or put
-   long m_maxLength;
+   qint64 m_maxLength;
 
    QString m_filePattern;
    QString m_fileAntiPattern;