diff options
Diffstat (limited to 'openbsd/14.0.0/dependencies/tqt3/patches/patch-src_tools_qfile_unix_cpp')
-rw-r--r-- | openbsd/14.0.0/dependencies/tqt3/patches/patch-src_tools_qfile_unix_cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/openbsd/14.0.0/dependencies/tqt3/patches/patch-src_tools_qfile_unix_cpp b/openbsd/14.0.0/dependencies/tqt3/patches/patch-src_tools_qfile_unix_cpp new file mode 100644 index 000000000..989554b93 --- /dev/null +++ b/openbsd/14.0.0/dependencies/tqt3/patches/patch-src_tools_qfile_unix_cpp @@ -0,0 +1,54 @@ +--- src/tools/qfile_unix.cpp.orig Fri Sep 5 20:17:49 2014 ++++ src/tools/qfile_unix.cpp Fri Sep 5 20:20:59 2014 +@@ -56,6 +56,17 @@ + #include <errno.h> + #include <limits.h> + ++class TQFilePrivate ++{ ++public: ++ TQString errorString; ++ int lastAccess; ++}; ++ ++#define ACCESS_NONE -1 ++#define ACCESS_READ 0 ++#define ACCESS_WRITE 1 ++ + extern const char* qt_fileerr_read; + + bool qt_file_access( const TQString& fn, int t ) +@@ -525,6 +536,7 @@ + #else + ok = ( ::fseek(fh, pos, SEEK_SET) == 0 ); + #endif ++ d->lastAccess = ACCESS_NONE; + } + if ( ok ) + #if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_QT4) +@@ -593,6 +605,10 @@ + setErrorStringErrno( errno ); + } + } else { // buffered file ++ if (d->lastAccess == ACCESS_WRITE) { ++ ::fseek(fh, 0, SEEK_CUR); ++ d->lastAccess = ACCESS_READ; ++ } + nread += fread( p, 1, len-nread, fh ); + if ( (uint)nread != len ) { + if ( ferror( fh ) || nread==0 ) { +@@ -644,8 +660,13 @@ + TQ_ULONG nwritten; // number of bytes written + if ( isRaw() ) // raw file + nwritten = ::write( fd, (void *)p, len ); +- else // buffered file ++ else { // buffered file ++ if (d->lastAccess == ACCESS_READ) { ++ ::fseek(fh, 0, SEEK_CUR); ++ d->lastAccess = ACCESS_WRITE; ++ } + nwritten = fwrite( p, 1, len, fh ); ++ } + if ( nwritten != len ) { // write error + if ( errno == ENOSPC ) // disk is full + setStatus( IO_ResourceError ); |