Skip to content

Commit

Permalink
ofxXmlSettings: use ofToString for string conversion, was crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
arturoc committed Jul 28, 2011
1 parent 16d3256 commit db91af0
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions addons/ofxXmlSettings/src/ofxXmlSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,17 +363,13 @@ int ofxXmlSettings::writeTag(const string& tag, const string& valueStr, int whi

//---------------------------------------------------------
int ofxXmlSettings::setValue(const string& tag, int value, int which){
char valueStr[255];
sprintf(valueStr, "%i", value);
int tagID = writeTag(tag, valueStr, which) -1;
int tagID = writeTag(tag, ofToString(value).c_str(), which) -1;
return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::setValue(const string& tag, double value, int which){
char valueStr[255];
sprintf(valueStr, "%f", value);
int tagID = writeTag(tag, valueStr, which) -1;
int tagID = writeTag(tag, ofToString(value).c_str(), which) -1;
return tagID;
}

Expand All @@ -385,17 +381,13 @@ int ofxXmlSettings::setValue(const string& tag, const string& value, int which){

//---------------------------------------------------------
int ofxXmlSettings::addValue(const string& tag, int value){
char valueStr[255];
sprintf(valueStr, "%i", value);
int tagID = writeTag(tag, valueStr, -1) -1;
int tagID = writeTag(tag, ofToString(value).c_str(), -1) -1;
return tagID;
}

//---------------------------------------------------------
int ofxXmlSettings::addValue(const string& tag, double value){
char valueStr[255];
sprintf(valueStr, "%f", value);
int tagID = writeTag(tag, valueStr, -1) -1;
int tagID = writeTag(tag, ofToString(value).c_str(), -1) -1;
return tagID;
}

Expand All @@ -417,9 +409,7 @@ int ofxXmlSettings::addTag(const string& tag){

//---------------------------------------------------------
int ofxXmlSettings::addAttribute(const string& tag, const string& attribute, int value, int which){
char valueStr[255];
sprintf(valueStr, "%i", value);
int tagID = writeAttribute(tag, attribute, valueStr, which) -1;
int tagID = writeAttribute(tag, attribute, ofToString(value).c_str(), which) -1;
return tagID;
}

Expand All @@ -430,9 +420,7 @@ int ofxXmlSettings::addAttribute(const string& tag, const string& attribute, int

//---------------------------------------------------------
int ofxXmlSettings::addAttribute(const string& tag, const string& attribute, double value, int which){
char valueStr[255];
sprintf(valueStr, "%lf", value);
int tagID = writeAttribute(tag, attribute, valueStr, which) -1;
int tagID = writeAttribute(tag, attribute, ofToString(value).c_str(), which) -1;
return tagID;
}

Expand Down

0 comments on commit db91af0

Please sign in to comment.