> While you are at it, can you check/fix the following warning
> ?
> 
> metadata.cpp:812:98: warning: narrowing conversion of
> 'strlen(((const 
> char*)string))' from 'size_t {aka long unsigned int}' to
> 'FLAC__uint32 
> {aka unsigned int}' inside { } is ill-formed in C++11
> [-Wnarrowing]
> 
> 
> Thanks !

Yeah sure! I don't get that error because I'm on a 32 bit OS by the way. The 
message makes it pretty clear you are compiling on 64 bit, so the size_t 
returned by strlen is 64 bits, but FLAC__StreamMetadata_VorbisComment_Entry 
expects a FLAC__uint32 (which is obviously 32 bits), so gcc warns/errors that 
the size_t might not fit. I can think of two solutions:
1. Make the FLAC__StreamMetadata_VorbisComment_Entry struct's 'length' member a 
FLAC__uint64.
2. static_cast the return value of strlen to 32 bits...

I'd say option 2 is easiest, as I don't know what else will be affected by 
changing the size of FLAC__StreamMetadata_VorbisComment_Entry. The only problem 
with option 2 would be if the vendor string ever gets larger than ~4.3 billion 
characters, but I don't think vorbis comments support values that large anyway.

Anyway, here's a patch that casts to FLAC__uint32, Note I have the offending 
code on a very different line number (current git I think), so this patch may 
not apply cleanly. But it's a one-liner anyway (a one-worder actually), so you 
could just read it and apply it manually...

Also, I don't know if such a cast is considered an expensive operation, but in 
that case it might be possible to first check the size of size_t (during 
preprocessing) to see if it is larger than 32 bits. The cast is unnecessary if 
it is not.

Bas

Attachment: narrowing_patch
Description: Binary data

_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to