Commit 1fd8528c authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/matroskadec: Beautify matroska_parse_laces()

Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent 2a3bbc00
......@@ -3049,31 +3049,26 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
for (n = 0; n < *laces - 1; n++) {
lace_size[n] = 0;
while (1) {
if (size <= total) {
do {
if (size <= total)
return AVERROR_INVALIDDATA;
}
temp = *data;
total += temp;
lace_size[n] += temp;
data += 1;
size -= 1;
if (temp != 0xff)
break;
}
} while (temp == 0xff);
}
if (size < total) {
if (size < total)
return AVERROR_INVALIDDATA;
}
lace_size[n] = size - total;
break;
}
case 0x2: /* fixed-size lacing */
if (size % (*laces)) {
if (size % (*laces))
return AVERROR_INVALIDDATA;
}
for (n = 0; n < *laces; n++)
lace_size[n] = size / *laces;
break;
......@@ -3109,9 +3104,9 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
}
data += offset;
size -= offset;
if (size < total) {
if (size < total)
return AVERROR_INVALIDDATA;
}
lace_size[*laces - 1] = size - total;
break;
}
......
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