diff --git a/uppsrc/Core/Rpc/Rpc.h b/uppsrc/Core/Rpc/Rpc.h index 6d5ec2e28..1507dab50 100644 --- a/uppsrc/Core/Rpc/Rpc.h +++ b/uppsrc/Core/Rpc/Rpc.h @@ -34,6 +34,7 @@ struct RawJsonText { void ValueCheck(bool b); void ValueGet(int& n, const Value& v); +void ValueGet(int64& n, const Value& v); void ValueGet(bool& b, const Value& v); void ValueGet(String& s, const Value& v); void ValueGet(double& x, const Value& v); @@ -112,6 +113,7 @@ void ValueGet(VectorMap& x, const Value& v) } void ValuePut(Value& v, int n); +void ValuePut(Value& v, int64 n); void ValuePut(Value& v, const String& s); void ValuePut(Value& v, const char *s); void ValuePut(Value& v, double x); @@ -248,9 +250,9 @@ private: XmlRpcDo *rpc; }; -String FormatXmlRpcValue(const Value& value); -String FormatXmlRpcParam(const Value& param); -String FormatXmlRpcParams(const ValueArray& params); +String FormatXmlRpcValue(const Value& _v, bool supports_i8); +String FormatXmlRpcParam(const Value& param, bool supports_i8); +String FormatXmlRpcParams(const ValueArray& params, bool supports_i8); String FormatXmlRpcError(int code, const char *text); @@ -280,6 +282,7 @@ class RpcRequest : public HttpRequest { int faultCode; bool shouldExecute; bool json, notification; + bool supports_i8; String protocol_version; void Init(); @@ -330,7 +333,7 @@ public: RpcRequest& JsonRpc() { json = true; return *this; } RpcRequest& Notification() { notification = true; return *this; } - RpcRequest& ProtocolVersion(const char *s) { protocol_version = s; return *this; } + RpcRequest& SupportsI8() { supports_i8 = true; protocol_version = "2.1"; return *this; } RpcRequest(const char *url); RpcRequest(); diff --git a/uppsrc/Core/Rpc/imp/Client.cpp b/uppsrc/Core/Rpc/imp/Client.cpp index 6fb321c7f..9ba892e4c 100644 --- a/uppsrc/Core/Rpc/imp/Client.cpp +++ b/uppsrc/Core/Rpc/imp/Client.cpp @@ -44,6 +44,7 @@ void RpcRequest::Init() RequestTimeout(30000); MaxRetries(0); json = false; + supports_i8 = false; } RpcRequest::RpcRequest(const char *url) @@ -121,8 +122,8 @@ RpcGet RpcRequest::Execute() ContentType("text/xml"); request = XmlHeader(); if(protocol_version.GetCount()) - request << "\r\n"; - request << XmlTag("methodCall")(XmlTag("methodName")(method) + FormatXmlRpcParams(data.out)); + request << "\r\n"; + request << XmlTag("methodCall")(XmlTag("methodName")(method) + FormatXmlRpcParams(data.out, supports_i8)); } if(sLogRpcCalls) { if(sLogRpcCallsCompress) @@ -202,6 +203,8 @@ RpcGet RpcRequest::Execute() XmlParser p(response); try { p.ReadPI(); + while(p.IsComment()) + p.ReadComment(); p.PassTag("methodResponse"); if(p.Tag("fault")) { Value m = ParseXmlRpcValue(p); diff --git a/uppsrc/Core/Rpc/imp/Server.cpp b/uppsrc/Core/Rpc/imp/Server.cpp index 105ee036e..2eec7ffa4 100644 --- a/uppsrc/Core/Rpc/imp/Server.cpp +++ b/uppsrc/Core/Rpc/imp/Server.cpp @@ -136,7 +136,7 @@ String XmlRpcDo::XmlResult() *rpc_trace << "Processing error: " << e << '\n'; return FormatXmlRpcError(RPC_SERVER_PROCESSING_ERROR, "Processing error: " + e); } - r << FormatXmlRpcParams(data.out); + r << FormatXmlRpcParams(data.out, false); } r << "\r\n\r\n"; return r; diff --git a/uppsrc/Core/Rpc/imp/Value.cpp b/uppsrc/Core/Rpc/imp/Value.cpp index 95839e617..d22864f47 100644 --- a/uppsrc/Core/Rpc/imp/Value.cpp +++ b/uppsrc/Core/Rpc/imp/Value.cpp @@ -40,6 +40,12 @@ void ValueGet(int& n, const Value& v) n = v; } +void ValueGet(int64& n, const Value& v) +{ + ValueCheck(IsNull(v) || IsNumber(v)); + n = v; +} + void ValueGet(String& s, const Value& v) { ValueCheck(IsNull(v) || IsString(v)); @@ -108,6 +114,11 @@ void ValuePut(Value& v, int n) v = n; } +void ValuePut(Value& v, int64 n) +{ + v = n; +} + void ValuePut(Value& v, const String& s) { v = s; diff --git a/uppsrc/Core/Rpc/imp/Xml.cpp b/uppsrc/Core/Rpc/imp/Xml.cpp index 36a33f0bc..5014770a0 100644 --- a/uppsrc/Core/Rpc/imp/Xml.cpp +++ b/uppsrc/Core/Rpc/imp/Xml.cpp @@ -15,6 +15,14 @@ Value ParseXmlRpcValue(XmlParser& p) r = p.ReadInt(); } else + if(p.Tag("i8")) { + String s = p.ReadText(); + CParser p(s); + if(!p.IsInt()) + throw XmlError("integer expected"); + r = p.ReadInt64(); + } + else if(p.Tag("boolean")) { int n = StrInt(p.ReadText()); if(n != 0 && n != 1) @@ -97,11 +105,11 @@ ValueArray ParseXmlRpcParams(XmlParser& p) return va; } -String FormatXmlRpcValue(const Value& _v) +String FormatXmlRpcValue(const Value& _v, bool supports_i8) { String r; Value v = _v; - if(v.GetType() == INT64_V) { + if(v.GetType() == INT64_V && !supports_i8) { int64 x = v; if((int)x == x) v = (int)x; @@ -109,6 +117,9 @@ String FormatXmlRpcValue(const Value& _v) if(IsNull(v) && !IsString(v) && !IsValueArray(v)) r = XmlTag("nil")(); else + if(v.GetType() == INT64_V && supports_i8) + r = XmlTag("i8")(AsString((int64)v)); + else if(v.GetType() == INT_V) r = XmlTag("int")(Format("%d", (int)v)); else @@ -131,7 +142,7 @@ String FormatXmlRpcValue(const Value& _v) const Index& k = vm.GetKeys(); ValueArray va = vm.GetValues(); for(int i = 0; i < k.GetCount(); i++) - r << XmlTag("member")(XmlTag("name")(k[i]) + FormatXmlRpcValue(va[i])); + r << XmlTag("member")(XmlTag("name")(k[i]) + FormatXmlRpcValue(va[i], supports_i8)); r << ""; } else @@ -139,7 +150,7 @@ String FormatXmlRpcValue(const Value& _v) r = ""; ValueArray va = v; for(int i = 0; i < va.GetCount(); i++) - r << FormatXmlRpcValue(va[i]); + r << FormatXmlRpcValue(va[i], supports_i8); r << ""; } else @@ -150,17 +161,17 @@ String FormatXmlRpcValue(const Value& _v) return XmlTag("value")(r); } -String FormatXmlRpcParam(const Value& param) +String FormatXmlRpcParam(const Value& param, bool supports_i8) { - return XmlTag("param")(FormatXmlRpcValue(param)); + return XmlTag("param")(FormatXmlRpcValue(param, supports_i8)); } -String FormatXmlRpcParams(const ValueArray& params) +String FormatXmlRpcParams(const ValueArray& params, bool supports_i8) { String r; r = ""; for(int i = 0; i < params.GetCount(); i++) - r << FormatXmlRpcParam(params[i]); + r << FormatXmlRpcParam(params[i], supports_i8); r << ""; return r; } diff --git a/uppsrc/Core/XML.cpp b/uppsrc/Core/XML.cpp index 2e1653b44..b0a114be2 100644 --- a/uppsrc/Core/XML.cpp +++ b/uppsrc/Core/XML.cpp @@ -45,8 +45,12 @@ String DeXml(const String& s, byte charset, bool escapelf) String XmlHeader(const char *encoding, const char *version, const char *standalone) { StringBuffer r; - r << "\r\n"; + r << "\r\n"; return r; } diff --git a/uppsrc/Core/XML.h b/uppsrc/Core/XML.h index 2f03e4a5b..596e0a39a 100644 --- a/uppsrc/Core/XML.h +++ b/uppsrc/Core/XML.h @@ -2,7 +2,7 @@ String DeXml(const char *s, byte charset = CHARSET_DEFAULT, bool escapelf = fals String DeXml(const char *s, const char *end, byte charset = CHARSET_DEFAULT, bool escapelf = false); String DeXml(const String& s, byte charset = CHARSET_DEFAULT, bool escapelf = false); String XmlPI(const char *text); -String XmlHeader(const char *encoding = "UTF-8", const char *version = "1.0", const char *standalone = "yes"); +String XmlHeader(const char *encoding = "UTF-8", const char *version = "1.0", const char *standalone = NULL); String XmlDecl(const char *text); String XmlDocType(const char *text); String XmlDoc(const char *name, const char *xmlbody); diff --git a/uppsrc/Core/src.tpp/XmlOutput_en-us.tpp b/uppsrc/Core/src.tpp/XmlOutput_en-us.tpp index 556bc5ee5..77bf2579e 100644 --- a/uppsrc/Core/src.tpp/XmlOutput_en-us.tpp +++ b/uppsrc/Core/src.tpp/XmlOutput_en-us.tpp @@ -1,5 +1,4 @@ topic "XML output"; -[2 $$0,0#00000000000000000000000000000000:Default] [i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] [l288;2 $$2,2#27521748481378242620020725143825:desc] [0 $$3,0#96390100711032703541132217272105:end] @@ -9,6 +8,7 @@ topic "XML output"; [l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] +[2 $$0,0#00000000000000000000000000000000:Default] [{_} [ {{10000@(113.42.0) [s0;%% [*@7;4 XmlTag]]}}&] [s3;%% &] @@ -101,8 +101,10 @@ to UTF`-8. If [*@3 escapelf].is true, `'`\n`' is escaped as `'[@(128.0.255) `&#x [s5;:XmlHeader`(const char`*`,const char`*`,const char`*`): [_^String^ String]_[* XmlHead er]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 encoding]_`=_`"UTF[@(0.0.255) `-][@3 8]`", [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 version]_`=_`"[@3 1][@(0.0.255) .][@3 0]`", -[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 standalone]_`=_`"yes`")&] -[s2;%% Creates the header of XML file.&] +[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 standalone]_`=_NULL)&] +[s2; [%% Creates the header of XML file. If ][*@3 version]_ is NULL, +it is not included, [*@3 standalone] can be either `"yes`" or `"no`" +or NULL (standalone attribute is then not included).&] [s3;%% &] [s4; &] [s5;:XmlDecl`(const char`*`): [_^String^ String]_[* XmlDecl]([@(0.0.255) const]_[@(0.0.255) c @@ -130,4 +132,4 @@ har]_`*[*@3 text])&] `*[*@3 text])&] [s2;%% Creates the processing info element of XML.&] [s3;%% &] -[s0; ] \ No newline at end of file +[s0; ]] \ No newline at end of file diff --git a/uppsrc/CtrlLib/ScrollBar.cpp b/uppsrc/CtrlLib/ScrollBar.cpp index 44687e7a8..e027f2f8f 100644 --- a/uppsrc/CtrlLib/ScrollBar.cpp +++ b/uppsrc/CtrlLib/ScrollBar.cpp @@ -811,7 +811,7 @@ ScrollBars::~ScrollBars() {} void Scroller::Scroll(Ctrl& p, const Rect& rc, Point newpos, Size cellsize) { - if(!IsNull(psb)) { + if(!IsNull(psb) && !p.IsTransparent()) { Point d = psb - newpos; p.ScrollView(rc, d.x * cellsize.cx, d.y * cellsize.cy); }