[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/taglib
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2004-02-17 2:11:05
Message-ID: 20040217021105.026BF995A () office ! kde ! org
[Download RAW message or body]

CVS commit by wheeler: 

Fixed problem with TagLib reading 1 byte fields in ID3v2 tags.

CCMAIL:Stefan Gehn <sgehn@gmx.net>
CCMAIL:Keith Brady <keith@funnelboy.org>


  M +22 -0     tests/toolkit-test.cpp   1.10
  M +4 -3      toolkit/tbytevectorlist.cpp   1.12


--- kdesupport/taglib/tests/toolkit-test.cpp  #1.9:1.10
@@ -26,4 +26,5 @@
 
 #include <tbytevector.h>
+#include <tbytevectorlist.h>
 #include <tstring.h>
 #include <tlist.h>
@@ -101,4 +102,7 @@ void testString()
   printResult(String("foo    ").stripWhiteSpace() == String("foo"));
   printResult(String("    foo").stripWhiteSpace() == String("foo"));
+
+  printResult(memcmp(String("foo").data(String::Latin1).data(), "foo", 3) == 0);
+  printResult(memcmp(String("f").data(String::Latin1).data(), "f", 1) == 0);
 }
 
@@ -161,4 +165,22 @@ void testByteVector()
   printResult(ByteVector::fromLongLong(0xfffffffffffffffeLL).toLongLong() == -2);
   printResult(ByteVector::fromLongLong(1024).toLongLong() == 1024);
+
+  ByteVector a1("foo");
+  a1.append("bar");
+  printResult(a1 == "foobar");
+
+  ByteVector a2("foo");
+  a2.append("b");
+  printResult(a2 == "foob");
+
+  ByteVector a3;
+  a3.append("b");
+  printResult(a3 == "b");
+
+  ByteVector s1("foo");
+  printResult(ByteVectorList::split(s1, " ").size() == 1);
+
+  ByteVector s2("f");
+  printResult(ByteVectorList::split(s2, " ").size() == 1);
 }
 

--- kdesupport/taglib/toolkit/tbytevectorlist.cpp  #1.11:1.12
@@ -39,5 +39,6 @@ ByteVectorList ByteVectorList::split(con
 
   uint previousOffset = 0;
-  for(int offset = v.find(pattern, 0, byteAlign); offset != -1;
+  for(int offset = v.find(pattern, 0, byteAlign);
+      offset != -1;
       offset = v.find(pattern, offset + pattern.size(), byteAlign))
   {
@@ -46,5 +47,5 @@ ByteVectorList ByteVectorList::split(con
   }
 
-  if(previousOffset < v.size() - 1)
+  if(previousOffset < v.size())
       l.append(v.mid(previousOffset, v.size() - previousOffset));
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic