File constructor inconsistent behaviour
Ibrahim Sha'ath
ibrahimshaath at gmail.com
Wed Feb 1 18:46:37 UTC 2012
Hi,
In reading some mp3 files (in particular one with Japanese characters in
the filename), the following (Qt) code returns inconsistent results.
(filePath is a QString passed by const ref, f is a Taglib::File*)
QString fileExt = filePath.right(filePath.length() -
filePath.lastIndexOf(".") - 1).toLower();
const char* filePathCh = QFile::encodeName(filePath);
f = NULL;
if(fileExt == "mp3"){
std::cerr << filePathCh << std::endl;
f = new TagLib::MPEG::File(filePathCh,false);
std::cerr << filePathCh << std::endl;
}
Sometimes, when passed the path of a file, this code works fine,
returning a valid File object whose tags I can read and write; in
these cases the two prints to cerr are correct (showing the whole file
path) and identical. Other times, f is returned invalid, and while the
first print to cerr is correct, the second is either blank or
incomplete (usually with the beginning truncated). I cannot determine
what causes the divergent behaviour.
This is all using TagLib 1.7 and Qt 4.7.4, on Mac OS 10.7.2. Does
anyone have any idea what might be causing this, or have you seen
anything similar? Any help appreciated.
Best regards
Ibrahim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20120201/dfe0fe90/attachment.html>
More information about the taglib-devel
mailing list