Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -265,21 +265,21 @@ - (void)reverse { size_t i, j, len = length / 2; - madvise(string, len, MADV_SEQUENTIAL); + madvise(string, length, MADV_SEQUENTIAL); /* We reverse all bytes and restore UTF-8 later, if necessary */ for (i = 0, j = length - 1; i < len; i++, j--) { string[i] ^= string[j]; string[j] ^= string[i]; string[i] ^= string[j]; } if (!isUTF8) { - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); return; } for (i = 0; i < length; i++) { /* ASCII */ @@ -286,17 +286,17 @@ if (OF_LIKELY(!(string[i] & 0x80))) continue; /* A start byte can't happen first as we reversed everything */ if (OF_UNLIKELY(string[i] & 0x40)) { - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); @throw [OFInvalidEncodingException newWithClass: isa]; } /* Next byte must not be ASCII */ if (OF_UNLIKELY(length < i + 1 || !(string[i + 1] & 0x80))) { - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); @throw [OFInvalidEncodingException newWithClass: isa]; } /* Next byte is the start byte */ if (OF_LIKELY(string[i + 1] & 0x40)) { @@ -308,11 +308,11 @@ continue; } /* Second next byte must not be ASCII */ if (OF_UNLIKELY(length < i + 2 || !(string[i + 2] & 0x80))) { - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); @throw [OFInvalidEncodingException newWithClass: isa]; } /* Second next byte is the start byte */ if (OF_LIKELY(string[i + 2] & 0x40)) { @@ -324,11 +324,11 @@ continue; } /* Third next byte must not be ASCII */ if (OF_UNLIKELY(length < i + 3 || !(string[i + 3] & 0x80))) { - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); @throw [OFInvalidEncodingException newWithClass: isa]; } /* Third next byte is the start byte */ if (OF_LIKELY(string[i + 3] & 0x40)) { @@ -343,15 +343,15 @@ i += 3; continue; } /* UTF-8 does not allow more than 4 bytes per character */ - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); @throw [OFInvalidEncodingException newWithClass: isa]; } - madvise(string, len, MADV_NORMAL); + madvise(string, length, MADV_NORMAL); } - (void)upper { [self _applyTable: of_unicode_upper_table