aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Shaforostoff <shafff@ukr.net>2011-01-28 13:18:36 +0000
committerNick Shaforostoff <shafff@ukr.net>2011-01-28 13:18:36 +0000
commitc56c0a3d0ca52e38dcf5f33491de0ecbd6853b24 (patch)
treea5a91f246aa628b31b16b9e90a4388979c5918e2
parent299e3f0ad6525b9456130d559362f29d09d85149 (diff)
fix crash on wma file parsing, add clarifications to API docs
CCMAIL: wheeler@kde.org git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1217766 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--taglib/asf/asffile.cpp6
-rw-r--r--taglib/fileref.h3
-rw-r--r--taglib/toolkit/tstring.h7
3 files changed, 15 insertions, 1 deletions
diff --git a/taglib/asf/asffile.cpp b/taglib/asf/asffile.cpp
index acfbe759..5c23ceb3 100644
--- a/taglib/asf/asffile.cpp
+++ b/taglib/asf/asffile.cpp
@@ -148,7 +148,11 @@ public:
void ASF::File::BaseObject::parse(ASF::File *file, unsigned int size)
{
- data = file->readBlock(size - 24);
+ data.clear();
+ if (size > 24 && size <= file->length())
+ data = file->readBlock(size - 24);
+ else
+ data = ByteVector::null;
}
ByteVector ASF::File::BaseObject::render(ASF::File * /*file*/)
diff --git a/taglib/fileref.h b/taglib/fileref.h
index 46da1430..0f0c21a4 100644
--- a/taglib/fileref.h
+++ b/taglib/fileref.h
@@ -149,6 +149,9 @@ namespace TagLib {
* \warning This pointer will become invalid when this FileRef and all
* copies pass out of scope.
*
+ * \warning Do not cast it to any subclasses of \class Tag.
+ * Use tag returning methods of appropriate subclasses of \class File instead.
+ *
* \see File::tag()
*/
Tag *tag() const;
diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
index a45c446e..693d043f 100644
--- a/taglib/toolkit/tstring.h
+++ b/taglib/toolkit/tstring.h
@@ -37,6 +37,9 @@
* \relates TagLib::String
*
* Converts a QString to a TagLib::String without a requirement to link to Qt.
+ *
+ * \note consider conversion via usual char-by-char for loop to avoid UTF16->UTF8->UTF16
+ * conversion happening in the background
*/
#define QStringToTString(s) TagLib::String(s.utf8().data(), TagLib::String::UTF8)
@@ -44,6 +47,10 @@
* \relates TagLib::String
*
* Converts a TagLib::String to a QString without a requirement to link to Qt.
+ *
+ * \note consider conversion via usual char-by-char for loop to avoid UTF16->UTF8->UTF16
+ * conversion happening in the background
+ *
*/
#define TStringToQString(s) QString::fromUtf8(s.toCString(true))