mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Accept number format strings like "%i%%" (results in "30%" if i == 30).
Fallout from #17349
This commit is contained in:
parent
fcb394398f
commit
efa167e2b4
1 changed files with 7 additions and 2 deletions
|
@ -197,11 +197,16 @@ static bool IsValidNumberFormatString(const std::string &s) {
|
||||||
size_t percentCount = 0;
|
size_t percentCount = 0;
|
||||||
for (int i = 0; i < (int)s.size(); i++) {
|
for (int i = 0; i < (int)s.size(); i++) {
|
||||||
if (s[i] == '%') {
|
if (s[i] == '%') {
|
||||||
percentCount++;
|
|
||||||
if (i < s.size() - 1) {
|
if (i < s.size() - 1) {
|
||||||
if (s[i] == 's')
|
if (s[i + 1] == 's')
|
||||||
return false;
|
return false;
|
||||||
|
if (s[i + 1] == '%') {
|
||||||
|
// Next is another % sign, so it's an escape to emit a % sign, which is fine.
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
percentCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return percentCount == 1;
|
return percentCount == 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue