]> granicus.if.org Git - taglib/commitdiff
Brian is right. It makes more sense to compute the alignment based on the offset...
authorScott Wheeler <wheeler@kde.org>
Wed, 18 Jul 2007 14:38:40 +0000 (14:38 +0000)
committerScott Wheeler <wheeler@kde.org>
Wed, 18 Jul 2007 14:38:40 +0000 (14:38 +0000)
CCBUG:135123

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@689545 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

taglib/toolkit/tbytevector.cpp
taglib/toolkit/tbytevector.h

index 363b76856a642cd39073e66d8662d1d30ba43ac8..26dd18cbb7c91fec2b477749f17011ae916e3f74 100644 (file)
@@ -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;
     }
 
index 5dbab36b5895190fd0bec653175dfbcf9251209a..462b0d1d0e8ee8c205e5930923a8804f037bf992 100644 (file)
@@ -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;