From 16fe77ca62bc031373280e7128a7bda6f42ec6cf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 1 Dec 2020 13:33:18 +0000 Subject: [PATCH] fix xmlrpc on empty base64 case, remove use of paralell on bulletxna; --- trunk/managed/Warp3Dmod/warp_Rasterizer.cs | 2 +- trunk/managed/XmlRpc/XmlRpcDeserializer.cs | 21 +++++++++++-------- trunk/managed/XmlRpc/XmlRpcErrorCodes.cs | 12 +++++------ trunk/managed/XmlRpc/XmlRpcRequest.cs | 21 ++++++++++++------- .../XmlRpc/XmlRpcRequestDeserializer.cs | 2 +- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/trunk/managed/Warp3Dmod/warp_Rasterizer.cs b/trunk/managed/Warp3Dmod/warp_Rasterizer.cs index c4287fc6..a864b231 100644 --- a/trunk/managed/Warp3Dmod/warp_Rasterizer.cs +++ b/trunk/managed/Warp3Dmod/warp_Rasterizer.cs @@ -241,7 +241,7 @@ namespace Warp3D int dy21 = y2 - y1; int dy31 = y3 - y1; - float tf = dy21 / dy31; + float tf = (float)dy21 / dy31; x4 = x1 + (int)((x3 - x1) * tf); dx = (x4 - x2) >> 8; diff --git a/trunk/managed/XmlRpc/XmlRpcDeserializer.cs b/trunk/managed/XmlRpc/XmlRpcDeserializer.cs index 1ecf9a89..7b1698ac 100644 --- a/trunk/managed/XmlRpc/XmlRpcDeserializer.cs +++ b/trunk/managed/XmlRpc/XmlRpcDeserializer.cs @@ -11,8 +11,8 @@ namespace Nwc.XmlRpc /// Parser context, we maintain contexts in a stack to avoiding recursion. struct Context { - public String Name; - public Object Container; + public string Name; + public object Container; } /// Basic XML-RPC data deserializer. @@ -23,15 +23,15 @@ namespace Nwc.XmlRpc { private static DateTimeFormatInfo _dateFormat = new DateTimeFormatInfo(); - private Object _container; + private object _container; private Stack _containerStack; /// Protected reference to last text. - protected String _text; + protected string _text; /// Protected reference to last deserialized value. - protected Object _value; + protected object _value; /// Protected reference to last name field. - protected String _name; + protected string _name; /// Basic constructor. @@ -44,7 +44,7 @@ namespace Nwc.XmlRpc /// Static method that parses XML data into a response using the Singleton. /// StreamReader containing an XML-RPC response. /// Object object resulting from the deserialization. - virtual public Object Deserialize(TextReader xmlData) + virtual public object Deserialize(TextReader xmlData) { return null; } @@ -82,7 +82,10 @@ namespace Nwc.XmlRpc switch(reader.Name) { case BASE64: - _value = Convert.FromBase64String(_text); + if(string.IsNullOrEmpty(_text)) + _value = new byte[0]; + else + _value = Convert.FromBase64String(_text); break; case BOOLEAN: int val = Int16.Parse(_text); @@ -143,7 +146,7 @@ namespace Nwc.XmlRpc /// request using the Singleton. /// String containing an XML-RPC request. /// XmlRpcRequest object resulting from the parse. - public Object Deserialize(String xmlData) + public object Deserialize(string xmlData) { StringReader sr = new StringReader(xmlData); return Deserialize(sr); diff --git a/trunk/managed/XmlRpc/XmlRpcErrorCodes.cs b/trunk/managed/XmlRpc/XmlRpcErrorCodes.cs index 8fa9a452..dfaf28ee 100644 --- a/trunk/managed/XmlRpc/XmlRpcErrorCodes.cs +++ b/trunk/managed/XmlRpc/XmlRpcErrorCodes.cs @@ -9,12 +9,12 @@ namespace Nwc.XmlRpc /// public const int PARSE_ERROR_MALFORMED = -32700; /// - public const String PARSE_ERROR_MALFORMED_MSG = "Parse Error, not well formed"; + public const string PARSE_ERROR_MALFORMED_MSG = "Parse Error, not well formed"; /// public const int PARSE_ERROR_ENCODING = -32701; /// - public const String PARSE_ERROR_ENCODING_MSG = "Parse Error, unsupported encoding"; + public const string PARSE_ERROR_ENCODING_MSG = "Parse Error, unsupported encoding"; /** -32702 ---> parse error. invalid character for encoding @@ -24,12 +24,12 @@ namespace Nwc.XmlRpc /// public const int SERVER_ERROR_METHOD = -32601; /// - public const String SERVER_ERROR_METHOD_MSG = "Server Error, requested method not found"; + public const string SERVER_ERROR_METHOD_MSG = "Server Error, requested method not found"; /// public const int SERVER_ERROR_PARAMS = -32602; /// - public const String SERVER_ERROR_PARAMS_MSG = "Server Error, invalid method parameters"; + public const string SERVER_ERROR_PARAMS_MSG = "Server Error, invalid method parameters"; /** -32603 ---> server error. internal xml-rpc error @@ -38,7 +38,7 @@ namespace Nwc.XmlRpc /// public const int APPLICATION_ERROR = -32500; /// - public const String APPLICATION_ERROR_MSG = "Application Error"; + public const string APPLICATION_ERROR_MSG = "Application Error"; /** -32400 ---> system error @@ -47,7 +47,7 @@ namespace Nwc.XmlRpc /// public const int TRANSPORT_ERROR = -32300; /// - public const String TRANSPORT_ERROR_MSG = "Transport Layer Error"; + public const string TRANSPORT_ERROR_MSG = "Transport Layer Error"; } } diff --git a/trunk/managed/XmlRpc/XmlRpcRequest.cs b/trunk/managed/XmlRpc/XmlRpcRequest.cs index 971f04e6..40ce8b4c 100644 --- a/trunk/managed/XmlRpc/XmlRpcRequest.cs +++ b/trunk/managed/XmlRpc/XmlRpcRequest.cs @@ -11,7 +11,7 @@ namespace Nwc.XmlRpc /// Class supporting the request side of an XML-RPC transaction. public class XmlRpcRequest { - private String m_methodName = null; + private string m_methodName = null; private Encoding m_encoding = new UTF8Encoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); @@ -25,11 +25,16 @@ namespace Nwc.XmlRpc _params = new ArrayList(); } + public XmlRpcRequest(Encoding enc) + { + _params = new ArrayList(); + m_encoding = enc; + } /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public XmlRpcRequest(String methodName, IList parameters) + public XmlRpcRequest(string methodName, IList parameters) { MethodName = methodName; _params = parameters; @@ -45,7 +50,7 @@ namespace Nwc.XmlRpc } /// String conntaining the method name, both object and method, that the request will be sent to. - public virtual String MethodName + public virtual string MethodName { get { @@ -58,7 +63,7 @@ namespace Nwc.XmlRpc } /// String object name portion of the method name. - public String MethodNameObject + public string MethodNameObject { get { @@ -72,7 +77,7 @@ namespace Nwc.XmlRpc } /// String method name portion of the object.method name. - public String MethodNameMethod + public string MethodNameMethod { get { @@ -89,7 +94,7 @@ namespace Nwc.XmlRpc /// String The url of the XML-RPC server. /// Object The value returned from the method invocation on the server. /// If an exception generated on the server side. - public Object Invoke(String url, RemoteCertificateValidationCallback certCallBack = null) + public object Invoke(string url, RemoteCertificateValidationCallback certCallBack = null) { XmlRpcResponse res = Send(url, 100000, certCallBack); @@ -102,7 +107,7 @@ namespace Nwc.XmlRpc /// Send the request to the server. /// String The url of the XML-RPC server. /// XmlRpcResponse The response generated. - public XmlRpcResponse Send(String url, int timeout = 100000, RemoteCertificateValidationCallback certCallBack = null) + public XmlRpcResponse Send(string url, int timeout = 100000, RemoteCertificateValidationCallback certCallBack = null) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); if (request == null) @@ -131,7 +136,7 @@ namespace Nwc.XmlRpc /// Produce String representation of the object. /// String representation of the object. - override public String ToString() + override public string ToString() { return _serializer.Serialize(this); } diff --git a/trunk/managed/XmlRpc/XmlRpcRequestDeserializer.cs b/trunk/managed/XmlRpc/XmlRpcRequestDeserializer.cs index c9068927..18b3cff3 100644 --- a/trunk/managed/XmlRpc/XmlRpcRequestDeserializer.cs +++ b/trunk/managed/XmlRpc/XmlRpcRequestDeserializer.cs @@ -28,7 +28,7 @@ namespace Nwc.XmlRpc { using(XmlTextReader reader = new XmlTextReader(xmlData)) { - XmlRpcRequest request = new XmlRpcRequest(); + XmlRpcRequest request = new XmlRpcRequest(reader.Encoding); bool done = false; lock(this)