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

Martijn van Rheenen rheenen at gmail.com
Tue Apr 19 09:22:47 CEST 2011


Hi all once again,

I am using the Android 'Crystax' R5 SDK to use TagLib on Android:

http://www.crystax.net/android/ndk.php

which is still having some issues with wstring / wchar support:

http://www.crystax.net/trac/ticket/26


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...

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? ;)

Thanks for reading, hope to hear any thoughts,
  Martijn van Rheenen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110419/3ef46fe2/attachment.htm 


More information about the taglib-devel mailing list