mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-12 17:19:28 +01:00
Accept number format strings like "%i%%" (results in "30%" if i == 30).
Fallout from #17349
This commit is contained in:
1 parent
fcb394398f
commit
efa167e2b4
1 file changed
+7
-2
@@ -197,11 +197,16 @@ static bool IsValidNumberFormatString(const std::string &s) {
|
||||
size_t percentCount = 0;
|
||||
for (int i = 0; i < (int)s.size(); i++) {
|
||||
if (s[i] == '%') {
|
||||
percentCount++;
|
||||
if (i < s.size() - 1) {
|
||||
if (s[i] == 's')
|
||||
if (s[i + 1] == 's')
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user