kernel32: Remove unneeded casts.
This commit is contained in:
parent
167aa9b9f9
commit
a9b05bea3f
|
@ -331,7 +331,7 @@ DWORD WINAPI FormatMessageA(
|
||||||
}
|
}
|
||||||
TRACE("-- %s\n",debugstr_a(target));
|
TRACE("-- %s\n",debugstr_a(target));
|
||||||
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
||||||
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(LMEM_ZEROINIT,max(nSize, talloced));
|
*((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT,max(nSize, talloced));
|
||||||
memcpy(*(LPSTR*)lpBuffer,target,talloced);
|
memcpy(*(LPSTR*)lpBuffer,target,talloced);
|
||||||
} else {
|
} else {
|
||||||
lstrcpynA(lpBuffer,target,nSize);
|
lstrcpynA(lpBuffer,target,nSize);
|
||||||
|
@ -547,7 +547,7 @@ DWORD WINAPI FormatMessageW(
|
||||||
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
||||||
/* nSize is the MINIMUM size */
|
/* nSize is the MINIMUM size */
|
||||||
DWORD len = strlenW(target) + 1;
|
DWORD len = strlenW(target) + 1;
|
||||||
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(LMEM_ZEROINIT,len*sizeof(WCHAR));
|
*((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT,len*sizeof(WCHAR));
|
||||||
strcpyW(*(LPWSTR*)lpBuffer, target);
|
strcpyW(*(LPWSTR*)lpBuffer, target);
|
||||||
}
|
}
|
||||||
else lstrcpynW(lpBuffer, target, nSize);
|
else lstrcpynW(lpBuffer, target, nSize);
|
||||||
|
|
|
@ -324,9 +324,9 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
||||||
!(pArena->flags & GA_DISCARDABLE) ||
|
!(pArena->flags & GA_DISCARDABLE) ||
|
||||||
(pArena->lockCount > 0) || (pArena->pageLockCount > 0)) return 0;
|
(pArena->lockCount > 0) || (pArena->pageLockCount > 0)) return 0;
|
||||||
if (pArena->flags & GA_DOSMEM)
|
if (pArena->flags & GA_DOSMEM)
|
||||||
DOSMEM_FreeBlock( (void *)pArena->base );
|
DOSMEM_FreeBlock( pArena->base );
|
||||||
else
|
else
|
||||||
HeapFree( heap, 0, (void *)pArena->base );
|
HeapFree( heap, 0, pArena->base );
|
||||||
pArena->base = 0;
|
pArena->base = 0;
|
||||||
|
|
||||||
/* Note: we rely on the fact that SELECTOR_ReallocBlock won't
|
/* Note: we rely on the fact that SELECTOR_ReallocBlock won't
|
||||||
|
@ -355,7 +355,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
||||||
|
|
||||||
/* Reallocate the linear memory */
|
/* Reallocate the linear memory */
|
||||||
|
|
||||||
ptr = (void *)pArena->base;
|
ptr = pArena->base;
|
||||||
oldsize = pArena->size;
|
oldsize = pArena->size;
|
||||||
TRACE("oldbase %p oldsize %08x newsize %08x\n", ptr,oldsize,size);
|
TRACE("oldbase %p oldsize %08x newsize %08x\n", ptr,oldsize,size);
|
||||||
if (ptr && (size == oldsize)) return handle; /* Nothing to do */
|
if (ptr && (size == oldsize)) return handle; /* Nothing to do */
|
||||||
|
@ -399,7 +399,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
||||||
if (pArena->pageLockCount <1)
|
if (pArena->pageLockCount <1)
|
||||||
{
|
{
|
||||||
if (pArena->flags & GA_DOSMEM)
|
if (pArena->flags & GA_DOSMEM)
|
||||||
DOSMEM_FreeBlock( (void *)pArena->base );
|
DOSMEM_FreeBlock( pArena->base );
|
||||||
else
|
else
|
||||||
HeapFree( heap, 0, ptr );
|
HeapFree( heap, 0, ptr );
|
||||||
SELECTOR_FreeBlock( sel );
|
SELECTOR_FreeBlock( sel );
|
||||||
|
@ -415,7 +415,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
||||||
if (!sel)
|
if (!sel)
|
||||||
{
|
{
|
||||||
if (pArena->flags & GA_DOSMEM)
|
if (pArena->flags & GA_DOSMEM)
|
||||||
DOSMEM_FreeBlock( (void *)pArena->base );
|
DOSMEM_FreeBlock( pArena->base );
|
||||||
else
|
else
|
||||||
HeapFree( heap, 0, ptr );
|
HeapFree( heap, 0, ptr );
|
||||||
memset( pArena, 0, sizeof(GLOBALARENA) );
|
memset( pArena, 0, sizeof(GLOBALARENA) );
|
||||||
|
@ -426,7 +426,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
||||||
if (!(pNewArena = GLOBAL_GetArena( sel, selcount )))
|
if (!(pNewArena = GLOBAL_GetArena( sel, selcount )))
|
||||||
{
|
{
|
||||||
if (pArena->flags & GA_DOSMEM)
|
if (pArena->flags & GA_DOSMEM)
|
||||||
DOSMEM_FreeBlock( (void *)pArena->base );
|
DOSMEM_FreeBlock( pArena->base );
|
||||||
else
|
else
|
||||||
HeapFree( heap, 0, ptr );
|
HeapFree( heap, 0, ptr );
|
||||||
SELECTOR_FreeBlock( sel );
|
SELECTOR_FreeBlock( sel );
|
||||||
|
@ -468,7 +468,7 @@ HGLOBAL16 WINAPI GlobalFree16(
|
||||||
WARN("Invalid handle 0x%04x passed to GlobalFree16!\n",handle);
|
WARN("Invalid handle 0x%04x passed to GlobalFree16!\n",handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ptr = (void *)GET_ARENA_PTR(handle)->base;
|
ptr = GET_ARENA_PTR(handle)->base;
|
||||||
|
|
||||||
TRACE("%04x\n", handle );
|
TRACE("%04x\n", handle );
|
||||||
if (!GLOBAL_FreeBlock( handle )) return handle; /* failed */
|
if (!GLOBAL_FreeBlock( handle )) return handle; /* failed */
|
||||||
|
@ -533,7 +533,7 @@ LPVOID WINAPI GlobalLock16(
|
||||||
if (!VALID_HANDLE(handle))
|
if (!VALID_HANDLE(handle))
|
||||||
return 0;
|
return 0;
|
||||||
GET_ARENA_PTR(handle)->lockCount++;
|
GET_ARENA_PTR(handle)->lockCount++;
|
||||||
return (LPVOID)GET_ARENA_PTR(handle)->base;
|
return GET_ARENA_PTR(handle)->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ static inline HANDLE HEAP_CreateSystemHeap(void)
|
||||||
{
|
{
|
||||||
/* wait for the heap to be initialized */
|
/* wait for the heap to be initialized */
|
||||||
WaitForSingleObject( event, INFINITE );
|
WaitForSingleObject( event, INFINITE );
|
||||||
systemHeap = (HANDLE)base;
|
systemHeap = base;
|
||||||
}
|
}
|
||||||
CloseHandle( map );
|
CloseHandle( map );
|
||||||
return systemHeap;
|
return systemHeap;
|
||||||
|
@ -360,7 +360,7 @@ HGLOBAL WINAPI GlobalAlloc(
|
||||||
{
|
{
|
||||||
palloc=HeapAlloc(GetProcessHeap(), hpflags, size);
|
palloc=HeapAlloc(GetProcessHeap(), hpflags, size);
|
||||||
TRACE( "(flags=%04x) returning %p\n", flags, palloc );
|
TRACE( "(flags=%04x) returning %p\n", flags, palloc );
|
||||||
return (HGLOBAL) palloc;
|
return palloc;
|
||||||
}
|
}
|
||||||
else /* HANDLE */
|
else /* HANDLE */
|
||||||
{
|
{
|
||||||
|
@ -620,10 +620,10 @@ HGLOBAL WINAPI GlobalReAlloc(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = HeapSize(GetProcessHeap(), 0, (LPVOID)hmem);
|
size = HeapSize(GetProcessHeap(), 0, hmem);
|
||||||
hnew = GlobalAlloc(flags, size);
|
hnew = GlobalAlloc(flags, size);
|
||||||
palloc = GlobalLock(hnew);
|
palloc = GlobalLock(hnew);
|
||||||
memcpy(palloc, (LPVOID)hmem, size);
|
memcpy(palloc, hmem, size);
|
||||||
GlobalUnlock(hnew);
|
GlobalUnlock(hnew);
|
||||||
GlobalFree(hmem);
|
GlobalFree(hmem);
|
||||||
}
|
}
|
||||||
|
@ -743,7 +743,7 @@ HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
|
||||||
hreturned = 0;
|
hreturned = 0;
|
||||||
if(ISPOINTER(hmem)) /* POINTER */
|
if(ISPOINTER(hmem)) /* POINTER */
|
||||||
{
|
{
|
||||||
if(!HeapFree(GetProcessHeap(), 0, (LPVOID) hmem))
|
if(!HeapFree(GetProcessHeap(), 0, hmem))
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_HANDLE);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
hreturned = hmem;
|
hreturned = hmem;
|
||||||
|
@ -817,7 +817,7 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
|
||||||
|
|
||||||
if(ISPOINTER(hmem))
|
if(ISPOINTER(hmem))
|
||||||
{
|
{
|
||||||
retval=HeapSize(GetProcessHeap(), 0, (LPVOID) hmem);
|
retval=HeapSize(GetProcessHeap(), 0, hmem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1159,7 +1159,7 @@ void WINAPI __regs_AllocMappedBuffer(
|
||||||
buffer[0] = (DWORD)handle;
|
buffer[0] = (DWORD)handle;
|
||||||
buffer[1] = ptr;
|
buffer[1] = ptr;
|
||||||
|
|
||||||
context->Eax = (DWORD) ptr;
|
context->Eax = ptr;
|
||||||
context->Edi = (DWORD)(buffer + 2);
|
context->Edi = (DWORD)(buffer + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue