Fix integer sign/size warnings in XML-related functions
This commit is contained in:
parent
6f8da1a27e
commit
0392147540
4 changed files with 11 additions and 3 deletions
|
|
@ -212,7 +212,7 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& titleString,
|
|||
* parameter. The default is the special double,
|
||||
* Cantera::Undef, which means to ignore the entry.
|
||||
*/
|
||||
void addNamedFloatArray(Cantera::XML_Node& parentNode, const std::string& name, const int n,
|
||||
void addNamedFloatArray(Cantera::XML_Node& parentNode, const std::string& name, const size_t n,
|
||||
const doublereal* const vals, const std::string units = "",
|
||||
const std::string type = "",
|
||||
const doublereal minval = Cantera::Undef,
|
||||
|
|
|
|||
|
|
@ -280,6 +280,9 @@ public:
|
|||
void addAttribute(const std::string& attrib, const doublereal value,
|
||||
const std::string& fmt="%g");
|
||||
|
||||
//! Add an unsigned integer attribute
|
||||
void addAttribute(const std::string& attrib, size_t value);
|
||||
|
||||
//! The operator[] is overloaded to provide a lookup capability
|
||||
//! on attributes for the current XML element.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -95,13 +95,13 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& title, const size
|
|||
}
|
||||
}
|
||||
|
||||
void addNamedFloatArray(Cantera::XML_Node& node, const std::string& name, const int n,
|
||||
void addNamedFloatArray(Cantera::XML_Node& node, const std::string& name, const size_t n,
|
||||
const doublereal* const vals, const std::string units,
|
||||
const std::string type, const doublereal minval,
|
||||
const doublereal maxval)
|
||||
{
|
||||
std::string v = "";
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
v += fp2str(vals[i],FP_Format);
|
||||
if (i == n-1) {
|
||||
v += "\n";
|
||||
|
|
|
|||
|
|
@ -501,6 +501,11 @@ void XML_Node::addAttribute(const std::string& attrib_,
|
|||
m_attribs[attrib_] = fp2str(value_, fmt);
|
||||
}
|
||||
|
||||
void XML_Node::addAttribute(const std::string& attrib_, const size_t value_)
|
||||
{
|
||||
m_attribs[attrib_] = int2str(value_);
|
||||
}
|
||||
|
||||
std::string XML_Node::operator[](const std::string& attr) const
|
||||
{
|
||||
return attrib(attr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue