svn-gvsig-desktop / tags / extI18n-0.1.0-1045_8 / libraries / libjni-ecwcompress / include / NCSMalloc.h @ 43745
History | View | Annotate | Download (2.23 KB)
1 |
/********************************************************
|
---|---|
2 |
** Copyright 1999 Earth Resource Mapping Pty Ltd.
|
3 |
** This document contains unpublished source code of
|
4 |
** Earth Resource Mapping Pty Ltd. This notice does
|
5 |
** not indicate any intention to publish the source
|
6 |
** code contained herein.
|
7 |
**
|
8 |
** FILE: NCSMalloc.h
|
9 |
** CREATED: Thu Feb 25 09:19:00 WST 1999
|
10 |
** AUTHOR: Simon Cope
|
11 |
** PURPOSE: NCS Memory handling routines.
|
12 |
** EDITS:
|
13 |
** [01] sjc 30Apr00 Merged Mac SDK port
|
14 |
** [02] sjc 15Jan02 Solaris port mods
|
15 |
** [03] tfl 02Jul04 Added util function to convert enum cell type to cell size
|
16 |
*******************************************************/
|
17 |
|
18 |
#ifndef NCSMALLOC_H
|
19 |
#define NCSMALLOC_H
|
20 |
|
21 |
#ifdef __cplusplus
|
22 |
extern "C" { |
23 |
#endif
|
24 |
|
25 |
#ifndef NCSTYPES_H
|
26 |
#include "NCSTypes.h" |
27 |
#endif
|
28 |
|
29 |
#ifdef MACINTOSH
|
30 |
|
31 |
#include <stdlib.h> |
32 |
#include <string.h> |
33 |
|
34 |
#elif defined MACOSX
|
35 |
#include <stdlib.h> |
36 |
#include <string.h> |
37 |
|
38 |
#else /* MACINTOSH */ |
39 |
|
40 |
#include <malloc.h> |
41 |
|
42 |
#if defined SOLARIS || defined LINUX || defined HPUX
|
43 |
#include <string.h> |
44 |
#include <alloca.h> |
45 |
#endif /* MACINTOSH */ |
46 |
|
47 |
#endif // SOLARIS |
48 |
|
49 |
typedef struct { |
50 |
#ifdef WIN32
|
51 |
HANDLE hMem; |
52 |
HANDLE hSize; |
53 |
#endif
|
54 |
void *pData;
|
55 |
UINT64 nSize; |
56 |
} NCSSHMInfo; |
57 |
|
58 |
/*
|
59 |
** Prototypes.
|
60 |
*/
|
61 |
void NCSMallocInit(void); |
62 |
void NCSMallocFini(void); |
63 |
void *NCSMalloc(UINT32 iSize, BOOLEAN bClear);
|
64 |
void *NCSRealloc(void *pPtr, UINT32 iSize, BOOLEAN bClear); |
65 |
void NCSFree(void *pPtr); |
66 |
INT32 NCSPhysicalMemorySize(void);
|
67 |
INT32 NCSCellSize(NCSEcwCellType eCellType); |
68 |
UINT16 NCSByteSwap16(UINT16 n); |
69 |
UINT32 NCSByteSwap32(UINT32 n); |
70 |
UINT64 NCSByteSwap64(UINT64 n); |
71 |
void NCSByteSwapRange16(UINT16 *pDst, UINT16 *pSrc, INT32 nValues);
|
72 |
void NCSByteSwapRange32(UINT32 *pDst, UINT32 *pSrc, INT32 nValues);
|
73 |
void NCSByteSwapRange64(UINT64 *pDst, UINT64 *pSrc, INT32 nValues);
|
74 |
|
75 |
#ifndef PALM
|
76 |
#define NCSMemSet(p, v, c) memset((p), (v), (c))
|
77 |
#define NCSMemMove(d, s, c) memmove((d), (s), (c))
|
78 |
#else /* PALM */ |
79 |
#define NCSMemSet(p, v, c) MemSet((void*)(p), (Int32)(c), (UInt8)(v)) |
80 |
#define NCSMemMove(d, s, c) MemMove((void*)(d), (const void*)(s), (Int32)(c)) |
81 |
#endif /* PALM */ |
82 |
|
83 |
/*
|
84 |
** Shared memory
|
85 |
*/
|
86 |
NCSSHMInfo *NCSMapSHM(UINT64 nMapSize, BOOLEAN bCreateUnique, char *pMapName);
|
87 |
void NCSUnmapSHM(NCSSHMInfo *pInfo);
|
88 |
|
89 |
#ifdef __cplusplus
|
90 |
} |
91 |
#endif // __cplusplus |
92 |
|
93 |
#endif /* NCSMALLOC_H */ |