summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-13 15:30:02 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-13 15:32:58 (GMT)
commit942abf1a3ba60a60207a213dbeb383904f97e47d (patch)
treeffd79e0d7509b8af4705d5fcd683cfcc1cda6a1f /src/corelib
parent07fcb3b032526e76086d7f75dad01b867233b5d5 (diff)
downloadQt-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.cpp2
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp7
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)