diff options
author | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-08-13 15:30:02 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-08-13 15:32:58 (GMT) |
commit | 942abf1a3ba60a60207a213dbeb383904f97e47d (patch) | |
tree | ffd79e0d7509b8af4705d5fcd683cfcc1cda6a1f /src/corelib | |
parent | 07fcb3b032526e76086d7f75dad01b867233b5d5 (diff) | |
download | Qt-942abf1a3ba60a60207a213dbeb383904f97e47d.zip Qt-942abf1a3ba60a60207a213dbeb383904f97e47d.tar.gz Qt-942abf1a3ba60a60207a213dbeb383904f97e47d.tar.bz2 |
fixing return values _wchmod on Windows CE
_wchmod returns 0 on success and -1 on error.
Our Windows CE implementation did it wrong.
Thanks to Konstantin Ritt for spotting this!
Reviewed-by: mauricek
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qfunctions_wince.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 3394a00..ba93a94 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1706,7 +1706,7 @@ bool QFSFileEngine::setPermissions(uint perms) #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); + ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode) == 0; #endif return ret; } diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp index 2b5d4fe..77f680a 100644 --- a/src/corelib/kernel/qfunctions_wince.cpp +++ b/src/corelib/kernel/qfunctions_wince.cpp @@ -292,13 +292,14 @@ bool qt_wince__chmod(const char *file, int mode) bool qt_wince__wchmod(const wchar_t *file, int mode) { + BOOL success = FALSE; // ### Does not work properly, what about just adding one property? if(mode&_S_IWRITE) { - return SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL); + success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL); } else if((mode&_S_IREAD) && !(mode&_S_IWRITE)) { - return SetFileAttributes(file, FILE_ATTRIBUTE_READONLY); + success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY); } - return false; + return success ? 0 : -1; } HANDLE qt_wince_CreateFileA(LPCSTR filename, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attr, DWORD dispo, DWORD flags, HANDLE tempFile) |