From a845f70c490aa2f62acd66604695ec00bf272f78 Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Fri, 21 Jun 2013 15:29:00 +0900
Subject: [PATCH 1/8] Added some test cases for FileRef about unsupported files

---
 tests/data/no-extension              | Bin 0 -> 256 bytes
 tests/data/unsupported-extension.xxx | Bin 0 -> 256 bytes
 tests/test_fileref.cpp               |  10 ++++++++++
 3 files changed, 10 insertions(+)
 create mode 100644 tests/data/no-extension
 create mode 100644 tests/data/unsupported-extension.xxx

diff --git a/tests/data/no-extension b/tests/data/no-extension
new file mode 100644
index 0000000000000000000000000000000000000000..65f57c2ee985713476ac0b6e3483e6fe472e2176
GIT binary patch
literal 256
LcmZQz7})>-0RR92

literal 0
HcmV?d00001

diff --git a/tests/data/unsupported-extension.xxx b/tests/data/unsupported-extension.xxx
new file mode 100644
index 0000000000000000000000000000000000000000..65f57c2ee985713476ac0b6e3483e6fe472e2176
GIT binary patch
literal 256
LcmZQz7})>-0RR92

literal 0
HcmV?d00001

diff --git a/tests/test_fileref.cpp b/tests/test_fileref.cpp
index 06663c97..197a9213 100644
--- a/tests/test_fileref.cpp
+++ b/tests/test_fileref.cpp
@@ -27,6 +27,7 @@ class TestFileRef : public CppUnit::TestFixture
   CPPUNIT_TEST(testTrueAudio);
   CPPUNIT_TEST(testAPE);
   CPPUNIT_TEST(testWav);
+  CPPUNIT_TEST(testUnsupported);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -148,6 +149,15 @@ public:
   {
     fileRefSave("mac-399", ".ape");
   }
+
+  void testUnsupported()
+  {
+    FileRef f1(TEST_FILE_PATH_C("no-extension"));
+    CPPUNIT_ASSERT(f1.isNull());
+    
+    FileRef f2(TEST_FILE_PATH_C("unsupported-extension.xxx"));
+    CPPUNIT_ASSERT(f2.isNull());
+  }
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TestFileRef);

From 35cdcd3b958460dfe6da40ff68f673d1fdca1aaf Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Sat, 22 Jun 2013 16:12:57 +0900
Subject: [PATCH 2/8] Added a missing check if an Opus file is open

---
 taglib/ogg/opus/opusfile.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/taglib/ogg/opus/opusfile.cpp b/taglib/ogg/opus/opusfile.cpp
index 8d3af7af..91ec5a09 100644
--- a/taglib/ogg/opus/opusfile.cpp
+++ b/taglib/ogg/opus/opusfile.cpp
@@ -59,18 +59,20 @@ public:
 // public members
 ////////////////////////////////////////////////////////////////////////////////
 
-Opus::File::File(FileName file, bool readProperties,
-                   Properties::ReadStyle propertiesStyle) : Ogg::File(file)
+Opus::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle) 
+  : Ogg::File(file)
+  , d(new FilePrivate())
 {
-  d = new FilePrivate;
-  read(readProperties, propertiesStyle);
+  if(isOpen())
+    read(readProperties, propertiesStyle);
 }
 
-Opus::File::File(IOStream *stream, bool readProperties,
-                   Properties::ReadStyle propertiesStyle) : Ogg::File(stream)
+Opus::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) 
+  : Ogg::File(stream)
+  , d(new FilePrivate())
 {
-  d = new FilePrivate;
-  read(readProperties, propertiesStyle);
+  if(isOpen())
+    read(readProperties, propertiesStyle);
 }
 
 Opus::File::~File()

From ab417fd9e3a481ad76caaa1d5205af928ce73772 Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Sat, 22 Jun 2013 18:06:40 +0900
Subject: [PATCH 3/8] Changed the style to follow TagLib's one

---
 taglib/ogg/opus/opusfile.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/taglib/ogg/opus/opusfile.cpp b/taglib/ogg/opus/opusfile.cpp
index 91ec5a09..cb81a32b 100644
--- a/taglib/ogg/opus/opusfile.cpp
+++ b/taglib/ogg/opus/opusfile.cpp
@@ -59,17 +59,17 @@ public:
 // public members
 ////////////////////////////////////////////////////////////////////////////////
 
-Opus::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle) 
-  : Ogg::File(file)
-  , d(new FilePrivate())
+Opus::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle) :
+  Ogg::File(file),
+  d(new FilePrivate())
 {
   if(isOpen())
     read(readProperties, propertiesStyle);
 }
 
-Opus::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) 
-  : Ogg::File(stream)
-  , d(new FilePrivate())
+Opus::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) :
+  Ogg::File(stream),
+  d(new FilePrivate())
 {
   if(isOpen())
     read(readProperties, propertiesStyle);

From 418a6c79cb67005402c7664764a5553c04645ebd Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Sun, 23 Jun 2013 02:08:10 +0900
Subject: [PATCH 4/8] Comment update: Added some supplementary explanations and
 fixed some spellings.

---
 taglib/asf/asffile.h         | 6 ++++--
 taglib/it/itfile.h           | 6 ++++--
 taglib/mod/modfile.h         | 6 ++++--
 taglib/ogg/oggfile.h         | 8 ++------
 taglib/s3m/s3mfile.h         | 6 ++++--
 taglib/toolkit/tbytevector.h | 6 +++---
 taglib/wavpack/wavpackfile.h | 1 -
 taglib/xm/xmfile.h           | 6 ++++--
 8 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/taglib/asf/asffile.h b/taglib/asf/asffile.h
index 4e850d6d..f43b54f4 100644
--- a/taglib/asf/asffile.h
+++ b/taglib/asf/asffile.h
@@ -51,7 +51,8 @@ namespace TagLib {
        * Constructs an ASF file from \a file.
        *
        * \note In the current implementation, both \a readProperties and
-       * \a propertiesStyle are ignored.
+       * \a propertiesStyle are ignored.  The audio properties are always
+       * read.
        */
       File(FileName file, bool readProperties = true, 
            Properties::ReadStyle propertiesStyle = Properties::Average);
@@ -60,7 +61,8 @@ namespace TagLib {
        * Constructs an ASF file from \a stream.
        *
        * \note In the current implementation, both \a readProperties and
-       * \a propertiesStyle are ignored.
+       * \a propertiesStyle are ignored.  The audio properties are always
+       * read.
        *
        * \note TagLib will *not* take ownership of the stream, the caller is
        * responsible for deleting it after the File object.
diff --git a/taglib/it/itfile.h b/taglib/it/itfile.h
index abbdfd3b..19327dc6 100644
--- a/taglib/it/itfile.h
+++ b/taglib/it/itfile.h
@@ -39,7 +39,8 @@ namespace TagLib {
          * Constructs a Impulse Tracker file from \a file.
          *
          * \note In the current implementation, both \a readProperties and
-         * \a propertiesStyle are ignored.
+         * \a propertiesStyle are ignored.  The audio properties are always
+         * read.
          */
         File(FileName file, bool readProperties = true,
              AudioProperties::ReadStyle propertiesStyle =
@@ -49,7 +50,8 @@ namespace TagLib {
          * Constructs a Impulse Tracker file from \a stream.
          *
          * \note In the current implementation, both \a readProperties and
-         * \a propertiesStyle are ignored.
+         * \a propertiesStyle are ignored.  The audio properties are always
+         * read.
          *
          * \note TagLib will *not* take ownership of the stream, the caller is
          * responsible for deleting it after the File object.
diff --git a/taglib/mod/modfile.h b/taglib/mod/modfile.h
index 6113f9fe..c45ede24 100644
--- a/taglib/mod/modfile.h
+++ b/taglib/mod/modfile.h
@@ -40,7 +40,8 @@ namespace TagLib {
        * Constructs a Protracker file from \a file.
        *
        * \note In the current implementation, both \a readProperties and
-       * \a propertiesStyle are ignored.
+       * \a propertiesStyle are ignored.  The audio properties are always
+       * read.
        */
       File(FileName file, bool readProperties = true,
            AudioProperties::ReadStyle propertiesStyle =
@@ -50,7 +51,8 @@ namespace TagLib {
        * Constructs a Protracker file from \a stream.
        *
        * \note In the current implementation, both \a readProperties and
-       * \a propertiesStyle are ignored.
+       * \a propertiesStyle are ignored.  The audio properties are always
+       * read.
        *
        * \note TagLib will *not* take ownership of the stream, the caller is
        * responsible for deleting it after the File object.
diff --git a/taglib/ogg/oggfile.h b/taglib/ogg/oggfile.h
index b36daecb..8fed4ba0 100644
--- a/taglib/ogg/oggfile.h
+++ b/taglib/ogg/oggfile.h
@@ -82,9 +82,7 @@ namespace TagLib {
 
     protected:
       /*!
-       * Contructs an Ogg file from \a file.  If \a readProperties is true the
-       * file's audio properties will also be read using \a propertiesStyle.  If
-       * false, \a propertiesStyle is ignored.
+       * Constructs an Ogg file from \a file.
        *
        * \note This constructor is protected since Ogg::File shouldn't be
        * instantiated directly but rather should be used through the codec
@@ -93,9 +91,7 @@ namespace TagLib {
       File(FileName file);
 
       /*!
-       * Contructs an Ogg file from \a file.  If \a readProperties is true the
-       * file's audio properties will also be read using \a propertiesStyle.  If
-       * false, \a propertiesStyle is ignored.
+       * Constructs an Ogg file from \a stream.
        *
        * \note This constructor is protected since Ogg::File shouldn't be
        * instantiated directly but rather should be used through the codec
diff --git a/taglib/s3m/s3mfile.h b/taglib/s3m/s3mfile.h
index 02732881..5f452977 100644
--- a/taglib/s3m/s3mfile.h
+++ b/taglib/s3m/s3mfile.h
@@ -39,7 +39,8 @@ namespace TagLib {
          * Constructs a ScreamTracker III from \a file.
          *
          * \note In the current implementation, both \a readProperties and
-         * \a propertiesStyle are ignored.
+         * \a propertiesStyle are ignored.  The audio properties are always
+         * read.
          */
         File(FileName file, bool readProperties = true,
              AudioProperties::ReadStyle propertiesStyle =
@@ -49,7 +50,8 @@ namespace TagLib {
          * Constructs a ScreamTracker III file from \a stream.
          *
          * \note In the current implementation, both \a readProperties and
-         * \a propertiesStyle are ignored.
+         * \a propertiesStyle are ignored.  The audio properties are always
+         * read.
          *
          * \note TagLib will *not* take ownership of the stream, the caller is
          * responsible for deleting it after the File object.
diff --git a/taglib/toolkit/tbytevector.h b/taglib/toolkit/tbytevector.h
index 4a0f2b91..538565b0 100644
--- a/taglib/toolkit/tbytevector.h
+++ b/taglib/toolkit/tbytevector.h
@@ -64,17 +64,17 @@ namespace TagLib {
     ByteVector(uint size, char value = 0);
 
     /*!
-     * Contructs a byte vector that is a copy of \a v.
+     * Constructs a byte vector that is a copy of \a v.
      */
     ByteVector(const ByteVector &v);
 
     /*!
-     * Contructs a byte vector that is a copy of \a v.
+     * Constructs a byte vector that is a copy of \a v.
      */
     ByteVector(const ByteVector &v, uint offset, uint length);
 
     /*!
-     * Contructs a byte vector that contains \a c.
+     * Constructs a byte vector that contains \a c.
      */
     ByteVector(char c);
 
diff --git a/taglib/wavpack/wavpackfile.h b/taglib/wavpack/wavpackfile.h
index c507977e..95a28bc6 100644
--- a/taglib/wavpack/wavpackfile.h
+++ b/taglib/wavpack/wavpackfile.h
@@ -84,7 +84,6 @@ namespace TagLib {
        * file's audio properties will also be read using \a propertiesStyle.  If
        * false, \a propertiesStyle is ignored
        */
-
       File(FileName file, bool readProperties = true,
            Properties::ReadStyle propertiesStyle = Properties::Average);
 
diff --git a/taglib/xm/xmfile.h b/taglib/xm/xmfile.h
index 95871d3a..ae48a511 100644
--- a/taglib/xm/xmfile.h
+++ b/taglib/xm/xmfile.h
@@ -39,7 +39,8 @@ namespace TagLib {
          * Constructs an Extended Module file from \a file.
          *
          * \note In the current implementation, both \a readProperties and
-         * \a propertiesStyle are ignored.
+         * \a propertiesStyle are ignored.  The audio properties are always
+         * read.
          */
         File(FileName file, bool readProperties = true,
              AudioProperties::ReadStyle propertiesStyle =
@@ -49,7 +50,8 @@ namespace TagLib {
          * Constructs an Extended Module file from \a stream.
          *
          * \note In the current implementation, both \a readProperties and
-         * \a propertiesStyle are ignored.
+         * \a propertiesStyle are ignored.  The audio properties are always
+         * read.
          *
          * \note TagLib will *not* take ownership of the stream, the caller is
          * responsible for deleting it after the File object.

From 62d55223b26d7549d8583866961a8f14177fc169 Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Tue, 11 Jun 2013 00:09:37 +0900
Subject: [PATCH 5/8] Added conversion from String to const wchar_t*

---
 taglib/toolkit/tstring.cpp |  5 +++++
 taglib/toolkit/tstring.h   | 11 ++++++++++-
 tests/test_string.cpp      |  3 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
index d28855b8..c83118d1 100644
--- a/taglib/toolkit/tstring.cpp
+++ b/taglib/toolkit/tstring.cpp
@@ -312,6 +312,11 @@ const char *String::toCString(bool unicode) const
   return d->cstring.c_str();
 }
 
+const wchar_t *String::toCWString() const
+{
+  return d->data.c_str();
+}
+
 String::Iterator String::begin()
 {
   return d->data.begin();
diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
index d353bcd9..569650eb 100644
--- a/taglib/toolkit/tstring.h
+++ b/taglib/toolkit/tstring.h
@@ -205,7 +205,16 @@ namespace TagLib {
      * where memory is critical.
      */
     const char *toCString(bool unicode = false) const;
-
+    
+    /*!
+     * Returns a pointer to the wide char version of the TagLib string.  The string 
+     * is encoded in UTF-16(without BOM/CPU byte order). 
+     *
+     * /note This returns a pointer to the String's internal data without any 
+     * conversions.
+     */
+    const wchar_t *toCWString() const;
+    
     /*!
      * Returns an iterator pointing to the beginning of the string.
      */
diff --git a/tests/test_string.cpp b/tests/test_string.cpp
index f2976919..a815a0b4 100644
--- a/tests/test_string.cpp
+++ b/tests/test_string.cpp
@@ -72,6 +72,9 @@ public:
     String unicode2(unicode.to8Bit(true), String::UTF8);
     CPPUNIT_ASSERT(unicode == unicode2);
 
+	String unicode3(L"\u65E5\u672C\u8A9E");
+	CPPUNIT_ASSERT(*(unicode3.toCWString() + 1) == L'\u672C');
+
     CPPUNIT_ASSERT(strcmp(String::number(0).toCString(), "0") == 0);
     CPPUNIT_ASSERT(strcmp(String::number(12345678).toCString(), "12345678") == 0);
     CPPUNIT_ASSERT(strcmp(String::number(-12345678).toCString(), "-12345678") == 0);

From 75b685fa53bb9c7ca258eafb3641f46e6b2546e6 Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Mon, 24 Jun 2013 01:13:35 +0900
Subject: [PATCH 6/8] Updated the related comments

---
 taglib/toolkit/tstring.h | 48 ++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 16 deletions(-)

diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
index 569650eb..57945bee 100644
--- a/taglib/toolkit/tstring.h
+++ b/taglib/toolkit/tstring.h
@@ -178,40 +178,56 @@ namespace TagLib {
     virtual ~String();
 
     /*!
-     * If \a unicode if false (the default) this will return a \e Latin1 encoded
-     * std::string.  If it is true the returned std::wstring will be UTF-8
-     * encoded.
+     * Returns a deep copy of this String as an std::string.  The returned string 
+     * is encoded in UTF8 if \a unicode is true, otherwise Latin1.
+     *
+     * \see toCString()
      */
     std::string to8Bit(bool unicode = false) const;
 
     /*!
-     * Returns a wstring version of the TagLib string as a wide string.
+     * Returns a deep copy of this String as a wstring.  The returned string is 
+     * encoded in UTF-16 (without BOM/CPU byte order).
+     *
+     * \see toCWString()
      */
     wstring toWString() const;
 
     /*!
-     * Creates and returns a C-String based on the data.  This string is still
-     * owned by the String (class) and as such should not be deleted by the user.
+     * Creates and returns a standard C-style (null-terminated) version of this 
+     * String.  The returned string is encoded in UTF8 if \a unicode is true, 
+     * otherwise Latin1.
+     * 
+     * The returned string is still owned by this String and should not be deleted 
+     * by the user.
      *
-     * If \a unicode if false (the default) this string will be encoded in
-     * \e Latin1.  If it is true the returned C-String will be UTF-8 encoded.
+     * The returned pointer remains valid until this String instance is destroyed 
+     * or toCString() is called again.
      *
-     * This string remains valid until the String instance is destroyed or
-     * another export method is called.
-     *
-     * \warning This however has the side effect that this C-String will remain
-     * in memory <b>in addition to</b> other memory that is consumed by the
+     * \warning This however has the side effect that the returned string will remain
+     * in memory <b>in addition to</b> other memory that is consumed by this 
      * String instance.  So, this method should not be used on large strings or
-     * where memory is critical.
+     * where memory is critical.  Consider using to8Bit() instead to avoid it.
+     *
+     * \see to8Bit()
      */
     const char *toCString(bool unicode = false) const;
     
     /*!
-     * Returns a pointer to the wide char version of the TagLib string.  The string 
-     * is encoded in UTF-16(without BOM/CPU byte order). 
+     * Returns a standard C-style (null-terminated) wide character version of 
+     * this String.  The returned string is encoded in UTF-16 (without BOM/CPU byte 
+     * order).
+     * 
+     * The returned string is still owned by this String and should not be deleted 
+     * by the user.
+     *
+     * The returned pointer remains valid until this String instance is destroyed 
+     * or any other method of this String is called.
      *
      * /note This returns a pointer to the String's internal data without any 
      * conversions.
+     *
+     * \see toWString()
      */
     const wchar_t *toCWString() const;
     

From 15039098245793a32f16be7ea2c0dba12a35eccf Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Thu, 4 Jul 2013 18:11:33 +0900
Subject: [PATCH 7/8] Added the methods to check which kind of tags the file
 actually has.

---
 taglib/ape/apefile.cpp             | 12 +++++++++++-
 taglib/ape/apefile.h               | 10 ++++++++++
 taglib/flac/flacfile.cpp           | 14 ++++++++++++++
 taglib/flac/flacfile.h             | 15 +++++++++++++++
 taglib/mpc/mpcfile.cpp             | 11 ++++++++++-
 taglib/mpc/mpcfile.h               | 10 ++++++++++
 taglib/mpeg/mpegfile.h             |  6 +++---
 taglib/ogg/flac/oggflacfile.cpp    |  5 +++++
 taglib/ogg/flac/oggflacfile.h      |  5 +++++
 taglib/riff/aiff/aifffile.cpp      |  1 +
 taglib/riff/aiff/aifffile.h        |  5 +++++
 taglib/riff/wav/wavfile.cpp        | 28 +++++++++++++++++++++++++---
 taglib/riff/wav/wavfile.h          | 10 ++++++++++
 taglib/trueaudio/trueaudiofile.cpp | 10 ++++++++++
 taglib/trueaudio/trueaudiofile.h   | 10 ++++++++++
 taglib/wavpack/wavpackfile.cpp     | 10 ++++++++++
 taglib/wavpack/wavpackfile.h       | 10 ++++++++++
 17 files changed, 164 insertions(+), 8 deletions(-)

diff --git a/taglib/ape/apefile.cpp b/taglib/ape/apefile.cpp
index 415eb17e..3cb9d9a7 100644
--- a/taglib/ape/apefile.cpp
+++ b/taglib/ape/apefile.cpp
@@ -47,7 +47,7 @@ using namespace TagLib;
 
 namespace
 {
-  enum { ApeAPEIndex, ApeID3v1Index };
+  enum { ApeAPEIndex = 0, ApeID3v1Index = 1 };
 }
 
 class APE::File::FilePrivate
@@ -235,6 +235,16 @@ void APE::File::strip(int tags)
   }
 }
 
+bool APE::File::hasAPETag() const
+{
+  return d->hasAPE;
+}
+
+bool APE::File::hasID3v1Tag() const
+{
+  return d->hasID3v1;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/taglib/ape/apefile.h b/taglib/ape/apefile.h
index 5ccef72f..5530edf3 100644
--- a/taglib/ape/apefile.h
+++ b/taglib/ape/apefile.h
@@ -186,6 +186,16 @@ namespace TagLib {
        */
       void strip(int tags = AllTags);
 
+      /*!
+       * Returns whether or not the file on disk contains an APE tag.
+       */
+      bool hasAPETag() const;
+
+      /*!
+       * Returns whether or not the file on disk contains an ID3v1 tag.
+       */
+      bool hasID3v1Tag() const;
+
     private:
       File(const File &);
       File &operator=(const File &);
diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp
index 9f6251cf..823170aa 100644
--- a/taglib/flac/flacfile.cpp
+++ b/taglib/flac/flacfile.cpp
@@ -552,3 +552,17 @@ void FLAC::File::removePictures()
   d->blocks = newBlocks;
 }
 
+bool FLAC::File::hasXiphComment() const
+{
+  return d->hasXiphComment;
+}
+
+bool FLAC::File::hasID3v1Tag() const
+{
+  return d->hasID3v1;
+}
+
+bool FLAC::File::hasID3v2Tag() const
+{
+  return d->hasID3v2;
+}
diff --git a/taglib/flac/flacfile.h b/taglib/flac/flacfile.h
index 95b52142..e159c505 100644
--- a/taglib/flac/flacfile.h
+++ b/taglib/flac/flacfile.h
@@ -246,6 +246,21 @@ namespace TagLib {
        */
       void addPicture(Picture *picture);
 
+      /*!
+       * Returns whether or not the file on disk contains a Xiph comment.
+       */
+      bool hasXiphComment() const;
+
+      /*!
+       * Returns whether or not the file on disk contains an ID3v1 tag.
+       */
+      bool hasID3v1Tag() const;
+
+      /*!
+       * Returns whether or not the file on disk contains an ID3v2 tag.
+       */
+      bool hasID3v2Tag() const;
+
     private:
       File(const File &);
       File &operator=(const File &);
diff --git a/taglib/mpc/mpcfile.cpp b/taglib/mpc/mpcfile.cpp
index ee992ebc..979c035e 100644
--- a/taglib/mpc/mpcfile.cpp
+++ b/taglib/mpc/mpcfile.cpp
@@ -39,7 +39,7 @@ using namespace TagLib;
 
 namespace
 {
-  enum { MPCAPEIndex, MPCID3v1Index };
+  enum { MPCAPEIndex = 0, MPCID3v1Index = 1 };
 }
 
 class MPC::File::FilePrivate
@@ -256,6 +256,15 @@ void MPC::File::remove(int tags)
   strip(tags);
 }
 
+bool MPC::File::hasID3v1Tag() const
+{
+  return d->hasID3v1;
+}
+
+bool MPC::File::hasAPETag() const
+{
+  return d->hasAPE;
+}
 
 ////////////////////////////////////////////////////////////////////////////////
 // private members
diff --git a/taglib/mpc/mpcfile.h b/taglib/mpc/mpcfile.h
index ea66a5f9..4db906b5 100644
--- a/taglib/mpc/mpcfile.h
+++ b/taglib/mpc/mpcfile.h
@@ -187,6 +187,16 @@ namespace TagLib {
        */
       void remove(int tags = AllTags);
 
+      /*!
+       * Returns whether or not the file on disk contains an ID3v1 tag.
+       */
+      bool hasID3v1Tag() const;
+
+      /*!
+       * Returns whether or not the file on disk contains an APE tag.
+       */
+      bool hasAPETag() const;
+
     private:
       File(const File &);
       File &operator=(const File &);
diff --git a/taglib/mpeg/mpegfile.h b/taglib/mpeg/mpegfile.h
index ef3a2b8f..be94be7f 100644
--- a/taglib/mpeg/mpegfile.h
+++ b/taglib/mpeg/mpegfile.h
@@ -327,17 +327,17 @@ namespace TagLib {
       long lastFrameOffset();
 
       /*!
-       * Returns whether or not the file on disk contains ID3v1 tag.
+       * Returns whether or not the file on disk contains an ID3v1 tag.
        */
       bool hasID3v1Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains ID3v2 tag.
+       * Returns whether or not the file on disk contains an ID3v2 tag.
        */
       bool hasID3v2Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains APE tag.
+       * Returns whether or not the file on disk contains an APE tag.
        */
       bool hasAPETag() const;
 
diff --git a/taglib/ogg/flac/oggflacfile.cpp b/taglib/ogg/flac/oggflacfile.cpp
index 18506b2e..d440a0c6 100644
--- a/taglib/ogg/flac/oggflacfile.cpp
+++ b/taglib/ogg/flac/oggflacfile.cpp
@@ -287,3 +287,8 @@ void Ogg::FLAC::File::scan()
 
   d->scanned = true;
 }
+
+bool Ogg::FLAC::File::hasXiphComment() const
+{
+  return d->hasXiphComment;
+}
diff --git a/taglib/ogg/flac/oggflacfile.h b/taglib/ogg/flac/oggflacfile.h
index 4b83df1f..77280eff 100644
--- a/taglib/ogg/flac/oggflacfile.h
+++ b/taglib/ogg/flac/oggflacfile.h
@@ -128,6 +128,11 @@ namespace TagLib {
        */
       long streamLength();
 
+      /*!
+       * Returns whether or not the file on disk contains a Xiph comment.
+       */
+      bool hasXiphComment() const;
+
     private:
       File(const File &);
       File &operator=(const File &);
diff --git a/taglib/riff/aiff/aifffile.cpp b/taglib/riff/aiff/aifffile.cpp
index 19b80c8a..d20c148b 100644
--- a/taglib/riff/aiff/aifffile.cpp
+++ b/taglib/riff/aiff/aifffile.cpp
@@ -123,6 +123,7 @@ bool RIFF::AIFF::File::save()
   return true;
 }
 
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/taglib/riff/aiff/aifffile.h b/taglib/riff/aiff/aifffile.h
index 4ddd43e8..ef72dcd7 100644
--- a/taglib/riff/aiff/aifffile.h
+++ b/taglib/riff/aiff/aifffile.h
@@ -113,6 +113,11 @@ namespace TagLib {
          */
         virtual bool save();
 
+        /*!
+         * Returns whether or not the file on disk contains an ID3v2 tag.
+         */
+        bool hasID3v2Tag() const;
+
       private:
         File(const File &);
         File &operator=(const File &);
diff --git a/taglib/riff/wav/wavfile.cpp b/taglib/riff/wav/wavfile.cpp
index 43f2d812..abecea35 100644
--- a/taglib/riff/wav/wavfile.cpp
+++ b/taglib/riff/wav/wavfile.cpp
@@ -45,7 +45,9 @@ class RIFF::WAV::File::FilePrivate
 public:
   FilePrivate() :
     properties(0),
-    tagChunkID("ID3 ")
+    tagChunkID("ID3 "),
+    hasID3v2(false),
+    hasInfo(false)
   {
   }
 
@@ -59,6 +61,9 @@ public:
   ByteVector tagChunkID;
 
   TagUnion tag;
+
+  bool hasID3v2;
+  bool hasInfo;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -143,8 +148,10 @@ bool RIFF::WAV::File::save(TagTypes tags, bool stripOthers, int id3v2Version)
 
   ID3v2::Tag *id3v2tag = d->tag.access<ID3v2::Tag>(ID3v2Index, false);
   if(!id3v2tag->isEmpty()) {
-    if(tags & ID3v2)
+    if(tags & ID3v2) {
       setChunkData(d->tagChunkID, id3v2tag->render(id3v2Version));
+      d->hasID3v2 = true;
+    }
   }
 
   Info::Tag *infotag = d->tag.access<Info::Tag>(InfoIndex, false);
@@ -155,12 +162,24 @@ bool RIFF::WAV::File::save(TagTypes tags, bool stripOthers, int id3v2Version)
         setChunkData(chunkId, infotag->render());
       else
         setChunkData("LIST", infotag->render(), true);
+
+      d->hasInfo = true;
     }
   }
 
   return true;
 }
 
+bool RIFF::WAV::File::hasID3v2Tag() const
+{
+  return d->hasID3v2;
+}
+
+bool RIFF::WAV::File::hasInfoTag() const
+{
+  return d->hasInfo;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
@@ -174,6 +193,7 @@ void RIFF::WAV::File::read(bool readProperties, Properties::ReadStyle properties
     if(name == "ID3 " || name == "id3 ") {
       d->tagChunkID = chunkName(i);
       d->tag.set(ID3v2Index, new ID3v2::Tag(this, chunkOffset(i)));
+      d->hasID3v2 = true;
     }
     else if(name == "fmt " && readProperties)
       formatData = chunkData(i);
@@ -183,8 +203,10 @@ void RIFF::WAV::File::read(bool readProperties, Properties::ReadStyle properties
       ByteVector data = chunkData(i);
       ByteVector type = data.mid(0, 4);
 
-      if(type == "INFO")
+      if(type == "INFO") {
         d->tag.set(InfoIndex, new RIFF::Info::Tag(data));
+        d->hasInfo = true;
+      }
     }
   }
 
diff --git a/taglib/riff/wav/wavfile.h b/taglib/riff/wav/wavfile.h
index e8dfb8f8..be5e5d15 100644
--- a/taglib/riff/wav/wavfile.h
+++ b/taglib/riff/wav/wavfile.h
@@ -139,6 +139,16 @@ namespace TagLib {
         virtual bool save();
 
         bool save(TagTypes tags, bool stripOthers = true, int id3v2Version = 4);
+        
+        /*!
+         * Returns whether or not the file on disk contains an ID3v2 tag.
+         */
+        bool hasID3v2Tag() const;
+
+        /*!
+         * Returns whether or not the file on disk contains an RIFF INFO tag.
+         */
+        bool hasInfoTag() const;
 
       private:
         File(const File &);
diff --git a/taglib/trueaudio/trueaudiofile.cpp b/taglib/trueaudio/trueaudiofile.cpp
index 9bac29f0..f98d6add 100644
--- a/taglib/trueaudio/trueaudiofile.cpp
+++ b/taglib/trueaudio/trueaudiofile.cpp
@@ -236,6 +236,16 @@ void TrueAudio::File::strip(int tags)
   }
 }
 
+bool TrueAudio::File::hasID3v1Tag() const
+{
+  return d->hasID3v1;
+}
+
+bool TrueAudio::File::hasID3v2Tag() const
+{
+  return d->hasID3v2;
+}
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // private members
diff --git a/taglib/trueaudio/trueaudiofile.h b/taglib/trueaudio/trueaudiofile.h
index d805c8c5..94c6102b 100644
--- a/taglib/trueaudio/trueaudiofile.h
+++ b/taglib/trueaudio/trueaudiofile.h
@@ -209,7 +209,17 @@ namespace TagLib {
        * \note In order to make the removal permanent save() still needs to be called
        */
       void strip(int tags = AllTags);
+      
+      /*!
+       * Returns whether or not the file on disk contains an ID3v1 tag.
+       */
+      bool hasID3v1Tag() const;
 
+      /*!
+       * Returns whether or not the file on disk contains an ID3v2 tag.
+       */
+      bool hasID3v2Tag() const;
+    
     private:
       File(const File &);
       File &operator=(const File &);
diff --git a/taglib/wavpack/wavpackfile.cpp b/taglib/wavpack/wavpackfile.cpp
index 3754ea86..13b8c570 100644
--- a/taglib/wavpack/wavpackfile.cpp
+++ b/taglib/wavpack/wavpackfile.cpp
@@ -231,6 +231,16 @@ void WavPack::File::strip(int tags)
   }
 }
 
+bool WavPack::File::hasID3v1Tag() const
+{
+  return d->hasID3v1;
+}
+
+bool WavPack::File::hasAPETag() const
+{
+  return d->hasAPE;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/taglib/wavpack/wavpackfile.h b/taglib/wavpack/wavpackfile.h
index c507977e..f84d5d78 100644
--- a/taglib/wavpack/wavpackfile.h
+++ b/taglib/wavpack/wavpackfile.h
@@ -173,7 +173,17 @@ namespace TagLib {
        * \note In order to make the removal permanent save() still needs to be called
        */
       void strip(int tags = AllTags);
+      
+      /*!
+       * Returns whether or not the file on disk contains an ID3v1 tag.
+       */
+      bool hasID3v1Tag() const;
 
+      /*!
+       * Returns whether or not the file on disk contains an APE tag.
+       */
+      bool hasAPETag() const;
+    
     private:
       File(const File &);
       File &operator=(const File &);

From 30f62ba887ee6b7d2d294ad8d73b006825f626c6 Mon Sep 17 00:00:00 2001
From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
Date: Thu, 4 Jul 2013 21:44:28 +0900
Subject: [PATCH 8/8] Updated the relevant comments

---
 taglib/ape/apefile.h             | 33 ++++++++++++++++------
 taglib/asf/asffile.h             |  1 -
 taglib/flac/flacfile.h           | 48 ++++++++++++++++++++++++--------
 taglib/mpc/mpcfile.h             | 37 ++++++++++++++++--------
 taglib/mpeg/mpegfile.h           | 46 ++++++++++++++++++++++--------
 taglib/ogg/flac/oggflacfile.cpp  | 10 +++----
 taglib/ogg/flac/oggflacfile.h    | 16 +++++++++--
 taglib/riff/aiff/aifffile.h      | 10 ++++++-
 taglib/riff/wav/wavfile.h        | 20 +++++++++++--
 taglib/trueaudio/trueaudiofile.h | 42 ++++++++++++++++++----------
 taglib/wavpack/wavpackfile.h     | 33 ++++++++++++++++------
 11 files changed, 218 insertions(+), 78 deletions(-)

diff --git a/taglib/ape/apefile.h b/taglib/ape/apefile.h
index 5530edf3..f7b509f4 100644
--- a/taglib/ape/apefile.h
+++ b/taglib/ape/apefile.h
@@ -152,27 +152,38 @@ namespace TagLib {
       /*!
        * Returns a pointer to the ID3v1 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this may return a null pointer
        * if there is no valid ID3v1 tag.  If \a create is true it will create
-       * an ID3v1 tag if one does not exist. If there is already an APE tag, the
-       * new ID3v1 tag will be placed after it.
+       * an ID3v1 tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the APE::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v1 tag.  Use hasID3v1Tag() to check if the file 
+       * on disk actually has an ID3v1 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v1Tag()
        */
       ID3v1::Tag *ID3v1Tag(bool create = false);
 
       /*!
        * Returns a pointer to the APE tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this may return a null pointer
        * if there is no valid APE tag.  If \a create is true it will create
-       * a APE tag if one does not exist.
+       * an APE tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the APE::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an APE tag.  Use hasAPETag() to check if the file 
+       * on disk actually has an APE tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasAPETag()
        */
       APE::Tag *APETag(bool create = false);
 
@@ -187,12 +198,16 @@ namespace TagLib {
       void strip(int tags = AllTags);
 
       /*!
-       * Returns whether or not the file on disk contains an APE tag.
+       * Returns whether or not the file on disk actually has an APE tag.
+       *
+       * \see APETag()
        */
       bool hasAPETag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v1 tag.
+       * Returns whether or not the file on disk actually has an ID3v1 tag.
+       *
+       * \see ID3v1Tag()
        */
       bool hasID3v1Tag() const;
 
diff --git a/taglib/asf/asffile.h b/taglib/asf/asffile.h
index 4e850d6d..3ce3837a 100644
--- a/taglib/asf/asffile.h
+++ b/taglib/asf/asffile.h
@@ -114,7 +114,6 @@ namespace TagLib {
       virtual bool save();
 
     private:
-
       int readBYTE(bool *ok = 0);
       int readWORD(bool *ok = 0);
       unsigned int readDWORD(bool *ok = 0);
diff --git a/taglib/flac/flacfile.h b/taglib/flac/flacfile.h
index e159c505..0963f4af 100644
--- a/taglib/flac/flacfile.h
+++ b/taglib/flac/flacfile.h
@@ -161,39 +161,57 @@ namespace TagLib {
       /*!
        * Returns a pointer to the ID3v2 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this returns a null pointer
        * if there is no valid ID3v2 tag.  If \a create is true it will create
-       * an ID3v2 tag if one does not exist.
+       * an ID3v2 tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v2 tag.  Use hasID3v2Tag() to check if the file 
+       * on disk actually has an ID3v2 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v2Tag()
        */
       ID3v2::Tag *ID3v2Tag(bool create = false);
 
       /*!
        * Returns a pointer to the ID3v1 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
-       * if there is no valid ID3v1 tag.  If \a create is true it will create
-       * an ID3v1 tag if one does not exist.
+       * If \a create is false (the default) this returns a null pointer
+       * if there is no valid APE tag.  If \a create is true it will create
+       * an APE tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v1 tag.  Use hasID3v1Tag() to check if the file 
+       * on disk actually has an ID3v1 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v1Tag()
        */
       ID3v1::Tag *ID3v1Tag(bool create = false);
 
       /*!
        * Returns a pointer to the XiphComment for the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this returns a null pointer
        * if there is no valid XiphComment.  If \a create is true it will create
-       * a XiphComment if one does not exist.
+       * a XiphComment if one does not exist and returns a valid pointer.
        *
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has a XiphComment.  Use hasXiphComment() to check if the 
+       * file on disk actually has a XiphComment.
+       * 
        * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasXiphComment()
        */
       Ogg::XiphComment *xiphComment(bool create = false);
 
@@ -247,17 +265,23 @@ namespace TagLib {
       void addPicture(Picture *picture);
 
       /*!
-       * Returns whether or not the file on disk contains a Xiph comment.
+       * Returns whether or not the file on disk actually has a XiphComment.
+       *
+       * \see xiphComment()
        */
       bool hasXiphComment() const;
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v1 tag.
+       * Returns whether or not the file on disk actually has an ID3v1 tag.
+       *
+       * \see ID3v1Tag()
        */
       bool hasID3v1Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v2 tag.
+       * Returns whether or not the file on disk actually has an ID3v2 tag.
+       *
+       * \see ID3v2Tag()
        */
       bool hasID3v2Tag() const;
 
diff --git a/taglib/mpc/mpcfile.h b/taglib/mpc/mpcfile.h
index 4db906b5..1eef8103 100644
--- a/taglib/mpc/mpcfile.h
+++ b/taglib/mpc/mpcfile.h
@@ -145,28 +145,39 @@ namespace TagLib {
       /*!
        * Returns a pointer to the ID3v1 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
-       * if there is no valid ID3v1 tag.  If \a create is true it will create
-       * an ID3v1 tag if one does not exist. If there is already an APE tag, the
-       * new ID3v1 tag will be placed after it.
+       * If \a create is false (the default) this returns a null pointer
+       * if there is no valid APE tag.  If \a create is true it will create
+       * an APE tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the APE::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v1 tag.  Use hasID3v1Tag() to check if the file 
+       * on disk actually has an ID3v1 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v1Tag()
        */
       ID3v1::Tag *ID3v1Tag(bool create = false);
 
       /*!
        * Returns a pointer to the APE tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this may return a null pointer
        * if there is no valid APE tag.  If \a create is true it will create
-       * a APE tag if one does not exist. If there is already an ID3v1 tag, thes
-       * new APE tag will be placed before it.
+       * an APE tag if one does not exist and returns a valid pointer.  If 
+       * there already be an ID3v1 tag, the new APE tag will be placed before it.
        *
-       * \note The Tag <b>is still</b> owned by the APE::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an APE tag.  Use hasAPETag() to check if the file 
+       * on disk actually has an APE tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasAPETag()
        */
       APE::Tag *APETag(bool create = false);
 
@@ -188,12 +199,16 @@ namespace TagLib {
       void remove(int tags = AllTags);
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v1 tag.
+       * Returns whether or not the file on disk actually has an ID3v1 tag.
+       *
+       * \see ID3v1Tag()
        */
       bool hasID3v1Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an APE tag.
+       * Returns whether or not the file on disk actually has an APE tag.
+       *
+       * \see APETag()
        */
       bool hasAPETag() const;
 
diff --git a/taglib/mpeg/mpegfile.h b/taglib/mpeg/mpegfile.h
index be94be7f..3fc01e68 100644
--- a/taglib/mpeg/mpegfile.h
+++ b/taglib/mpeg/mpegfile.h
@@ -238,39 +238,57 @@ namespace TagLib {
       /*!
        * Returns a pointer to the ID3v2 tag of the file.
        *
-       * A tag will always be returned, regardless of whether there is a
-       * tag in the file or not. Use ID3v2::Tag::isEmpty() to check if
-       * the tag contains no data.
+       * If \a create is false (the default) this may return a null pointer
+       * if there is no valid ID3v2 tag.  If \a create is true it will create
+       * an ID3v2 tag if one does not exist and returns a valid pointer.
+       *
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v2 tag.  Use hasID3v2Tag() to check if the file 
+       * on disk actually has an ID3v2 tag.
        *
        * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v2Tag()
        */
       ID3v2::Tag *ID3v2Tag(bool create = false);
 
       /*!
        * Returns a pointer to the ID3v1 tag of the file.
        *
-       * A tag will always be returned, regardless of whether there is a
-       * tag in the file or not. Use Tag::isEmpty() to check if
-       * the tag contains no data.
+       * If \a create is false (the default) this may return a null pointer
+       * if there is no valid ID3v1 tag.  If \a create is true it will create
+       * an ID3v1 tag if one does not exist and returns a valid pointer.
+       *
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v1 tag.  Use hasID3v1Tag() to check if the file 
+       * on disk actually has an ID3v1 tag.
        *
        * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v1Tag()
        */
       ID3v1::Tag *ID3v1Tag(bool create = false);
 
       /*!
        * Returns a pointer to the APE tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this may return a null pointer
        * if there is no valid APE tag.  If \a create is true it will create
-       * an APE tag if one does not exist.
+       * an APE tag if one does not exist and returns a valid pointer.
+       *
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an APE tag.  Use hasAPETag() to check if the file 
+       * on disk actually has an APE tag.
        *
        * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasAPETag()
        */
       APE::Tag *APETag(bool create = false);
 
@@ -327,17 +345,23 @@ namespace TagLib {
       long lastFrameOffset();
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v1 tag.
+       * Returns whether or not the file on disk actually has an ID3v1 tag.
+       *
+       * \see ID3v1Tag()
        */
       bool hasID3v1Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v2 tag.
+       * Returns whether or not the file on disk actually has an ID3v2 tag.
+       *
+       * \see ID3v2Tag()
        */
       bool hasID3v2Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an APE tag.
+       * Returns whether or not the file on disk actually has an APE tag.
+       *
+       * \see APETag()
        */
       bool hasAPETag() const;
 
diff --git a/taglib/ogg/flac/oggflacfile.cpp b/taglib/ogg/flac/oggflacfile.cpp
index d440a0c6..bdf82459 100644
--- a/taglib/ogg/flac/oggflacfile.cpp
+++ b/taglib/ogg/flac/oggflacfile.cpp
@@ -137,6 +137,11 @@ bool Ogg::FLAC::File::save()
   return Ogg::File::save();
 }
 
+bool Ogg::FLAC::File::hasXiphComment() const
+{
+  return d->hasXiphComment;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
@@ -287,8 +292,3 @@ void Ogg::FLAC::File::scan()
 
   d->scanned = true;
 }
-
-bool Ogg::FLAC::File::hasXiphComment() const
-{
-  return d->hasXiphComment;
-}
diff --git a/taglib/ogg/flac/oggflacfile.h b/taglib/ogg/flac/oggflacfile.h
index 77280eff..8d87e486 100644
--- a/taglib/ogg/flac/oggflacfile.h
+++ b/taglib/ogg/flac/oggflacfile.h
@@ -91,11 +91,19 @@ namespace TagLib {
 
       /*!
        * Returns the Tag for this file.  This will always be a XiphComment.
+       *
+       * \note This always returns a valid pointer regardless of whether or not 
+       * the file on disk has a XiphComment.  Use hasXiphComment() to check if 
+       * the file on disk actually has a XiphComment.
+       * 
+       * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
+       * deleted by the user.  It will be deleted when the file (object) is
+       * destroyed.
+       *
+       * \see hasXiphComment()
        */
       virtual XiphComment *tag() const;
 
-
-
       /*!
        * Returns the FLAC::Properties for this file.  If no audio properties
        * were read then this will return a null pointer.
@@ -129,7 +137,9 @@ namespace TagLib {
       long streamLength();
 
       /*!
-       * Returns whether or not the file on disk contains a Xiph comment.
+       * Returns whether or not the file on disk actually has a XiphComment.
+       *
+       * \see tag()
        */
       bool hasXiphComment() const;
 
diff --git a/taglib/riff/aiff/aifffile.h b/taglib/riff/aiff/aifffile.h
index ef72dcd7..c75b94b4 100644
--- a/taglib/riff/aiff/aifffile.h
+++ b/taglib/riff/aiff/aifffile.h
@@ -85,6 +85,12 @@ namespace TagLib {
 
         /*!
          * Returns the Tag for this file.
+         *
+         * \note This always returns a valid pointer regardless of whether or not 
+         * the file on disk has an ID3v2 tag.  Use hasID3v2Tag() to check if the file 
+         * on disk actually has an ID3v2 tag.
+         *
+         * \see hasID3v2Tag()
          */
         virtual ID3v2::Tag *tag() const;
 
@@ -114,7 +120,9 @@ namespace TagLib {
         virtual bool save();
 
         /*!
-         * Returns whether or not the file on disk contains an ID3v2 tag.
+         * Returns whether or not the file on disk actually has an ID3v2 tag.
+         *
+         * \see ID3v2Tag()
          */
         bool hasID3v2Tag() const;
 
diff --git a/taglib/riff/wav/wavfile.h b/taglib/riff/wav/wavfile.h
index be5e5d15..2f83332a 100644
--- a/taglib/riff/wav/wavfile.h
+++ b/taglib/riff/wav/wavfile.h
@@ -105,11 +105,23 @@ namespace TagLib {
 
         /*!
          * Returns the ID3v2 Tag for this file.
+         *
+         * \note This always returns a valid pointer regardless of whether or not 
+         * the file on disk has an ID3v2 tag.  Use hasID3v2Tag() to check if the 
+         * file on disk actually has an ID3v2 tag.
+         *
+         * \see hasID3v2Tag()
          */
         ID3v2::Tag *ID3v2Tag() const;
 
         /*!
          * Returns the RIFF INFO Tag for this file.
+         *
+         * \note This always returns a valid pointer regardless of whether or not 
+         * the file on disk has a RIFF INFO tag.  Use hasInfoTag() to check if the 
+         * file on disk actually has a RIFF INFO tag.
+         *
+         * \see hasInfoTag()
          */
         Info::Tag *InfoTag() const;
 
@@ -141,12 +153,16 @@ namespace TagLib {
         bool save(TagTypes tags, bool stripOthers = true, int id3v2Version = 4);
         
         /*!
-         * Returns whether or not the file on disk contains an ID3v2 tag.
+         * Returns whether or not the file on disk actually has an ID3v2 tag.
+         *
+         * \see ID3v2Tag()
          */
         bool hasID3v2Tag() const;
 
         /*!
-         * Returns whether or not the file on disk contains an RIFF INFO tag.
+         * Returns whether or not the file on disk actually has a RIFF INFO tag.
+         *
+         * \see InfoTag()
          */
         bool hasInfoTag() const;
 
diff --git a/taglib/trueaudio/trueaudiofile.h b/taglib/trueaudio/trueaudiofile.h
index 94c6102b..dbaafcdb 100644
--- a/taglib/trueaudio/trueaudiofile.h
+++ b/taglib/trueaudio/trueaudiofile.h
@@ -173,30 +173,40 @@ namespace TagLib {
       virtual bool save();
 
       /*!
-       * Returns a pointer to the ID3v2 tag of the file.
+       * Returns a pointer to the ID3v1 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
-       * if there is no valid ID3v2 tag.  If \a create is true it will create
-       * an ID3v1 tag if one does not exist. If there is already an APE tag, the
-       * new ID3v1 tag will be placed after it.
+       * If \a create is false (the default) this may return a null pointer
+       * if there is no valid ID3v1 tag.  If \a create is true it will create
+       * an ID3v1 tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the TrueAudio::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v1 tag.  Use hasID3v1Tag() to check if the file 
+       * on disk actually has an ID3v1 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v1Tag()
        */
       ID3v1::Tag *ID3v1Tag(bool create = false);
 
       /*!
-       * Returns a pointer to the ID3v1 tag of the file.
+       * Returns a pointer to the ID3v2 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
-       * if there is no valid ID3v1 tag.  If \a create is true it will create
-       * an ID3v1 tag if one does not exist. If there is already an APE tag, the
-       * new ID3v1 tag will be placed after it.
+       * If \a create is false (the default) this may return a null pointer
+       * if there is no valid ID3v2 tag.  If \a create is true it will create
+       * an ID3v2 tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the TrueAudio::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v2 tag.  Use hasID3v2Tag() to check if the file 
+       * on disk actually has an ID3v2 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v2Tag()
        */
       ID3v2::Tag *ID3v2Tag(bool create = false);
 
@@ -211,12 +221,16 @@ namespace TagLib {
       void strip(int tags = AllTags);
       
       /*!
-       * Returns whether or not the file on disk contains an ID3v1 tag.
+       * Returns whether or not the file on disk actually has an ID3v1 tag.
+       *
+       * \see ID3v1Tag()
        */
       bool hasID3v1Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an ID3v2 tag.
+       * Returns whether or not the file on disk actually has an ID3v2 tag.
+       *
+       * \see ID3v2Tag()
        */
       bool hasID3v2Tag() const;
     
diff --git a/taglib/wavpack/wavpackfile.h b/taglib/wavpack/wavpackfile.h
index f84d5d78..198e9619 100644
--- a/taglib/wavpack/wavpackfile.h
+++ b/taglib/wavpack/wavpackfile.h
@@ -140,27 +140,38 @@ namespace TagLib {
       /*!
        * Returns a pointer to the ID3v1 tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this may return a null pointer
        * if there is no valid ID3v1 tag.  If \a create is true it will create
-       * an ID3v1 tag if one does not exist. If there is already an APE tag, the
-       * new ID3v1 tag will be placed after it.
+       * an ID3v1 tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the APE::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an ID3v1 tag.  Use hasID3v1Tag() to check if the file 
+       * on disk actually has an ID3v1 tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasID3v1Tag()
        */
       ID3v1::Tag *ID3v1Tag(bool create = false);
 
       /*!
        * Returns a pointer to the APE tag of the file.
        *
-       * If \a create is false (the default) this will return a null pointer
+       * If \a create is false (the default) this may return a null pointer
        * if there is no valid APE tag.  If \a create is true it will create
-       * a APE tag if one does not exist.
+       * an APE tag if one does not exist and returns a valid pointer.
        *
-       * \note The Tag <b>is still</b> owned by the APE::File and should not be
+       * \note This may return a valid pointer regardless of whether or not the 
+       * file on disk has an APE tag.  Use hasAPETag() to check if the file 
+       * on disk actually has an APE tag.
+       *
+       * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
        * deleted by the user.  It will be deleted when the file (object) is
        * destroyed.
+       *
+       * \see hasAPETag()
        */
       APE::Tag *APETag(bool create = false);
 
@@ -175,12 +186,16 @@ namespace TagLib {
       void strip(int tags = AllTags);
       
       /*!
-       * Returns whether or not the file on disk contains an ID3v1 tag.
+       * Returns whether or not the file on disk actually has an ID3v1 tag.
+       *
+       * \see ID3v1Tag()
        */
       bool hasID3v1Tag() const;
 
       /*!
-       * Returns whether or not the file on disk contains an APE tag.
+       * Returns whether or not the file on disk actually has an APE tag.
+       *
+       * \see APETag()
        */
       bool hasAPETag() const;