1
0
Fork 0

Strip spaces properly. Fixes bug #480

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4100
This commit is contained in:
Peter Veenstra 2018-05-06 19:34:22 +00:00
parent 129613c419
commit 54c993669a
4 changed files with 9 additions and 9 deletions

View file

@ -53,6 +53,7 @@ bool IsHexWord(char * word);
Bits ConvDecWord(char * word);
Bits ConvHexWord(char * word);
void trim(std::string& str);
void upcase(std::string &str);
void lowcase(std::string &str);

View file

@ -177,7 +177,7 @@ public:
fullconf.erase(fullconf.find("delaysysex"));
LOG_MSG("MIDI: Using delayed SysEx processing");
}
std::remove(fullconf.begin(), fullconf.end(), ' ');
trim(fullconf);
const char * conf = fullconf.c_str();
midi.status=0x00;
midi.cmd_pos=0;

View file

@ -608,13 +608,6 @@ Hex Section_prop::Get_hex(string const& _propname) const {
return 0;
}
void trim(string& in) {
string::size_type loc = in.find_first_not_of(" \r\t\f\n");
if (loc != string::npos) in.erase(0,loc);
loc = in.find_last_not_of(" \r\t\f\n");
if (loc != string::npos) in.erase(loc+1);
}
bool Section_prop::HandleInputline(string const& gegevens){
string str1 = gegevens;
string::size_type loc = str1.find('=');

View file

@ -43,7 +43,13 @@ void lowcase(std::string &str) {
int (*tf)(int) = std::tolower;
std::transform(str.begin(), str.end(), str.begin(), tf);
}
void trim(std::string &str) {
std::string::size_type loc = str.find_first_not_of(" \r\t\f\n");
if (loc != std::string::npos) str.erase(0,loc);
loc = str.find_last_not_of(" \r\t\f\n");
if (loc != std::string::npos) str.erase(loc+1);
}
/*
Ripped some source from freedos for this one.