mirror of https://github.com/stella-emu/stella.git
Fixed nasty C-style string conversion to upper/lower-case.
This commit is contained in:
parent
3e85ae4d47
commit
ebfff85cb6
|
@ -123,6 +123,18 @@ namespace BSPF
|
|||
if(val < lower || val > upper) val = setVal;
|
||||
}
|
||||
|
||||
// Convert string to given case
|
||||
inline const string& toUpperCase(string& s)
|
||||
{
|
||||
transform(s.begin(), s.end(), s.begin(), ::toupper);
|
||||
return s;
|
||||
}
|
||||
inline const string& toLowerCase(string& s)
|
||||
{
|
||||
transform(s.begin(), s.end(), s.begin(), ::tolower);
|
||||
return s;
|
||||
}
|
||||
|
||||
// Compare two strings, ignoring case
|
||||
inline int compareIgnoreCase(const string& s1, const string& s2)
|
||||
{
|
||||
|
|
|
@ -992,21 +992,10 @@ string TIADebug::audFreq(uInt8 div)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::booleanWithLabel(string label, bool value)
|
||||
{
|
||||
char buf[64];
|
||||
string ret;
|
||||
|
||||
if(value)
|
||||
{
|
||||
char *p = buf;
|
||||
const char *q = label.c_str();
|
||||
while((*p++ = toupper(*q++)))
|
||||
;
|
||||
ret += "+";
|
||||
ret += buf;
|
||||
return ret;
|
||||
}
|
||||
return "+" + BSPF::toUpperCase(label);
|
||||
else
|
||||
return "-" + label;
|
||||
return "-" + BSPF::toLowerCase(label);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -58,8 +56,7 @@ void Properties::set(PropertyType key, const string& value)
|
|||
case Controller_MouseAxis:
|
||||
case Display_Phosphor:
|
||||
{
|
||||
transform(myProperties[key].begin(), myProperties[key].end(),
|
||||
myProperties[key].begin(), ::toupper);
|
||||
BSPF::toUpperCase(myProperties[key]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue