From: malaterre Date: Tue, 5 Jul 2005 23:05:31 +0000 (+0000) Subject: BUG: Provide a fix(=hack) for bcc32, since jasper does not support this compiler X-Git-Tag: Version1.2.bp~368 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e167d27c34ff982bd32e4a7ab56699751faf2637;p=gdcm.git BUG: Provide a fix(=hack) for bcc32, since jasper does not support this compiler --- diff --git a/src/gdcmjasper/src/libjasper/base/jas_malloc.c b/src/gdcmjasper/src/libjasper/base/jas_malloc.c index 6ad4ed24..cc8fef8c 100644 --- a/src/gdcmjasper/src/libjasper/base/jas_malloc.c +++ b/src/gdcmjasper/src/libjasper/base/jas_malloc.c @@ -64,7 +64,7 @@ /* * Memory Allocator * - * $Id: jas_malloc.c,v 1.1 2005/05/22 18:32:59 malaterre Exp $ + * $Id: jas_malloc.c,v 1.2 2005/07/05 23:05:31 malaterre Exp $ */ /******************************************************************************\ @@ -90,7 +90,17 @@ void *jas_malloc(size_t size) { +#ifdef __BORLANDC__ + // Apparently jasper does not take into account POSIX: + // http://www.opengroup.org/onlinepubs/007908799/xsh/malloc.html + // If the size of the space requested is 0, the behaviour is implementation-dependent; + // the value returned will be either a null pointer or a unique pointer. + + // As quick fix always over allocate so we avoid the case of the NULL pointer + return malloc(size+1); +#else return malloc(size); +#endif } void jas_free(void *ptr)