From c357d293a14bdd5b6e332cf9b14b4bb7bedf3687 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 13 Mar 2014 14:38:03 +0900 Subject: [PATCH 1/2] Added some comment about UTF-16 encoding to String::data(). --- taglib/toolkit/tstring.cpp | 3 +-- taglib/toolkit/tstring.h | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index 0151f784..603455a1 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -457,8 +457,7 @@ ByteVector String::data(Type t) const ByteVector v(2 + size() * 2, 0); char *p = v.data(); - // Assume that if we're doing UTF16 and not UTF16BE that we want little - // endian encoding. (Byte Order Mark) + // We use little-endian encoding here and need a BOM. *p++ = '\xff'; *p++ = '\xfe'; diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h index 2cff5a4b..795e913f 100644 --- a/taglib/toolkit/tstring.h +++ b/taglib/toolkit/tstring.h @@ -334,6 +334,9 @@ namespace TagLib { * UTF8, this will return a vector of 8 bit characters, otherwise it will use * 16 bit characters. * + * \note If \a t is UTF16, the returned data is encoded in little-endian + * format and has a BOM. + * * \note The returned data is not null terminated. */ ByteVector data(Type t) const; From 6bcd422afacd5bbf5a64fc18a8e1dd3fe865c793 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Fri, 14 Mar 2014 15:12:03 +0900 Subject: [PATCH 2/2] Small fix of a comment --- taglib/toolkit/tstring.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h index 795e913f..76e4c32f 100644 --- a/taglib/toolkit/tstring.h +++ b/taglib/toolkit/tstring.h @@ -163,7 +163,6 @@ namespace TagLib { */ String(wchar_t c, Type t = Latin1); - /*! * Makes a deep copy of the data in \a s. * @@ -173,7 +172,7 @@ namespace TagLib { String(const char *s, Type t = Latin1); /*! - * Makes a deep copy of the data in \a s. + * Makes a deep copy of the data in \a v. * * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when * used with other codecs it will simply print a warning and exit.