mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-16 09:34:05 +02:00
Update to v098r10 release.
byuu says: Changelog: - synchronized tomoko, loki, icarus with extensive changes to nall (118KiB diff)
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
|
||||
namespace nall {
|
||||
|
||||
auto string::trim(rstring lhs, rstring rhs, long limit) -> string& {
|
||||
rtrim(rhs, limit);
|
||||
ltrim(lhs, limit);
|
||||
auto string::trim(string_view lhs, string_view rhs, long limit) -> string& {
|
||||
trimRight(rhs, limit);
|
||||
trimLeft(lhs, limit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::ltrim(rstring lhs, long limit) -> string& {
|
||||
auto string::trimLeft(string_view lhs, long limit) -> string& {
|
||||
if(lhs.size() == 0) return *this;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = lhs.size() * matches;
|
||||
signed length = (signed)size() - offset;
|
||||
if(length < (signed)lhs.size()) break;
|
||||
int offset = lhs.size() * matches;
|
||||
int length = (int)size() - offset;
|
||||
if(length < (int)lhs.size()) break;
|
||||
if(memory::compare(data() + offset, lhs.data(), lhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
@@ -22,13 +22,13 @@ auto string::ltrim(rstring lhs, long limit) -> string& {
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::rtrim(rstring rhs, long limit) -> string& {
|
||||
auto string::trimRight(string_view rhs, long limit) -> string& {
|
||||
if(rhs.size() == 0) return *this;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = (signed)size() - rhs.size() * (matches + 1);
|
||||
signed length = (signed)size() - offset;
|
||||
if(offset < 0 || length < (signed)rhs.size()) break;
|
||||
int offset = (int)size() - rhs.size() * (matches + 1);
|
||||
int length = (int)size() - offset;
|
||||
if(offset < 0 || length < (int)rhs.size()) break;
|
||||
if(memory::compare(data() + offset, rhs.data(), rhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
@@ -36,19 +36,19 @@ auto string::rtrim(rstring rhs, long limit) -> string& {
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::itrim(rstring lhs, rstring rhs, long limit) -> string& {
|
||||
irtrim(rhs, limit);
|
||||
iltrim(lhs, limit);
|
||||
auto string::itrim(string_view lhs, string_view rhs, long limit) -> string& {
|
||||
itrimRight(rhs, limit);
|
||||
itrimLeft(lhs, limit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::iltrim(rstring lhs, long limit) -> string& {
|
||||
auto string::itrimLeft(string_view lhs, long limit) -> string& {
|
||||
if(lhs.size() == 0) return *this;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = lhs.size() * matches;
|
||||
signed length = (signed)size() - offset;
|
||||
if(length < (signed)lhs.size()) break;
|
||||
int offset = lhs.size() * matches;
|
||||
int length = (int)size() - offset;
|
||||
if(length < (int)lhs.size()) break;
|
||||
if(memory::icompare(data() + offset, lhs.data(), lhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
@@ -56,13 +56,13 @@ auto string::iltrim(rstring lhs, long limit) -> string& {
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::irtrim(rstring rhs, long limit) -> string& {
|
||||
auto string::itrimRight(string_view rhs, long limit) -> string& {
|
||||
if(rhs.size() == 0) return *this;
|
||||
long matches = 0;
|
||||
while(matches < limit) {
|
||||
signed offset = (signed)size() - rhs.size() * (matches + 1);
|
||||
signed length = (signed)size() - offset;
|
||||
if(offset < 0 || length < (signed)rhs.size()) break;
|
||||
int offset = (int)size() - rhs.size() * (matches + 1);
|
||||
int length = (int)size() - offset;
|
||||
if(offset < 0 || length < (int)rhs.size()) break;
|
||||
if(memory::icompare(data() + offset, rhs.data(), rhs.size()) != 0) break;
|
||||
matches++;
|
||||
}
|
||||
@@ -71,13 +71,13 @@ auto string::irtrim(rstring rhs, long limit) -> string& {
|
||||
}
|
||||
|
||||
auto string::strip() -> string& {
|
||||
rstrip();
|
||||
lstrip();
|
||||
stripRight();
|
||||
stripLeft();
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::lstrip() -> string& {
|
||||
unsigned length = 0;
|
||||
auto string::stripLeft() -> string& {
|
||||
uint length = 0;
|
||||
while(length < size()) {
|
||||
char input = operator[](length);
|
||||
if(input != ' ' && input != '\t' && input != '\r' && input != '\n') break;
|
||||
@@ -87,8 +87,8 @@ auto string::lstrip() -> string& {
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto string::rstrip() -> string& {
|
||||
unsigned length = 0;
|
||||
auto string::stripRight() -> string& {
|
||||
uint length = 0;
|
||||
while(length < size()) {
|
||||
bool matched = false;
|
||||
char input = operator[](size() - length - 1);
|
||||
|
Reference in New Issue
Block a user