From 4bac99e3da324b736c538d586b0bcbc01b1d307b Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Tue, 17 Nov 2015 13:06:03 +0900 Subject: [PATCH] Add some notes about ByteVector::isNull() and ByteVector::null. --- taglib/toolkit/tbytevector.h | 7 ++++++- tests/test_bytevector.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/taglib/toolkit/tbytevector.h b/taglib/toolkit/tbytevector.h index 793b414c..98b5d8b5 100644 --- a/taglib/toolkit/tbytevector.h +++ b/taglib/toolkit/tbytevector.h @@ -261,7 +261,9 @@ namespace TagLib { /*! * Returns true if the vector is null. * - * \note A vector may be empty without being null. + * \note A vector may be empty without being null. So do not use this + * method to check if the vector is empty. + * * \see isEmpty() */ bool isNull() const; @@ -565,6 +567,9 @@ namespace TagLib { /*! * A static, empty ByteVector which is convenient and fast (since returning * an empty or "null" value does not require instantiating a new ByteVector). + * + * \warning Do not modify this variable. It will mess up the internal state + * of TagLib. */ static ByteVector null; diff --git a/tests/test_bytevector.cpp b/tests/test_bytevector.cpp index 1c2ca904..4b0c098f 100644 --- a/tests/test_bytevector.cpp +++ b/tests/test_bytevector.cpp @@ -124,6 +124,10 @@ public: CPPUNIT_ASSERT(i.containsAt(j, 5, 0)); CPPUNIT_ASSERT(i.containsAt(j, 6, 1)); CPPUNIT_ASSERT(i.containsAt(j, 6, 1, 3)); + + i.clear(); + CPPUNIT_ASSERT(i.isEmpty()); + CPPUNIT_ASSERT(!i.isNull()); } void testFind1() -- 2.50.1