|
Lines 44-49
Link Here
|
| 44 |
|
44 |
|
| 45 |
#endif // USE_EXCEPTIONS |
45 |
#endif // USE_EXCEPTIONS |
| 46 |
|
46 |
|
|
|
47 |
#ifdef __cplusplus |
| 47 |
class SafeInt |
48 |
class SafeInt |
| 48 |
{ |
49 |
{ |
| 49 |
int c; |
50 |
int c; |
|
Lines 135-140
Link Here
|
| 135 |
SafeInt operator*(const int& left, const SafeInt& right); |
136 |
SafeInt operator*(const int& left, const SafeInt& right); |
| 136 |
SafeInt operator/(const int& left, const SafeInt& right); |
137 |
SafeInt operator/(const int& left, const SafeInt& right); |
| 137 |
SafeInt operator%(const int& left, const SafeInt& right); |
138 |
SafeInt operator%(const int& left, const SafeInt& right); |
|
|
139 |
#endif |
| 138 |
|
140 |
|
| 139 |
#ifdef __cplusplus |
141 |
#ifdef __cplusplus |
| 140 |
extern "C" { |
142 |
extern "C" { |
|
Lines 162-173
Link Here
|
| 162 |
* The gmallocn_checkoverflow variant returns NULL instead of exiting |
164 |
* The gmallocn_checkoverflow variant returns NULL instead of exiting |
| 163 |
* the application if a overflow is detected |
165 |
* the application if a overflow is detected |
| 164 |
*/ |
166 |
*/ |
| 165 |
extern void *gmallocn(SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
167 |
extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP; |
| 166 |
extern void *gmallocn_checkoverflow(SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
168 |
extern void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP; |
| 167 |
extern void *gmallocn3(int a, int b, int c) GMEM_EXCEP; |
169 |
extern void *gmallocn3(int a, int b, int c) GMEM_EXCEP; |
| 168 |
extern void *gmallocn3_checkoverflow(int a, int b, int c) GMEM_EXCEP; |
170 |
extern void *gmallocn3_checkoverflow(int a, int b, int c) GMEM_EXCEP; |
| 169 |
extern void *greallocn(void *p, SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
171 |
extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP; |
| 170 |
extern void *greallocn_checkoverflow(void *p, SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
172 |
extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize) GMEM_EXCEP; |
| 171 |
|
173 |
|
| 172 |
/* |
174 |
/* |
| 173 |
* Same as free, but checks for and ignores NULL pointers. |
175 |
* Same as free, but checks for and ignores NULL pointers. |
|
Lines 199-200
Link Here
|
| 199 |
|
201 |
|
|
|
202 |
|
| 203 |
#ifdef __cplusplus |
| 204 |
extern void *gmallocn(SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
| 205 |
extern void *gmallocn_checkoverflow(SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
| 206 |
extern void *greallocn(void *p, SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
| 207 |
extern void *greallocn_checkoverflow(void *p, SafeInt nObjs, SafeInt objSize) GMEM_EXCEP; |
| 208 |
#endif |
| 209 |
|
| 200 |
#endif |
210 |
#endif |