summaryrefslogtreecommitdiff
path: root/qmake/tools/qfile_unix.cpp
Unidiff
Diffstat (limited to 'qmake/tools/qfile_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/tools/qfile_unix.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/qmake/tools/qfile_unix.cpp b/qmake/tools/qfile_unix.cpp
index 2d5a856..460bf06 100644
--- a/qmake/tools/qfile_unix.cpp
+++ b/qmake/tools/qfile_unix.cpp
@@ -435,11 +435,14 @@ bool QFile::open( int m, int f )
435QIODevice::Offset QFile::size() const 435QIODevice::Offset QFile::size() const
436{ 436{
437 struct stat st; 437 struct stat st;
438 int ret = 0;
438 if ( isOpen() ) { 439 if ( isOpen() ) {
439 ::fstat( fh ? fileno(fh) : fd, &st ); 440 ret = ::fstat( fh ? fileno(fh) : fd, &st );
440 } else { 441 } else {
441 ::stat( QFile::encodeName(fn), &st ); 442 ret = ::stat( QFile::encodeName(fn), &st );
442 } 443 }
444 if ( ret == -1 )
445 return 0;
443#if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET) 446#if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_64BITOFFSET)
444 return (uint)st.st_size > UINT_MAX ? UINT_MAX : (QIODevice::Offset)st.st_size; 447 return (uint)st.st_size > UINT_MAX ? UINT_MAX : (QIODevice::Offset)st.st_size;
445#else 448#else
@@ -538,7 +541,7 @@ Q_LONG QFile::readBlock( char *p, Q_ULONG len )
538 // need to add these to the returned string. 541 // need to add these to the returned string.
539 uint l = ungetchBuffer.length(); 542 uint l = ungetchBuffer.length();
540 while( nread < l ) { 543 while( nread < l ) {
541 *p = ungetchBuffer[ l - nread - 1 ]; 544 *p = ungetchBuffer.at( l - nread - 1 );
542 p++; 545 p++;
543 nread++; 546 nread++;
544 } 547 }
@@ -629,7 +632,9 @@ Q_LONG QFile::writeBlock( const char *p, Q_ULONG len )
629 Returns the file handle of the file. 632 Returns the file handle of the file.
630 633
631 This is a small positive integer, suitable for use with C library 634 This is a small positive integer, suitable for use with C library
632 functions such as fdopen() and fcntl(), as well as with QSocketNotifier. 635 functions such as fdopen() and fcntl(). On systems that use file
636 descriptors for sockets (ie. Unix systems, but not Windows) the handle
637 can be used with QSocketNotifier as well.
633 638
634 If the file is not open or there is an error, handle() returns -1. 639 If the file is not open or there is an error, handle() returns -1.
635 640