mirror of https://gitee.com/bigwinds/arangodb
cleanup
This commit is contained in:
parent
de999018c0
commit
138f495431
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -23,16 +23,16 @@
|
||||||
///
|
///
|
||||||
/// @author Dr. Frank Celler
|
/// @author Dr. Frank Celler
|
||||||
/// @author Martin Schoenert
|
/// @author Martin Schoenert
|
||||||
/// @author Copyright 2006-2011, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2006-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "json-shaper.h"
|
#include "json-shaper.h"
|
||||||
|
|
||||||
#include <BasicsC/associative.h>
|
#include "BasicsC/associative.h"
|
||||||
#include <BasicsC/hashes.h>
|
#include "BasicsC/hashes.h"
|
||||||
#include <BasicsC/logging.h>
|
#include "BasicsC/logging.h"
|
||||||
#include <BasicsC/strings.h>
|
#include "BasicsC/strings.h"
|
||||||
#include <BasicsC/vector.h>
|
#include "BasicsC/vector.h"
|
||||||
|
|
||||||
// #define DEBUG_JSON_SHAPER 1
|
// #define DEBUG_JSON_SHAPER 1
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ static uint64_t HashElementAttributeName (TRI_associative_pointer_t* array, void
|
||||||
e = (char const*) element;
|
e = (char const*) element;
|
||||||
ee = (attribute_2_id_t const*) element;
|
ee = (attribute_2_id_t const*) element;
|
||||||
|
|
||||||
return TRI_FnvHashPointer(e + sizeof(attribute_2_id_t), ee->_size - 1);
|
return TRI_FnvHashPointer(e + sizeof(attribute_2_id_t), (size_t)(ee->_size - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -393,7 +393,7 @@ static uint64_t HashElementShape (TRI_associative_pointer_t* array, void const*
|
||||||
e = element;
|
e = element;
|
||||||
ee = element;
|
ee = element;
|
||||||
|
|
||||||
return TRI_FnvHashPointer(e + sizeof(TRI_shape_sid_t), ee->_size - sizeof(TRI_shape_sid_t));
|
return TRI_FnvHashPointer(e + sizeof(TRI_shape_sid_t), (size_t)(ee->_size - sizeof(TRI_shape_sid_t)));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -413,7 +413,7 @@ static bool EqualElementShape (TRI_associative_pointer_t* array, void const* lef
|
||||||
rr = right;
|
rr = right;
|
||||||
|
|
||||||
return (ll->_size == rr->_size)
|
return (ll->_size == rr->_size)
|
||||||
&& memcmp(l + sizeof(TRI_shape_sid_t), r + sizeof(TRI_shape_sid_t), ll->_size - sizeof(TRI_shape_sid_t)) == 0;
|
&& memcmp(l + sizeof(TRI_shape_sid_t), r + sizeof(TRI_shape_sid_t), (size_t)(ll->_size - sizeof(TRI_shape_sid_t))) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -23,16 +23,15 @@
|
||||||
///
|
///
|
||||||
/// @author Dr. Frank Celler
|
/// @author Dr. Frank Celler
|
||||||
/// @author Martin Schoenert
|
/// @author Martin Schoenert
|
||||||
/// @author Copyright 2006-2011, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2006-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef TRIAGENS_PHILADELPHIA_SHAPED_JSON_JSON_SHAPER_H
|
#ifndef TRIAGENS_SHAPED_JSON_JSON_SHAPER_H
|
||||||
#define TRIAGENS_PHILADELPHIA_SHAPED_JSON_JSON_SHAPER_H 1
|
#define TRIAGENS_SHAPED_JSON_JSON_SHAPER_H 1
|
||||||
|
|
||||||
#include <BasicsC/common.h>
|
#include "BasicsC/common.h"
|
||||||
|
|
||||||
#include <BasicsC/json.h>
|
|
||||||
|
|
||||||
|
#include "BasicsC/json.h"
|
||||||
#include "ShapedJson/shaped-json.h"
|
#include "ShapedJson/shaped-json.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -22,14 +22,13 @@
|
||||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// @author Dr. Frank Celler
|
/// @author Dr. Frank Celler
|
||||||
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "shape-accessor.h"
|
#include "shape-accessor.h"
|
||||||
|
|
||||||
#include <BasicsC/logging.h>
|
#include "BasicsC/logging.h"
|
||||||
#include <BasicsC/vector.h>
|
#include "BasicsC/vector.h"
|
||||||
|
|
||||||
#include "ShapedJson/shaped-json.h"
|
#include "ShapedJson/shaped-json.h"
|
||||||
|
|
||||||
// #define DEBUG_SHAPE_ACCESSOR 1
|
// #define DEBUG_SHAPE_ACCESSOR 1
|
||||||
|
@ -143,8 +142,8 @@ static bool BytecodeShapeAccessor (TRI_shaper_t* shaper, TRI_shape_access_t* acc
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_PushBackVectorPointer(&ops, (void*) TRI_SHAPE_AC_OFFSET_FIX);
|
TRI_PushBackVectorPointer(&ops, (void*) TRI_SHAPE_AC_OFFSET_FIX);
|
||||||
TRI_PushBackVectorPointer(&ops, (void*) (offsetsF[0]));
|
TRI_PushBackVectorPointer(&ops, (void*) (intptr_t) (offsetsF[0])); // offset is always smaller than 4 GByte
|
||||||
TRI_PushBackVectorPointer(&ops, (void*) (offsetsF[1]));
|
TRI_PushBackVectorPointer(&ops, (void*) (intptr_t) (offsetsF[1])); // offset is always smaller than 4 GByte
|
||||||
|
|
||||||
TRI_PushBackVectorPointer(&ops, (void*) TRI_SHAPE_AC_SHAPE_PTR);
|
TRI_PushBackVectorPointer(&ops, (void*) TRI_SHAPE_AC_SHAPE_PTR);
|
||||||
cv.c = shape;
|
cv.c = shape;
|
||||||
|
@ -259,8 +258,8 @@ static bool ExecuteBytecodeShapeAccessor (TRI_shape_access_t* accessor,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRI_SHAPE_AC_OFFSET_FIX:
|
case TRI_SHAPE_AC_OFFSET_FIX:
|
||||||
b = (TRI_shape_size_t) *ops++;
|
b = (TRI_shape_size_t) (intptr_t) *ops++; // offset is always smaller than 4 GByte
|
||||||
e = (TRI_shape_size_t) *ops++;
|
e = (TRI_shape_size_t) (intptr_t) *ops++; // offset is always smaller than 4 GByte
|
||||||
|
|
||||||
*end = ((char*) *begin) + e;
|
*end = ((char*) *begin) + e;
|
||||||
*begin = ((char*) *begin) + b;
|
*begin = ((char*) *begin) + b;
|
||||||
|
@ -268,7 +267,7 @@ static bool ExecuteBytecodeShapeAccessor (TRI_shape_access_t* accessor,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRI_SHAPE_AC_OFFSET_VAR:
|
case TRI_SHAPE_AC_OFFSET_VAR:
|
||||||
pos = (TRI_shape_size_t) *ops++;
|
pos = (TRI_shape_size_t) (intptr_t) *ops++; // offset is always smaller than 4 GByte
|
||||||
|
|
||||||
offsetsV = (TRI_shape_size_t*) *begin;
|
offsetsV = (TRI_shape_size_t*) *begin;
|
||||||
|
|
||||||
|
@ -391,8 +390,8 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRI_SHAPE_AC_OFFSET_FIX:
|
case TRI_SHAPE_AC_OFFSET_FIX:
|
||||||
b = (TRI_shape_size_t) *ops++;
|
b = (TRI_shape_size_t) (intptr_t) *ops++; // offset is always smaller than 4 GByte
|
||||||
e = (TRI_shape_size_t) *ops++;
|
e = (TRI_shape_size_t) (intptr_t) *ops++; // offset is always smaller than 4 GByte
|
||||||
|
|
||||||
printf(" OP: fixed offset %lu - %lu\n",
|
printf(" OP: fixed offset %lu - %lu\n",
|
||||||
(unsigned long) b,
|
(unsigned long) b,
|
||||||
|
@ -400,7 +399,7 @@ void TRI_PrintShapeAccessor (TRI_shape_access_t* accessor) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRI_SHAPE_AC_OFFSET_VAR:
|
case TRI_SHAPE_AC_OFFSET_VAR:
|
||||||
pos = (TRI_shape_size_t) *ops++;
|
pos = (TRI_shape_size_t) (intptr_t) *ops++; // offset is always smaller than 4 GByte
|
||||||
|
|
||||||
printf(" OP: variable offset at position %lu\n",
|
printf(" OP: variable offset at position %lu\n",
|
||||||
(unsigned long) pos);
|
(unsigned long) pos);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -22,15 +22,15 @@
|
||||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// @author Dr. Frank Celler
|
/// @author Dr. Frank Celler
|
||||||
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPE_ACCESSOR_H
|
#ifndef TRIAGENS_SHAPED_JSON_SHAPE_ACCESSOR_H
|
||||||
#define TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPE_ACCESSOR_H 1
|
#define TRIAGENS_SHAPED_JSON_SHAPE_ACCESSOR_H 1
|
||||||
|
|
||||||
#include <BasicsC/common.h>
|
#include "BasicsC/common.h"
|
||||||
|
|
||||||
#include <BasicsC/json.h>
|
#include "BasicsC/json.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -23,17 +23,16 @@
|
||||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// @author Dr. Frank Celler
|
/// @author Dr. Frank Celler
|
||||||
/// @author Copyright 2011, triagens GmbH, Cologne, Germany
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "shaped-json.h"
|
#include "shaped-json.h"
|
||||||
|
|
||||||
#include <BasicsC/associative.h>
|
#include "BasicsC/associative.h"
|
||||||
#include <BasicsC/hashes.h>
|
#include "BasicsC/hashes.h"
|
||||||
#include <BasicsC/logging.h>
|
#include "BasicsC/logging.h"
|
||||||
#include <BasicsC/string-buffer.h>
|
#include "BasicsC/string-buffer.h"
|
||||||
#include <BasicsC/vector.h>
|
#include "BasicsC/vector.h"
|
||||||
|
|
||||||
#include "ShapedJson/json-shaper.h"
|
#include "ShapedJson/json-shaper.h"
|
||||||
|
|
||||||
// #define DEBUG_JSON_SHAPER 1
|
// #define DEBUG_JSON_SHAPER 1
|
||||||
|
@ -44,8 +43,8 @@
|
||||||
|
|
||||||
void TRI_PrintShape (TRI_shaper_t* shaper, TRI_shape_t const* shape, int indent);
|
void TRI_PrintShape (TRI_shaper_t* shaper, TRI_shape_t const* shape, int indent);
|
||||||
static bool FillShapeValueJson (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TRI_json_t const* json);
|
static bool FillShapeValueJson (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TRI_json_t const* json);
|
||||||
static TRI_json_t* JsonShapeData (TRI_shaper_t* shaper, TRI_shape_t const* shape, char const* data, size_t size);
|
static TRI_json_t* JsonShapeData (TRI_shaper_t* shaper, TRI_shape_t const* shape, char const* data, uint64_t size);
|
||||||
static bool StringifyJsonShapeData (TRI_shaper_t* shaper, TRI_string_buffer_t* buffer, TRI_shape_t const* shape, char const* data, size_t size);
|
static bool StringifyJsonShapeData (TRI_shaper_t* shaper, TRI_string_buffer_t* buffer, TRI_shape_t const* shape, char const* data, uint64_t size);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private functions
|
// --SECTION-- private functions
|
||||||
|
@ -69,7 +68,7 @@ void TRI_PrintShape (TRI_shaper_t* shaper, TRI_shape_t const* shape, int indent)
|
||||||
TRI_shape_size_t const* offsets;
|
TRI_shape_size_t const* offsets;
|
||||||
char const* ptr;
|
char const* ptr;
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t n;
|
uint64_t n;
|
||||||
|
|
||||||
if (shape == NULL) {
|
if (shape == NULL) {
|
||||||
printf("%*sUNKNOWN\n", indent, "");
|
printf("%*sUNKNOWN\n", indent, "");
|
||||||
|
@ -341,7 +340,7 @@ static int SortShapeValuesFunc (void const* l, void const* r) {
|
||||||
return wl - wr;
|
return wl - wr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return left->_aid - right->_aid;
|
return (int)(left->_aid - right->_aid);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -438,7 +437,7 @@ static bool FillShapeValueString (TRI_shaper_t* shaper, TRI_shape_value_t* dst,
|
||||||
static bool FillShapeValueList (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TRI_json_t const* json) {
|
static bool FillShapeValueList (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TRI_json_t const* json) {
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t total;
|
uint64_t total;
|
||||||
|
|
||||||
TRI_shape_value_t* values;
|
TRI_shape_value_t* values;
|
||||||
TRI_shape_value_t* p;
|
TRI_shape_value_t* p;
|
||||||
|
@ -561,7 +560,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TR
|
||||||
ptr += sizeof(TRI_shape_length_list_t);
|
ptr += sizeof(TRI_shape_length_list_t);
|
||||||
|
|
||||||
for (p = values; p < e; ++p) {
|
for (p = values; p < e; ++p) {
|
||||||
memcpy(ptr, p->_value, p->_size);
|
memcpy(ptr, p->_value, (size_t) p->_size);
|
||||||
ptr += p->_size;
|
ptr += p->_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,7 +611,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TR
|
||||||
*offsets++ = offset;
|
*offsets++ = offset;
|
||||||
offset += p->_size;
|
offset += p->_size;
|
||||||
|
|
||||||
memcpy(ptr, p->_value, p->_size);
|
memcpy(ptr, p->_value, (size_t) p->_size);
|
||||||
ptr += p->_size;
|
ptr += p->_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +648,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TR
|
||||||
*offsets++ = offset;
|
*offsets++ = offset;
|
||||||
offset += p->_size;
|
offset += p->_size;
|
||||||
|
|
||||||
memcpy(ptr, p->_value, p->_size);
|
memcpy(ptr, p->_value, (size_t) p->_size);
|
||||||
ptr += p->_size;
|
ptr += p->_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +673,7 @@ static bool FillShapeValueList (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TR
|
||||||
static bool FillShapeValueArray (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TRI_json_t const* json) {
|
static bool FillShapeValueArray (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TRI_json_t const* json) {
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t total;
|
uint64_t total;
|
||||||
|
|
||||||
size_t f;
|
size_t f;
|
||||||
size_t v;
|
size_t v;
|
||||||
|
@ -815,7 +814,7 @@ static bool FillShapeValueArray (TRI_shaper_t* shaper, TRI_shape_value_t* dst, T
|
||||||
*aids++ = p->_aid;
|
*aids++ = p->_aid;
|
||||||
*sids++ = p->_sid;
|
*sids++ = p->_sid;
|
||||||
|
|
||||||
memcpy(ptr, p->_value, p->_size);
|
memcpy(ptr, p->_value, (size_t) p->_size);
|
||||||
ptr += p->_size;
|
ptr += p->_size;
|
||||||
|
|
||||||
dst->_fixedSized &= p->_fixedSized;
|
dst->_fixedSized &= p->_fixedSized;
|
||||||
|
@ -892,7 +891,7 @@ static bool FillShapeValueJson (TRI_shaper_t* shaper, TRI_shape_value_t* dst, TR
|
||||||
static TRI_json_t* JsonShapeDataNull (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataNull (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
return TRI_CreateNullJson();
|
return TRI_CreateNullJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +902,7 @@ static TRI_json_t* JsonShapeDataNull (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataBoolean (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataBoolean (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
bool v;
|
bool v;
|
||||||
|
|
||||||
v = (* (TRI_shape_boolean_t const*) data) != 0;
|
v = (* (TRI_shape_boolean_t const*) data) != 0;
|
||||||
|
@ -918,7 +917,7 @@ static TRI_json_t* JsonShapeDataBoolean (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataNumber (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataNumber (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_number_t v;
|
TRI_shape_number_t v;
|
||||||
|
|
||||||
v = * (TRI_shape_number_t const*) data;
|
v = * (TRI_shape_number_t const*) data;
|
||||||
|
@ -933,7 +932,7 @@ static TRI_json_t* JsonShapeDataNumber (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataShortString (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataShortString (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_length_short_string_t l;
|
TRI_shape_length_short_string_t l;
|
||||||
|
|
||||||
l = * (TRI_shape_length_short_string_t const*) data;
|
l = * (TRI_shape_length_short_string_t const*) data;
|
||||||
|
@ -949,7 +948,7 @@ static TRI_json_t* JsonShapeDataShortString (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataLongString (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataLongString (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_length_long_string_t l;
|
TRI_shape_length_long_string_t l;
|
||||||
|
|
||||||
l = * (TRI_shape_length_long_string_t const*) data;
|
l = * (TRI_shape_length_long_string_t const*) data;
|
||||||
|
@ -965,7 +964,7 @@ static TRI_json_t* JsonShapeDataLongString (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataArray (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataArray (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_array_shape_t const* s;
|
TRI_array_shape_t const* s;
|
||||||
TRI_shape_size_t f;
|
TRI_shape_size_t f;
|
||||||
TRI_shape_size_t v;
|
TRI_shape_size_t v;
|
||||||
|
@ -1076,7 +1075,7 @@ static TRI_json_t* JsonShapeDataArray (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataList (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataList (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
char const* ptr;
|
char const* ptr;
|
||||||
TRI_json_t* list;
|
TRI_json_t* list;
|
||||||
|
|
||||||
|
@ -1131,7 +1130,7 @@ static TRI_json_t* JsonShapeDataList (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataHomogeneousList (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataHomogeneousList (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_homogeneous_list_shape_t const* s;
|
TRI_homogeneous_list_shape_t const* s;
|
||||||
TRI_json_t* list;
|
TRI_json_t* list;
|
||||||
TRI_shape_length_list_t i;
|
TRI_shape_length_list_t i;
|
||||||
|
@ -1185,7 +1184,7 @@ static TRI_json_t* JsonShapeDataHomogeneousList (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeDataHomogeneousSizedList (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeDataHomogeneousSizedList (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_homogeneous_sized_list_shape_t const* s;
|
TRI_homogeneous_sized_list_shape_t const* s;
|
||||||
TRI_json_t* list;
|
TRI_json_t* list;
|
||||||
TRI_shape_length_list_t i;
|
TRI_shape_length_list_t i;
|
||||||
|
@ -1238,7 +1237,7 @@ static TRI_json_t* JsonShapeDataHomogeneousSizedList (TRI_shaper_t* shaper,
|
||||||
static TRI_json_t* JsonShapeData (TRI_shaper_t* shaper,
|
static TRI_json_t* JsonShapeData (TRI_shaper_t* shaper,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
if (shape == NULL) {
|
if (shape == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1283,7 +1282,7 @@ static bool StringifyJsonShapeDataNull (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_AppendString2StringBuffer(buffer, "null", 4);
|
TRI_AppendString2StringBuffer(buffer, "null", 4);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1296,7 +1295,7 @@ static bool StringifyJsonShapeDataBoolean (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
bool v;
|
bool v;
|
||||||
|
|
||||||
v = (* (TRI_shape_boolean_t const*) data) != 0;
|
v = (* (TRI_shape_boolean_t const*) data) != 0;
|
||||||
|
@ -1319,7 +1318,7 @@ static bool StringifyJsonShapeDataNumber (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_number_t v;
|
TRI_shape_number_t v;
|
||||||
|
|
||||||
v = * (TRI_shape_number_t const*) data;
|
v = * (TRI_shape_number_t const*) data;
|
||||||
|
@ -1336,7 +1335,7 @@ static bool StringifyJsonShapeDataShortString (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_length_short_string_t l;
|
TRI_shape_length_short_string_t l;
|
||||||
|
|
||||||
l = * (TRI_shape_length_short_string_t const*) data;
|
l = * (TRI_shape_length_short_string_t const*) data;
|
||||||
|
@ -1357,7 +1356,7 @@ static bool StringifyJsonShapeDataLongString (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_length_long_string_t l;
|
TRI_shape_length_long_string_t l;
|
||||||
|
|
||||||
l = * (TRI_shape_length_long_string_t const*) data;
|
l = * (TRI_shape_length_long_string_t const*) data;
|
||||||
|
@ -1378,7 +1377,7 @@ static bool StringifyJsonShapeDataArray (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size,
|
uint64_t size,
|
||||||
bool braces) {
|
bool braces) {
|
||||||
TRI_array_shape_t const* s;
|
TRI_array_shape_t const* s;
|
||||||
TRI_shape_aid_t const* aids;
|
TRI_shape_aid_t const* aids;
|
||||||
|
@ -1519,7 +1518,7 @@ static bool StringifyJsonShapeDataList (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_shape_length_list_t i;
|
TRI_shape_length_list_t i;
|
||||||
TRI_shape_length_list_t l;
|
TRI_shape_length_list_t l;
|
||||||
TRI_shape_sid_t const* sids;
|
TRI_shape_sid_t const* sids;
|
||||||
|
@ -1582,7 +1581,7 @@ static bool StringifyJsonShapeDataHomogeneousList (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_homogeneous_list_shape_t const* s;
|
TRI_homogeneous_list_shape_t const* s;
|
||||||
TRI_shape_length_list_t i;
|
TRI_shape_length_list_t i;
|
||||||
TRI_shape_length_list_t l;
|
TRI_shape_length_list_t l;
|
||||||
|
@ -1645,7 +1644,7 @@ static bool StringifyJsonShapeDataHomogeneousSizedList (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
TRI_homogeneous_sized_list_shape_t const* s;
|
TRI_homogeneous_sized_list_shape_t const* s;
|
||||||
TRI_shape_length_list_t i;
|
TRI_shape_length_list_t i;
|
||||||
TRI_shape_length_list_t l;
|
TRI_shape_length_list_t l;
|
||||||
|
@ -1707,7 +1706,7 @@ static bool StringifyJsonShapeData (TRI_shaper_t* shaper,
|
||||||
TRI_string_buffer_t* buffer,
|
TRI_string_buffer_t* buffer,
|
||||||
TRI_shape_t const* shape,
|
TRI_shape_t const* shape,
|
||||||
char const* data,
|
char const* data,
|
||||||
size_t size) {
|
uint64_t size) {
|
||||||
if (shape == NULL) {
|
if (shape == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1819,7 +1818,7 @@ TRI_shaped_json_t* TRI_ShapedJsonJson (TRI_shaper_t* shaper, TRI_json_t const* j
|
||||||
shaped = TRI_Allocate(sizeof(TRI_shaped_json_t));
|
shaped = TRI_Allocate(sizeof(TRI_shaped_json_t));
|
||||||
|
|
||||||
shaped->_sid = dst._sid;
|
shaped->_sid = dst._sid;
|
||||||
shaped->_data.length = dst._size;
|
shaped->_data.length = (uint32_t) dst._size;
|
||||||
shaped->_data.data = dst._value;
|
shaped->_data.data = dst._value;
|
||||||
|
|
||||||
return shaped;
|
return shaped;
|
||||||
|
@ -1933,7 +1932,7 @@ bool TRI_AtListShapedJson (TRI_list_shape_t const* shape,
|
||||||
|
|
||||||
result->_sid = sids[position];
|
result->_sid = sids[position];
|
||||||
result->_data.data = ((char*) json->_data.data) + offsets[position];
|
result->_data.data = ((char*) json->_data.data) + offsets[position];
|
||||||
result->_data.length = offsets[position + 1] - offsets[position];
|
result->_data.length = (uint32_t)(offsets[position + 1] - offsets[position]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1967,7 +1966,7 @@ bool TRI_AtHomogeneousListShapedJson (TRI_homogeneous_list_shape_t const* shape,
|
||||||
|
|
||||||
result->_sid = shape->_sidEntry;
|
result->_sid = shape->_sidEntry;
|
||||||
result->_data.data = ((char*) json->_data.data) + offsets[position];
|
result->_data.data = ((char*) json->_data.data) + offsets[position];
|
||||||
result->_data.length = offsets[position + 1] - offsets[position];
|
result->_data.length = (uint32_t)(offsets[position + 1] - offsets[position]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1999,7 +1998,7 @@ bool TRI_AtHomogeneousSizedListShapedJson (TRI_homogeneous_sized_list_shape_t co
|
||||||
|
|
||||||
result->_sid = shape->_sidEntry;
|
result->_sid = shape->_sidEntry;
|
||||||
result->_data.data = ptr + (shape->_sizeEntry * position);
|
result->_data.data = ptr + (shape->_sizeEntry * position);
|
||||||
result->_data.length = shape->_sizeEntry;
|
result->_data.length = (uint32_t) shape->_sizeEntry;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -23,15 +23,15 @@
|
||||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// @author Dr. Frank Celler
|
/// @author Dr. Frank Celler
|
||||||
/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPED_JSON_H
|
#ifndef TRIAGENS_SHAPED_JSON_SHAPED_JSON_H
|
||||||
#define TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPED_JSON_H 1
|
#define TRIAGENS_SHAPED_JSON_SHAPED_JSON_H 1
|
||||||
|
|
||||||
#include <BasicsC/common.h>
|
#include "BasicsC/common.h"
|
||||||
|
|
||||||
#include <BasicsC/json.h>
|
#include "BasicsC/json.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
Loading…
Reference in New Issue