mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
21e725f138
|
@ -270,6 +270,9 @@
|
|||
var data = {};
|
||||
data.name = collName;
|
||||
data.waitForSync = wfs;
|
||||
if (journalSize > 0) {
|
||||
data.journalSize = journalSize;
|
||||
}
|
||||
data.isSystem = isSystem;
|
||||
data.type = parseInt(collType, 10);
|
||||
if (shards) {
|
||||
|
|
|
@ -90,77 +90,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="createDatabaseModal" class="modal hide fade createModalDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<a class="arangoHeader">Create Database</a>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name:</th>
|
||||
<th><input type="text" id="newDatabaseName" name="databasename" value="" placeholder="Database Name"/></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Please define the owner of this database. This will be the only user having initial access to this database. If the user is different to your account you will not be able to see the database. If there is a failure you will be informed.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Username:</th>
|
||||
<th><input type="text" id="newUser" name="username" value="" placeholder="Database Owner"/></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Password:</th>
|
||||
<th><input type="password" id="newPassword" name="password" value=""/></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="button-close" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button id="submitCreateDatabase" class="button-success pull-right">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="editDatabaseModal" class="modal hide fade createModalDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<a class="arangoHeader">Edit database</a>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name:</th>
|
||||
<th id="editDatabaseName"></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="button-close" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button id="deleteDatabase" class="button-danger pull-right" >Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="deleteDatabaseModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<a class="arangoHeader">Delete Database</a>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Really delete?</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="button-close" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button id="submitDeleteDatabase" class="button-danger pull-right">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -80,12 +80,18 @@
|
|||
return true;
|
||||
},
|
||||
|
||||
createDatabase: function(e) {
|
||||
e.preventDefault();
|
||||
this.createAddDatabaseModal();
|
||||
},
|
||||
|
||||
submitCreateDatabase: function() {
|
||||
var self = this;
|
||||
var name = $('#newDatabaseName').val();
|
||||
var userName = $('#newUser').val();
|
||||
var userPassword = $('#newPassword').val();
|
||||
if (!this.validateDatabaseInfo(name, userName, userPassword)) {
|
||||
console.log("VALIDATE");
|
||||
return;
|
||||
}
|
||||
var options = {
|
||||
|
@ -104,37 +110,17 @@
|
|||
self.handleError(err.status, err.statusText, name);
|
||||
},
|
||||
success: function(data) {
|
||||
self.hideModal('createDatabaseModal');
|
||||
self.updateDatabases();
|
||||
window.modalView.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
hideModal: function(modal) {
|
||||
$('#' + modal).modal('hide');
|
||||
},
|
||||
|
||||
showModal: function(modal) {
|
||||
$('#' + modal).modal('show');
|
||||
},
|
||||
|
||||
createDatabase: function(e) {
|
||||
e.preventDefault();
|
||||
this.showModal('createDatabaseModal');
|
||||
},
|
||||
|
||||
submitDeleteDatabase: function(e) {
|
||||
var toDelete = this.collection.where({name: this.dbToDelete});
|
||||
toDelete[0].destroy({wait: true, url:"/_api/database/"+this.dbToDelete});
|
||||
this.dbToDelete = '';
|
||||
this.hideModal('deleteDatabaseModal');
|
||||
submitDeleteDatabase: function(dbname) {
|
||||
var toDelete = this.collection.where({name: dbname});
|
||||
toDelete[0].destroy({wait: true, url:"/_api/database/"+dbname});
|
||||
this.updateDatabases();
|
||||
},
|
||||
|
||||
deleteDatabase: function(e) {
|
||||
this.hideModal('editDatabaseModal');
|
||||
this.dbToDelete = $('#editDatabaseName').html();
|
||||
this.showModal('deleteDatabaseModal');
|
||||
window.modalView.hide();
|
||||
},
|
||||
|
||||
currentDatabase: function() {
|
||||
|
@ -158,20 +144,12 @@
|
|||
},
|
||||
|
||||
editDatabase: function(e) {
|
||||
var dbName = this.evaluateDatabaseName($(e.currentTarget).attr("id"), '_edit-database');
|
||||
$('#editDatabaseName').html(dbName);
|
||||
var button = $('#deleteDatabase');
|
||||
var dbName = this.evaluateDatabaseName($(e.currentTarget).attr("id"), '_edit-database'),
|
||||
isDeleteable = true;
|
||||
if(dbName === this.currentDB) {
|
||||
var element;
|
||||
button.prop('disabled', true);
|
||||
button.removeClass('button-danger');
|
||||
button.addClass('button-neutral');
|
||||
} else {
|
||||
button.prop('disabled', false);
|
||||
button.removeClass('button-neutral');
|
||||
button.addClass('button-danger');
|
||||
isDeleteable = false;
|
||||
}
|
||||
this.showModal('editDatabaseModal');
|
||||
this.createEditDatabaseModal(dbName, isDeleteable);
|
||||
},
|
||||
|
||||
search: function() {
|
||||
|
@ -218,6 +196,82 @@
|
|||
evaluateDatabaseName : function(str, substr) {
|
||||
var index = str.lastIndexOf(substr);
|
||||
return str.substring(0, index);
|
||||
},
|
||||
|
||||
createEditDatabaseModal: function(dbName, isDeleteable) {
|
||||
var buttons = [],
|
||||
tableContent = [];
|
||||
|
||||
tableContent.push(
|
||||
window.modalView.createReadOnlyEntry("Name", dbName, "")
|
||||
);
|
||||
if (isDeleteable) {
|
||||
buttons.push(
|
||||
window.modalView.createDeleteButton(
|
||||
"Delete",
|
||||
this.submitDeleteDatabase.bind(this, dbName)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
buttons.push(window.modalView.createDisabledButton("Delete"));
|
||||
}
|
||||
window.modalView.show(
|
||||
"modalTable.ejs",
|
||||
"Edit database",
|
||||
buttons,
|
||||
tableContent
|
||||
);
|
||||
},
|
||||
|
||||
createAddDatabaseModal: function() {
|
||||
var buttons = [],
|
||||
tableContent = [];
|
||||
|
||||
tableContent.push(
|
||||
window.modalView.createTextEntry(
|
||||
"newDatabaseName",
|
||||
"Name",
|
||||
"",
|
||||
false,
|
||||
"Database Name",
|
||||
true
|
||||
)
|
||||
);
|
||||
tableContent.push(
|
||||
window.modalView.createTextEntry(
|
||||
"newUser",
|
||||
"Username",
|
||||
"",
|
||||
"Please define the owner of this database. This will be the only user having "
|
||||
+ "initial access to this database. If the user is different to your account "
|
||||
+ "you will not be able to see the database. "
|
||||
+ "If there is a failure you will be informed.",
|
||||
"Database Owner",
|
||||
true
|
||||
)
|
||||
);
|
||||
tableContent.push(
|
||||
window.modalView.createPasswordEntry(
|
||||
"newPassword",
|
||||
"Password",
|
||||
"",
|
||||
false,
|
||||
"",
|
||||
false
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createSuccessButton(
|
||||
"Create",
|
||||
this.submitCreateDatabase.bind(this)
|
||||
)
|
||||
);
|
||||
window.modalView.show(
|
||||
"modalTable.ejs",
|
||||
"Create Database",
|
||||
buttons,
|
||||
tableContent
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,6 +83,12 @@
|
|||
return createButtonStub(this.buttons.NEUTRAL, title, cb);
|
||||
},
|
||||
|
||||
createDisabledButton: function(title) {
|
||||
var disabledButton = createButtonStub(this.buttons.NEUTRAL, title);
|
||||
disabledButton.disabled = true;
|
||||
return disabledButton;
|
||||
},
|
||||
|
||||
createReadOnlyEntry: function(label, value, info) {
|
||||
return createTextStub(this.tables.READONLY, label, value, info);
|
||||
},
|
||||
|
|
|
@ -91,15 +91,9 @@
|
|||
}
|
||||
var isSystem = (collName.substr(0, 1) === '_');
|
||||
var wfs = (collSync === "true");
|
||||
var journalSizeString;
|
||||
|
||||
if (collSize === '') {
|
||||
journalSizeString = '';
|
||||
}
|
||||
else {
|
||||
if (collSize > 0) {
|
||||
try {
|
||||
collSize = JSON.parse(collSize) * 1024 * 1024;
|
||||
journalSizeString = ', "journalSize":' + collSize;
|
||||
}
|
||||
catch (e) {
|
||||
arangoHelper.arangoError('Please enter a valid number');
|
||||
|
@ -112,7 +106,7 @@
|
|||
}
|
||||
|
||||
var returnobj = window.arangoCollectionsStore.newCollection(
|
||||
collName, wfs, isSystem, journalSizeString, collType, shards, shardBy
|
||||
collName, wfs, isSystem, collSize, collType, shards, shardBy
|
||||
);
|
||||
if (returnobj.status === true) {
|
||||
self.hidden();
|
||||
|
|
|
@ -27,8 +27,19 @@ module.exports = function(karma) {
|
|||
|
||||
preprocessors: {
|
||||
'test/karma/files.json': ['html2js'],
|
||||
'frontend/js/**/**.js': ['coverage'],
|
||||
'clusterFrontend/js/**/**.js': ['coverage']
|
||||
'clusterFrontend/js/**/**.js': ['coverage'],
|
||||
'frontend/js/arango/**.js': ['coverage'],
|
||||
'frontend/js/bootstrap/**.js': ['coverage'],
|
||||
'frontend/js/client/**.js': ['coverage'],
|
||||
'frontend/js/collections/**.js': ['coverage'],
|
||||
'frontend/js/config/**.js': ['coverage'],
|
||||
'frontend/js/graphViewer/**.js': ['coverage'],
|
||||
'frontend/js/models/**.js': ['coverage'],
|
||||
'frontend/js/modules/**.js': ['coverage'],
|
||||
'frontend/js/routers/**.js': ['coverage'],
|
||||
'frontend/js/shell/**.js': ['coverage'],
|
||||
'frontend/js/templates/**.js': ['coverage'],
|
||||
'frontend/js/views/**.js': ['coverage']
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
|
|
|
@ -21,12 +21,23 @@ module.exports = function(karma) {
|
|||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
|
||||
],
|
||||
|
||||
preprocessors: {
|
||||
'frontend/js/**/**.js': ['coverage'],
|
||||
'clusterFrontend/js/**/**.js': ['coverage']
|
||||
'test/karma/files.json': ['html2js'],
|
||||
'clusterFrontend/js/**/**.js': ['coverage'],
|
||||
'frontend/js/arango/**.js': ['coverage'],
|
||||
'frontend/js/bootstrap/**.js': ['coverage'],
|
||||
'frontend/js/client/**.js': ['coverage'],
|
||||
'frontend/js/collections/**.js': ['coverage'],
|
||||
'frontend/js/config/**.js': ['coverage'],
|
||||
'frontend/js/graphViewer/**.js': ['coverage'],
|
||||
'frontend/js/models/**.js': ['coverage'],
|
||||
'frontend/js/modules/**.js': ['coverage'],
|
||||
'frontend/js/routers/**.js': ['coverage'],
|
||||
'frontend/js/shell/**.js': ['coverage'],
|
||||
'frontend/js/templates/**.js': ['coverage'],
|
||||
'frontend/js/views/**.js': ['coverage']
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
|
|
|
@ -116,10 +116,9 @@ add_library(
|
|||
Rest/InitialiseRest.cpp
|
||||
Rest/SslInterface.cpp
|
||||
Rest/Version.cpp
|
||||
Rest/Url.cpp
|
||||
ShapedJson/json-shaper.c
|
||||
ShapedJson/shape-accessor.c
|
||||
ShapedJson/shaped-json.c
|
||||
ShapedJson/json-shaper.cpp
|
||||
ShapedJson/shape-accessor.cpp
|
||||
ShapedJson/shaped-json.cpp
|
||||
Statistics/statistics.cpp
|
||||
Utilities/ScriptLoader.cpp
|
||||
Zip/ioapi.c
|
||||
|
|
|
@ -89,10 +89,9 @@ lib_libarango_a_SOURCES = \
|
|||
lib/Rest/InitialiseRest.cpp \
|
||||
lib/Rest/SslInterface.cpp \
|
||||
lib/Rest/Version.cpp \
|
||||
lib/Rest/Url.cpp \
|
||||
lib/ShapedJson/json-shaper.c \
|
||||
lib/ShapedJson/shape-accessor.c \
|
||||
lib/ShapedJson/shaped-json.c \
|
||||
lib/ShapedJson/json-shaper.cpp \
|
||||
lib/ShapedJson/shape-accessor.cpp \
|
||||
lib/ShapedJson/shaped-json.cpp \
|
||||
lib/Statistics/statistics.cpp \
|
||||
lib/Utilities/ScriptLoader.cpp \
|
||||
lib/Zip/ioapi.c \
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "Basics/InitialiseBasics.h"
|
||||
#include "Rest/HttpResponse.h"
|
||||
#include "Rest/Version.h"
|
||||
#include "Rest/Url.h"
|
||||
#include "Statistics/statistics.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -116,7 +115,6 @@ namespace triagens {
|
|||
void InitialiseRest (int argc, char* argv[]) {
|
||||
TRIAGENS_BASICS_INITIALISE(argc, argv);
|
||||
|
||||
TRI_InitialiseUrl();
|
||||
TRI_InitialiseStatistics();
|
||||
|
||||
SSL_library_init();
|
||||
|
@ -138,7 +136,6 @@ namespace triagens {
|
|||
opensslCleanup();
|
||||
#endif
|
||||
|
||||
TRI_ShutdownUrl();
|
||||
TRI_ShutdownStatistics();
|
||||
|
||||
TRIAGENS_BASICS_SHUTDOWN;
|
||||
|
|
214
lib/Rest/Url.cpp
214
lib/Rest/Url.cpp
|
@ -1,214 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief url class
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
/// @author Achim Brandt
|
||||
/// @author Copyright 2007-2013, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Url.h"
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "Basics/Exceptions.h"
|
||||
#include "Basics/StringUtils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace triagens::basics;
|
||||
using namespace triagens::rest;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief URL pattern
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static regex_t re;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Url::Url (string const& urlName)
|
||||
: _host("localhost"),
|
||||
_port(80),
|
||||
_service("http"),
|
||||
_path("") {
|
||||
int result;
|
||||
regmatch_t matches[5];
|
||||
|
||||
result = regexec(&re, urlName.c_str(), sizeof(matches) / sizeof(matches[0]), matches, 0);
|
||||
|
||||
if (result == 0) {
|
||||
char const* ptr = urlName.c_str();
|
||||
string port = string(ptr + matches[3].rm_so, matches[3].rm_eo - matches[3].rm_so);
|
||||
|
||||
_host = string(ptr + matches[2].rm_so, matches[2].rm_eo - matches[2].rm_so);
|
||||
_port = port.empty() ? 80 : StringUtils::uint32(port.substr(1));
|
||||
_path = string(ptr + matches[4].rm_so, matches[4].rm_eo - matches[4].rm_so);
|
||||
|
||||
if (matches[1].rm_so == matches[1].rm_eo) {
|
||||
_service = "http";
|
||||
}
|
||||
else {
|
||||
_service = string(ptr + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so - 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
THROW_PARAMETER_ERROR("url", "url not valid", "constructor");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the service part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& Url::service () const {
|
||||
return _service;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the host part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& Url::host () const {
|
||||
return _host;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the port
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint16_t Url::port () const {
|
||||
return _port;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the path part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& Url::path () const {
|
||||
return _path;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- MODULE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief already initialised
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool Initialised = false;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises the hashes components
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitialiseUrl () {
|
||||
if (Initialised) {
|
||||
return;
|
||||
}
|
||||
|
||||
regcomp(&re, "([a-z]*:)//([a-z0-9\\._-]*)(:[0-9]+)?(/.*)", REG_ICASE | REG_EXTENDED);
|
||||
|
||||
Initialised = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shut downs the hashes components
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_ShutdownUrl () {
|
||||
regfree(&re);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
|
||||
// End:
|
194
lib/Rest/Url.h
194
lib/Rest/Url.h
|
@ -1,194 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief url class
|
||||
///
|
||||
/// @file
|
||||
/// A class describing the various parts of an URL.
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
/// @author Achim Brandt
|
||||
/// @author Copyright 2007-2013, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef TRIAGENS_REST_URL_H
|
||||
#define TRIAGENS_REST_URL_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
|
||||
namespace triagens {
|
||||
namespace rest {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- class Url
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Url
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class Url {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
explicit
|
||||
Url (string const& urlName);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the service part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& service () const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the host part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& host () const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the port
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint16_t port () const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the path part
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& path () const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief host
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string _host;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief port
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint16_t _port;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief service
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string _service;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string _path;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- MODULE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Url
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises the url components
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitialiseUrl (void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shut downs the url components
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_ShutdownUrl (void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
|
||||
// End:
|
|
@ -127,7 +127,7 @@ static bool EqualPidKeyAttributePath (TRI_associative_synced_t* array, void cons
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static TRI_shape_path_t const* LookupPidAttributePath (TRI_shaper_t* shaper, TRI_shape_pid_t pid) {
|
||||
return TRI_LookupByKeyAssociativeSynced(&shaper->_attributePathsByPid, &pid);
|
||||
return static_cast<TRI_shape_path_t const*>(TRI_LookupByKeyAssociativeSynced(&shaper->_attributePathsByPid, &pid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -217,7 +217,7 @@ static TRI_shape_path_t const* FindShapePathByName (TRI_shaper_t* shaper,
|
|||
|
||||
// split path into attribute pieces
|
||||
count = 0;
|
||||
aids = TRI_Allocate(shaper->_memoryZone, len * sizeof(TRI_shape_aid_t), false);
|
||||
aids = static_cast<TRI_shape_aid_t*>(TRI_Allocate(shaper->_memoryZone, len * sizeof(TRI_shape_aid_t), false));
|
||||
|
||||
if (aids == NULL) {
|
||||
TRI_UnlockMutex(&shaper->_attributePathLock);
|
||||
|
@ -267,7 +267,7 @@ static TRI_shape_path_t const* FindShapePathByName (TRI_shaper_t* shaper,
|
|||
|
||||
// create element
|
||||
total = sizeof(TRI_shape_path_t) + (len + 1) + (count * sizeof(TRI_shape_aid_t));
|
||||
result = TRI_Allocate(shaper->_memoryZone, total, false);
|
||||
result = static_cast<TRI_shape_path_t*>(TRI_Allocate(shaper->_memoryZone, total, false));
|
||||
|
||||
if (result == NULL) {
|
||||
TRI_UnlockMutex(&shaper->_attributePathLock);
|
|
@ -293,7 +293,7 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
|
|||
}
|
||||
|
||||
accessor->_shape = shape;
|
||||
accessor->_code = TRI_Allocate(shaper->_memoryZone, ops._length * sizeof(void*), false);
|
||||
accessor->_code = static_cast<void const**>(TRI_Allocate(shaper->_memoryZone, ops._length * sizeof(void*), false));
|
||||
|
||||
if (accessor->_code == NULL) {
|
||||
LOG_ERROR("out of memory");
|
||||
|
@ -318,18 +318,15 @@ static bool ExecuteBytecodeShapeAccessor (TRI_shape_access_t const* accessor,
|
|||
TRI_shape_size_t e;
|
||||
TRI_shape_size_t pos;
|
||||
TRI_shape_size_t* offsetsV;
|
||||
void* const* ops;
|
||||
|
||||
if (accessor->_shape == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ops = accessor->_code;
|
||||
void const** ops = static_cast<void const**>(accessor->_code);
|
||||
|
||||
while (true) {
|
||||
TRI_shape_ac_bc_e op;
|
||||
|
||||
op = * (TRI_shape_ac_bc_e*) ops;
|
||||
TRI_shape_ac_bc_e op = *(TRI_shape_ac_bc_e*) ops;
|
||||
ops++;
|
||||
|
||||
switch (op) {
|
||||
|
@ -401,10 +398,7 @@ void TRI_FreeShapeAccessor (TRI_shape_access_t* accessor) {
|
|||
TRI_shape_access_t* TRI_ShapeAccessor (TRI_shaper_t* shaper,
|
||||
TRI_shape_sid_t sid,
|
||||
TRI_shape_pid_t pid) {
|
||||
TRI_shape_access_t* accessor;
|
||||
bool ok;
|
||||
|
||||
accessor = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shape_access_t), false);
|
||||
TRI_shape_access_t* accessor = static_cast<TRI_shape_access_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shape_access_t), false));
|
||||
|
||||
if (accessor == NULL) {
|
||||
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -416,7 +410,7 @@ TRI_shape_access_t* TRI_ShapeAccessor (TRI_shaper_t* shaper,
|
|||
accessor->_code = NULL;
|
||||
accessor->_memoryZone = shaper->_memoryZone;
|
||||
|
||||
ok = BytecodeShapeAccessor(shaper, accessor);
|
||||
bool ok = BytecodeShapeAccessor(shaper, accessor);
|
||||
|
||||
if (ok) {
|
||||
return accessor;
|
||||
|
@ -462,7 +456,6 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
|
|||
TRI_shape_size_t e;
|
||||
TRI_shape_size_t pos;
|
||||
TRI_shape_t const* shape;
|
||||
void* const* ops;
|
||||
|
||||
printf("shape accessor for sid: %lu, pid: %lu\n",
|
||||
(unsigned long) accessor->_sid,
|
||||
|
@ -475,13 +468,11 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
|
|||
|
||||
printf(" result shape: %lu\n", (unsigned long) accessor->_shape->_sid);
|
||||
|
||||
ops = accessor->_code;
|
||||
void const** ops = static_cast<void const**>(accessor->_code);
|
||||
shape = accessor->_shape;
|
||||
|
||||
while (true) {
|
||||
TRI_shape_ac_bc_e op;
|
||||
|
||||
op = * (TRI_shape_ac_bc_e*) ops;
|
||||
TRI_shape_ac_bc_e op = static_cast<TRI_shape_ac_bc_e>(*(TRI_shape_ac_bc_e*) ops);
|
||||
ops++;
|
||||
|
||||
switch (op) {
|
||||
|
@ -489,7 +480,7 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
|
|||
return;
|
||||
|
||||
case TRI_SHAPE_AC_SHAPE_PTR:
|
||||
shape = *ops++;
|
||||
shape = static_cast<TRI_shape_t const*>(*ops++);
|
||||
|
||||
printf(" OP: shape %lu\n",
|
||||
(unsigned long) shape->_sid);
|
|
@ -55,7 +55,7 @@ typedef struct TRI_shape_access_s {
|
|||
TRI_shape_pid_t _pid; // path identifier of the attribute path
|
||||
|
||||
TRI_shape_t const* _shape; // resulting shape
|
||||
void* const* _code; // bytecode
|
||||
void const** _code; // bytecode
|
||||
|
||||
TRI_memory_zone_t* _memoryZone;
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ static bool FillShapeValueBoolean (TRI_shaper_t* shaper, TRI_shape_value_t* dst,
|
|||
dst->_fixedSized = true;
|
||||
dst->_size = sizeof(TRI_shape_boolean_t);
|
||||
// no need to prefill dst->_value with 0, as it is overwritten directly afterwards
|
||||
dst->_value = (char*) (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, false));
|
||||
dst->_value = (char*) (ptr = static_cast<TRI_shape_boolean_t*>(TRI_Allocate(shaper->_memoryZone, dst->_size, false)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
return false;
|
||||
|
@ -403,7 +403,7 @@ static bool FillShapeValueNumber (TRI_shaper_t* shaper, TRI_shape_value_t* dst,
|
|||
dst->_sid = TRI_LookupBasicSidShaper(TRI_SHAPE_NUMBER);
|
||||
dst->_fixedSized = true;
|
||||
dst->_size = sizeof(TRI_shape_number_t);
|
||||
dst->_value = (char*) (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (char*) (ptr = static_cast<TRI_shape_number_t*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
return false;
|
||||
|
@ -426,7 +426,7 @@ static bool FillShapeValueString (TRI_shaper_t* shaper, TRI_shape_value_t* dst,
|
|||
dst->_sid = TRI_LookupBasicSidShaper(TRI_SHAPE_SHORT_STRING);
|
||||
dst->_fixedSized = true;
|
||||
dst->_size = sizeof(TRI_shape_length_short_string_t) + TRI_SHAPE_SHORT_STRING_CUT;
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
return false;
|
||||
|
@ -443,7 +443,7 @@ static bool FillShapeValueString (TRI_shaper_t* shaper, TRI_shape_value_t* dst,
|
|||
dst->_sid = TRI_LookupBasicSidShaper(TRI_SHAPE_LONG_STRING);
|
||||
dst->_fixedSized = false;
|
||||
dst->_size = sizeof(TRI_shape_length_long_string_t) + json->_value._string.length;
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
return false;
|
||||
|
@ -501,7 +501,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
|
||||
dst->_fixedSized = false;
|
||||
dst->_size = sizeof(TRI_shape_length_list_t);
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
return false;
|
||||
|
@ -513,7 +513,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
}
|
||||
|
||||
// convert into TRI_shape_value_t array
|
||||
p = (values = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shape_value_t) * n, true));
|
||||
p = (values = static_cast<TRI_shape_value_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shape_value_t) * n, true)));
|
||||
|
||||
if (p == NULL) {
|
||||
return false;
|
||||
|
@ -562,9 +562,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
|
||||
// homogeneous sized
|
||||
if (hs && hl) {
|
||||
TRI_homogeneous_sized_list_shape_t* shape;
|
||||
|
||||
shape = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_homogeneous_sized_list_shape_t), true);
|
||||
TRI_homogeneous_sized_list_shape_t* shape = static_cast<TRI_homogeneous_sized_list_shape_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_homogeneous_sized_list_shape_t), true));
|
||||
|
||||
if (shape == NULL) {
|
||||
for (p = values; p < e; ++p) {
|
||||
|
@ -606,7 +604,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
|
||||
dst->_fixedSized = false;
|
||||
dst->_size = sizeof(TRI_shape_length_list_t) + total;
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
for (p = values; p < e; ++p) {
|
||||
|
@ -632,9 +630,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
|
||||
// homogeneous
|
||||
else if (hs) {
|
||||
TRI_homogeneous_list_shape_t* shape;
|
||||
|
||||
shape = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_homogeneous_list_shape_t), true);
|
||||
TRI_homogeneous_list_shape_t* shape = static_cast<TRI_homogeneous_list_shape_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_homogeneous_list_shape_t), true));
|
||||
|
||||
if (shape == NULL) {
|
||||
for (p = values; p < e; ++p) {
|
||||
|
@ -677,7 +673,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
|
||||
dst->_fixedSized = false;
|
||||
dst->_size = offset + total;
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
for (p = values; p < e; ++p) {
|
||||
|
@ -721,7 +717,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper,
|
|||
|
||||
dst->_fixedSized = false;
|
||||
dst->_size = offset + total;
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (dst->_value == NULL) {
|
||||
for (p = values; p < e; ++p) {
|
||||
|
@ -807,7 +803,7 @@ static bool FillShapeValueArray (TRI_shaper_t* shaper,
|
|||
n = json->_value._objects._length / 2;
|
||||
|
||||
// convert into TRI_shape_value_t array
|
||||
p = (values = TRI_Allocate(shaper->_memoryZone, n * sizeof(TRI_shape_value_t), true));
|
||||
p = (values = static_cast<TRI_shape_value_t*>(TRI_Allocate(shaper->_memoryZone, n * sizeof(TRI_shape_value_t), true)));
|
||||
|
||||
if (p == NULL) {
|
||||
return false;
|
||||
|
@ -818,12 +814,10 @@ static bool FillShapeValueArray (TRI_shaper_t* shaper,
|
|||
v = 0;
|
||||
|
||||
for (i = 0; i < n; ++i, ++p) {
|
||||
TRI_json_t* key;
|
||||
TRI_json_t* val;
|
||||
bool ok;
|
||||
|
||||
key = TRI_AtVector(&json->_value._objects, 2 * i);
|
||||
val = TRI_AtVector(&json->_value._objects, 2 * i + 1);
|
||||
TRI_json_t* key = static_cast<TRI_json_t*>(TRI_AtVector(&json->_value._objects, 2 * i));
|
||||
TRI_json_t* val = static_cast<TRI_json_t*>(TRI_AtVector(&json->_value._objects, 2 * i + 1));
|
||||
|
||||
assert(key != NULL);
|
||||
assert(val != NULL);
|
||||
|
@ -896,7 +890,7 @@ static bool FillShapeValueArray (TRI_shaper_t* shaper,
|
|||
+ n * sizeof(TRI_shape_aid_t)
|
||||
+ (f + 1) * sizeof(TRI_shape_size_t);
|
||||
|
||||
a = (TRI_array_shape_t*) (ptr = TRI_Allocate(shaper->_memoryZone, i, true));
|
||||
a = (TRI_array_shape_t*) (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, i, true)));
|
||||
|
||||
if (ptr == NULL) {
|
||||
e = values + n;
|
||||
|
@ -938,7 +932,7 @@ static bool FillShapeValueArray (TRI_shaper_t* shaper,
|
|||
|
||||
dst->_fixedSized = true;
|
||||
dst->_size = total;
|
||||
dst->_value = (ptr = TRI_Allocate(shaper->_memoryZone, dst->_size, true));
|
||||
dst->_value = (ptr = static_cast<char*>(TRI_Allocate(shaper->_memoryZone, dst->_size, true)));
|
||||
|
||||
if (ptr == NULL) {
|
||||
e = values + n;
|
||||
|
@ -2208,21 +2202,18 @@ static bool StringifyJsonShapeData (TRI_shaper_t* shaper,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TRI_shaped_json_t* TRI_CopyShapedJson (TRI_shaper_t* shaper, TRI_shaped_json_t* oldShapedJson) {
|
||||
TRI_shaped_json_t* newShapedJson;
|
||||
int res;
|
||||
|
||||
if (oldShapedJson == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newShapedJson = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shaped_json_t), true);
|
||||
TRI_shaped_json_t* newShapedJson = static_cast<TRI_shaped_json_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shaped_json_t), true));
|
||||
|
||||
if (newShapedJson == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newShapedJson->_sid = oldShapedJson->_sid;
|
||||
res = TRI_CopyToBlob(shaper->_memoryZone, &(newShapedJson->_data), &(oldShapedJson->_data));
|
||||
int res = TRI_CopyToBlob(shaper->_memoryZone, &(newShapedJson->_data), &(oldShapedJson->_data));
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_Free(shaper->_memoryZone, newShapedJson);
|
||||
|
@ -2272,7 +2263,6 @@ TRI_shaped_json_t* TRI_ShapedJsonJson (TRI_shaper_t* shaper,
|
|||
TRI_json_t const* json,
|
||||
bool create,
|
||||
bool isLocked) {
|
||||
TRI_shaped_json_t* shaped;
|
||||
TRI_shape_value_t dst;
|
||||
bool ok;
|
||||
|
||||
|
@ -2290,7 +2280,7 @@ TRI_shaped_json_t* TRI_ShapedJsonJson (TRI_shaper_t* shaper,
|
|||
#endif
|
||||
|
||||
// no need to prefill shaped with 0's as all attributes are set directly afterwards
|
||||
shaped = TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shaped_json_t), false);
|
||||
TRI_shaped_json_t* shaped = static_cast<TRI_shaped_json_t*>(TRI_Allocate(shaper->_memoryZone, sizeof(TRI_shaped_json_t), false));
|
||||
|
||||
if (shaped == NULL) {
|
||||
TRI_Free(shaper->_memoryZone, dst._value);
|
Loading…
Reference in New Issue