NOT a bug in TagLib, more in the Android SDK for now...

Martijn van Rheenen rheenen at gmail.com
Thu Apr 21 14:22:51 CEST 2011


Just to let anyone interested now, the new Crystax R5 Beta2 build is now
downloadable from www.crystax.net and has fixed the wstring support, so
TagLib now compiles again without any changes needed!

Greets,
  Martijn van Rheenen



On Tue, Apr 19, 2011 at 11:55 AM, Martijn van Rheenen <rheenen at gmail.com>wrote:

> Lukas,
>
> then may I suggest using this code in the String::prepare() method of
> tstring.cpp, replacing the current case UTF16: block?
>
>   case UTF16:
>   {
>     if(d->data.size() >= 1 && (d->data[0] == 0xfeff || d->data[0] ==
> 0xfffe)) {
>       bool swap = d->data[0] != 0xfeff;
> #ifndef __ANDROID__
>       // ORIGINAL TAGLIB CODE.
>       d->data.erase(d->data.begin(), d->data.begin() + 1);
> #else
>       // ERASE FUNCTION RESPONSIBLE FOR DUPLICATE CHARACTER ON SOME
> POSITION OF STRING
>       // CIRCUMVENTED BY THIS LOOP FOR NOW (bug reported to developer of
> Crystax NDK R5)
>       for(uint i =0; i < d->data.size()-1; i++){
>  d->data[i] = d->data[i+1];
>       }
>       d->data.resize(d->data.size()-1);
> #endif
>
>       if(swap) {
>         for(uint i = 0; i < d->data.size(); i++){
>           d->data[i] = byteSwap((unsigned short)d->data[i]);
>  }
>        }
>     }
>     else {
>       debug("String::prepare() - Invalid UTF16 string.");
>       d->data.erase(d->data.begin(), d->data.end());
>     }
>     break;
>   }
>
>
> Greets,
>   Martijn van Rheenen
>
>
>
> 2011/4/19 Lukáš Lalinský <lalinsky at gmail.com>
>
>> 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
>> _______________________________________________
>> taglib-devel mailing list
>> taglib-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/taglib-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110421/62ccf635/attachment.htm 


More information about the taglib-devel mailing list