[ cegcc-Bugs (deprecated, use Trac)-1768189 ] LocalLock and LocalUnlock - winbase.h

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ cegcc-Bugs (deprecated, use Trac)-1768189 ] LocalLock and LocalUnlock - winbase.h

SourceForge.net
Bugs (deprecated, use Trac) item #1768189, was opened at 2007-08-06 00:48
Message generated for change (Settings changed) made by pfalcon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=865514&aid=1768189&group_id=173455

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Pedro Alves (pedroalves)
Summary: LocalLock and LocalUnlock - winbase.h

Initial Comment:
Compiler: arm-wince-mingw32ce
SVN version: 1039
Compiled from source under Cygwin.

Problem: undefined externals after linking UPP example See http://www.ultimatepp.org and http://www.ultimatepp.org/forum/index.php?t=msg&goto=10942&#msg_10942 

Possible cause:
LocalLock and LocalUnlock are defined as macros in Microsoft's winbase.h - but in cegcc, these macros aren't defined.

I changed winbase.h so the definitions of these functions are:


#ifndef _WIN32_WCE
WINBASEAPI PVOID WINAPI LocalLock(HLOCAL);
WINBASEAPI BOOL WINAPI LocalUnlock(HLOCAL);
WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID);
WINBASEAPI UINT WINAPI LocalFlags(HLOCAL); /* Obsolete: Has no effect. */
#else
#define LocalLock(X) ((LPVOID)(X))
#define LocalUnlock(X) (0)
#define LocalHandle(X) ((HLOCAL)(X))
#define LocalFlags(X) (0)
#endif


----------------------------------------------------------------------

Comment By: Pedro Alves (pedroalves)
Date: 2007-08-06 14:40

Message:
Logged In: YES
user_id=1370634
Originator: NO

Hi,

The Local* patch is unacceptable, since we should never copy MSFT
copyrighted code
while doing our headers.  Luckilly, I have had implementations for those
in my tree for months now - they were needed for my Qt4 port.  See the
changelog of the commit for more details.  Anyway, thanks for triggering me
to finally commit that.

I'm also committing a patch quite similar to what you posted to remove the
W suffix from GetCharABCWidths.  Thanks for reporting!  Notice that we
usually request people to provide a changelog entry.  Since this change was
close to a one-liner, this time you'll get by ;)

Cheers,
Pedro Alves


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2007-08-06 06:14

Message:
Logged In: NO

The actual changes I made to the include files are:

Index: wingdi.h
===================================================================
--- wingdi.h (revision 1039)
+++ wingdi.h (working copy)
@@ -2797,13 +2797,13 @@
 WINGDIAPI int WINAPI GetBkMode(HDC);
 WINGDIAPI UINT WINAPI GetBoundsRect(HDC,LPRECT,UINT);
 WINGDIAPI BOOL WINAPI GetBrushOrgEx(HDC,LPPOINT);
-WINGDIAPI BOOL WINAPI GetCharABCWidthsA(HDC,UINT,UINT,LPABC);
-WINGDIAPI BOOL WINAPI GetCharABCWidthsW(HDC,UINT,UINT,LPABC);
 WINGDIAPI BOOL WINAPI GetCharABCWidthsFloatA(HDC,UINT,UINT,LPABCFLOAT);
 WINGDIAPI BOOL WINAPI GetCharABCWidthsFloatW(HDC,UINT,UINT,LPABCFLOAT);
 WINGDIAPI DWORD WINAPI
GetCharacterPlacementA(HDC,LPCSTR,int,int,LPGCP_RESULTSA,DWORD);
 WINGDIAPI DWORD WINAPI
GetCharacterPlacementW(HDC,LPCWSTR,int,int,LPGCP_RESULTSW,DWORD);
 #ifndef _WIN32_WCE
+WINGDIAPI BOOL WINAPI GetCharABCWidthsA(HDC,UINT,UINT,LPABC);
+WINGDIAPI BOOL WINAPI GetCharABCWidthsW(HDC,UINT,UINT,LPABC);
 WINGDIAPI BOOL WINAPI GetCharWidth32A(HDC,UINT,UINT,LPINT);
 WINGDIAPI BOOL WINAPI GetCharWidth32W(HDC,UINT,UINT,LPINT);
 WINGDIAPI BOOL WINAPI GetCharWidthA(HDC,UINT,UINT,LPINT);
@@ -2811,6 +2811,7 @@
 WINGDIAPI BOOL WINAPI GetCharWidthFloatA(HDC,UINT,UINT,PFLOAT);
 WINGDIAPI BOOL WINAPI GetCharWidthFloatW(HDC,UINT,UINT,PFLOAT);
 #else
+WINGDIAPI BOOL WINAPI GetCharABCWidths(HDC,UINT,UINT,LPABC);
 WINGDIAPI BOOL WINAPI GetCharWidth32(HDC,UINT,UINT,LPINT);
 #endif
 WINGDIAPI int WINAPI GetClipBox(HDC,LPRECT);
@@ -3099,10 +3100,10 @@
 #define EnumICMProfiles EnumICMProfilesW
 #define ExtTextOut ExtTextOutW
 #define GetCharABCWidthsFloat GetCharABCWidthsFloatW
-#define GetCharABCWidths GetCharABCWidthsW
 #define GetCharacterPlacement GetCharacterPlacementW
 #ifndef _WIN32_WCE
 #define GetCharWidth32 GetCharWidth32W
+#define GetCharABCWidths GetCharABCWidthsW
 #endif
 #define GetCharWidthFloat GetCharWidthFloatW
 #define GetCharWidth GetCharWidthW
Index: winbase.h
===================================================================
--- winbase.h (revision 1039)
+++ winbase.h (working copy)
@@ -1660,6 +1660,7 @@
 WINBASEAPI VOID WINAPI GlobalFix(HGLOBAL); /* Obsolete: Has no effect.
*/
 WINBASEAPI UINT WINAPI GlobalGetAtomNameA(ATOM,LPSTR,int);
 WINBASEAPI UINT WINAPI GlobalGetAtomNameW(ATOM,LPWSTR,int);
+
 #ifndef _WIN32_WCE
 WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT,DWORD);
 WINBASEAPI HGLOBAL WINAPI GlobalFree(HGLOBAL);
@@ -1679,6 +1680,7 @@
 # define GlobalSize(lp) LocalSize(lp)
 # define GlobalFlags(lp) LocalFlags(lp)
 #endif
+
 WINBASEAPI VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS);
 #if (_WIN32_WINNT >= 0x0500)
 WINBASEAPI BOOL WINAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX);
@@ -1776,16 +1778,26 @@
 WINBASEAPI SIZE_T WINAPI LocalCompact(UINT); /* Obsolete: Has no effect.
*/
 WINBASEAPI HLOCAL LocalDiscard(HLOCAL);
 WINBASEAPI BOOL WINAPI LocalFileTimeToFileTime(CONST FILETIME
*,LPFILETIME);
-WINBASEAPI UINT WINAPI LocalFlags(HLOCAL); /* Obsolete: Has no effect.
*/
 WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL);
-WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID);
-WINBASEAPI PVOID WINAPI LocalLock(HLOCAL);
 WINBASEAPI HLOCAL WINAPI LocalReAlloc(HLOCAL,SIZE_T,UINT);
 WINBASEAPI SIZE_T WINAPI LocalShrink(HLOCAL,UINT);  /* Obsolete: Has no
effect. */
 WINBASEAPI UINT WINAPI LocalSize(HLOCAL);
-WINBASEAPI BOOL WINAPI LocalUnlock(HLOCAL);
 WINBASEAPI BOOL WINAPI LockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
 WINBASEAPI BOOL WINAPI
LockFileEx(HANDLE,DWORD,DWORD,DWORD,DWORD,LPOVERLAPPED);
+
+#ifndef _WIN32_WCE
+WINBASEAPI PVOID WINAPI LocalLock(HLOCAL);
+WINBASEAPI BOOL WINAPI LocalUnlock(HLOCAL);
+WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID);
+WINBASEAPI UINT WINAPI LocalFlags(HLOCAL); /* Obsolete: Has no effect.
*/
+#else
+#define LocalLock(X) ((LPVOID)(X))
+#define LocalUnlock(X) (0)
+#define LocalHandle(X) ((HLOCAL)(X))
+#define LocalFlags(X) (0)
+#endif
+
+
 #ifdef _WIN32_WCE
 #define LockResource(h) ((PVOID)(h))
 #else


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=865514&aid=1768189&group_id=173455

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Cegcc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cegcc-devel