mirror of https://github.com/catchorg/Catch2.git
- Rename isValidChar() -> isValidByte()
- Minor adjustments to mimic styling of surrounding code P.S.: a .clang-format file would be nice ;-)
This commit is contained in:
parent
0837427e00
commit
5300004f50
|
@ -43,11 +43,11 @@ namespace Catch {
|
||||||
return b >= 0xF0 && b <= 0xF4;
|
return b >= 0xF0 && b <= 0xF4;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isInvalidChar(unsigned char b) {
|
inline bool isInvalidByte( unsigned char b ) {
|
||||||
return b == 0xC0 || b == 0xC1 || b >= 0xF5;
|
return b == 0xC0 || b == 0xC1 || b >= 0xF5;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isValid(const char* str, size_t len) {
|
inline bool isValid( char const* str, size_t len ) {
|
||||||
int outstandingBytesOfCurrentChar = 0;
|
int outstandingBytesOfCurrentChar = 0;
|
||||||
|
|
||||||
for( std::size_t i = 0; i < len; ++ i ) {
|
for( std::size_t i = 0; i < len; ++ i ) {
|
||||||
|
@ -83,14 +83,14 @@ namespace Catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// explicit negative check (sould be fully redundant here)
|
// explicit negative check (should be fully redundant here)
|
||||||
assert( isInvalidChar( b ) == false );
|
assert( isInvalidByte( b ) == false );
|
||||||
}
|
}
|
||||||
|
|
||||||
return outstandingBytesOfCurrentChar == 0;
|
return outstandingBytesOfCurrentChar == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isValid(const std::string& str) {
|
inline bool isValid( std::string const& str ) {
|
||||||
return isValid( str.c_str(), str.size() );
|
return isValid( str.c_str(), str.size() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue