Merge pull request #427 from TsudaKageyu/linebreak

Small fixes in line breaking.
This commit is contained in:
Stephen F. Booth 2014-08-17 09:01:47 -04:00
commit aff3351a25
2 changed files with 9 additions and 16 deletions

View File

@ -161,15 +161,12 @@ int findVector(
lastOccurrence[static_cast<uchar>(*(patternBegin + i))] = patternSize - i - 1;
TIterator it = dataBegin + patternSize - 1 + offset;
while(true)
{
while(true) {
TIterator itBuffer = it;
TIterator itPattern = patternBegin + patternSize - 1;
while(*itBuffer == *itPattern)
{
if(itPattern == patternBegin)
{
while(*itBuffer == *itPattern) {
if(itPattern == patternBegin) {
if((itBuffer - dataBegin - offset) % byteAlign == 0)
return (itBuffer - dataBegin);
else
@ -243,7 +240,7 @@ ByteVector fromNumber(T value, bool mostSignificantByteFirst)
template <typename TFloat, typename TInt, Utils::ByteOrder ENDIAN>
TFloat toFloat(const ByteVector &v, size_t offset)
{
if (offset > v.size() - sizeof(TInt)) {
if(offset > v.size() - sizeof(TInt)) {
debug("toFloat() - offset is out of range. Returning 0.");
return 0.0;
}

View File

@ -347,16 +347,13 @@ int String::rfind(const String &s, int offset) const
StringList String::split(const String &separator) const
{
StringList list;
for(int index = 0;;)
{
for(int index = 0;;) {
int sep = find(separator, index);
if(sep < 0)
{
if(sep < 0) {
list.append(substr(index, size() - index));
break;
}
else
{
else {
list.append(substr(index, sep - index));
index = sep + separator.size();
}
@ -619,8 +616,7 @@ bool String::operator==(const char *s) const
{
const wchar_t *p = toCWString();
while(*p != L'\0' || *s != '\0')
{
while(*p != L'\0' || *s != '\0') {
if(*p++ != static_cast<uchar>(*s++))
return false;
}
@ -634,7 +630,7 @@ bool String::operator!=(const char *s) const
bool String::operator==(const wchar_t *s) const
{
return (::wcscmp(toCWString(), s) == 0);
return (d->data == s);
}
bool String::operator!=(const wchar_t *s) const