From 92b7462fcbd0514e7381b6a28d83b23462975627 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Mon, 24 Sep 2007 19:17:15 +0000 Subject: [PATCH] clean up : move EngWideCharToMultiByte from stubs.c to eng.c and mark it as implement svn path=/trunk/; revision=29195 --- reactos/dll/win32/gdi32/misc/stubs.c | 27 -------- reactos/dll/win32/gdi32/objects/eng.c | 93 ++++++++++++++++----------- 2 files changed, 56 insertions(+), 64 deletions(-) diff --git a/reactos/dll/win32/gdi32/misc/stubs.c b/reactos/dll/win32/gdi32/misc/stubs.c index 972820dd198..fa11337371f 100644 --- a/reactos/dll/win32/gdi32/misc/stubs.c +++ b/reactos/dll/win32/gdi32/misc/stubs.c @@ -2282,9 +2282,6 @@ CreateBitmap(INT Width, return NtGdiCreateBitmap(Width, Height, Planes, BitsPixel, (LPBYTE) pUnsafeBits); } - - - /* * @unimplemented */ @@ -2296,30 +2293,6 @@ EngGetDriverName(HDEV hdev) return 0; } - - -/* - * @unimplemented - */ -INT STDCALL -EngWideCharToMultiByte( UINT CodePage, - LPWSTR WideCharString, - INT BytesInWideCharString, - LPSTR MultiByteString, - INT BytesInMultiByteString) -{ - return WideCharToMultiByte( - CodePage, - 0, - WideCharString, - (BytesInWideCharString/sizeof(WCHAR)), /* Bytes to (in WCHARs) */ - MultiByteString, - BytesInMultiByteString, - NULL, - NULL); -} - - /* * @unimplemented */ diff --git a/reactos/dll/win32/gdi32/objects/eng.c b/reactos/dll/win32/gdi32/objects/eng.c index 5d0092af121..04be69881c6 100644 --- a/reactos/dll/win32/gdi32/objects/eng.c +++ b/reactos/dll/win32/gdi32/objects/eng.c @@ -19,6 +19,52 @@ EngAcquireSemaphore ( IN HSEMAPHORE hsem ) RtlEnterCriticalSection((PRTL_CRITICAL_SECTION)hsem); } + +/* + * @unimplemented + */ +BOOL +copy_my_glyphset( FD_GLYPHSET *dst_glyphset , FD_GLYPHSET * src_glyphset, ULONG Size) +{ + BOOL retValue = FALSE; + + memcpy(src_glyphset, dst_glyphset, Size); + if (src_glyphset->cRuns == 0) + { + retValue = TRUE; + } + + /* FIXME copy wrun */ + return retValue; +} + +FD_GLYPHSET* STDCALL +EngComputeGlyphSet(INT nCodePage,INT nFirstChar,INT cChars) +{ + FD_GLYPHSET * ntfd_glyphset; + FD_GLYPHSET * myfd_glyphset = NULL; + + ntfd_glyphset = NtGdiEngComputeGlyphSet(nCodePage,nFirstChar,cChars); + + if (!ntfd_glyphset) + { + if (ntfd_glyphset->cjThis) + { + myfd_glyphset = GlobalAlloc(0,ntfd_glyphset->cjThis); + + if (!myfd_glyphset) + { + if (copy_my_glyphset(myfd_glyphset,ntfd_glyphset,ntfd_glyphset->cjThis) == FALSE) + { + GlobalFree(myfd_glyphset); + myfd_glyphset = NULL; + } + } + } + } + return myfd_glyphset; +} + /* * @implemented */ @@ -160,47 +206,20 @@ EngReleaseSemaphore ( IN HSEMAPHORE hsem ) RtlLeaveCriticalSection( (PRTL_CRITICAL_SECTION) hsem); } -BOOL -copy_my_glyphset( FD_GLYPHSET *dst_glyphset , FD_GLYPHSET * src_glyphset, ULONG Size) -{ - BOOL retValue = FALSE; - memcpy(src_glyphset, dst_glyphset, Size); - if (src_glyphset->cRuns == 0) - { - retValue = TRUE; - } - /* FIXME copy wrun */ - return retValue; -} /* - * @unimplemented + * @implemented */ -FD_GLYPHSET* STDCALL -EngComputeGlyphSet(INT nCodePage,INT nFirstChar,INT cChars) +INT +STDCALL +EngWideCharToMultiByte( UINT CodePage, + LPWSTR WideCharString, + INT BytesInWideCharString, + LPSTR MultiByteString, + INT BytesInMultiByteString) { - FD_GLYPHSET * ntfd_glyphset; - FD_GLYPHSET * myfd_glyphset = NULL; - - ntfd_glyphset = NtGdiEngComputeGlyphSet(nCodePage,nFirstChar,cChars); - - if (!ntfd_glyphset) - { - if (ntfd_glyphset->cjThis) - { - myfd_glyphset = GlobalAlloc(0,ntfd_glyphset->cjThis); - - if (!myfd_glyphset) - { - if (copy_my_glyphset(myfd_glyphset,ntfd_glyphset,ntfd_glyphset->cjThis) == FALSE) - { - GlobalFree(myfd_glyphset); - myfd_glyphset = NULL; - } - } - } - } - return myfd_glyphset; + return WideCharToMultiByte(CodePage, 0, WideCharString, (BytesInWideCharString/sizeof(WCHAR)), + MultiByteString, BytesInMultiByteString, NULL, NULL); }