Simplify a bit, remove unused macros.

svn path=/trunk/; revision=45492
This commit is contained in:
Dmitry Gorbachev 2010-02-07 19:56:49 +00:00
parent 6fe7914710
commit 8dd5d145e5
2 changed files with 14 additions and 24 deletions

View file

@ -66,28 +66,22 @@ static PVOID CabinetReservedArea = NULL;
/* Needed by zlib, but we don't want the dependency on msvcrt.dll */
/* round to 16 bytes + alloc at minimum 16 bytes */
#define ROUND_SIZE(size) (max(16, ROUND_UP(size, 16)))
void* __cdecl malloc(size_t _size)
void *__cdecl
malloc(size_t size)
{
size_t nSize = ROUND_SIZE(_size);
if (nSize<_size)
return NULL;
return RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, nSize);
return RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, size);
}
void __cdecl free(void* _ptr)
void __cdecl
free(void *ptr)
{
RtlFreeHeap(ProcessHeap, 0, _ptr);
RtlFreeHeap(ProcessHeap, 0, ptr);
}
void* __cdecl calloc(size_t _nmemb, size_t _size)
void *__cdecl
calloc(size_t nmemb, size_t size)
{
return (void*)RtlAllocateHeap (ProcessHeap, HEAP_ZERO_MEMORY, _size);
return (void *)RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, nmemb * size);
}
/* RAW codec */
@ -108,9 +102,11 @@ RawCodecUncompress(PVOID OutputBuffer,
PLONG InputLength,
PLONG OutputLength)
{
LONG In = abs(*InputLength), Out = abs(*OutputLength);
memcpy(OutputBuffer, InputBuffer, In < Out ? In : Out);
*InputLength = *OutputLength = In < Out ? In : Out;
LONG Len = min(abs(*InputLength), abs(*OutputLength));
memcpy(OutputBuffer, InputBuffer, Len);
*InputLength = *OutputLength = Len;
return CS_SUCCESS;
}

View file

@ -122,12 +122,6 @@ typedef enum _PAGE_NUMBER
#define POPUP_WAIT_ANY_KEY 1
#define POPUP_WAIT_ENTER 2
#define ROUND_DOWN(n, align) \
(((ULONG)n) & ~((align) - 1l))
#define ROUND_UP(n, align) \
ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
#define LIST_FOR_EACH(elem, list, type, field) \
for ((elem) = CONTAINING_RECORD((list)->Flink, type, field); \
&(elem)->field != (list) || (elem == NULL); \