svn-gvsig-desktop / branches / v1_0_2 / libraries / libjni-ecw / include / NCSMalloc.h @ 40081
History | View | Annotate | Download (2.48 KB)
1 | 3538 | nacho | /********************************************************
|
---|---|---|---|
2 | ** Copyright 1999 Earth Resource Mapping Ltd.
|
||
3 | ** This document contains proprietary source code of
|
||
4 | ** Earth Resource Mapping Ltd, and can only be used under
|
||
5 | ** one of the three licenses as described in the
|
||
6 | ** license.txt file supplied with this distribution.
|
||
7 | ** See separate license.txt file for license details
|
||
8 | ** and conditions.
|
||
9 | **
|
||
10 | ** This software is covered by US patent #6,442,298,
|
||
11 | ** #6,102,897 and #6,633,688. Rights to use these patents
|
||
12 | ** is included in the license agreements.
|
||
13 | **
|
||
14 | ** FILE: NCSMalloc.h
|
||
15 | ** CREATED: Thu Feb 25 09:19:00 WST 1999
|
||
16 | ** AUTHOR: Simon Cope
|
||
17 | ** PURPOSE: NCS Memory handling routines.
|
||
18 | ** EDITS:
|
||
19 | ** [01] sjc 30Apr00 Merged Mac SDK port
|
||
20 | ** [02] sjc 15Jan02 Solaris port mods
|
||
21 | ** [03] tfl 02Jul04 Added util function to convert enum cell type to cell size
|
||
22 | *******************************************************/
|
||
23 | |||
24 | #ifndef NCSMALLOC_H
|
||
25 | #define NCSMALLOC_H
|
||
26 | |||
27 | #ifdef __cplusplus
|
||
28 | extern "C" { |
||
29 | #endif
|
||
30 | |||
31 | #ifndef NCSTYPES_H
|
||
32 | #include "NCSTypes.h" |
||
33 | #endif
|
||
34 | |||
35 | #ifdef MACINTOSH
|
||
36 | |||
37 | #include <stdlib.h> |
||
38 | #include <string.h> |
||
39 | |||
40 | #elif defined MACOSX
|
||
41 | #include <stdlib.h> |
||
42 | #include <string.h> |
||
43 | |||
44 | #else /* MACINTOSH */ |
||
45 | |||
46 | #include <malloc.h> |
||
47 | |||
48 | #if defined SOLARIS || defined LINUX || defined HPUX
|
||
49 | #include <string.h> |
||
50 | #include <alloca.h> |
||
51 | #endif /* MACINTOSH */ |
||
52 | |||
53 | #endif // SOLARIS |
||
54 | |||
55 | typedef struct { |
||
56 | #ifdef WIN32
|
||
57 | HANDLE hMem; |
||
58 | HANDLE hSize; |
||
59 | #endif
|
||
60 | void *pData;
|
||
61 | UINT64 nSize; |
||
62 | } NCSSHMInfo; |
||
63 | |||
64 | /*
|
||
65 | ** Prototypes.
|
||
66 | */
|
||
67 | void NCSMallocInit(void); |
||
68 | void NCSMallocFini(void); |
||
69 | void *NCSMalloc(UINT32 iSize, BOOLEAN bClear);
|
||
70 | void *NCSRealloc(void *pPtr, UINT32 iSize, BOOLEAN bClear); |
||
71 | void NCSFree(void *pPtr); |
||
72 | INT32 NCSPhysicalMemorySize(void);
|
||
73 | INT32 NCSCellSize(NCSEcwCellType eCellType); |
||
74 | UINT16 NCSByteSwap16(UINT16 n); |
||
75 | UINT32 NCSByteSwap32(UINT32 n); |
||
76 | UINT64 NCSByteSwap64(UINT64 n); |
||
77 | void NCSByteSwapRange16(UINT16 *pDst, UINT16 *pSrc, INT32 nValues);
|
||
78 | void NCSByteSwapRange32(UINT32 *pDst, UINT32 *pSrc, INT32 nValues);
|
||
79 | void NCSByteSwapRange64(UINT64 *pDst, UINT64 *pSrc, INT32 nValues);
|
||
80 | |||
81 | #ifndef PALM
|
||
82 | #define NCSMemSet(p, v, c) memset((p), (v), (c))
|
||
83 | #define NCSMemMove(d, s, c) memmove((d), (s), (c))
|
||
84 | #else /* PALM */ |
||
85 | #define NCSMemSet(p, v, c) MemSet((void*)(p), (Int32)(c), (UInt8)(v)) |
||
86 | #define NCSMemMove(d, s, c) MemMove((void*)(d), (const void*)(s), (Int32)(c)) |
||
87 | #endif /* PALM */ |
||
88 | |||
89 | /*
|
||
90 | ** Shared memory
|
||
91 | */
|
||
92 | NCSSHMInfo *NCSMapSHM(UINT64 nMapSize, BOOLEAN bCreateUnique, char *pMapName);
|
||
93 | void NCSUnmapSHM(NCSSHMInfo *pInfo);
|
||
94 | |||
95 | #ifdef __cplusplus
|
||
96 | } |
||
97 | #endif // __cplusplus |
||
98 | |||
99 | #endif /* NCSMALLOC_H */ |