_type->decrRef();
}
+bool Any::IsNull(char *data)
+{
+ if(!data)
+ return true;
+ bool isNull(true);
+ for(std::size_t i=0;i<sizeof(void *) && isNull;i++)
+ isNull=(data[i]==SeqAlloc::DFT_CHAR_VAR);
+ return isNull;
+}
+
AtomAny::AtomAny(int val):Any(Runtime::_tc_int)
{
_value._i=val;
DynType typ=type->kind();
if(typ==String)
{
- void **tmp=(void **)data;
- delete ((StringOnHeap *)(*tmp));
+ if(!Any::IsNull(data))
+ {
+ void **tmp=(void **)data;
+ delete ((StringOnHeap *)(*tmp));
+ }
}
}
void SequenceAny::destroyReprAtPlace(char *data, const TypeCode *type)
{
void **tmp=(void **) data;
- if(*tmp)
+ if(!Any::IsNull(data))
((SequenceAny *)(*tmp))->decrRef();
//((SequenceAny *)data)->~SequenceAny();
}
{
_data=new char[_type->getSizeInByteOfAnyReprInSeq()];
for(unsigned int i=0;i<_type->getSizeInByteOfAnyReprInSeq();i++)
- _data[i]='\0';
+ _data[i]=SeqAlloc::DFT_CHAR_VAR;
}
ArrayAny::ArrayAny(char *data, TypeCodeArray * type):ComposedAny(type,false),_data(0)
{
_data=new char[_type->getSizeInByteOfAnyReprInSeq()];
for(unsigned int i=0;i<_type->getSizeInByteOfAnyReprInSeq();i++)
- _data[i]='\0';
+ _data[i]=SeqAlloc::DFT_CHAR_VAR;
}
StructAny::StructAny(const StructAny& other):ComposedAny(other)
Any(TypeCode* type);
Any(const Any& other);
virtual void putMyReprAtPlace(char *data) const = 0;
- static AnyPtr buildAnyFromCoarseData(char *data, TypeCode* type); //Factory Method
+ //static AnyPtr buildAnyFromCoarseData(char *data, TypeCode* type); //Factory Method
+ static bool IsNull(char *data);
protected:
TypeCode* _type;
};
void deallocate(char *pt);
unsigned int size() const;
std::vector<unsigned int> getSetItems() const;
+ public:
static const char DFT_CHAR_VAR;
};