Commit cf1fd2b0 authored by Max Kellermann's avatar Max Kellermann

decoder/flac: return early from flac_find_float_comment()

When one metadata check fails, return quickly. This removes 2 levels of indent.
parent 8e2d9879
...@@ -44,27 +44,28 @@ static bool ...@@ -44,27 +44,28 @@ static bool
flac_find_float_comment(const FLAC__StreamMetadata *block, flac_find_float_comment(const FLAC__StreamMetadata *block,
const char *cmnt, float *fl) const char *cmnt, float *fl)
{ {
int offset = int offset;
FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, cmnt); size_t pos;
int len;
if (offset >= 0) { unsigned char tmp, *p;
size_t pos = strlen(cmnt) + 1; /* 1 is for '=' */
int len = block->data.vorbis_comment.comments[offset].length offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0,
- pos; cmnt);
if (len > 0) { if (offset < 0)
unsigned char tmp; return false;
unsigned char *p = &(block->data.vorbis_comment.
comments[offset].entry[pos]); pos = strlen(cmnt) + 1; /* 1 is for '=' */
tmp = p[len]; len = block->data.vorbis_comment.comments[offset].length - pos;
p[len] = '\0'; if (len <= 0)
*fl = (float)atof((char *)p); return false;
p[len] = tmp;
p = &block->data.vorbis_comment.comments[offset].entry[pos];
return true; tmp = p[len];
} p[len] = '\0';
} *fl = (float)atof((char *)p);
p[len] = tmp;
return false;
return true;
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment