NOT a bug in TagLib, more in the Android SDK for now...
Lukáš Lalinský
lalinsky at gmail.com
Tue Apr 19 10:12:04 CEST 2011
On Tue, Apr 19, 2011 at 9:22 AM, Martijn van Rheenen <rheenen at gmail.com> wrote:
> Now in TagLib, in the file tstring.cpp, the wstring::erase() method is used,
> which is NO problem ofcourse with native Linux/Windows development and I
> guess any other platform for now, but with Crystax it fails to properly move
> all characters of the resulting string. The workaround I found, for now, is
> this:
> ...
> void String::prepare(Type t)
> {
> switch(t) {
> case UTF16:
> {
> if(d->data.size() >= 1 && (d->data[0] == 0xfeff || d->data[0] ==
> 0xfffe)) {
> bool swap = d->data[0] != 0xfeff;
>
> // ORIGINAL TAGLIB CODE. ERASE FUNCTION RESPONSIBLE FOR DUPLICATE
> CHARACTER ON 6TH POSITION OF STRING USING CRYSTAX
> //d->data.erase(d->data.begin(), d->data.begin() + 1);
>
> // FIX FOR CRYSTAX R5 SDK:
> for(uint i =0; i < d->data.size()-1; i++){
> d->data[i] = d->data[i+1];
> }
> d->data.resize(d->data.size()-1);
> ...
> Note that I also could not use the 'wstring::copy()' method either, it
> produces the same bug...
What about std::copy()?
> Is there perhaps a way to implement this 'workaround' without having to
> change an internal class of TagLib, with which nothing is wrong? Because I
> wouldn't dare to ask to include this change in the official sourcecode, with
> precompiler directive or not, since it's not a bug of TagLib itself... or
> should I? ;)
I don't see why not. I'd prefer to use wstring::erase() normally, but
if there is a macro that Crystax defines that you can check, we can
conditionally use this code.
Lukas
More information about the taglib-devel
mailing list