[Common-dev] CR: Removing HX_CPP_MALLOC_SUPPORTED from hxcppflags.h
Larry Young lyoung at real.comI'd like to make the following change to hxcppflags.h (see below for diff). The HX_CPP_MALLOC_SUPPORTED flag enables an optimization in CHXBuffer that allows the underlying buffer to be realloc'ed in CHXBuffer::Reallocate. The optimization potentially sets up a new/free mismatch if the following constructor is used to pass in a buffer that has been allocated outside of CHXBuffer: CHXBuffer(UCHAR* pData, UINT32 ulLength, BOOL bOwnBuffer = TRUE); This is causing the VC7 CRT library to throw an exception in ~CHXBuffer. This change will require anyone who wants to use the optimization to define the flag in their own .cf / .pf / etc. file. It admittedly does not fix the underlying problem. It just mean that anyone taking advantage of the optimization will have to ensure that their code does not have the new/free mismatch issue (and that those not using the optimization don't have to worry about it). I believe the r1 player folks are the primary users of HX_CPP_MALLOC_SUPPORTED. They have given the preliminary OK for this change. If anyone has any objections, please speak up by EOD Thurs. Thanks, Larry Index: hxcppflags.h =================================================================== RCS file: /cvsroot/common/include/hxcppflags.h,v retrieving revision 1.3 diff -u -r1.3 hxcppflags.h --- hxcppflags.h 1 May 2003 16:15:40 -0000 1.3 +++ hxcppflags.h 19 May 2004 02:40:39 -0000 @@ -42,8 +42,4 @@ # endif #endif -#if defined (_WINDOWS) -# define HX_CPP_MALLOC_SUPPORTED -#endif