<div>Just to let anyone interested now, the new Crystax R5 Beta2 build is now downloadable from <a href="http://www.crystax.net">www.crystax.net</a> and has fixed the wstring support, so TagLib now compiles again without any changes needed!</div>

<br clear="all">Greets,<div>  Martijn van Rheenen</div><br>
<br><br><div class="gmail_quote">On Tue, Apr 19, 2011 at 11:55 AM, Martijn van Rheenen <span dir="ltr">&lt;<a href="mailto:rheenen@gmail.com">rheenen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div>Lukas,</div><div><br></div><div>then may I suggest using this code in the String::prepare() method of tstring.cpp, replacing the current case UTF16: block?</div><div><br></div><div><div class="im"><div>  <font face="&#39;courier new&#39;, monospace" size="1">case UTF16:</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">  {</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    if(d-&gt;data.size() &gt;= 1 &amp;&amp; (d-&gt;data[0] == 0xfeff || d-&gt;data[0] == 0xfffe)) {</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">      bool swap = d-&gt;data[0] != 0xfeff;</font></div></div><div><font face="&#39;courier new&#39;, monospace" size="1">#ifndef __ANDROID__      </font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">      // ORIGINAL TAGLIB CODE. </font></div><div class="im"><div><font face="&#39;courier new&#39;, monospace" size="1">      d-&gt;data.erase(d-&gt;data.begin(), d-&gt;data.begin() + 1);</font></div>


</div><div><font face="&#39;courier new&#39;, monospace" size="1">#else      </font></div><div><font face="&#39;courier new&#39;, monospace" size="1">      // ERASE FUNCTION RESPONSIBLE FOR DUPLICATE CHARACTER ON SOME POSITION OF STRING</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">      // CIRCUMVENTED BY THIS LOOP FOR NOW (bug reported to developer of Crystax NDK R5)</font></div><div class="im"><div><font face="&#39;courier new&#39;, monospace" size="1">      for(uint i =0; i &lt; d-&gt;data.size()-1; i++){</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1"><span style="white-space:pre-wrap">        </span>d-&gt;data[i] = d-&gt;data[i+1];</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">      }  </font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">      d-&gt;data.resize(d-&gt;data.size()-1);</font></div></div><div><font face="&#39;courier new&#39;, monospace" size="1">#endif      </font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">      </font></div><div><font face="&#39;courier new&#39;, monospace" size="1">      if(swap) {</font></div><div>
<font face="&#39;courier new&#39;, monospace" size="1">        for(uint i = 0; i &lt; d-&gt;data.size(); i++){</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">          d-&gt;data[i] = byteSwap((unsigned short)d-&gt;data[i]);</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1"><span style="white-space:pre-wrap">        </span>}</font></div><div><span style="white-space:pre-wrap"><font face="&#39;courier new&#39;, monospace" size="1">        </font></span></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">      }</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    }</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    else {</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">      debug(&quot;String::prepare() - Invalid UTF16 string.&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">      d-&gt;data.erase(d-&gt;data.begin(), d-&gt;data.end());</font></div>


<div><font face="&#39;courier new&#39;, monospace" size="1">    }</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    break;</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">  }</font></div>


</div><div><br></div><br clear="all">Greets,<div>  Martijn van Rheenen</div><div><div></div><div class="h5"><br>
<br><br><div class="gmail_quote">2011/4/19 Lukáš Lalinský <span dir="ltr">&lt;<a href="mailto:lalinsky@gmail.com" target="_blank">lalinsky@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


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