1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-08 01:47:11 +02:00

Fixed excpetion throwing in XML document to that generated corrupted messages because snprintf was used instead of vsnprintf.

Revised most of the XML plugin and cleaned code.
This commit is contained in:
Sandu Liviu Catalin
2016-04-02 11:04:28 +03:00
parent 3a08e17cad
commit b6466b9181
11 changed files with 275 additions and 198 deletions

View File

@ -29,16 +29,11 @@ protected:
/* ... */
}
/* --------------------------------------------------------------------------------------------
* Validate the document reference and throw an error if invalid.
*/
void Validate() const;
private:
// ---------------------------------------------------------------------------------------------
DocumentRef m_Doc; /* The main xml document instance. */
Type m_Text; /* The managed document node. */
DocumentRef m_Doc; // The main xml document instance.
Type m_Text; // The managed document node.
public:
@ -156,7 +151,7 @@ public:
*/
SQFloat AsFloat(SQFloat def) const
{
return (SQFloat)m_Text.as_float(def);
return static_cast< SQFloat >(m_Text.as_float(static_cast< Float32 >(def)));
}
/* --------------------------------------------------------------------------------------------
@ -164,7 +159,7 @@ public:
*/
SQFloat AsDouble(SQFloat def) const
{
return (SQFloat)m_Text.as_double(def);
return static_cast< SQFloat >(m_Text.as_double(static_cast< Float64 >(def)));
}
/* --------------------------------------------------------------------------------------------
@ -296,7 +291,7 @@ public:
*/
SQFloat GetFloat() const
{
return (SQFloat)m_Text.as_float();
return static_cast< SQFloat >(m_Text.as_float());
}
/* --------------------------------------------------------------------------------------------
@ -312,7 +307,7 @@ public:
*/
SQFloat GetDouble() const
{
return (SQFloat)m_Text.as_double();
return static_cast< SQFloat >(m_Text.as_double());
}
/* --------------------------------------------------------------------------------------------