I have similar problems when I tried to write the vorbis cover art and reported it about one month ago.<br><br><div class="gmail_quote">2010/4/22 Lukáš Lalinský <span dir="ltr"><<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">On Wed, Apr 21, 2010 at 9:01 PM, Matthieu Riolo<br>
<<a href="mailto:matthieu.riolo@googlemail.com">matthieu.riolo@googlemail.com</a>> wrote:<br>
> Hello everybody<br>
> I've just an small question but the problem is it really confusing me. I<br>
> wrote an obj-c wrapper around the taglib class and I tried to integrate the<br>
> Ogg Vorbis METADATA_BLOCK_PICTURE into the wrapper. I tried to work<br>
> ByteVector but it seems that it does not behaviour like I thought. But maybe<br>
> I just did not understand what the idea is behind ByteVector. For me it was<br>
> clear that the class just manipulates the memory in a comfortable way.<br>
> However, I seem to be unabled to put the complete data into memory!<br>
><br>
> NSLog(@"%u",<br>
> TagLib::String(TagLib::ByteVector(TagLib::ByteVector::fromUInt(10,<br>
> true))).size());<br>
> The code above will return 1! I recognized this problem as I tried to set 4<br>
> bytes long integervalues with the quantity of 0. It occurs that the<br>
> ByteVector contains the correct datasize but no data. This way ByteVector is<br>
> always empty and will not append any data to his content (even if he resize<br>
> correct).<br>
><br>
> So me question is: Did I missed something? Or did I just run over a strange<br>
> obj-c vs c++ case? For me it's important to know if this "strip" effect is<br>
> wished or not. Because in me case it is absolutly in the way.<br>
<br>
</div></div>The problem is conversion of a byte vector with NULL bytes to a string.<br>
<br>
I'm not sure if this is a copy&paste error in your example, but the<br>
code should return 0. ByteVector::fromUInt(10, true) creates a byte<br>
vector with four bytes 0x00 0x00 0x00 0x0A. The second<br>
ByteVector(byteVector) creates a copy, so it's useless in this case.<br>
String(ByteVector("\x00\x00\x00\x0A", 4)) tries to convert the bytes<br>
into a string using Latin-1. It sees \x00 as the first character, so<br>
it stops parsing it. The result is an empty string.<br>
<br>
Btw, if you use ByteVector::fromUInt(10, false), the byte order would<br>
be reversed and you would get a string with one character (ASCII code<br>
\x0A).<br>
<br>
Lukas<br>
_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org">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><br clear="all"><br>-- <br>Best Regards<br>