internal
| 1007 | |
| 1008 | // internal |
| 1009 | void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end) |
| 1010 | { |
| 1011 | if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) ) |
| 1012 | { |
| 1013 | // Create an object using the default constructor/factory for each element |
| 1014 | void **max = (void**)(buf->data + end * sizeof(void*)); |
| 1015 | void **d = (void**)(buf->data + start * sizeof(void*)); |
| 1016 | |
| 1017 | asIScriptEngine *engine = objType->GetEngine(); |
| 1018 | asITypeInfo *subType = objType->GetSubType(); |
| 1019 | |
| 1020 | for( ; d < max; d++ ) |
| 1021 | { |
| 1022 | *d = (void*)engine->CreateScriptObject(subType); |
| 1023 | if( *d == 0 ) |
| 1024 | { |
| 1025 | // Set the remaining entries to null so the destructor |
| 1026 | // won't attempt to destroy invalid objects later |
| 1027 | memset(d, 0, sizeof(void*)*(max-d)); |
| 1028 | |
| 1029 | // There is no need to set an exception on the context, |
| 1030 | // as CreateScriptObject has already done that |
| 1031 | return; |
| 1032 | } |
| 1033 | } |
| 1034 | } |
| 1035 | else |
| 1036 | { |
| 1037 | // Set all elements to zero whether they are handles or primitives |
| 1038 | void *d = (void*)(buf->data + start * elementSize); |
| 1039 | memset(d, 0, (end-start)*elementSize); |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 | // internal |
| 1044 | void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end) |
nothing calls this directly
no test coverage detected