Merge pull request #356 from TsudaKageyu/string-comment

Added some comment about UTF-16 encoding to String::data().
This commit is contained in:
Lukáš Lalinský 2014-04-10 20:05:55 +02:00
commit 2d528d844a
2 changed files with 5 additions and 4 deletions

View File

@ -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';

View File

@ -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.
@ -334,6 +333,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;