From ba63b36b530aeeccc130939f6f094beb977362f6 Mon Sep 17 00:00:00 2001 From: Oreste Panaia Date: Wed, 26 Sep 2012 19:10:48 +0800 Subject: [PATCH] With git you never know --- lib/BasicsC/json.c | 3 ++- lib/BasicsC/strings.c | 2 +- lib/Rest/Endpoint.cpp | 22 +++++++--------------- lib/Rest/Endpoint.h | 31 ++++++++++++++++++------------- lib/V8/v8-globals.h | 7 +++++++ 5 files changed, 35 insertions(+), 30 deletions(-) mode change 100644 => 100755 lib/BasicsC/json.c mode change 100644 => 100755 lib/BasicsC/strings.c mode change 100644 => 100755 lib/Rest/Endpoint.cpp mode change 100644 => 100755 lib/Rest/Endpoint.h mode change 100644 => 100755 lib/V8/v8-globals.h diff --git a/lib/BasicsC/json.c b/lib/BasicsC/json.c old mode 100644 new mode 100755 index e6edc99651..15b3f077cd --- a/lib/BasicsC/json.c +++ b/lib/BasicsC/json.c @@ -1065,7 +1065,8 @@ bool TRI_EqualJsonJson (TRI_json_t* left, TRI_json_t* right) { default: { assert(false); } - } + } + return false; // stops the vc++ compiler from complaining } diff --git a/lib/BasicsC/strings.c b/lib/BasicsC/strings.c old mode 100644 new mode 100755 index 1b3037540c..1d187cd030 --- a/lib/BasicsC/strings.c +++ b/lib/BasicsC/strings.c @@ -1378,7 +1378,7 @@ char* TRI_UnescapeUtf8StringZ (TRI_memory_zone_t* zone, char const* in, size_t i // we might have wasted some space if the unescaped string is shorter than the // escaped one. this is the case if the string contained escaped characters - if (*outLength < (ptr - in)) { + if (((ptr - in) > 0) && (*outLength < (size_t)(ptr - in))) { // result string is shorter than original string qtr = TRI_Allocate(zone, *outLength + 1, false); diff --git a/lib/Rest/Endpoint.cpp b/lib/Rest/Endpoint.cpp old mode 100644 new mode 100755 index b3b3944747..7fd023541a --- a/lib/Rest/Endpoint.cpp +++ b/lib/Rest/Endpoint.cpp @@ -27,11 +27,7 @@ #include "Endpoint.h" -#include -#include - #include "BasicsC/socket-utils.h" - #include "Basics/StringUtils.h" #include "Basics/FileUtils.h" #include "Logger/Logger.h" @@ -81,7 +77,7 @@ Endpoint::Endpoint (const Endpoint::Type type, const Endpoint::DomainType domainType, const Endpoint::Protocol protocol, const Endpoint::Encryption encryption, - const string& specification) : + const std::string& specification) : _connected(false), _socket(0), _type(type), @@ -115,7 +111,7 @@ Endpoint::~Endpoint () { /// @brief create a client endpoint object from a string value //////////////////////////////////////////////////////////////////////////////// -Endpoint* Endpoint::clientFactory (const string& specification) { +Endpoint* Endpoint::clientFactory (const std::string& specification) { return Endpoint::factory(ENDPOINT_CLIENT, specification); } @@ -123,7 +119,7 @@ Endpoint* Endpoint::clientFactory (const string& specification) { /// @brief create a server endpoint object from a string value //////////////////////////////////////////////////////////////////////////////// -Endpoint* Endpoint::serverFactory (const string& specification) { +Endpoint* Endpoint::serverFactory (const std::string& specification) { return Endpoint::factory(ENDPOINT_SERVER, specification); } @@ -132,7 +128,7 @@ Endpoint* Endpoint::serverFactory (const string& specification) { //////////////////////////////////////////////////////////////////////////////// Endpoint* Endpoint::factory (const Endpoint::Type type, - const string& specification) { + const std::string& specification) { if (specification.size() < 7) { return 0; } @@ -150,11 +146,7 @@ Endpoint* Endpoint::factory (const Endpoint::Type type, size_t found = copy.find('@'); if (found != string::npos) { string protoString = StringUtils::tolower(copy.substr(0, found)); - if (protoString == "binary") { - protocol = PROTOCOL_BINARY; - copy = copy.substr(strlen("binary@")); - } - else if (protoString == "http") { + if (protoString == "http") { copy = copy.substr(strlen("http@")); } else { @@ -481,8 +473,8 @@ EndpointIp::EndpointIp (const Endpoint::Type type, const Endpoint::DomainType domainType, const Endpoint::Protocol protocol, const Endpoint::Encryption encryption, - string const& specification, - string const& host, + const std::string& specification, + const std::string& host, const uint16_t port) : Endpoint(type, domainType, protocol, encryption, specification), _host(host), _port(port) { diff --git a/lib/Rest/Endpoint.h b/lib/Rest/Endpoint.h old mode 100644 new mode 100755 index dc895fcc92..4531c7ba0c --- a/lib/Rest/Endpoint.h +++ b/lib/Rest/Endpoint.h @@ -31,16 +31,22 @@ #include #include + + +#ifdef TRI_HAVE_LINUX_SOCKETS #include #include #include - -#ifdef TRI_HAVE_LINUX_SOCKETS #include -#endif - #include #include +#include +#endif + + +#ifdef TRI_HAVE_WINSOCK2_H +#endif + // ----------------------------------------------------------------------------- // --SECTION-- Endpoint @@ -94,7 +100,6 @@ namespace triagens { enum Protocol { PROTOCOL_UNKNOWN, - PROTOCOL_BINARY, PROTOCOL_HTTP }; @@ -130,7 +135,7 @@ namespace triagens { const DomainType, const Protocol, const Encryption, - const string&); + const std::string&); public: @@ -159,20 +164,20 @@ namespace triagens { /// @brief creates a server endpoint from a string value //////////////////////////////////////////////////////////////////////////////// - static Endpoint* serverFactory (const string&); + static Endpoint* serverFactory (const std::string&); //////////////////////////////////////////////////////////////////////////////// /// @brief creates a client endpoint from a string value //////////////////////////////////////////////////////////////////////////////// - static Endpoint* clientFactory (const string&); + static Endpoint* clientFactory (const std::string&); //////////////////////////////////////////////////////////////////////////////// /// @brief creates an endpoint from a string value //////////////////////////////////////////////////////////////////////////////// static Endpoint* factory (const Type type, - const string&); + const std::string&); //////////////////////////////////////////////////////////////////////////////// /// @brief compare two endpoints @@ -260,7 +265,7 @@ namespace triagens { /// @brief get the original endpoint specification //////////////////////////////////////////////////////////////////////////////// - string getSpecification () const { + std::string getSpecification () const { return _specification; } @@ -280,13 +285,13 @@ namespace triagens { /// @brief get host name //////////////////////////////////////////////////////////////////////////////// - virtual string getHost () const = 0; + virtual std::string getHost () const = 0; //////////////////////////////////////////////////////////////////////////////// /// @brief get address //////////////////////////////////////////////////////////////////////////////// - virtual string getHostString () const = 0; + virtual std::string getHostString () const = 0; //////////////////////////////////////////////////////////////////////////////// /// @} @@ -343,7 +348,7 @@ namespace triagens { /// @brief original endpoint specification //////////////////////////////////////////////////////////////////////////////// - string _specification; + std::string _specification; //////////////////////////////////////////////////////////////////////////////// /// @} diff --git a/lib/V8/v8-globals.h b/lib/V8/v8-globals.h old mode 100644 new mode 100755 index d8de5909e4..b5eafe55b8 --- a/lib/V8/v8-globals.h +++ b/lib/V8/v8-globals.h @@ -79,6 +79,7 @@ typedef struct TRI_v8_global_s { ContentTypeKey(), JournalSizeKey(), ParametersKey(), + PathKey(), PrefixKey(), ResponseCodeKey(), SuffixKey(), @@ -288,6 +289,12 @@ typedef struct TRI_v8_global_s { v8::Persistent ParametersKey; +//////////////////////////////////////////////////////////////////////////////// +/// @brief "path" key name +//////////////////////////////////////////////////////////////////////////////// + + v8::Persistent PathKey; + //////////////////////////////////////////////////////////////////////////////// /// @brief "prefix" key name ////////////////////////////////////////////////////////////////////////////////