derive from gddDestructor so that same form of new and delete are used
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.22 1999/04/30 15:24:52 jhill
|
||||
// fixed improper container index bug
|
||||
//
|
||||
// Revision 1.21 1999/01/28 19:12:46 jhill
|
||||
// fixed a mostly benign string array bounds over reach
|
||||
//
|
||||
@@ -167,6 +170,14 @@ epicsShareDef gddDbrToAitTable gddDbrToAit[] = {
|
||||
static gddApplicationTypeTable* type_table = NULL;
|
||||
static aitDataFormat local_data_format=aitLocalDataFormat;
|
||||
|
||||
//
|
||||
// special gddDestructor guarantees same form of new and delete
|
||||
//
|
||||
class dbMapperFixedStringDestructor: public gddDestructor {
|
||||
virtual void run (void *);
|
||||
};
|
||||
|
||||
|
||||
// I generated a container for each of the important DBR types. This
|
||||
// includes all the control and graphic structures. The others are
|
||||
// not needed become you can get time stamp and status in each gdd.
|
||||
@@ -1018,7 +1029,7 @@ static gdd* mapGraphicEnumToGdd(void* v, aitIndex /*count*/)
|
||||
menu.setDimension(1);
|
||||
sz=db->no_str;
|
||||
str=new aitFixedString[db->no_str];
|
||||
menu.putRef(str,new gddDestructor);
|
||||
menu.putRef(str,new dbMapperFixedStringDestructor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1060,7 +1071,7 @@ static gdd* mapControlEnumToGdd(void* v, aitIndex /*count*/)
|
||||
menu.setDimension(1);
|
||||
sz=db->no_str;
|
||||
str=new aitFixedString[db->no_str];
|
||||
menu.putRef(str,new gddDestructor);
|
||||
menu.putRef(str,new dbMapperFixedStringDestructor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1523,6 +1534,17 @@ epicsShareFunc void gddMakeMapDBR(gddApplicationTypeTable* tt)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// dbMapperFixedStringDestructor::run()
|
||||
//
|
||||
// special gddDestructor guarantees same form of new and delete
|
||||
//
|
||||
void dbMapperFixedStringDestructor::run (void *pUntyped)
|
||||
{
|
||||
aitFixedString *ps = (aitFixedString *) pUntyped;
|
||||
delete [] ps;
|
||||
}
|
||||
|
||||
// An array of one function per DBR structure is provided here so conversions
|
||||
// can take place quickly by knowing the DBR enumerated type.
|
||||
//
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.27 1999/04/30 15:24:53 jhill
|
||||
// fixed improper container index bug
|
||||
//
|
||||
// Revision 1.26 1998/10/26 11:18:41 lange
|
||||
// Bug in gdd::~gdd fixed (CA gateway crashes).
|
||||
//
|
||||
@@ -133,6 +136,20 @@ void gddContainerCleaner::run(void* v)
|
||||
for(i=0;i<tot;i++) cdd->remove(0);
|
||||
}
|
||||
|
||||
//
|
||||
// special gddDestructor guarantees same form of new and delete
|
||||
//
|
||||
class gddAitInt8Destructor: public gddDestructor {
|
||||
virtual void run (void *);
|
||||
};
|
||||
|
||||
//
|
||||
// special gddDestructor guarantees same form of new and delete
|
||||
//
|
||||
class gddAitUint8Destructor: public gddDestructor {
|
||||
virtual void run (void *);
|
||||
};
|
||||
|
||||
// --------------------------The gdd functions-------------------------
|
||||
|
||||
gdd::gdd(int app, aitEnum prim, int dimen)
|
||||
@@ -322,7 +339,7 @@ gddStatus gdd::genCopy(aitEnum t, const void* d, aitDataFormat f)
|
||||
}
|
||||
else
|
||||
{
|
||||
destruct=new gddDestructor;
|
||||
destruct=new gddAitInt8Destructor;
|
||||
if (destruct==NULL) {
|
||||
gddAutoPrint("gdd::genCopy()",gddErrorNewFailed);
|
||||
rc=gddErrorNewFailed;
|
||||
@@ -472,7 +489,7 @@ gddStatus gdd::copyStuff(gdd* dd,int ctype)
|
||||
a_size=dd->getDataSizeBytes();
|
||||
if( (array=new aitUint8[a_size]) )
|
||||
{
|
||||
destruct=new gddDestructor;
|
||||
destruct=new gddAitUint8Destructor;
|
||||
if (destruct!=NULL) {
|
||||
destruct->reference();
|
||||
memcpy(array,dd->dataPointer(),a_size);
|
||||
@@ -1292,7 +1309,7 @@ gddStatus gdd::put(const gdd* dd)
|
||||
// allocate a data buffer for the user
|
||||
if((arr=new aitUint8[sz]))
|
||||
{
|
||||
destruct=new gddDestructor;
|
||||
destruct=new gddAitUint8Destructor;
|
||||
if (destruct!=NULL) {
|
||||
destruct->reference();
|
||||
setData(arr);
|
||||
@@ -1665,4 +1682,26 @@ const gdd* gdd::indexDD (aitIndex index) const
|
||||
i--;
|
||||
}
|
||||
return dd;
|
||||
}
|
||||
|
||||
//
|
||||
// gddAitInt8Destructor::run()
|
||||
//
|
||||
// special gddDestructor guarantees same form of new and delete
|
||||
//
|
||||
void gddAitInt8Destructor::run (void *pUntyped)
|
||||
{
|
||||
aitInt8 *pi8 = (aitInt8 *) pUntyped;
|
||||
delete [] pi8;
|
||||
}
|
||||
|
||||
//
|
||||
// gddAitUint8Destructor::run()
|
||||
//
|
||||
// special gddDestructor guarantees same form of new and delete
|
||||
//
|
||||
void gddAitUint8Destructor::run (void *pUntyped)
|
||||
{
|
||||
aitUint8 *pui8 = (aitUint8 *) pUntyped;
|
||||
delete [] pui8;
|
||||
}
|
||||
Reference in New Issue
Block a user