diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-18 06:34:18 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-18 06:34:18 (GMT) |
commit | fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf (patch) | |
tree | aa2ba4ce64d047d73c29ab0616e8a89d352c3abd /src/corelib/io | |
parent | d24029e3d4639f1300e7a68858936911df969f69 (diff) | |
parent | 572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (diff) | |
download | Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.zip Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.gz Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.bz2 |
Merge commit 'qt/master'
Conflicts:
doc/src/examples.qdoc
doc/src/plugins-howto.qdoc
doc/src/topics.qdoc
examples/phonon/musicplayer/mainwindow.cpp
src/3rdparty/freetype/src/base/ftobjs.c
src/corelib/global/qglobal.h
src/corelib/tools/qalgorithms.h
src/corelib/tools/qshareddata.cpp
src/corelib/tools/qsharedpointer.cpp
src/corelib/tools/tools.pri
src/corelib/xml/qxmlstream.h
src/gui/painting/painting.pri
src/gui/widgets/qdatetimeedit.cpp
tests/auto/qdesktopservices/qdesktopservices.pro
tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
tests/auto/qtextcodec/test/test.pro
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qdebug.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qdir.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qfile.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfileinfo_p.h | 4 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_fsevents_p.h | 4 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 198 | ||||
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qnoncontiguousbytedevice.cpp | 7 | ||||
-rw-r--r-- | src/corelib/io/qnoncontiguousbytedevice_p.h | 2 | ||||
-rw-r--r-- | src/corelib/io/qprocess.cpp | 21 | ||||
-rw-r--r-- | src/corelib/io/qresource.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qsettings.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qtemporaryfile.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qtextstream.cpp | 6 | ||||
-rw-r--r-- | src/corelib/io/qurl.cpp | 27 | ||||
-rw-r--r-- | src/corelib/io/qurl.h | 5 |
17 files changed, 129 insertions, 165 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 ©) : 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/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(¤tUserTrusteeW, (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(¤tUserTrusteeW, 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, ¤tFilePos, FILE_CURRENT)) { + if (!::SetFilePointerEx(fileHandle, offset, ¤tFilePos, 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, ¤tFilePos, FILE_BEGIN) == 0) { - thatQ->setError(QFile::UnspecifiedError, qt_error_string()); + if (!::SetFilePointerEx(fileHandle, offset, ¤tFilePos, 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 ©); QUrl &operator =(const QUrl ©); +#ifndef QT_NO_URL_CAST_FROM_STRING QUrl &operator =(const QString &url); +#endif ~QUrl(); void setUrl(const QString &url); |