kernel32: Fix indentation of Global* functions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-03-29 15:24:36 +02:00 committed by Alexandre Julliard
parent 56c57f8ae2
commit 48ebc410ef
1 changed files with 81 additions and 82 deletions

View File

@ -231,11 +231,10 @@ BOOL WINAPI GlobalUnlock(HGLOBAL hmem)
* Handle: Success
* NULL: Failure
*/
HGLOBAL WINAPI GlobalHandle(
LPCVOID pmem /* [in] Pointer to global memory block */
) {
HGLOBAL WINAPI GlobalHandle( LPCVOID pmem )
{
HGLOBAL handle;
PGLOBAL32_INTERN maybe_intern;
PGLOBAL32_INTERN maybe_intern;
LPCVOID test;
if (!pmem)
@ -244,7 +243,7 @@ HGLOBAL WINAPI GlobalHandle(
return 0;
}
RtlLockHeap(GetProcessHeap());
RtlLockHeap( GetProcessHeap() );
__TRY
{
handle = 0;
@ -252,22 +251,25 @@ HGLOBAL WINAPI GlobalHandle(
/* note that if pmem is a pointer to a block allocated by */
/* GlobalAlloc with GMEM_MOVEABLE then magic test in HeapValidate */
/* will fail. */
if (ISPOINTER(pmem)) {
if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, pmem )) {
handle = (HGLOBAL)pmem; /* valid fixed block */
if (ISPOINTER( pmem ))
{
if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, pmem ))
{
handle = (HGLOBAL)pmem; /* valid fixed block */
break;
}
handle = POINTER_TO_HANDLE(pmem);
} else
handle = (HGLOBAL)pmem;
handle = POINTER_TO_HANDLE( pmem );
}
else handle = (HGLOBAL)pmem;
/* Now test handle either passed in or retrieved from pointer */
maybe_intern = HANDLE_TO_INTERN( handle );
if (maybe_intern->Magic == MAGIC_GLOBAL_USED) {
if (maybe_intern->Magic == MAGIC_GLOBAL_USED)
{
test = maybe_intern->Pointer;
if (HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, (const char *)test - HGLOBAL_STORAGE ) && /* obj(-handle) valid arena? */
HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, maybe_intern )) /* intern valid arena? */
break; /* valid moveable block */
HeapValidate( GetProcessHeap(), HEAP_NO_SERIALIZE, maybe_intern )) /* intern valid arena? */
break; /* valid moveable block */
}
handle = 0;
SetLastError( ERROR_INVALID_HANDLE );
@ -278,12 +280,11 @@ HGLOBAL WINAPI GlobalHandle(
handle = 0;
}
__ENDTRY
RtlUnlockHeap(GetProcessHeap());
RtlUnlockHeap( GetProcessHeap() );
return handle;
}
/***********************************************************************
* GlobalReAlloc (KERNEL32.@)
*
@ -317,50 +318,49 @@ HGLOBAL WINAPI GlobalReAlloc( HGLOBAL hmem, SIZE_T size, UINT flags )
*/
SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
{
SIZE_T retval;
PGLOBAL32_INTERN pintern;
SIZE_T retval;
PGLOBAL32_INTERN pintern;
if (!((ULONG_PTR)hmem >> 16))
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
if (!((ULONG_PTR)hmem >> 16))
{
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
if(ISPOINTER(hmem))
{
retval=HeapSize(GetProcessHeap(), 0, hmem);
if (ISPOINTER( hmem ))
{
retval = HeapSize( GetProcessHeap(), 0, hmem );
if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */
{
retval = HeapSize( GetProcessHeap(), 0, (char *)hmem - HGLOBAL_STORAGE );
if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
{
RtlLockHeap( GetProcessHeap() );
pintern = HANDLE_TO_INTERN( hmem );
if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */
{
retval = HeapSize(GetProcessHeap(), 0, (char*)hmem - HGLOBAL_STORAGE);
if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
{
RtlLockHeap(GetProcessHeap());
pintern=HANDLE_TO_INTERN(hmem);
if(pintern->Magic==MAGIC_GLOBAL_USED)
{
if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */
retval = 0;
else
{
retval = HeapSize(GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE );
if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
{
WARN("invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic);
SetLastError(ERROR_INVALID_HANDLE);
retval=0;
}
RtlUnlockHeap(GetProcessHeap());
}
if (retval == ~(SIZE_T)0) retval = 0;
return retval;
if (pintern->Magic == MAGIC_GLOBAL_USED)
{
if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */
retval = 0;
else
{
retval = HeapSize( GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE );
if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
{
WARN( "invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic );
SetLastError( ERROR_INVALID_HANDLE );
retval = 0;
}
RtlUnlockHeap( GetProcessHeap() );
}
if (retval == ~(SIZE_T)0) retval = 0;
return retval;
}
@ -415,32 +415,31 @@ VOID WINAPI GlobalUnfix(HGLOBAL hmem)
*/
UINT WINAPI GlobalFlags(HGLOBAL hmem)
{
DWORD retval;
PGLOBAL32_INTERN pintern;
DWORD retval;
PGLOBAL32_INTERN pintern;
if(ISPOINTER(hmem))
{
retval=0;
}
else
{
RtlLockHeap(GetProcessHeap());
pintern=HANDLE_TO_INTERN(hmem);
if(pintern->Magic==MAGIC_GLOBAL_USED)
{
retval=pintern->LockCount + (pintern->Flags<<8);
if(pintern->Pointer==0)
retval|= GMEM_DISCARDED;
}
else
{
WARN("invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic);
SetLastError(ERROR_INVALID_HANDLE);
retval = GMEM_INVALID_HANDLE;
}
RtlUnlockHeap(GetProcessHeap());
}
return retval;
if (ISPOINTER( hmem ))
{
retval = 0;
}
else
{
RtlLockHeap( GetProcessHeap() );
pintern = HANDLE_TO_INTERN( hmem );
if (pintern->Magic == MAGIC_GLOBAL_USED)
{
retval = pintern->LockCount + (pintern->Flags << 8);
if (pintern->Pointer == 0) retval |= GMEM_DISCARDED;
}
else
{
WARN( "invalid handle %p (Magic: 0x%04x)\n", hmem, pintern->Magic );
SetLastError( ERROR_INVALID_HANDLE );
retval = GMEM_INVALID_HANDLE;
}
RtlUnlockHeap( GetProcessHeap() );
}
return retval;
}