[Flac-dev] reading vorbis comments with FLAC++?

Josh Coalson xflac at yahoo.com
Tue Nov 18 10:41:31 PST 2003


--- Joshua Kwan <joshk at triplehelix.org> wrote:
> On Mon, Nov 17, 2003 at 11:10:58AM -0800, Josh Coalson wrote:
> > > but there's still junk on the char* i get back from
> > > get_field_value().
> > 
> > there's no terminating null for these routines either, they
> > are returning the unterminated UTF-8 buffer just like the C
> > API.
> 
> OK. I assumed that stuff passed back to the user as char* would have
> been made to behave like a normal C string.
> 
> > it's hard to do that without dealing with encodings right in the
> > metadata API.
> 
> What about making them return wchar_t* and thus IMPLYING to the user
> that they have to do something about character conversion?

wchar_t still means converting to ucs-2 in the metadata library.
that's not nearly as bad as dealing with multiple encodings, but
it's independent of the question of whether or not to null-
terminate.  returning char* or wchar_t* don't in and of themselves
imply that you're getting a null-terminated C string.

> > > > char str[entry->length+1];
> > > > memcpy(str, entry->entry);
> > > > str[entry->length] = '\0';
> > > 
> > > That's about the size of what I've been doing.
> > 
> > and that's working, right?  (or at least it will for ASCII
> > tags)
> 
> Yes. To convert, would i use iconv() or something like that?

yes, see the plugin code I mentioned before for examples.

Josh


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree




More information about the Flac-dev mailing list