Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ZLib.cpp File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <zlib.h>
#include "Compress.hpp"
#include "MemStreamer.hpp"
#include "Input.hpp"
#include "Output.hpp"

Go to the source code of this file.

Functions

void * zalloc (void *opaque, unsigned items, unsigned size)
void zfree (void *opaque, void *ptr)


Function Documentation

void* zalloc void *    opaque,
unsigned    items,
unsigned    size
 

Definition at line 64 of file ZLib.cpp.

00066 {
00067 #ifdef ZALLOC_COUNT
00068    void *ptr=malloc(items*size+4);
00069 #else
00070    void *ptr=malloc(items*size);
00071 #endif
00072    if(ptr==NULL)
00073       ExitNoMem();
00074 
00075 //   printf("zalloc : %lu * %lu ==> %lX\n",items,size,ptr);
00076 
00077 #ifdef ZALLOC_COUNT
00078    allocsize+=size;
00079    *(unsigned *)ptr=size;
00080    return (void *)(((char *)ptr)+4);
00081 #else
00082    return (void *)ptr;
00083 #endif
00084 }

void zfree void *    opaque,
void *    ptr
 

Definition at line 88 of file ZLib.cpp.

00089 {
00090 #ifdef ZALLOC_COUNT
00091    allocsize-=*((unsigned *)ptr-1);
00092    free((char *)ptr-4);
00093 #else
00094    free((char *)ptr);
00095 #endif
00096 }


Generated on Sat Oct 13 16:08:51 2001 for XMILL by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001