[Libreoffice-commits] .: 3 commits - tools/inc tools/source
Tor Lillqvist
tml at kemper.freedesktop.org
Sat Jan 22 15:10:06 PST 2011
tools/inc/tools/postwin.h | 1 +
tools/inc/tools/prewin.h | 1 +
tools/source/fsys/wntmsc.cxx | 6 ++++--
tools/source/stream/strmwnt.cxx | 12 ++++++++++--
4 files changed, 16 insertions(+), 4 deletions(-)
New commits:
commit c9e0b0b691fe31da1d500705e0dd6fb1c10c90d3
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Sun Jan 23 00:35:18 2011 +0200
Make GetFileHandle's return type match declaration
But as the return type is just 32 bits, it is actually not enough for
a HANDLE anyway on a 64-bit OS. But on the other hand, this method is
private and not used on Windows at all. So just make it abort() then.
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index 31ad200..38c7b87 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -177,9 +177,17 @@ SvFileStream::~SvFileStream()
|*
*************************************************************************/
-ULONG SvFileStream::GetFileHandle() const
+sal_uInt32 SvFileStream::GetFileHandle() const
{
- return (ULONG)pInstanceData->hFile;
+ // Note that this method is broken on 64-bit as it would return
+ // only the lower 32 bits of a file handle. (As such, it might be
+ // that on 64-bit Windows, even in a 64-bit process, the upper 32
+ // bits of handles are always zero? But surely we should not rely
+ // on that.) On the other hand, this method is private in
+ // SvFileStream and isn't used anywhere for Windows. So make sure
+ // it doesn't get used in the future either, just abort().
+ abort( );
+ return 0;
}
/*************************************************************************
commit ebb2c5fe409592024250a709d6cc9d3f22b64d65
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Sun Jan 23 00:34:03 2011 +0200
Define ULONG as WIN_ULONG while including shlobj.h
To match what prewin.h/postwin.h do.
diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx
index 5e0d6e0..12da4c9 100644
--- a/tools/source/fsys/wntmsc.cxx
+++ b/tools/source/fsys/wntmsc.cxx
@@ -572,7 +572,9 @@ FileStat::FileStat( const void *pInfo, // struct dirent
#pragma warning(push, 1)
#pragma warning(disable: 4917)
#endif
+#define ULONG WIN_ULONG
#include <shlobj.h>
+#undef ULONG
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -611,8 +613,8 @@ HRESULT SHGetIDListFromPath( HWND hwndOwner, LPCTSTR pszPath, LPITEMIDLIST *ppid
if ( FAILED(hResult) )
return hResult;
- ULONG chEaten = lstrlen( pszPath );
- DWORD dwAttributes = FILE_ATTRIBUTE_DIRECTORY;
+ WIN_ULONG chEaten = lstrlen( pszPath );
+ DWORD dwAttributes = FILE_ATTRIBUTE_DIRECTORY;
#ifdef UNICODE
LPOLESTR wszPath = pszPath;
commit 9247faeb830a6404b4dc840a857cfa5fd6b2af6f
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Sun Jan 23 00:30:47 2011 +0200
Hide also ULONG while including <windows.h>
LibreOffice's deprecated ULONG is sal_uIntPtr, and thus 64 bits on
64-bit Windows, unlike Windows's ULONG which is 32 bits on both 32-
and 64-bit Windows. So we must hide ULONG, too, to avoid compilation
errors on 64-bit Windows.
diff --git a/tools/inc/tools/postwin.h b/tools/inc/tools/postwin.h
index 40a11c1..4a2f196 100644
--- a/tools/inc/tools/postwin.h
+++ b/tools/inc/tools/postwin.h
@@ -47,6 +47,7 @@
#undef UINT64
#undef INT32
#undef UINT32
+#undef ULONG
#endif
#undef Folder
#undef GradientStyle_RECT
diff --git a/tools/inc/tools/prewin.h b/tools/inc/tools/prewin.h
index b73e93f..7744dbe 100644
--- a/tools/inc/tools/prewin.h
+++ b/tools/inc/tools/prewin.h
@@ -37,6 +37,7 @@
#define UINT64 WIN_UINT64
#define INT32 WIN_INT32
#define UINT32 WIN_UINT32
+#define ULONG WIN_ULONG
#endif
#define Rectangle BLA_Rectangle
More information about the Libreoffice-commits
mailing list