mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel
This commit is contained in:
commit
0fc0d74e6b
|
@ -10072,7 +10072,7 @@ static v8::Handle<v8::Integer> PropertyQueryShapedJson (v8::Local<v8::String> na
|
||||||
TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(shaper, sid, pid);
|
TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(shaper, sid, pid);
|
||||||
|
|
||||||
// key not found
|
// key not found
|
||||||
if (acc == 0 || acc->_resultSid == 0) {
|
if (acc == 0 || acc->_resultSid == TRI_SHAPE_ILLEGAL) {
|
||||||
return scope.Close(v8::Handle<v8::Integer>());
|
return scope.Close(v8::Handle<v8::Integer>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,12 +109,12 @@ static TRI_shape_aid_t LookupAttributeByName (TRI_shaper_t* shaper,
|
||||||
voc_shaper_t* s;
|
voc_shaper_t* s;
|
||||||
void const* p;
|
void const* p;
|
||||||
|
|
||||||
assert(name != NULL);
|
assert(name != nullptr);
|
||||||
|
|
||||||
s = (voc_shaper_t*) shaper;
|
s = (voc_shaper_t*) shaper;
|
||||||
p = TRI_LookupByKeyAssociativeSynced(&s->_attributeNames, name);
|
p = TRI_LookupByKeyAssociativeSynced(&s->_attributeNames, name);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != nullptr) {
|
||||||
return ((TRI_df_attribute_marker_t const*) p)->_aid;
|
return ((TRI_df_attribute_marker_t const*) p)->_aid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ static TRI_shape_aid_t FindOrCreateAttributeByName (TRI_shaper_t* shaper,
|
||||||
void const* p;
|
void const* p;
|
||||||
void* f;
|
void* f;
|
||||||
|
|
||||||
assert(name != NULL);
|
assert(name != nullptr);
|
||||||
|
|
||||||
s = (voc_shaper_t*) shaper;
|
s = (voc_shaper_t*) shaper;
|
||||||
p = TRI_LookupByKeyAssociativeSynced(&s->_attributeNames, name);
|
p = TRI_LookupByKeyAssociativeSynced(&s->_attributeNames, name);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != nullptr) {
|
||||||
return ((TRI_df_attribute_marker_t const*) p)->_aid;
|
return ((TRI_df_attribute_marker_t const*) p)->_aid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ static TRI_shape_aid_t FindOrCreateAttributeByName (TRI_shaper_t* shaper,
|
||||||
totalSize = (TRI_voc_size_t) (sizeof(TRI_df_attribute_marker_t) + n);
|
totalSize = (TRI_voc_size_t) (sizeof(TRI_df_attribute_marker_t) + n);
|
||||||
mem = (char*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, totalSize, false);
|
mem = (char*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, totalSize, false);
|
||||||
|
|
||||||
if (mem == NULL) {
|
if (mem == nullptr) {
|
||||||
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -164,7 +164,7 @@ static TRI_shape_aid_t FindOrCreateAttributeByName (TRI_shaper_t* shaper,
|
||||||
|
|
||||||
// marker points to mem, but has a different type
|
// marker points to mem, but has a different type
|
||||||
marker = (TRI_df_attribute_marker_t*) mem;
|
marker = (TRI_df_attribute_marker_t*) mem;
|
||||||
assert(marker != NULL);
|
assert(marker != nullptr);
|
||||||
|
|
||||||
// init attribute marker
|
// init attribute marker
|
||||||
TRI_InitMarker(mem, TRI_DF_MARKER_ATTRIBUTE, totalSize);
|
TRI_InitMarker(mem, TRI_DF_MARKER_ATTRIBUTE, totalSize);
|
||||||
|
@ -179,7 +179,7 @@ static TRI_shape_aid_t FindOrCreateAttributeByName (TRI_shaper_t* shaper,
|
||||||
p = TRI_LookupByKeyAssociativeSynced(&s->_attributeNames, name);
|
p = TRI_LookupByKeyAssociativeSynced(&s->_attributeNames, name);
|
||||||
|
|
||||||
// if the element appeared, return the aid
|
// if the element appeared, return the aid
|
||||||
if (p != NULL) {
|
if (p != nullptr) {
|
||||||
TRI_UnlockMutex(&s->_attributeLock);
|
TRI_UnlockMutex(&s->_attributeLock);
|
||||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, mem);
|
TRI_Free(TRI_UNKNOWN_MEM_ZONE, mem);
|
||||||
|
|
||||||
|
@ -212,22 +212,22 @@ static TRI_shape_aid_t FindOrCreateAttributeByName (TRI_shaper_t* shaper,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(result != NULL);
|
assert(result != nullptr);
|
||||||
|
|
||||||
// update datafile info
|
// update datafile info
|
||||||
dfi = TRI_FindDatafileInfoPrimaryCollection(&s->_collection->base, fid, true);
|
dfi = TRI_FindDatafileInfoPrimaryCollection(&s->_collection->base, fid, true);
|
||||||
|
|
||||||
if (dfi != NULL) {
|
if (dfi != nullptr) {
|
||||||
dfi->_numberAttributes++;
|
dfi->_numberAttributes++;
|
||||||
dfi->_sizeAttributes += (int64_t) TRI_DF_ALIGN_BLOCK(totalSize);
|
dfi->_sizeAttributes += (int64_t) TRI_DF_ALIGN_BLOCK(totalSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
f = TRI_InsertKeyAssociativeSynced(&s->_attributeIds, &aid, result, false);
|
f = TRI_InsertKeyAssociativeSynced(&s->_attributeIds, &aid, result, false);
|
||||||
assert(f == NULL);
|
assert(f == nullptr);
|
||||||
|
|
||||||
// enter into the dictionaries
|
// enter into the dictionaries
|
||||||
f = TRI_InsertKeyAssociativeSynced(&s->_attributeNames, name, result, false);
|
f = TRI_InsertKeyAssociativeSynced(&s->_attributeNames, name, result, false);
|
||||||
assert(f == NULL);
|
assert(f == nullptr);
|
||||||
|
|
||||||
// ...........................................................................
|
// ...........................................................................
|
||||||
// and release the lock
|
// and release the lock
|
||||||
|
@ -279,8 +279,8 @@ static char const* LookupAttributeId (TRI_shaper_t* shaper,
|
||||||
|
|
||||||
void const* p = TRI_LookupByKeyAssociativeSynced(&s->_attributeIds, &aid);
|
void const* p = TRI_LookupByKeyAssociativeSynced(&s->_attributeIds, &aid);
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == nullptr) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<char const*>(p) + sizeof(TRI_df_attribute_marker_t);
|
return static_cast<char const*>(p) + sizeof(TRI_df_attribute_marker_t);
|
||||||
|
@ -319,9 +319,9 @@ static bool EqualElementShape (TRI_associative_synced_t* array,
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief finds a shape
|
/// @brief finds a shape
|
||||||
/// if the function returns non-NULL, the return value is a pointer to an
|
/// if the function returns non-nullptr, the return value is a pointer to an
|
||||||
/// already existing shape and the value must not be freed
|
/// already existing shape and the value must not be freed
|
||||||
/// if the function returns NULL, it has not found the shape and was not able
|
/// if the function returns nullptr, it has not found the shape and was not able
|
||||||
/// to create it. The value must then be freed by the caller
|
/// to create it. The value must then be freed by the caller
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -345,12 +345,12 @@ static TRI_shape_t const* FindShape (TRI_shaper_t* shaper,
|
||||||
|
|
||||||
found = TRI_LookupBasicShapeShaper(shape);
|
found = TRI_LookupBasicShapeShaper(shape);
|
||||||
|
|
||||||
if (found == NULL) {
|
if (found == nullptr) {
|
||||||
found = static_cast<TRI_shape_t const*>(TRI_LookupByElementAssociativeSynced(&s->_shapeDictionary, shape));
|
found = static_cast<TRI_shape_t const*>(TRI_LookupByElementAssociativeSynced(&s->_shapeDictionary, shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
// shape found, free argument and return
|
// shape found, free argument and return
|
||||||
if (found != NULL) {
|
if (found != nullptr) {
|
||||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, shape);
|
TRI_Free(TRI_UNKNOWN_MEM_ZONE, shape);
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
|
@ -365,14 +365,14 @@ static TRI_shape_t const* FindShape (TRI_shaper_t* shaper,
|
||||||
totalSize = (TRI_voc_size_t) (sizeof(TRI_df_shape_marker_t) + shape->_size);
|
totalSize = (TRI_voc_size_t) (sizeof(TRI_df_shape_marker_t) + shape->_size);
|
||||||
mem = (char*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, totalSize, false);
|
mem = (char*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, totalSize, false);
|
||||||
|
|
||||||
if (mem == NULL) {
|
if (mem == nullptr) {
|
||||||
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
marker = (TRI_df_shape_marker_t*) mem;
|
marker = (TRI_df_shape_marker_t*) mem;
|
||||||
assert(marker != NULL);
|
assert(marker != nullptr);
|
||||||
|
|
||||||
TRI_InitMarker(mem, TRI_DF_MARKER_SHAPE, totalSize);
|
TRI_InitMarker(mem, TRI_DF_MARKER_SHAPE, totalSize);
|
||||||
|
|
||||||
|
@ -418,15 +418,15 @@ static TRI_shape_t const* FindShape (TRI_shaper_t* shaper,
|
||||||
|
|
||||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, mem);
|
TRI_Free(TRI_UNKNOWN_MEM_ZONE, mem);
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(result != NULL);
|
assert(result != nullptr);
|
||||||
|
|
||||||
// update datafile info
|
// update datafile info
|
||||||
dfi = TRI_FindDatafileInfoPrimaryCollection(&s->_collection->base, fid, true);
|
dfi = TRI_FindDatafileInfoPrimaryCollection(&s->_collection->base, fid, true);
|
||||||
|
|
||||||
if (dfi != NULL) {
|
if (dfi != nullptr) {
|
||||||
dfi->_numberShapes++;
|
dfi->_numberShapes++;
|
||||||
dfi->_sizeShapes += (int64_t) TRI_DF_ALIGN_BLOCK(totalSize);
|
dfi->_sizeShapes += (int64_t) TRI_DF_ALIGN_BLOCK(totalSize);
|
||||||
}
|
}
|
||||||
|
@ -435,10 +435,10 @@ static TRI_shape_t const* FindShape (TRI_shaper_t* shaper,
|
||||||
l = (TRI_shape_t*) (((char*) result) + sizeof(TRI_df_shape_marker_t));
|
l = (TRI_shape_t*) (((char*) result) + sizeof(TRI_df_shape_marker_t));
|
||||||
|
|
||||||
f = TRI_InsertKeyAssociativeSynced(&s->_shapeIds, &l->_sid, l, false);
|
f = TRI_InsertKeyAssociativeSynced(&s->_shapeIds, &l->_sid, l, false);
|
||||||
assert(f == NULL);
|
assert(f == nullptr);
|
||||||
|
|
||||||
f = TRI_InsertElementAssociativeSynced(&s->_shapeDictionary, l, false);
|
f = TRI_InsertElementAssociativeSynced(&s->_shapeDictionary, l, false);
|
||||||
assert(f == NULL);
|
assert(f == nullptr);
|
||||||
|
|
||||||
TRI_UnlockMutex(&s->_shapeLock);
|
TRI_UnlockMutex(&s->_shapeLock);
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ static TRI_shape_t const* LookupShapeId (TRI_shaper_t* shaper,
|
||||||
TRI_shape_sid_t sid) {
|
TRI_shape_sid_t sid) {
|
||||||
TRI_shape_t const* shape = TRI_LookupSidBasicShapeShaper(sid);
|
TRI_shape_t const* shape = TRI_LookupSidBasicShapeShaper(sid);
|
||||||
|
|
||||||
if (shape == NULL) {
|
if (shape == nullptr) {
|
||||||
voc_shaper_t* s = (voc_shaper_t*) shaper;
|
voc_shaper_t* s = (voc_shaper_t*) shaper;
|
||||||
shape = static_cast<TRI_shape_t const*>(TRI_LookupByKeyAssociativeSynced(&s->_shapeIds, &sid));
|
shape = static_cast<TRI_shape_t const*>(TRI_LookupByKeyAssociativeSynced(&s->_shapeIds, &sid));
|
||||||
}
|
}
|
||||||
|
@ -646,9 +646,9 @@ TRI_shaper_t* TRI_CreateVocShaper (TRI_vocbase_t* vocbase,
|
||||||
TRI_document_collection_t* document) {
|
TRI_document_collection_t* document) {
|
||||||
voc_shaper_t* shaper = static_cast<voc_shaper_t*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(voc_shaper_t), false));
|
voc_shaper_t* shaper = static_cast<voc_shaper_t*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(voc_shaper_t), false));
|
||||||
|
|
||||||
if (shaper == NULL) {
|
if (shaper == nullptr) {
|
||||||
// out of memory
|
// out of memory
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
shaper->_collection = document;
|
shaper->_collection = document;
|
||||||
|
@ -658,7 +658,7 @@ TRI_shaper_t* TRI_CreateVocShaper (TRI_vocbase_t* vocbase,
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, shaper);
|
TRI_Free(TRI_UNKNOWN_MEM_ZONE, shaper);
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = InitStep1VocShaper(shaper);
|
res = InitStep1VocShaper(shaper);
|
||||||
|
@ -666,7 +666,7 @@ TRI_shaper_t* TRI_CreateVocShaper (TRI_vocbase_t* vocbase,
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
TRI_FreeShaper(&shaper->base);
|
TRI_FreeShaper(&shaper->base);
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = InitStep2VocShaper(shaper);
|
res = InitStep2VocShaper(shaper);
|
||||||
|
@ -674,7 +674,7 @@ TRI_shaper_t* TRI_CreateVocShaper (TRI_vocbase_t* vocbase,
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
TRI_FreeVocShaper(&shaper->base);
|
TRI_FreeVocShaper(&shaper->base);
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// and return
|
// and return
|
||||||
|
@ -688,7 +688,7 @@ TRI_shaper_t* TRI_CreateVocShaper (TRI_vocbase_t* vocbase,
|
||||||
void TRI_DestroyVocShaper (TRI_shaper_t* s) {
|
void TRI_DestroyVocShaper (TRI_shaper_t* s) {
|
||||||
voc_shaper_t* shaper = (voc_shaper_t*) s;
|
voc_shaper_t* shaper = (voc_shaper_t*) s;
|
||||||
|
|
||||||
assert(shaper != NULL);
|
assert(shaper != nullptr);
|
||||||
|
|
||||||
TRI_DestroyAssociativeSynced(&shaper->_attributeNames);
|
TRI_DestroyAssociativeSynced(&shaper->_attributeNames);
|
||||||
TRI_DestroyAssociativeSynced(&shaper->_attributeIds);
|
TRI_DestroyAssociativeSynced(&shaper->_attributeIds);
|
||||||
|
@ -698,7 +698,7 @@ void TRI_DestroyVocShaper (TRI_shaper_t* s) {
|
||||||
for (size_t i = 0; i < shaper->_accessors._nrAlloc; ++i) {
|
for (size_t i = 0; i < shaper->_accessors._nrAlloc; ++i) {
|
||||||
TRI_shape_access_t* accessor = (TRI_shape_access_t*) shaper->_accessors._table[i];
|
TRI_shape_access_t* accessor = (TRI_shape_access_t*) shaper->_accessors._table[i];
|
||||||
|
|
||||||
if (accessor != NULL) {
|
if (accessor != nullptr) {
|
||||||
TRI_FreeShapeAccessor(accessor);
|
TRI_FreeShapeAccessor(accessor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -750,12 +750,12 @@ int TRI_MoveMarkerVocShaper (TRI_shaper_t* s,
|
||||||
// remove the old marker
|
// remove the old marker
|
||||||
// and re-insert the marker with the new pointer
|
// and re-insert the marker with the new pointer
|
||||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_shapeIds, &l->_sid, l, true);
|
f = TRI_InsertKeyAssociativeSynced(&shaper->_shapeIds, &l->_sid, l, true);
|
||||||
assert(f != NULL);
|
assert(f != nullptr);
|
||||||
|
|
||||||
// same for the shape dictionary
|
// same for the shape dictionary
|
||||||
// delete and re-insert
|
// delete and re-insert
|
||||||
f = TRI_InsertElementAssociativeSynced(&shaper->_shapeDictionary, l, true);
|
f = TRI_InsertElementAssociativeSynced(&shaper->_shapeDictionary, l, true);
|
||||||
assert(f != NULL);
|
assert(f != nullptr);
|
||||||
|
|
||||||
TRI_UnlockMutex(&shaper->_shapeLock);
|
TRI_UnlockMutex(&shaper->_shapeLock);
|
||||||
}
|
}
|
||||||
|
@ -770,12 +770,12 @@ int TRI_MoveMarkerVocShaper (TRI_shaper_t* s,
|
||||||
// are identical in old and new marker)
|
// are identical in old and new marker)
|
||||||
// and re-insert same attribute with adjusted pointer
|
// and re-insert same attribute with adjusted pointer
|
||||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeNames, p, m, true);
|
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeNames, p, m, true);
|
||||||
assert(f != NULL);
|
assert(f != nullptr);
|
||||||
|
|
||||||
// same for attribute ids
|
// same for attribute ids
|
||||||
// delete and re-insert same attribute with adjusted pointer
|
// delete and re-insert same attribute with adjusted pointer
|
||||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeIds, &m->_aid, m, true);
|
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeIds, &m->_aid, m, true);
|
||||||
assert(f != NULL);
|
assert(f != nullptr);
|
||||||
|
|
||||||
TRI_UnlockMutex(&shaper->_attributeLock);
|
TRI_UnlockMutex(&shaper->_attributeLock);
|
||||||
}
|
}
|
||||||
|
@ -797,10 +797,10 @@ int TRI_InsertShapeVocShaper (TRI_shaper_t* s,
|
||||||
LOG_TRACE("found shape %lu", (unsigned long) l->_sid);
|
LOG_TRACE("found shape %lu", (unsigned long) l->_sid);
|
||||||
|
|
||||||
f = TRI_InsertElementAssociativeSynced(&shaper->_shapeDictionary, l, false);
|
f = TRI_InsertElementAssociativeSynced(&shaper->_shapeDictionary, l, false);
|
||||||
assert(f == NULL);
|
assert(f == nullptr);
|
||||||
|
|
||||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_shapeIds, &l->_sid, l, false);
|
f = TRI_InsertKeyAssociativeSynced(&shaper->_shapeIds, &l->_sid, l, false);
|
||||||
assert(f == NULL);
|
assert(f == nullptr);
|
||||||
|
|
||||||
if (shaper->_nextSid <= l->_sid) {
|
if (shaper->_nextSid <= l->_sid) {
|
||||||
shaper->_nextSid = l->_sid + 1;
|
shaper->_nextSid = l->_sid + 1;
|
||||||
|
@ -824,7 +824,7 @@ int TRI_InsertAttributeVocShaper (TRI_shaper_t* s,
|
||||||
|
|
||||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeNames, p, m, false);
|
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeNames, p, m, false);
|
||||||
|
|
||||||
if (f != NULL) {
|
if (f != nullptr) {
|
||||||
char const* name = shaper->_collection->base.base._info._name;
|
char const* name = shaper->_collection->base.base._info._name;
|
||||||
|
|
||||||
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||||
|
@ -836,7 +836,7 @@ int TRI_InsertAttributeVocShaper (TRI_shaper_t* s,
|
||||||
|
|
||||||
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeIds, &m->_aid, m, false);
|
f = TRI_InsertKeyAssociativeSynced(&shaper->_attributeIds, &m->_aid, m, false);
|
||||||
|
|
||||||
if (f != NULL) {
|
if (f != nullptr) {
|
||||||
char const* name = shaper->_collection->base.base._info._name;
|
char const* name = shaper->_collection->base.base._info._name;
|
||||||
|
|
||||||
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||||
|
@ -871,11 +871,11 @@ TRI_shape_access_t const* TRI_FindAccessorVocShaper (TRI_shaper_t* s,
|
||||||
TRI_LockMutex(&shaper->_accessorLock);
|
TRI_LockMutex(&shaper->_accessorLock);
|
||||||
TRI_shape_access_t const* found = static_cast<TRI_shape_access_t const*>(TRI_LookupByElementAssociativePointer(&shaper->_accessors, &search));
|
TRI_shape_access_t const* found = static_cast<TRI_shape_access_t const*>(TRI_LookupByElementAssociativePointer(&shaper->_accessors, &search));
|
||||||
|
|
||||||
if (found == NULL) {
|
if (found == nullptr) {
|
||||||
found = accessor = TRI_ShapeAccessor(&shaper->base, sid, pid);
|
found = accessor = TRI_ShapeAccessor(&shaper->base, sid, pid);
|
||||||
|
|
||||||
// TRI_ShapeAccessor can return a NULL pointer
|
// TRI_ShapeAccessor can return a nullptr pointer
|
||||||
if (found != NULL) {
|
if (found != nullptr) {
|
||||||
TRI_InsertElementAssociativePointer(&shaper->_accessors, accessor, true);
|
TRI_InsertElementAssociativePointer(&shaper->_accessors, accessor, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -900,7 +900,7 @@ bool TRI_ExtractShapedJsonVocShaper (TRI_shaper_t* shaper,
|
||||||
|
|
||||||
accessor = TRI_FindAccessorVocShaper(shaper, document->_sid, pid);
|
accessor = TRI_FindAccessorVocShaper(shaper, document->_sid, pid);
|
||||||
|
|
||||||
if (accessor == NULL) {
|
if (accessor == nullptr) {
|
||||||
LOG_TRACE("failed to get accessor for sid %lu and path %lu",
|
LOG_TRACE("failed to get accessor for sid %lu and path %lu",
|
||||||
(unsigned long) document->_sid,
|
(unsigned long) document->_sid,
|
||||||
(unsigned long) pid);
|
(unsigned long) pid);
|
||||||
|
@ -908,22 +908,14 @@ bool TRI_ExtractShapedJsonVocShaper (TRI_shaper_t* shaper,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sid != 0 && sid != accessor->_resultSid) {
|
if (accessor->_resultSid == TRI_SHAPE_ILLEGAL) {
|
||||||
LOG_TRACE("expecting sid %lu for path %lu, got sid %lu",
|
|
||||||
(unsigned long) sid,
|
|
||||||
(unsigned long) pid,
|
|
||||||
(unsigned long) accessor->_resultSid);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (accessor->_resultSid == 0) {
|
|
||||||
LOG_TRACE("expecting any object for path %lu, got nothing",
|
LOG_TRACE("expecting any object for path %lu, got nothing",
|
||||||
(unsigned long) pid);
|
(unsigned long) pid);
|
||||||
|
|
||||||
return false;
|
*shape = nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
|
return sid == TRI_SHAPE_ILLEGAL;
|
||||||
|
}
|
||||||
|
|
||||||
*shape = shaper->lookupShapeId(shaper, accessor->_resultSid);
|
*shape = shaper->lookupShapeId(shaper, accessor->_resultSid);
|
||||||
|
|
||||||
|
@ -932,7 +924,17 @@ bool TRI_ExtractShapedJsonVocShaper (TRI_shaper_t* shaper,
|
||||||
(unsigned long) pid,
|
(unsigned long) pid,
|
||||||
(unsigned long) accessor->_resultSid);
|
(unsigned long) accessor->_resultSid);
|
||||||
|
|
||||||
return sid == 0;
|
*shape = nullptr;
|
||||||
|
|
||||||
|
return sid == TRI_SHAPE_ILLEGAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sid != 0 && sid != accessor->_resultSid) {
|
||||||
|
LOG_TRACE("expecting sid %lu for path %lu, got sid %lu",
|
||||||
|
(unsigned long) sid,
|
||||||
|
(unsigned long) pid,
|
||||||
|
(unsigned long) accessor->_resultSid);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1124,7 +1126,7 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
// left is either a shaped json or a shaped sub object
|
// left is either a shaped json or a shaped sub object
|
||||||
if (leftDocument != NULL) {
|
if (leftDocument != nullptr) {
|
||||||
ptr = (char const*) leftDocument->_data;
|
ptr = (char const*) leftDocument->_data;
|
||||||
|
|
||||||
left._sid = leftObject->_sid;
|
left._sid = leftObject->_sid;
|
||||||
|
@ -1136,7 +1138,7 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
// right is either a shaped json or a shaped sub object
|
// right is either a shaped json or a shaped sub object
|
||||||
if (rightDocument != NULL) {
|
if (rightDocument != nullptr) {
|
||||||
ptr = (char const*) rightDocument->_data;
|
ptr = (char const*) rightDocument->_data;
|
||||||
|
|
||||||
right._sid = rightObject->_sid;
|
right._sid = rightObject->_sid;
|
||||||
|
@ -1158,7 +1160,7 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
||||||
rightShape = rightShaper->lookupShapeId(rightShaper, right._sid);
|
rightShape = rightShaper->lookupShapeId(rightShaper, right._sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftShape == NULL || rightShape == NULL) {
|
if (leftShape == nullptr || rightShape == nullptr) {
|
||||||
LOG_ERROR("shape not found");
|
LOG_ERROR("shape not found");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
@ -1196,7 +1198,7 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
||||||
} // end of case TRI_SHAPE_ILLEGAL
|
} // end of case TRI_SHAPE_ILLEGAL
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// NULL
|
// nullptr
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
|
|
||||||
case TRI_SHAPE_NULL: {
|
case TRI_SHAPE_NULL: {
|
||||||
|
@ -1402,11 +1404,11 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
||||||
&rightElement);
|
&rightElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TRI_CompareShapeTypes(NULL,
|
result = TRI_CompareShapeTypes(nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&leftElement,
|
&leftElement,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&rightElement,
|
&rightElement,
|
||||||
leftShaper,
|
leftShaper,
|
||||||
rightShaper);
|
rightShaper);
|
||||||
|
@ -1489,11 +1491,11 @@ int TRI_CompareShapeTypes (TRI_doc_mptr_t* leftDocument,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TRI_CompareShapeTypes(NULL,
|
result = TRI_CompareShapeTypes(nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&l->_value,
|
&l->_value,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&r->_value,
|
&r->_value,
|
||||||
leftShaper,
|
leftShaper,
|
||||||
rightShaper);
|
rightShaper);
|
||||||
|
|
|
@ -124,7 +124,8 @@
|
||||||
this.collection.create(options, {
|
this.collection.create(options, {
|
||||||
wait:true,
|
wait:true,
|
||||||
error: function(data, err) {
|
error: function(data, err) {
|
||||||
self.handleError(err.status, err.statusText, name);
|
//Fix this. Function not available
|
||||||
|
//self.handleError(err.status, err.statusText, name);
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
self.updateUserManagement();
|
self.updateUserManagement();
|
||||||
|
|
|
@ -263,6 +263,7 @@
|
||||||
"test/specs/views/statisticBarViewSpec.js",
|
"test/specs/views/statisticBarViewSpec.js",
|
||||||
"test/specs/views/shellViewSpec.js",
|
"test/specs/views/shellViewSpec.js",
|
||||||
"test/specs/views/queryViewSpec.js",
|
"test/specs/views/queryViewSpec.js",
|
||||||
|
"test/specs/views/userManagementViewSpec.js",
|
||||||
|
|
||||||
|
|
||||||
"test/specs/router/routerSpec.js",
|
"test/specs/router/routerSpec.js",
|
||||||
|
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
|
||||||
|
/*global describe, beforeEach, afterEach, it, spyOn, expect, jQuery*/
|
||||||
|
/*global runs, waitsFor, jasmine, waits*/
|
||||||
|
/*global $, console, arangoHelper */
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
describe("User Management View", function () {
|
||||||
|
var myStore,
|
||||||
|
isCoordinator,
|
||||||
|
myView,
|
||||||
|
div,
|
||||||
|
div2;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
isCoordinator = false;
|
||||||
|
|
||||||
|
div = document.createElement("div");
|
||||||
|
div.id = "content";
|
||||||
|
document.body.appendChild(div);
|
||||||
|
|
||||||
|
div2 = document.createElement("div");
|
||||||
|
div2.id = "modalPlaceholder";
|
||||||
|
document.body.appendChild(div2);
|
||||||
|
|
||||||
|
window.App = {
|
||||||
|
notificationList: {
|
||||||
|
add: function() {
|
||||||
|
throw "Should be a spy";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(window.App.notificationList, "add");
|
||||||
|
|
||||||
|
myStore = new window.ArangoUsers();
|
||||||
|
|
||||||
|
myView = {
|
||||||
|
collection: myStore
|
||||||
|
};
|
||||||
|
spyOn(myView.collection, "fetch").andReturn({});
|
||||||
|
|
||||||
|
myView = new window.userManagementView({
|
||||||
|
collection: myStore
|
||||||
|
});
|
||||||
|
myView.render();
|
||||||
|
|
||||||
|
window.modalView = new window.ModalView();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
document.body.removeChild(div);
|
||||||
|
document.body.removeChild(div2);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("user management view", function () {
|
||||||
|
|
||||||
|
it("assert the basics", function() {
|
||||||
|
var myEvents = {
|
||||||
|
"click #createUser" : "createUser",
|
||||||
|
"click #submitCreateUser" : "submitCreateUser",
|
||||||
|
"click .editUser" : "editUser",
|
||||||
|
"click .icon" : "editUser",
|
||||||
|
"click #submitEditUser" : "submitEditUser",
|
||||||
|
"click #userManagementToggle" : "toggleView",
|
||||||
|
"keyup #userManagementSearchInput" : "search",
|
||||||
|
"click #userManagementSearchSubmit" : "search",
|
||||||
|
"click #callEditUserPassword" : "editUserPassword",
|
||||||
|
"click #submitEditUserPassword" : "submitEditUserPassword",
|
||||||
|
"click #submitEditCurrentUserProfile" : "submitEditCurrentUserProfile"
|
||||||
|
};
|
||||||
|
expect(myEvents).toEqual(myView.events);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should check the render function (with visible dropdown)", function() {
|
||||||
|
$('#userManagementDropdown').show();
|
||||||
|
spyOn($.fn, 'show');
|
||||||
|
myView.render();
|
||||||
|
expect($.fn.show).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render user modal view", function() {
|
||||||
|
spyOn(myView, "editCurrentUser");
|
||||||
|
myView.render("DummyUser");
|
||||||
|
expect(myView.editCurrentUser).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should fire the event for creating a user", function() {
|
||||||
|
spyOn(myView, "createCreateUserModal");
|
||||||
|
|
||||||
|
var e = {
|
||||||
|
preventDefault: function(){}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(e, "preventDefault");
|
||||||
|
myView.createUser(e);
|
||||||
|
expect(e.preventDefault).toHaveBeenCalled();
|
||||||
|
expect(myView.createCreateUserModal).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should submit creation of a new user", function() {
|
||||||
|
spyOn(myView.collection, "create").andCallFake(function(options, options2) {
|
||||||
|
options2.success();
|
||||||
|
});
|
||||||
|
|
||||||
|
spyOn(window.modalView, "hide");
|
||||||
|
spyOn(myView, "updateUserManagement");
|
||||||
|
|
||||||
|
var name = "Dummy User", options = {
|
||||||
|
user: "dummyuser",
|
||||||
|
passwd: "dummypassword",
|
||||||
|
active: false,
|
||||||
|
extra: {name: name}
|
||||||
|
};
|
||||||
|
|
||||||
|
myView.createCreateUserModal();
|
||||||
|
$('#newUsername').val(options.user);
|
||||||
|
$('#newName').val(name);
|
||||||
|
$('#newPassword').val(options.passwd);
|
||||||
|
$('#newStatus').click();
|
||||||
|
myView.submitCreateUser();
|
||||||
|
|
||||||
|
expect(myView.collection.create).toHaveBeenCalledWith(options,{
|
||||||
|
wait : true, error : jasmine.any(Function), success : jasmine.any(Function)
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(window.modalView.hide).toHaveBeenCalled();
|
||||||
|
expect(myView.updateUserManagement).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should cancel the submit creation of a new user", function() {
|
||||||
|
spyOn(myView.collection, "create");
|
||||||
|
|
||||||
|
var name = "Dummy User", options = {
|
||||||
|
user: "",
|
||||||
|
passwd: "dummypassword",
|
||||||
|
active: false,
|
||||||
|
extra: {name: name}
|
||||||
|
};
|
||||||
|
|
||||||
|
myView.createCreateUserModal();
|
||||||
|
$('#newUsername').val(options.user);
|
||||||
|
$('#newName').val(name);
|
||||||
|
$('#newPassword').val(options.passwd);
|
||||||
|
$('#newStatus').click();
|
||||||
|
myView.submitCreateUser();
|
||||||
|
|
||||||
|
expect(myView.collection.create).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}());
|
|
@ -11,4 +11,4 @@ module.exports = {
|
||||||
isTag: function(elem){
|
isTag: function(elem){
|
||||||
return elem.type === "tag" || elem.type === "script" || elem.type === "style";
|
return elem.type === "tag" || elem.type === "script" || elem.type === "style";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -104,6 +104,9 @@
|
||||||
#define TRI_HAVE_STRTOLL 1
|
#define TRI_HAVE_STRTOLL 1
|
||||||
#define TRI_HAVE_STRTOULL 1
|
#define TRI_HAVE_STRTOULL 1
|
||||||
|
|
||||||
|
#define TRI_srandom srandom
|
||||||
|
#define TRI_random random
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief available features
|
/// @brief available features
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -263,6 +266,9 @@
|
||||||
#define TRI_HAVE_STRTOLL 1
|
#define TRI_HAVE_STRTOLL 1
|
||||||
#define TRI_HAVE_STRTOULL 1
|
#define TRI_HAVE_STRTOULL 1
|
||||||
|
|
||||||
|
#define TRI_srandom srand
|
||||||
|
#define TRI_random rand
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief available features
|
/// @brief available features
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -441,6 +447,9 @@
|
||||||
|
|
||||||
#define TRI_HAVE_ANONYMOUS_MMAP 1
|
#define TRI_HAVE_ANONYMOUS_MMAP 1
|
||||||
|
|
||||||
|
#define TRI_srandom srand
|
||||||
|
#define TRI_random rand
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief alignment and limits
|
/// @brief alignment and limits
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -564,10 +573,21 @@
|
||||||
|
|
||||||
#define TRI_HAVE_WIN32_GLOBAL_MEMORY_STATUS 1
|
#define TRI_HAVE_WIN32_GLOBAL_MEMORY_STATUS 1
|
||||||
|
|
||||||
|
#define TRI_srandom srand
|
||||||
|
#define TRI_random rand
|
||||||
|
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
|
||||||
|
#define usleep TRI_usleep
|
||||||
|
#define sleep TRI_sleep
|
||||||
|
#define fsync _commit
|
||||||
|
#define isatty _isatty
|
||||||
|
#define fileno _fileno
|
||||||
|
#define putenv _putenv
|
||||||
|
#define tzset _tzset
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief available features
|
/// @brief available features
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -601,15 +621,6 @@
|
||||||
// has been redefined in win-utils.h
|
// has been redefined in win-utils.h
|
||||||
// ..............................................................
|
// ..............................................................
|
||||||
|
|
||||||
#define usleep TRI_usleep
|
|
||||||
#define sleep TRI_sleep
|
|
||||||
#define srandom srand
|
|
||||||
#define fsync _commit
|
|
||||||
#define isatty _isatty
|
|
||||||
#define fileno _fileno
|
|
||||||
#define putenv _putenv
|
|
||||||
#define tzset _tzset
|
|
||||||
|
|
||||||
typedef int ssize_t;
|
typedef int ssize_t;
|
||||||
|
|
||||||
#ifndef va_copy
|
#ifndef va_copy
|
||||||
|
|
|
@ -67,20 +67,18 @@ static unsigned long SeedRandom (void) {
|
||||||
#ifdef TRI_HAVE_GETTIMEOFDAY
|
#ifdef TRI_HAVE_GETTIMEOFDAY
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int result;
|
int result;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
seed = (unsigned long) time(0);
|
|
||||||
|
|
||||||
#ifdef TRI_HAVE_GETTIMEOFDAY
|
|
||||||
result = gettimeofday(&tv, 0);
|
result = gettimeofday(&tv, 0);
|
||||||
|
|
||||||
seed ^= (unsigned long)(tv.tv_sec);
|
seed = (unsigned long)(tv.tv_sec);
|
||||||
seed ^= (unsigned long)(tv.tv_usec);
|
seed ^= (unsigned long)(tv.tv_usec);
|
||||||
seed ^= (unsigned long)(result);
|
#else
|
||||||
|
seed = (unsigned long) time(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
seed ^= (unsigned long)(TRI_CurrentProcessId());
|
seed ^= (unsigned long)(TRI_CurrentProcessId() << 8);
|
||||||
|
seed ^= (unsigned long)(TRI_CurrentProcessId() << 16);
|
||||||
|
seed ^= (unsigned long)(TRI_CurrentProcessId() << 24);
|
||||||
seed ^= (unsigned long)(TRI_CurrentThreadId());
|
seed ^= (unsigned long)(TRI_CurrentThreadId());
|
||||||
|
|
||||||
return seed;
|
return seed;
|
||||||
|
@ -106,15 +104,15 @@ static unsigned long SeedRandom (void) {
|
||||||
uint16_t TRI_UInt16Random (void) {
|
uint16_t TRI_UInt16Random (void) {
|
||||||
#if RAND_MAX == 2147483647
|
#if RAND_MAX == 2147483647
|
||||||
|
|
||||||
return rand() & 0xFFFF;
|
return TRI_random() & 0xFFFF;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t l1;
|
uint32_t l1;
|
||||||
uint32_t l2;
|
uint32_t l2;
|
||||||
|
|
||||||
l1 = rand();
|
l1 = TRI_random();
|
||||||
l2 = rand();
|
l2 = TRI_random();
|
||||||
|
|
||||||
return ((l1 & 0xFF) << 8) | (l2 & 0xFF);
|
return ((l1 & 0xFF) << 8) | (l2 & 0xFF);
|
||||||
|
|
||||||
|
@ -131,8 +129,8 @@ uint32_t TRI_UInt32Random (void) {
|
||||||
uint32_t l1;
|
uint32_t l1;
|
||||||
uint32_t l2;
|
uint32_t l2;
|
||||||
|
|
||||||
l1 = (uint32_t) rand();
|
l1 = (uint32_t) TRI_random();
|
||||||
l2 = (uint32_t) rand();
|
l2 = (uint32_t) TRI_random();
|
||||||
|
|
||||||
return ((l1 & 0xFFFF) << 16) | (l2 & 0xFFFF);
|
return ((l1 & 0xFFFF) << 16) | (l2 & 0xFFFF);
|
||||||
|
|
||||||
|
@ -143,10 +141,10 @@ uint32_t TRI_UInt32Random (void) {
|
||||||
uint32_t l3;
|
uint32_t l3;
|
||||||
uint32_t l4;
|
uint32_t l4;
|
||||||
|
|
||||||
l1 = rand();
|
l1 = TRI_random();
|
||||||
l2 = rand();
|
l2 = TRI_random();
|
||||||
l3 = rand();
|
l3 = TRI_random();
|
||||||
l4 = rand();
|
l4 = TRI_random();
|
||||||
|
|
||||||
return ((l1 & 0xFF) << 24) | ((l2 & 0xFF) << 16) | ((l3 & 0xFF) << 8) | (l4 & 0xFF);
|
return ((l1 & 0xFF) << 24) | ((l2 & 0xFF) << 16) | ((l3 & 0xFF) << 8) | (l4 & 0xFF);
|
||||||
|
|
||||||
|
@ -179,7 +177,8 @@ void TRI_InitialiseRandom (void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
srandom(SeedRandom());
|
|
||||||
|
TRI_srandom(SeedRandom());
|
||||||
|
|
||||||
Initialised = true;
|
Initialised = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
|
||||||
|
|
||||||
TRI_DestroyVectorPointer(&ops);
|
TRI_DestroyVectorPointer(&ops);
|
||||||
|
|
||||||
accessor->_resultSid = 0;
|
accessor->_resultSid = TRI_SHAPE_ILLEGAL;
|
||||||
accessor->_code = NULL;
|
accessor->_code = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -223,7 +223,7 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
|
||||||
else {
|
else {
|
||||||
TRI_DestroyVectorPointer(&ops);
|
TRI_DestroyVectorPointer(&ops);
|
||||||
|
|
||||||
accessor->_resultSid = 0;
|
accessor->_resultSid = TRI_SHAPE_ILLEGAL;
|
||||||
accessor->_code = NULL;
|
accessor->_code = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -264,7 +264,7 @@ static bool ExecuteBytecodeShapeAccessor (TRI_shape_access_t const* accessor,
|
||||||
TRI_shape_size_t pos;
|
TRI_shape_size_t pos;
|
||||||
TRI_shape_size_t* offsetsV;
|
TRI_shape_size_t* offsetsV;
|
||||||
|
|
||||||
if (accessor->_resultSid == 0) {
|
if (accessor->_resultSid == TRI_SHAPE_ILLEGAL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
|
||||||
(unsigned long) accessor->_sid,
|
(unsigned long) accessor->_sid,
|
||||||
(unsigned long) accessor->_pid);
|
(unsigned long) accessor->_pid);
|
||||||
|
|
||||||
if (accessor->_resultSid == 0) {
|
if (accessor->_resultSid == TRI_SHAPE_ILLEGAL) {
|
||||||
printf(" result shape: -\n");
|
printf(" result shape: -\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue