summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdatastream.cpp2
-rw-r--r--src/corelib/io/qdebug.cpp3
-rw-r--r--src/corelib/io/qdir.cpp4
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qfileinfo_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp29
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian_p.h4
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp7
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp198
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice.cpp7
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h2
-rw-r--r--src/corelib/io/qprocess.cpp21
-rw-r--r--src/corelib/io/qresource.cpp2
-rw-r--r--src/corelib/io/qsettings.cpp3
-rw-r--r--src/corelib/io/qtemporaryfile.cpp2
-rw-r--r--src/corelib/io/qtextstream.cpp6
-rw-r--r--src/corelib/io/qurl.cpp27
-rw-r--r--src/corelib/io/qurl.h5
20 files changed, 154 insertions, 180 deletions
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 572b8a1..52902d0 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
to a QIODevice.
\ingroup io
- \mainclass
+
A data stream is a binary stream of encoded information which is
100% independent of the host computer's operating system, CPU or
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 6dd2640..1545082 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -52,8 +52,7 @@
/*!
\class QDebug
- \ingroup io
- \mainclass
+
\brief The QDebug class provides an output stream for debugging information.
QDebug is used whenever the developer needs to write out debugging or tracing
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 8eb1ce7..91d41f1 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -58,7 +58,7 @@
#include "qvarlengtharray.h"
-#include "../kernel/qcoreglobaldata_p.h"
+#include "private/qcoreglobaldata_p.h"
#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -346,7 +346,7 @@ void QDirPrivate::detach(bool createFileEngine)
\ingroup io
\ingroup shared
\reentrant
- \mainclass
+
A QDir is used to manipulate path names, access information
regarding paths and files, and manipulate the underlying file
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 69f1ff5..5e1a5e7 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -174,7 +174,7 @@ QFilePrivate::setError(QFile::FileError err, int errNum)
\brief The QFile class provides an interface for reading from and writing to files.
\ingroup io
- \mainclass
+
\reentrant
QFile is an I/O device for reading and writing text and binary
diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h
index d64a5c4..d92090c 100644
--- a/src/corelib/io/qfileinfo_p.h
+++ b/src/corelib/io/qfileinfo_p.h
@@ -81,11 +81,11 @@ public:
CachedSize =0x08 };
struct Data {
inline Data()
- : ref(1), fileEngine(0), cache_enabled(1)
+ : ref(1), fileEngine(0), cache_enabled(1), fileSize(0)
{ clear(); }
inline Data(const Data &copy)
: ref(1), fileEngine(QAbstractFileEngine::create(copy.fileName)),
- fileName(copy.fileName), cache_enabled(copy.cache_enabled)
+ fileName(copy.fileName), cache_enabled(copy.cache_enabled), fileSize(copy.fileSize)
{ clear(); }
inline ~Data() { delete fileEngine; }
inline void clearFlags() {
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index b93d711..317c149 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -59,8 +59,8 @@
#include <QtCore/qmutex.h>
#include <QtCore/qwaitcondition.h>
#include <QtCore/qthread.h>
-#include <QtCore/QHash>
-#include <QtCore/QLinkedList>
+#include <QtCore/qhash.h>
+#include <QtCore/qlinkedlist.h>
#include <private/qcore_mac_p.h>
#include <sys/stat.h>
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
index 49a5f34..412372a 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp
@@ -52,20 +52,25 @@
QT_BEGIN_NAMESPACE
CNotifyChangeEvent* CNotifyChangeEvent::New(RFs &fs, const TDesC& file,
- QSymbianFileSystemWatcherEngine* e)
+ QSymbianFileSystemWatcherEngine* e, bool aIsDir)
{
- CNotifyChangeEvent* self = new CNotifyChangeEvent(fs, file, e);
+ CNotifyChangeEvent* self = new CNotifyChangeEvent(fs, file, e, aIsDir);
return self;
}
CNotifyChangeEvent::CNotifyChangeEvent(RFs &fs, const TDesC& file,
- QSymbianFileSystemWatcherEngine* e, TInt aPriority) :
+ QSymbianFileSystemWatcherEngine* e, bool aIsDir, TInt aPriority) :
CActive(aPriority),
+ isDir(aIsDir),
fsSession(fs),
watchedPath(file),
engine(e)
{
- fsSession.NotifyChange(ENotifyAll, iStatus, file);
+ if(isDir) {
+ fsSession.NotifyChange(ENotifyEntry, iStatus, file);
+ } else {
+ fsSession.NotifyChange(ENotifyAll, iStatus, file);
+ }
CActiveScheduler::Add(this);
SetActive();
}
@@ -77,8 +82,12 @@ CNotifyChangeEvent::~CNotifyChangeEvent()
void CNotifyChangeEvent::RunL()
{
- if (iStatus.Int() == KErrNone){
- fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath);
+ if (iStatus.Int() == KErrNone) {
+ if(isDir) {
+ fsSession.NotifyChange(ENotifyEntry, iStatus, watchedPath);
+ } else {
+ fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath);
+ }
SetActive();
QT_TRYCATCH_LEAVING(engine->emitPathChanged(this));
} else {
@@ -88,7 +97,7 @@ void CNotifyChangeEvent::RunL()
void CNotifyChangeEvent::DoCancel()
{
- fsSession.NotifyChangeCancel();
+ fsSession.NotifyChangeCancel(iStatus);
}
QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() :
@@ -132,8 +141,8 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
// Use absolute filepath as relative paths seem to have some issues.
QString filePath = fi.absoluteFilePath();
- if(isDir && filePath.at(filePath.size()-1) != QChar('/')) {
- filePath += QChar('/');
+ if(isDir && filePath.at(filePath.size()-1) != QChar(L'/')) {
+ filePath += QChar(L'/');
}
currentEvent = NULL;
@@ -264,7 +273,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory
QMutexLocker locker(&mutex);
QString nativeDir(QDir::toNativeSeparators(directoryPath));
TPtrC ptr(qt_QString2TPtrC(nativeDir));
- currentEvent = CNotifyChangeEvent::New(fsSession, ptr, this);
+ currentEvent = CNotifyChangeEvent::New(fsSession, ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
syncCondition.wakeOne();
}
diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h
index 53b2b13..846541b 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian_p.h
+++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h
@@ -71,10 +71,10 @@ class CNotifyChangeEvent : public CActive
{
public:
CNotifyChangeEvent(RFs &fsSession, const TDesC& file, QSymbianFileSystemWatcherEngine* engine,
- TInt aPriority = EPriorityStandard);
+ bool aIsDir, TInt aPriority = EPriorityStandard);
~CNotifyChangeEvent();
static CNotifyChangeEvent* New(RFs &fsSession, const TDesC& file,
- QSymbianFileSystemWatcherEngine* engine);
+ QSymbianFileSystemWatcherEngine* engine, bool aIsDir);
bool isDir;
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 2b7a3f7..620d82f 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -803,20 +803,21 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
if (!(ret & RootFlag) && !d->isSymlink())
if(_q_isSymbianHidden(d->filePath, ret & DirectoryType))
ret |= HiddenFlag;
-#endif
+#else
if (d->filePath == QLatin1String("/")) {
ret |= RootFlag;
} else {
QString baseName = fileName(BaseName);
if ((baseName.size() > 1
&& baseName.at(0) == QLatin1Char('.') && baseName.at(1) != QLatin1Char('.'))
-#if !defined(QWS) && defined(Q_OS_MAC)
+# if !defined(QWS) && defined(Q_OS_MAC)
|| _q_isMacHidden(d->filePath)
-#endif
+# endif
) {
ret |= HiddenFlag;
}
}
+#endif
}
return ret;
}
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index b7f4e48..e01b42b 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -107,24 +107,15 @@ typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURIT
static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0;
typedef BOOL (WINAPI *PtrLookupAccountSidW)(LPCWSTR, PSID, LPWSTR, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE);
static PtrLookupAccountSidW ptrLookupAccountSidW = 0;
-typedef BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
-static PtrAllocateAndInitializeSid ptrAllocateAndInitializeSid = 0;
typedef VOID (WINAPI *PtrBuildTrusteeWithSidW)(PTRUSTEE_W, PSID);
static PtrBuildTrusteeWithSidW ptrBuildTrusteeWithSidW = 0;
-typedef VOID (WINAPI *PtrBuildTrusteeWithNameW)(PTRUSTEE_W, unsigned short*);
-static PtrBuildTrusteeWithNameW ptrBuildTrusteeWithNameW = 0;
typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACCESS_MASK);
static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0;
-typedef PVOID (WINAPI *PtrFreeSid)(PSID);
-static PtrFreeSid ptrFreeSid = 0;
static TRUSTEE_W currentUserTrusteeW;
+static TRUSTEE_W worldTrusteeW;
-typedef BOOL (WINAPI *PtrOpenProcessToken)(HANDLE, DWORD, PHANDLE );
-static PtrOpenProcessToken ptrOpenProcessToken = 0;
typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
-typedef BOOL (WINAPI *PtrSetFilePointerEx)(HANDLE, LARGE_INTEGER, PLARGE_INTEGER, DWORD);
-static PtrSetFilePointerEx ptrSetFilePointerEx = 0;
QT_END_INCLUDE_NAMESPACE
@@ -152,67 +143,37 @@ void QFSFileEnginePrivate::resolveLibs()
if (advapiHnd) {
ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW");
ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW");
- ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
ptrBuildTrusteeWithSidW = (PtrBuildTrusteeWithSidW)GetProcAddress(advapiHnd, "BuildTrusteeWithSidW");
- ptrBuildTrusteeWithNameW = (PtrBuildTrusteeWithNameW)GetProcAddress(advapiHnd, "BuildTrusteeWithNameW");
ptrGetEffectiveRightsFromAclW = (PtrGetEffectiveRightsFromAclW)GetProcAddress(advapiHnd, "GetEffectiveRightsFromAclW");
- ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
}
- if (ptrBuildTrusteeWithNameW) {
- HINSTANCE versionHnd = LoadLibraryW(L"version");
- if (versionHnd) {
- typedef DWORD (WINAPI *PtrGetFileVersionInfoSizeW)(LPCWSTR lptstrFilename,LPDWORD lpdwHandle);
- PtrGetFileVersionInfoSizeW ptrGetFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)GetProcAddress(versionHnd, "GetFileVersionInfoSizeW");
- typedef BOOL (WINAPI *PtrGetFileVersionInfoW)(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData);
- PtrGetFileVersionInfoW ptrGetFileVersionInfoW = (PtrGetFileVersionInfoW)GetProcAddress(versionHnd, "GetFileVersionInfoW");
- typedef BOOL (WINAPI *PtrVerQueryValueW)(const LPVOID pBlock,LPCWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen);
- PtrVerQueryValueW ptrVerQueryValueW = (PtrVerQueryValueW)GetProcAddress(versionHnd, "VerQueryValueW");
- if(ptrGetFileVersionInfoSizeW && ptrGetFileVersionInfoW && ptrVerQueryValueW) {
- DWORD fakeHandle;
- DWORD versionSize = ptrGetFileVersionInfoSizeW(L"secur32.dll", &fakeHandle);
- if(versionSize) {
- LPVOID versionData;
- versionData = malloc(versionSize);
- if(ptrGetFileVersionInfoW(L"secur32.dll", 0, versionSize, versionData)) {
- UINT puLen;
- VS_FIXEDFILEINFO *pLocalInfo;
- if(ptrVerQueryValueW(versionData, L"\\", (void**)&pLocalInfo, &puLen)) {
- WORD wVer1, wVer2, wVer3, wVer4;
- wVer1 = HIWORD(pLocalInfo->dwFileVersionMS);
- wVer2 = LOWORD(pLocalInfo->dwFileVersionMS);
- wVer3 = HIWORD(pLocalInfo->dwFileVersionLS);
- wVer4 = LOWORD(pLocalInfo->dwFileVersionLS);
- // It will not work with secur32.dll version 5.0.2195.2862
- if(!(wVer1 == 5 && wVer2 == 0 && wVer3 == 2195 && (wVer4 == 2862 || wVer4 == 4587))) {
- HINSTANCE userHnd = LoadLibraryW(L"secur32");
- if (userHnd) {
- typedef BOOL (WINAPI *PtrGetUserNameExW)(EXTENDED_NAME_FORMAT nameFormat, ushort* lpBuffer, LPDWORD nSize);
- PtrGetUserNameExW ptrGetUserNameExW = (PtrGetUserNameExW)GetProcAddress(userHnd, "GetUserNameExW");
- if(ptrGetUserNameExW) {
- static wchar_t buffer[258];
- DWORD bufferSize = 257;
- ptrGetUserNameExW(NameSamCompatible, (ushort*)buffer, &bufferSize);
- ptrBuildTrusteeWithNameW(&currentUserTrusteeW, (ushort*)buffer);
- }
- FreeLibrary(userHnd);
- }
- }
- }
- }
- free(versionData);
- }
- }
- FreeLibrary(versionHnd);
+ if (ptrBuildTrusteeWithSidW) {
+ // Create TRUSTEE for current user
+ HANDLE hnd = ::GetCurrentProcess();
+ HANDLE token = 0;
+ if (::OpenProcessToken(hnd, TOKEN_QUERY, &token)) {
+ TOKEN_USER tu;
+ DWORD retsize;
+ if (::GetTokenInformation(token, TokenUser, &tu, sizeof(tu), &retsize))
+ ptrBuildTrusteeWithSidW(&currentUserTrusteeW, tu.User.Sid);
+ ::CloseHandle(token);
}
- ptrOpenProcessToken = (PtrOpenProcessToken)GetProcAddress(advapiHnd, "OpenProcessToken");
- HINSTANCE userenvHnd = LoadLibraryW(L"userenv");
- if (userenvHnd) {
- ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
+
+ typedef BOOL (WINAPI *PtrAllocateAndInitializeSid)(PSID_IDENTIFIER_AUTHORITY, BYTE, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, PSID*);
+ PtrAllocateAndInitializeSid ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid");
+ typedef PVOID (WINAPI *PtrFreeSid)(PSID);
+ PtrFreeSid ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid");
+ if (ptrAllocateAndInitializeSid && ptrFreeSid) {
+ // Create TRUSTEE for Everyone (World)
+ SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
+ PSID pWorld = 0;
+ if (ptrAllocateAndInitializeSid(&worldAuth, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pWorld))
+ ptrBuildTrusteeWithSidW(&worldTrusteeW, pWorld);
+ ptrFreeSid(pWorld);
}
- HINSTANCE kernelHnd = LoadLibraryW(L"kernel32");
- if (kernelHnd)
- ptrSetFilePointerEx = (PtrSetFilePointerEx)GetProcAddress(kernelHnd, "SetFilePointerEx");
}
+ HINSTANCE userenvHnd = LoadLibraryW(L"userenv");
+ if (userenvHnd)
+ ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
#endif
}
}
@@ -596,34 +557,27 @@ qint64 QFSFileEnginePrivate::nativePos() const
if (fileHandle == INVALID_HANDLE_VALUE)
return 0;
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- QFSFileEnginePrivate::resolveLibs();
- if (!ptrSetFilePointerEx) {
-#endif
- LARGE_INTEGER filepos;
- filepos.HighPart = 0;
- DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
- return 0;
- }
-
- // Note: This is the case for MOC, UIC, qmake and other
- // bootstrapped tools, and for Windows CE.
- filepos.LowPart = newFilePointer;
- return filepos.QuadPart;
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- }
-
+#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = 0;
- if (!ptrSetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_CURRENT)) {
+ if (!::SetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_CURRENT)) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string());
return 0;
}
return qint64(currentFilePos.QuadPart);
+#else
+ LARGE_INTEGER filepos;
+ filepos.HighPart = 0;
+ DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+ thatQ->setError(QFile::UnspecifiedError, qt_error_string());
+ return 0;
+ }
+
+ filepos.LowPart = newFilePointer;
+ return filepos.QuadPart;
#endif
}
@@ -632,39 +586,32 @@ qint64 QFSFileEnginePrivate::nativePos() const
*/
bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
{
- Q_Q(const QFSFileEngine);
- QFSFileEngine *thatQ = const_cast<QFSFileEngine *>(q);
+ Q_Q(QFSFileEngine);
if (fh || fd != -1) {
// stdlib / stdio mode.
return seekFdFh(pos);
}
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- QFSFileEnginePrivate::resolveLibs();
- if (!ptrSetFilePointerEx) {
-#endif
- DWORD newFilePointer;
- LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
- newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- thatQ->setError(QFile::PositionError, qt_error_string());
- return false;
- }
-
- // Note: This is the case for MOC, UIC, qmake and other
- // bootstrapped tools, and for Windows CE.
- return true;
-#if !defined(QT_NO_LIBRARY) && !defined(Q_OS_WINCE)
- }
-
+#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = pos;
- if (ptrSetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_BEGIN) == 0) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
+ if (!::SetFilePointerEx(fileHandle, offset, &currentFilePos, FILE_BEGIN)) {
+ q->setError(QFile::UnspecifiedError, qt_error_string());
return false;
}
+
+ return true;
+#else
+ DWORD newFilePointer;
+ LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
+ newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
+ if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+ q->setError(QFile::PositionError, qt_error_string());
+ return false;
+ }
+
return true;
#endif
}
@@ -1044,10 +991,10 @@ QString QFSFileEngine::homePath()
QString ret;
#if !defined(QT_NO_LIBRARY)
QFSFileEnginePrivate::resolveLibs();
- if (ptrOpenProcessToken && ptrGetUserProfileDirectoryW) {
+ if (ptrGetUserProfileDirectoryW) {
HANDLE hnd = ::GetCurrentProcess();
HANDLE token = 0;
- BOOL ok = ::ptrOpenProcessToken(hnd, TOKEN_QUERY, &token);
+ BOOL ok = ::OpenProcessToken(hnd, TOKEN_QUERY, &token);
if (ok) {
DWORD dwBufferSize = 0;
// First call, to determine size of the strings (with '\0').
@@ -1393,7 +1340,7 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
enum { ReadMask = 0x00000001, WriteMask = 0x00000002, ExecMask = 0x00000020 };
resolveLibs();
- if(ptrGetNamedSecurityInfoW && ptrAllocateAndInitializeSid && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW && ptrFreeSid) {
+ if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) {
QString fname = filePath.endsWith(QLatin1String(".lnk")) ? readLink(filePath) : filePath;
DWORD res = ptrGetNamedSecurityInfoW((wchar_t*)fname.utf16(), SE_FILE_OBJECT,
@@ -1435,21 +1382,14 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const
ret |= QAbstractFileEngine::ExeGroupPerm;
}
{ //other (world)
- // Create SID for Everyone (World)
- SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
- PSID pWorld = 0;
- if(ptrAllocateAndInitializeSid(&worldAuth, 1, SECURITY_WORLD_RID, 0,0,0,0,0,0,0, &pWorld)) {
- ptrBuildTrusteeWithSidW(&trustee, pWorld);
- if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS)
- access_mask = (ACCESS_MASK)-1; // ###
- if(access_mask & ReadMask)
- ret |= QAbstractFileEngine::ReadOtherPerm;
- if(access_mask & WriteMask)
- ret |= QAbstractFileEngine::WriteOtherPerm;
- if(access_mask & ExecMask)
- ret |= QAbstractFileEngine::ExeOtherPerm;
- }
- ptrFreeSid(pWorld);
+ if(ptrGetEffectiveRightsFromAclW(pDacl, &worldTrusteeW, &access_mask) != ERROR_SUCCESS)
+ access_mask = (ACCESS_MASK)-1; // ###
+ if(access_mask & ReadMask)
+ ret |= QAbstractFileEngine::ReadOtherPerm;
+ if(access_mask & WriteMask)
+ ret |= QAbstractFileEngine::WriteOtherPerm;
+ if(access_mask & ExecMask)
+ ret |= QAbstractFileEngine::ExeOtherPerm;
}
LocalFree(pSD);
}
@@ -1703,12 +1643,8 @@ bool QFSFileEngine::setPermissions(uint perms)
if (mode == 0) // not supported
return false;
-#if !defined(Q_OS_WINCE)
- ret = ::_wchmod((wchar_t*)d->filePath.utf16(), mode) == 0;
-#else
- ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode);
-#endif
- return ret;
+ ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode) == 0;
+ return ret;
}
bool QFSFileEngine::setSize(qint64 size)
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 2df7a27..4f66edd 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -811,7 +811,7 @@ qint64 QIODevice::read(char *data, qint64 maxSize)
#endif
if (readFromDevice < bytesToBuffer)
- d->buffer.truncate(readFromDevice < 0 ? 0 : int(readFromDevice));
+ d->buffer.truncate(int(readFromDevice));
if (!d->buffer.isEmpty()) {
lastReadChunkSize = d->buffer.read(data + readSoFar, maxSize - readSoFar);
readSoFar += lastReadChunkSize;
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp
index 89ed041..185d961 100644
--- a/src/corelib/io/qnoncontiguousbytedevice.cpp
+++ b/src/corelib/io/qnoncontiguousbytedevice.cpp
@@ -40,10 +40,9 @@
****************************************************************************/
#include "qnoncontiguousbytedevice_p.h"
-#include <QObject>
-#include <QBuffer>
-#include <QDebug>
-#include <QFile>
+#include <qbuffer.h>
+#include <qdebug.h>
+#include <qfile.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index dd34c67..ecf9b9c 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -53,7 +53,7 @@
// We mean it.
//
-#include <QObject>
+#include <QtCore/qobject.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qbuffer.h>
#include <QtCore/qiodevice.h>
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 6fc6710..18ed676 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -151,12 +151,19 @@ void QProcessPrivate::Channel::clear()
to communicate with them.
\ingroup io
- \ingroup misc
- \mainclass
+
\reentrant
+ \section1 Running a Process
+
To start a process, pass the name and command line arguments of
- the program you want to run as arguments to start(). For example:
+ the program you want to run as arguments to start(). Arguments
+ are supplied as individual strings in a QStringList.
+
+ For example, the following code snippet runs the analog clock
+ example in the Motif style on X11 platforms by passing strings
+ containing "-style" and "motif" as two items in the list of
+ arguments:
\snippet doc/src/snippets/qprocess/qprocess-simpleexecution.cpp 0
\dots
@@ -1585,16 +1592,16 @@ QByteArray QProcess::readAllStandardError()
process, a warning may be printed at the console, and the existing
process will continue running.
- Note that arguments that contain spaces are not passed to the
+ \note Arguments that contain spaces are not passed to the
process as separate arguments.
- \bold{Windows:} Arguments that contain spaces are wrapped in quotes.
-
\note Processes are started asynchronously, which means the started()
and error() signals may be delayed. Call waitForStarted() to make
sure the process has started (or has failed to start) and those signals
have been emitted.
+ \bold{Windows:} Arguments that contain spaces are wrapped in quotes.
+
\sa pid(), started(), waitForStarted()
*/
void QProcess::start(const QString &program, const QStringList &arguments, OpenMode mode)
@@ -1860,7 +1867,7 @@ bool QProcess::startDetached(const QString &program,
otherwise returns false. If the calling process exits, the
detached process will continue to live.
- Note that arguments that contain spaces are not passed to the
+ \note Arguments that contain spaces are not passed to the
process as separate arguments.
\bold{Unix:} The started process will run in its own session and act
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 34c21d7..ab4a7b7 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -169,7 +169,7 @@ Q_GLOBAL_STATIC(QStringList, resourceSearchPaths)
\brief The QResource class provides an interface for reading directly from resources.
\ingroup io
- \mainclass
+
\reentrant
\since 4.2
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index d7cf561..4c19cbf 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2011,8 +2011,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\brief The QSettings class provides persistent platform-independent application settings.
\ingroup io
- \ingroup misc
- \mainclass
+
\reentrant
Users normally expect an application to remember its settings
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 13a0e4c..d76e99b 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -447,7 +447,7 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate()
\brief The QTemporaryFile class is an I/O device that operates on temporary files.
\ingroup io
- \mainclass
+
QTemporaryFile is used to create unique temporary files safely.
The file itself is created by calling open(). The name of the
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 3b94c03..ad0a67d 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -49,7 +49,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
reading and writing text.
\ingroup io
- \ingroup text
+ \ingroup string-processing
\reentrant
QTextStream can operate on a QIODevice, a QByteArray or a
@@ -3085,8 +3085,6 @@ QLocale QTextStream::locale() const
\compat
\reentrant
- \ingroup io
- \ingroup text
Use QTextStream instead.
*/
@@ -3113,8 +3111,6 @@ QLocale QTextStream::locale() const
\compat
\reentrant
- \ingroup io
- \ingroup text
Use QTextStream instead.
*/
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 77df601..acbac36 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -47,9 +47,9 @@
\reentrant
\ingroup io
- \ingroup misc
+ \ingroup network
\ingroup shared
- \mainclass
+
It can parse and construct URLs in both encoded and unencoded
form. QUrl also has support for internationalized domain names
@@ -4024,6 +4024,29 @@ QString QUrlPrivate::createErrorString()
}
/*!
+ \macro QT_NO_URL_CAST_FROM_STRING
+ \relates QUrl
+
+ Disables automatic conversions from QString (or char *) to QUrl.
+
+ Compiling your code with this define is useful when you have a lot of
+ code that uses QString for file names and you wish to convert it to
+ use QUrl for network transparency. In any code that uses QUrl, it can
+ help avoid missing QUrl::resolved() calls, and other misuses of
+ QString to QUrl conversions.
+
+ \oldcode
+ url = filename; // probably not what you want
+ \newcode
+ url = QUrl::fromLocalFile(filename);
+ url = baseurl.resolved(QUrl(filename));
+ \endcode
+
+ \sa QT_NO_CAST_FROM_ASCII
+*/
+
+
+/*!
Constructs a URL by parsing \a url. \a url is assumed to be in human
readable representation, with no percent encoding. QUrl will automatically
percent encode all characters that are not allowed in a URL.
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index febaf4a..65da5bf 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -81,12 +81,17 @@ public:
Q_DECLARE_FLAGS(FormattingOptions, FormattingOption)
QUrl();
+#ifdef QT_NO_URL_CAST_FROM_STRING
+ explicit
+#endif
QUrl(const QString &url);
QUrl(const QString &url, ParsingMode mode);
// ### Qt 5: merge the two constructors, with mode = TolerantMode
QUrl(const QUrl &copy);
QUrl &operator =(const QUrl &copy);
+#ifndef QT_NO_URL_CAST_FROM_STRING
QUrl &operator =(const QString &url);
+#endif
~QUrl();
void setUrl(const QString &url);