Author: rharabien Date: Sun Dec 11 20:09:53 2011 New Revision: 54641
URL: http://svn.reactos.org/svn/reactos?rev=54641&view=rev Log: [WIN32K] - Formatting. No code changes.
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] Sun Dec 11 20:09:53 2011 @@ -29,46 +29,46 @@ LPSIZE psize, UINT flOpts) { - PDC pdc; - PDC_ATTR pdcattr; - BOOL Result; - PTEXTOBJ TextObj; - - if (!cwc) - { - psize->cx = 0; - psize->cy = 0; - return TRUE; - } - - pdc = DC_LockDc(hDC); - if (!pdc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - - pdcattr = pdc->pdcattr; - - TextObj = RealizeFontInit(pdcattr->hlfntNew); - if ( TextObj ) - { - Result = TextIntGetTextExtentPoint( pdc, - TextObj, - lpwsz, - cwc, - 0, - NULL, - 0, - psize, - flOpts); - TEXTOBJ_UnlockText(TextObj); - } - else - Result = FALSE; - - DC_UnlockDc(pdc); - return Result; + PDC pdc; + PDC_ATTR pdcattr; + BOOL Result; + PTEXTOBJ TextObj; + + if (!cwc) + { + psize->cx = 0; + psize->cy = 0; + return TRUE; + } + + pdc = DC_LockDc(hDC); + if (!pdc) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + pdcattr = pdc->pdcattr; + + TextObj = RealizeFontInit(pdcattr->hlfntNew); + if ( TextObj ) + { + Result = TextIntGetTextExtentPoint( pdc, + TextObj, + lpwsz, + cwc, + 0, + NULL, + 0, + psize, + flOpts); + TEXTOBJ_UnlockText(TextObj); + } + else + Result = FALSE; + + DC_UnlockDc(pdc); + return Result; }
@@ -89,72 +89,72 @@ LPSIZE pSize, FLONG fl) { - PDC pdc; - PDC_ATTR pdcattr; - BOOL Result; - PTEXTOBJ TextObj; - - if ( (!String && Count ) || !pSize ) - { - EngSetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if ( !Count ) - { - if ( Fit ) Fit = 0; - return TRUE; - } - - pdc = DC_LockDc(hDC); - if (NULL == pdc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - pdcattr = pdc->pdcattr; - - TextObj = RealizeFontInit(pdcattr->hlfntNew); - if ( TextObj ) - { - Result = TextIntGetTextExtentPoint( pdc, - TextObj, - String, - Count, - MaxExtent, - (LPINT)Fit, - (LPINT)Dx, - pSize, - fl); - TEXTOBJ_UnlockText(TextObj); - } - else - Result = FALSE; - - DC_UnlockDc(pdc); - return Result; + PDC pdc; + PDC_ATTR pdcattr; + BOOL Result; + PTEXTOBJ TextObj; + + if ( (!String && Count ) || !pSize ) + { + EngSetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if ( !Count ) + { + if ( Fit ) Fit = 0; + return TRUE; + } + + pdc = DC_LockDc(hDC); + if (NULL == pdc) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + pdcattr = pdc->pdcattr; + + TextObj = RealizeFontInit(pdcattr->hlfntNew); + if ( TextObj ) + { + Result = TextIntGetTextExtentPoint( pdc, + TextObj, + String, + Count, + MaxExtent, + (LPINT)Fit, + (LPINT)Dx, + pSize, + fl); + TEXTOBJ_UnlockText(TextObj); + } + else + Result = FALSE; + + DC_UnlockDc(pdc); + return Result; }
DWORD APIENTRY NtGdiGetCharSet(HDC hDC) { - PDC Dc; - PDC_ATTR pdcattr; - DWORD cscp; - // If here, update everything! - Dc = DC_LockDc(hDC); - if (!Dc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return 0; - } - cscp = ftGdiGetTextCharsetInfo(Dc,NULL,0); - pdcattr = Dc->pdcattr; - pdcattr->iCS_CP = cscp; - pdcattr->ulDirty_ &= ~DIRTY_CHARSET; - DC_UnlockDc( Dc ); - return cscp; + PDC Dc; + PDC_ATTR pdcattr; + DWORD cscp; + // If here, update everything! + Dc = DC_LockDc(hDC); + if (!Dc) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return 0; + } + cscp = ftGdiGetTextCharsetInfo(Dc, NULL, 0); + pdcattr = Dc->pdcattr; + pdcattr->iCS_CP = cscp; + pdcattr->ulDirty_ &= ~DIRTY_CHARSET; + DC_UnlockDc( Dc ); + return cscp; }
BOOL @@ -163,37 +163,37 @@ OUT LPRASTERIZER_STATUS praststat, IN ULONG cjBytes) { - NTSTATUS Status = STATUS_SUCCESS; - RASTERIZER_STATUS rsSafe; - - if (praststat && cjBytes) - { - if ( cjBytes >= sizeof(RASTERIZER_STATUS) ) cjBytes = sizeof(RASTERIZER_STATUS); - if ( ftGdiGetRasterizerCaps(&rsSafe)) - { - _SEH2_TRY - { - ProbeForWrite( praststat, - sizeof(RASTERIZER_STATUS), - 1); - RtlCopyMemory(praststat, &rsSafe, cjBytes ); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return FALSE; - } - - return TRUE; - } - } - return FALSE; + NTSTATUS Status = STATUS_SUCCESS; + RASTERIZER_STATUS rsSafe; + + if (praststat && cjBytes) + { + if ( cjBytes >= sizeof(RASTERIZER_STATUS) ) cjBytes = sizeof(RASTERIZER_STATUS); + if ( ftGdiGetRasterizerCaps(&rsSafe)) + { + _SEH2_TRY + { + ProbeForWrite( praststat, + sizeof(RASTERIZER_STATUS), + 1); + RtlCopyMemory(praststat, &rsSafe, cjBytes ); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + + return TRUE; + } + } + return FALSE; }
INT @@ -203,49 +203,49 @@ OUT OPTIONAL LPFONTSIGNATURE lpSig, IN DWORD dwFlags) { - PDC Dc; - INT Ret; - FONTSIGNATURE fsSafe; - PFONTSIGNATURE pfsSafe = &fsSafe; - NTSTATUS Status = STATUS_SUCCESS; - - Dc = DC_LockDc(hdc); - if (!Dc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return DEFAULT_CHARSET; - } - - if (!lpSig) pfsSafe = NULL; - - Ret = HIWORD(ftGdiGetTextCharsetInfo( Dc, pfsSafe, dwFlags)); - - if (lpSig) - { - if (Ret == DEFAULT_CHARSET) - RtlZeroMemory(pfsSafe, sizeof(FONTSIGNATURE)); - - _SEH2_TRY - { - ProbeForWrite( lpSig, - sizeof(FONTSIGNATURE), - 1); - RtlCopyMemory(lpSig, pfsSafe, sizeof(FONTSIGNATURE)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return DEFAULT_CHARSET; - } - } - DC_UnlockDc(Dc); - return Ret; + PDC Dc; + INT Ret; + FONTSIGNATURE fsSafe; + PFONTSIGNATURE pfsSafe = &fsSafe; + NTSTATUS Status = STATUS_SUCCESS; + + Dc = DC_LockDc(hdc); + if (!Dc) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return DEFAULT_CHARSET; + } + + if (!lpSig) pfsSafe = NULL; + + Ret = HIWORD(ftGdiGetTextCharsetInfo( Dc, pfsSafe, dwFlags)); + + if (lpSig) + { + if (Ret == DEFAULT_CHARSET) + RtlZeroMemory(pfsSafe, sizeof(FONTSIGNATURE)); + + _SEH2_TRY + { + ProbeForWrite( lpSig, + sizeof(FONTSIGNATURE), + 1); + RtlCopyMemory(lpSig, pfsSafe, sizeof(FONTSIGNATURE)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return DEFAULT_CHARSET; + } + } + DC_UnlockDc(Dc); + return Ret; }
@@ -268,145 +268,145 @@ IN FLONG fl ) { - PDC dc; - PDC_ATTR pdcattr; - LPWSTR String; - SIZE Size; - NTSTATUS Status; - BOOLEAN Result; - INT Fit; - LPINT Dx; - PTEXTOBJ TextObj; - - /* FIXME: Handle fl */ - - if (0 == Count) - { - Size.cx = 0; - Size.cy = 0; - Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE)); - if (! NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return FALSE; - } - return TRUE; - } - - String = ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), GDITAG_TEXT); - if (NULL == String) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - if (NULL != UnsafeDx) - { - Dx = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), GDITAG_TEXT); - if (NULL == Dx) - { - ExFreePoolWithTag(String, GDITAG_TEXT); - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - } - else - { - Dx = NULL; - } - - Status = MmCopyFromCaller(String, UnsafeString, Count * sizeof(WCHAR)); - if (! NT_SUCCESS(Status)) - { - if (NULL != Dx) - { - ExFreePoolWithTag(Dx, GDITAG_TEXT); - } - ExFreePoolWithTag(String, GDITAG_TEXT); - SetLastNtError(Status); - return FALSE; - } - - dc = DC_LockDc(hDC); - if (NULL == dc) - { - if (NULL != Dx) - { - ExFreePoolWithTag(Dx, GDITAG_TEXT); - } - ExFreePoolWithTag(String, GDITAG_TEXT); - EngSetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - pdcattr = dc->pdcattr; - TextObj = RealizeFontInit(pdcattr->hlfntNew); - if ( TextObj ) - { - Result = TextIntGetTextExtentPoint( dc, - TextObj, - String, - Count, - MaxExtent, - NULL == UnsafeFit ? NULL : &Fit, - Dx, - &Size, - fl); - TEXTOBJ_UnlockText(TextObj); - } - else - Result = FALSE; - DC_UnlockDc(dc); - - ExFreePoolWithTag(String, GDITAG_TEXT); - if (! Result) - { - if (NULL != Dx) - { - ExFreePoolWithTag(Dx, GDITAG_TEXT); - } - return FALSE; - } - - if (NULL != UnsafeFit) - { - Status = MmCopyToCaller(UnsafeFit, &Fit, sizeof(INT)); - if (! NT_SUCCESS(Status)) - { - if (NULL != Dx) - { - ExFreePoolWithTag(Dx, GDITAG_TEXT); - } - SetLastNtError(Status); - return FALSE; - } - } - - if (NULL != UnsafeDx) - { - Status = MmCopyToCaller(UnsafeDx, Dx, Count * sizeof(INT)); - if (! NT_SUCCESS(Status)) - { - if (NULL != Dx) - { - ExFreePoolWithTag(Dx, GDITAG_TEXT); - } - SetLastNtError(Status); - return FALSE; - } - } - if (NULL != Dx) - { - ExFreePoolWithTag(Dx,GDITAG_TEXT); - } - - Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE)); - if (! NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return FALSE; - } - - return TRUE; + PDC dc; + PDC_ATTR pdcattr; + LPWSTR String; + SIZE Size; + NTSTATUS Status; + BOOLEAN Result; + INT Fit; + LPINT Dx; + PTEXTOBJ TextObj; + + /* FIXME: Handle fl */ + + if (0 == Count) + { + Size.cx = 0; + Size.cy = 0; + Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE)); + if (! NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + return TRUE; + } + + String = ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), GDITAG_TEXT); + if (NULL == String) + { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + if (NULL != UnsafeDx) + { + Dx = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), GDITAG_TEXT); + if (NULL == Dx) + { + ExFreePoolWithTag(String, GDITAG_TEXT); + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + } + else + { + Dx = NULL; + } + + Status = MmCopyFromCaller(String, UnsafeString, Count * sizeof(WCHAR)); + if (! NT_SUCCESS(Status)) + { + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, GDITAG_TEXT); + } + ExFreePoolWithTag(String, GDITAG_TEXT); + SetLastNtError(Status); + return FALSE; + } + + dc = DC_LockDc(hDC); + if (NULL == dc) + { + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, GDITAG_TEXT); + } + ExFreePoolWithTag(String, GDITAG_TEXT); + EngSetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + pdcattr = dc->pdcattr; + TextObj = RealizeFontInit(pdcattr->hlfntNew); + if ( TextObj ) + { + Result = TextIntGetTextExtentPoint( dc, + TextObj, + String, + Count, + MaxExtent, + NULL == UnsafeFit ? NULL : &Fit, + Dx, + &Size, + fl); + TEXTOBJ_UnlockText(TextObj); + } + else + Result = FALSE; + DC_UnlockDc(dc); + + ExFreePoolWithTag(String, GDITAG_TEXT); + if (! Result) + { + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, GDITAG_TEXT); + } + return FALSE; + } + + if (NULL != UnsafeFit) + { + Status = MmCopyToCaller(UnsafeFit, &Fit, sizeof(INT)); + if (! NT_SUCCESS(Status)) + { + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, GDITAG_TEXT); + } + SetLastNtError(Status); + return FALSE; + } + } + + if (NULL != UnsafeDx) + { + Status = MmCopyToCaller(UnsafeDx, Dx, Count * sizeof(INT)); + if (! NT_SUCCESS(Status)) + { + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, GDITAG_TEXT); + } + SetLastNtError(Status); + return FALSE; + } + } + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, GDITAG_TEXT); + } + + Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE)); + if (! NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + + return TRUE; }
@@ -423,7 +423,7 @@ LPSIZE psize, UINT flOpts) { - return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, 0, NULL, NULL, psize, flOpts); + return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, 0, NULL, NULL, psize, flOpts); }
BOOL @@ -432,23 +432,23 @@ int BreakExtra, int BreakCount) { - PDC pDc; - PDC_ATTR pdcattr; - - pDc = DC_LockDc(hDC); - if (!pDc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - - pdcattr = pDc->pdcattr; - - pdcattr->lBreakExtra = BreakExtra; - pdcattr->cBreak = BreakCount; - - DC_UnlockDc(pDc); - return TRUE; + PDC pDc; + PDC_ATTR pdcattr; + + pDc = DC_LockDc(hDC); + if (!pDc) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + pdcattr = pDc->pdcattr; + + pdcattr->lBreakExtra = BreakExtra; + pdcattr->cBreak = BreakCount; + + DC_UnlockDc(pDc); + return TRUE; }
@@ -462,53 +462,53 @@ IN BOOL bAliasName ) { - PDC Dc; - PDC_ATTR pdcattr; - HFONT hFont; - PTEXTOBJ TextObj; - NTSTATUS Status; - INT fLen, ret; - - /* FIXME: Handle bAliasName */ - - Dc = DC_LockDc(hDC); - if (Dc == NULL) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - pdcattr = Dc->pdcattr; - hFont = pdcattr->hlfntNew; - DC_UnlockDc(Dc); - - TextObj = RealizeFontInit(hFont); - ASSERT(TextObj != NULL); - fLen = wcslen(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName) + 1; - - if (FaceName != NULL) - { - Count = min(Count, fLen); - Status = MmCopyToCaller(FaceName, TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName, Count * sizeof(WCHAR)); - if (!NT_SUCCESS(Status)) - { - TEXTOBJ_UnlockText(TextObj); - SetLastNtError(Status); - return 0; - } - /* Terminate if we copied only part of the font name */ - if (Count > 0 && Count < fLen) - { - FaceName[Count - 1] = '\0'; - } - ret = Count; - } - else - { - ret = fLen; - } - - TEXTOBJ_UnlockText(TextObj); - return ret; + PDC Dc; + PDC_ATTR pdcattr; + HFONT hFont; + PTEXTOBJ TextObj; + NTSTATUS Status; + INT fLen, ret; + + /* FIXME: Handle bAliasName */ + + Dc = DC_LockDc(hDC); + if (Dc == NULL) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + pdcattr = Dc->pdcattr; + hFont = pdcattr->hlfntNew; + DC_UnlockDc(Dc); + + TextObj = RealizeFontInit(hFont); + ASSERT(TextObj != NULL); + fLen = wcslen(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName) + 1; + + if (FaceName != NULL) + { + Count = min(Count, fLen); + Status = MmCopyToCaller(FaceName, TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName, Count * sizeof(WCHAR)); + if (!NT_SUCCESS(Status)) + { + TEXTOBJ_UnlockText(TextObj); + SetLastNtError(Status); + return 0; + } + /* Terminate if we copied only part of the font name */ + if (Count > 0 && Count < fLen) + { + FaceName[Count - 1] = '\0'; + } + ret = Count; + } + else + { + ret = fLen; + } + + TEXTOBJ_UnlockText(TextObj); + return ret; }
W32KAPI @@ -520,33 +520,33 @@ IN ULONG cj ) { - TMW_INTERNAL Tmwi; - NTSTATUS Status = STATUS_SUCCESS; - - if ( cj <= sizeof(TMW_INTERNAL) ) - { - if (ftGdiGetTextMetricsW(hDC,&Tmwi)) - { - _SEH2_TRY - { - ProbeForWrite(pUnsafeTmwi, cj, 1); - RtlCopyMemory(pUnsafeTmwi,&Tmwi,cj); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return FALSE; - } - return TRUE; - } - } - return FALSE; + TMW_INTERNAL Tmwi; + NTSTATUS Status = STATUS_SUCCESS; + + if ( cj <= sizeof(TMW_INTERNAL) ) + { + if (ftGdiGetTextMetricsW(hDC, &Tmwi)) + { + _SEH2_TRY + { + ProbeForWrite(pUnsafeTmwi, cj, 1); + RtlCopyMemory(pUnsafeTmwi, &Tmwi, cj); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + return TRUE; + } + } + return FALSE; }
/* EOF */