comparison kdiff3/src-QT4/fileaccess.cpp @ 101:8463601a34a7

Corrections for file sizes >2GB
author joachim99
date Sat, 31 Jul 2010 21:17:57 +0000
parents 6f42f5bd218e
children 2df4daf33fbd 44fa471eb3c4
comparison
equal deleted inserted replaced
100:519e1cf2dab9 101:8463601a34a7
312 bool FileAccess::isValid() const { return m_bValidData; } 312 bool FileAccess::isValid() const { return m_bValidData; }
313 bool FileAccess::isFile() const { return m_bFile; } 313 bool FileAccess::isFile() const { return m_bFile; }
314 bool FileAccess::isDir() const { return m_bDir; } 314 bool FileAccess::isDir() const { return m_bDir; }
315 bool FileAccess::isSymLink() const { return m_bSymLink; } 315 bool FileAccess::isSymLink() const { return m_bSymLink; }
316 bool FileAccess::exists() const { return m_bExists; } 316 bool FileAccess::exists() const { return m_bExists; }
317 long FileAccess::size() const { return m_size; } 317 qint64 FileAccess::size() const { return m_size; }
318 KUrl FileAccess::url() const { return m_url; } 318 KUrl FileAccess::url() const { return m_url; }
319 bool FileAccess::isLocal() const { return m_bLocal; } 319 bool FileAccess::isLocal() const { return m_bLocal; }
320 bool FileAccess::isReadable() const { return m_bReadable; } 320 bool FileAccess::isReadable() const { return m_bReadable; }
321 bool FileAccess::isWritable() const { return m_bWritable; } 321 bool FileAccess::isWritable() const { return m_bWritable; }
322 bool FileAccess::isExecutable() const { return m_bExecutable; } 322 bool FileAccess::isExecutable() const { return m_bExecutable; }
554 FileAccess fa( name ); 554 FileAccess fa( name );
555 return fa.exists(); 555 return fa.exists();
556 } 556 }
557 557
558 // If the size couldn't be determined by stat() then the file is copied to a local temp file. 558 // If the size couldn't be determined by stat() then the file is copied to a local temp file.
559 long FileAccess::sizeForReading() 559 qint64 FileAccess::sizeForReading()
560 { 560 {
561 if ( m_size == 0 && !isLocal() ) 561 if ( m_size == 0 && !isLocal() )
562 { 562 {
563 // Size couldn't be determined. Copy the file to a local temp place. 563 // Size couldn't be determined. Copy the file to a local temp place.
564 QString localCopy = tempFileName(); 564 QString localCopy = tempFileName();
696 { 696 {
697 pJob->uiDelegate()->showErrorMessage(); 697 pJob->uiDelegate()->showErrorMessage();
698 } 698 }
699 else 699 else
700 { 700 {
701 long length = min2( long(newData.size()), m_maxLength - m_transferredBytes ); 701 qint64 length = min2( qint64(newData.size()), m_maxLength - m_transferredBytes );
702 ::memcpy( m_pTransferBuffer + m_transferredBytes, newData.data(), newData.size() ); 702 ::memcpy( m_pTransferBuffer + m_transferredBytes, newData.data(), newData.size() );
703 m_transferredBytes += length; 703 m_transferredBytes += length;
704 } 704 }
705 } 705 }
706 706
733 { 733 {
734 pJob->uiDelegate()->showErrorMessage(); 734 pJob->uiDelegate()->showErrorMessage();
735 } 735 }
736 else 736 else
737 { 737 {
738 long maxChunkSize = 100000; 738 qint64 maxChunkSize = 100000;
739 long length = min2( maxChunkSize, m_maxLength - m_transferredBytes ); 739 qint64 length = min2( maxChunkSize, m_maxLength - m_transferredBytes );
740 data.resize( length ); 740 data.resize( length );
741 if ( data.size()==length ) 741 if ( data.size()==length )
742 { 742 {
743 if ( length>0 ) 743 if ( length>0 )
744 { 744 {
1283 FindNextFileA(searchHandle,&findDataA)) ) 1283 FindNextFileA(searchHandle,&findDataA)) )
1284 break; 1284 break;
1285 } 1285 }
1286 bFirst = false; 1286 bFirst = false;
1287 FileAccess fa; 1287 FileAccess fa;
1288 fa.m_size = findData.nFileSizeLow ;//+ findData.nFileSizeHigh; 1288 fa.m_size = ( qint64( findData.nFileSizeHigh ) << 32 ) + findData.nFileSizeLow;
1289 1289
1290 FILETIME ft; 1290 FILETIME ft;
1291 SYSTEMTIME t; 1291 SYSTEMTIME t;
1292 FileTimeToLocalFileTime( &findData.ftLastWriteTime, &ft ); FileTimeToSystemTime(&ft,&t); 1292 FileTimeToLocalFileTime( &findData.ftLastWriteTime, &ft ); FileTimeToSystemTime(&ft,&t);
1293 fa.m_modificationTime = QDateTime( QDate(t.wYear, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) ); 1293 fa.m_modificationTime = QDateTime( QDate(t.wYear, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) );