diff --git a/arangod/RestHandler/RestEdgeHandler.cpp b/arangod/RestHandler/RestEdgeHandler.cpp index a3a0305523..41b0af9498 100644 --- a/arangod/RestHandler/RestEdgeHandler.cpp +++ b/arangod/RestHandler/RestEdgeHandler.cpp @@ -249,6 +249,8 @@ bool RestEdgeHandler::createDocument () { if (res != TRI_ERROR_NO_ERROR) { FREE_STRING(TRI_CORE_MEM_ZONE, edge._fromKey); FREE_STRING(TRI_CORE_MEM_ZONE, edge._toKey); + + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); if (res == TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND) { generateError(HttpResponse::NOT_FOUND, res, wrongPart + " does not point to a valid collection"); diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index e05a07dd06..21aa73babd 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -382,7 +382,7 @@ void ApplicationV8::addGlobalContextMethod (string const& method) { //////////////////////////////////////////////////////////////////////////////// ApplicationV8::V8Context* ApplicationV8::pickContextForGc () { - size_t n = _freeContexts.size(); + const size_t n = _freeContexts.size(); if (n == 0) { // this is easy... diff --git a/arangod/V8Server/v8-query.cpp b/arangod/V8Server/v8-query.cpp index f432fa0fb5..7363a99bc1 100644 --- a/arangod/V8Server/v8-query.cpp +++ b/arangod/V8Server/v8-query.cpp @@ -1047,7 +1047,7 @@ static v8::Handle ExecuteSkiplistQuery (v8::Arguments const& argv, trx.lockRead(); // extract the index - TRI_index_t* idx = TRI_LookupIndexByHandle(resolver, col, argv[0], false, &err); + TRI_index_t* idx = TRI_LookupIndexByHandle(col, argv[0], false, &err); if (idx == 0) { return scope.Close(v8::ThrowException(err)); @@ -1246,7 +1246,7 @@ static v8::Handle ExecuteBitarrayQuery (v8::Arguments const& argv, // ............................................................................. v8::Handle err; - TRI_index_t* idx = TRI_LookupIndexByHandle(resolver, col, argv[0], false, &err); + TRI_index_t* idx = TRI_LookupIndexByHandle(col, argv[0], false, &err); if (idx == 0) { return scope.Close(v8::ThrowException(err)); @@ -2068,7 +2068,7 @@ static v8::Handle ByExampleHashIndexQuery (ReadTransactionType& trx, result->Set(v8::String::New("documents"), documents); // extract the index - TRI_index_t* idx = TRI_LookupIndexByHandle(trx.resolver(), collection, argv[0], false, err); + TRI_index_t* idx = TRI_LookupIndexByHandle(collection, argv[0], false, err); if (idx == 0) { return scope.Close(v8::ThrowException(*err)); @@ -2567,7 +2567,7 @@ static v8::Handle FulltextQuery (ReadTransactionType& trx, } // extract the index - TRI_index_t* idx = TRI_LookupIndexByHandle(trx.resolver(), collection, argv[0], false, err); + TRI_index_t* idx = TRI_LookupIndexByHandle(collection, argv[0], false, err); if (idx == 0) { return scope.Close(v8::ThrowException(*err)); @@ -2848,7 +2848,7 @@ static v8::Handle NearQuery (ReadTransactionType& trx, } // extract the index - TRI_index_t* idx = TRI_LookupIndexByHandle(trx.resolver(), collection, argv[0], false, err); + TRI_index_t* idx = TRI_LookupIndexByHandle(collection, argv[0], false, err); if (idx == 0) { return scope.Close(v8::ThrowException(*err)); @@ -2979,7 +2979,7 @@ static v8::Handle JS_TopQuery (v8::Arguments const& argv) { } v8::Handle err; - TRI_index_t* idx = TRI_LookupIndexByHandle(resolver, col, argv[0], false, &err); + TRI_index_t* idx = TRI_LookupIndexByHandle(col, argv[0], false, &err); if (idx == 0) { return scope.Close(v8::ThrowException(err)); @@ -3044,7 +3044,7 @@ static v8::Handle WithinQuery (ReadTransactionType& trx, } // extract the index - TRI_index_t* idx = TRI_LookupIndexByHandle(trx.resolver(), collection, argv[0], false, err); + TRI_index_t* idx = TRI_LookupIndexByHandle(collection, argv[0], false, err); if (idx == 0) { return scope.Close(v8::ThrowException(*err)); diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 4b750153d0..7bcfd0ce98 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -4825,8 +4825,6 @@ static v8::Handle JS_DropIndexVocbaseCol (v8::Arguments const& argv) return scope.Close(v8::ThrowException(err)); } - CollectionNameResolver resolver(collection->_vocbase); - TRI_primary_collection_t* primary = collection->_collection; if (! TRI_IS_DOCUMENT_COLLECTION(collection->_type)) { @@ -4841,7 +4839,7 @@ static v8::Handle JS_DropIndexVocbaseCol (v8::Arguments const& argv) TRI_V8_EXCEPTION_USAGE(scope, "dropIndex()"); } - TRI_index_t* idx = TRI_LookupIndexByHandle(resolver, collection, argv[0], true, &err); + TRI_index_t* idx = TRI_LookupIndexByHandle(collection, argv[0], true, &err); if (idx == 0) { if (err.IsEmpty()) { @@ -8638,8 +8636,7 @@ v8::Handle TRI_ParseDocumentOrDocumentHandle (const CollectionNameRes /// @brief looks up an index identifier //////////////////////////////////////////////////////////////////////////////// -TRI_index_t* TRI_LookupIndexByHandle (const CollectionNameResolver& resolver, - TRI_vocbase_col_t const* collection, +TRI_index_t* TRI_LookupIndexByHandle (TRI_vocbase_col_t const* collection, v8::Handle val, bool ignoreNotFound, v8::Handle* err) { diff --git a/arangod/V8Server/v8-vocbase.h b/arangod/V8Server/v8-vocbase.h index 9af5028458..5ae7fbe8a9 100644 --- a/arangod/V8Server/v8-vocbase.h +++ b/arangod/V8Server/v8-vocbase.h @@ -67,8 +67,7 @@ v8::Handle TRI_ParseDocumentOrDocumentHandle (const triagens::arango: /// @brief looks up a index identifier //////////////////////////////////////////////////////////////////////////////// -TRI_index_t* TRI_LookupIndexByHandle (const triagens::arango::CollectionNameResolver&, - TRI_vocbase_col_t const*, +TRI_index_t* TRI_LookupIndexByHandle (TRI_vocbase_col_t const*, v8::Handle, bool, v8::Handle*); diff --git a/lib/V8/v8-utils.cpp b/lib/V8/v8-utils.cpp index 3e62c06313..4f4e2a40cf 100644 --- a/lib/V8/v8-utils.cpp +++ b/lib/V8/v8-utils.cpp @@ -308,7 +308,7 @@ static v8::Handle JS_Base64Decode (v8::Arguments const& argv) { TRI_V8_EXCEPTION_MESSAGE(scope, TRI_errno(), TRI_last_error()); } - return scope.Close(v8::String::New(base64.c_str(), base64.size())); + return scope.Close(v8::String::New(base64.c_str(), (int) base64.size())); } //////////////////////////////////////////////////////////////////////////////// @@ -336,7 +336,7 @@ static v8::Handle JS_Base64Encode (v8::Arguments const& argv) { TRI_V8_EXCEPTION_MESSAGE(scope, TRI_errno(), TRI_last_error()); } - return scope.Close(v8::String::New(base64.c_str(), base64.size())); + return scope.Close(v8::String::New(base64.c_str(), (int) base64.size())); } //////////////////////////////////////////////////////////////////////////////// @@ -661,7 +661,8 @@ static v8::Handle JS_Download (v8::Arguments const& argv) { } else { // set "body" attribute in result - result->Set(v8::String::New("body"), v8::String::New(response->getBody().str().c_str(), response->getBody().str().length())); + const string s = response->getBody().str(); + result->Set(v8::String::New("body"), v8::String::New(s.c_str(), (int) s.size())); } } catch (...) { @@ -703,7 +704,6 @@ static v8::Handle JS_Download (v8::Arguments const& argv) { static v8::Handle JS_Execute (v8::Arguments const& argv) { v8::HandleScope scope; - size_t i; // extract arguments if (argv.Length() != 3) { @@ -732,7 +732,7 @@ static v8::Handle JS_Execute (v8::Arguments const& argv) { // copy sandbox into context v8::Handle keys = sandbox->GetPropertyNames(); - for (i = 0; i < keys->Length(); i++) { + for (uint32_t i = 0; i < keys->Length(); i++) { v8::Handle key = keys->Get(v8::Integer::New(i))->ToString(); v8::Handle value = sandbox->Get(key); @@ -781,7 +781,7 @@ static v8::Handle JS_Execute (v8::Arguments const& argv) { if (useSandbox) { v8::Handle keys = context->Global()->GetPropertyNames(); - for (i = 0; i < keys->Length(); i++) { + for (uint32_t i = 0; i < keys->Length(); i++) { v8::Handle key = keys->Get(v8::Integer::New(i))->ToString(); v8::Handle value = context->Global()->Get(key); @@ -883,7 +883,7 @@ static v8::Handle JS_Getline (v8::Arguments const& argv) { string line; getline(cin, line); - return scope.Close(v8::String::New(line.c_str(), line.size())); + return scope.Close(v8::String::New(line.c_str(), (int) line.size())); } //////////////////////////////////////////////////////////////////////////////// @@ -954,7 +954,7 @@ static v8::Handle JS_GetTempFile (v8::Arguments const& argv) { TRI_Free(TRI_CORE_MEM_ZONE, result); // return result - return scope.Close(v8::String::New(tempfile.c_str(), tempfile.size())); + return scope.Close(v8::String::New(tempfile.c_str(), (int) tempfile.size())); } //////////////////////////////////////////////////////////////////////////////// @@ -1440,7 +1440,7 @@ static v8::Handle JS_RandomNumbers (v8::Arguments const& argv) { int length = (int) TRI_ObjectToInt64(argv[0]); string str = JSNumGenerator.random(length); - return scope.Close(v8::String::New(str.c_str(), str.length())); + return scope.Close(v8::String::New(str.c_str(), (int) str.length())); } //////////////////////////////////////////////////////////////////////////////// @@ -1461,7 +1461,7 @@ static v8::Handle JS_RandomAlphaNum (v8::Arguments const& argv) { int length = (int) TRI_ObjectToInt64(argv[0]); string str = JSAlphaNumGenerator.random(length); - return scope.Close(v8::String::New(str.c_str(), str.length())); + return scope.Close(v8::String::New(str.c_str(), (int) str.length())); } //////////////////////////////////////////////////////////////////////////////// @@ -1480,7 +1480,7 @@ static v8::Handle JS_RandomSalt (v8::Arguments const& argv) { } string str = JSSaltGenerator.random(8); - return scope.Close(v8::String::New(str.c_str(), str.length())); + return scope.Close(v8::String::New(str.c_str(), (int) str.length())); } //////////////////////////////////////////////////////////////////////////////// @@ -1500,7 +1500,7 @@ static v8::Handle JS_CreateNonce (v8::Arguments const& argv) { string str = Nonce::createNonce(); - return scope.Close(v8::String::New(str.c_str(), str.length())); + return scope.Close(v8::String::New(str.c_str(), (int) str.length())); } //////////////////////////////////////////////////////////////////////////////// @@ -1767,7 +1767,7 @@ static v8::Handle JS_Read64 (v8::Arguments const& argv) { TRI_V8_EXCEPTION_MESSAGE(scope, TRI_errno(), TRI_last_error()); } - return scope.Close(v8::String::New(base64.c_str(), base64.size())); + return scope.Close(v8::String::New(base64.c_str(), (int) base64.size())); } //////////////////////////////////////////////////////////////////////////////// @@ -2114,7 +2114,7 @@ static v8::Handle JS_Sha256 (v8::Arguments const& argv) { delete[] hash; // and return - v8::Handle hashStr = v8::String::New(hex, hexLen); + v8::Handle hashStr = v8::String::New(hex, (int) hexLen); delete[] hex; @@ -2665,17 +2665,17 @@ v8::Handle TRI_normalize_V8_Obj (v8::Handle obj) { v8::String::Value str(obj); size_t str_len = str.length(); if (str_len > 0) { - UErrorCode erroCode = U_ZERO_ERROR; - const Normalizer2* normalizer = Normalizer2::getInstance(NULL, "nfc", UNORM2_COMPOSE ,erroCode); + UErrorCode errorCode = U_ZERO_ERROR; + const Normalizer2* normalizer = Normalizer2::getInstance(NULL, "nfc", UNORM2_COMPOSE ,errorCode); - if (U_FAILURE(erroCode)) { - return scope.Close(v8::String::New(*str, str_len)); + if (U_FAILURE(errorCode)) { + return scope.Close(v8::String::New(*str, (int) str_len)); } - UnicodeString result = normalizer->normalize(UnicodeString((UChar*)(*str), str_len), erroCode); + UnicodeString result = normalizer->normalize(UnicodeString((UChar*)(*str), str_len), errorCode); - if (U_FAILURE(erroCode)) { - return scope.Close(v8::String::New(*str, str_len)); + if (U_FAILURE(errorCode)) { + return scope.Close(v8::String::New(*str, (int) str_len)); } // .......................................................................... @@ -2684,7 +2684,7 @@ v8::Handle TRI_normalize_V8_Obj (v8::Handle obj) { // compilers. v8 expects uint16_t (2 bytes) // .......................................................................... - return scope.Close(v8::String::New( (const uint16_t*)(result.getBuffer()), result.length())); + return scope.Close(v8::String::New((const uint16_t*) result.getBuffer(), (int) result.length())); } else { return scope.Close(v8::String::New(""));