diff --git a/taglib/toolkit/tbytevector.cpp b/taglib/toolkit/tbytevector.cpp index 363b7685..26dd18cb 100644 --- a/taglib/toolkit/tbytevector.cpp +++ b/taglib/toolkit/tbytevector.cpp @@ -100,7 +100,7 @@ namespace TagLib { if(pattern.size() == 1) { char p = pattern[0]; for(uint i = offset; i < v.size(); i++) { - if(v[i] == p && i % byteAlign == 0) + if(v[i] == p && (i - offset) % byteAlign == 0) return i; } return -1; @@ -123,7 +123,7 @@ namespace TagLib { --iPattern; } - if(-1 == iPattern && (iBuffer + 1) % byteAlign == 0) + if(-1 == iPattern && (iBuffer + 1 - offset) % byteAlign == 0) return iBuffer + 1; } diff --git a/taglib/toolkit/tbytevector.h b/taglib/toolkit/tbytevector.h index 5dbab36b..462b0d1d 100644 --- a/taglib/toolkit/tbytevector.h +++ b/taglib/toolkit/tbytevector.h @@ -124,8 +124,8 @@ namespace TagLib { /*! * Searches the ByteVector for \a pattern starting at \a offset and returns * the offset. Returns -1 if the pattern was not found. If \a byteAlign is - * specified the pattern will only be matched if it starts on a byteDivisible - * by \a byteAlign. + * specified the pattern will only be matched if it starts on a byte divisible + * by \a byteAlign (starting from \a offset). */ int find(const ByteVector &pattern, uint offset = 0, int byteAlign = 1) const; @@ -133,7 +133,7 @@ namespace TagLib { * Searches the ByteVector for \a pattern starting from either the end of the * vector or \a offset and returns the offset. Returns -1 if the pattern was * not found. If \a byteAlign is specified the pattern will only be matched - * if it starts on a byteDivisible by \a byteAlign. + * if it starts on a byte divisible by \a byteAlign (starting from \a offset). */ int rfind(const ByteVector &pattern, uint offset = 0, int byteAlign = 1) const;