summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-13 17:30:02 +0200
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-13 17:32:58 +0200
commit942abf1a3ba60a60207a213dbeb383904f97e47d (patch)
treeffd79e0d7509b8af4705d5fcd683cfcc1cda6a1f /src
parent07fcb3b032526e76086d7f75dad01b867233b5d5 (diff)
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')
-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 3394a0030..ba93a9441 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 2b5d4fee0..77f680ac8 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)