Add missing {}s to conditionals & loops

This was necessary after:
44257cb8 apply clang-format

Which made some single-line statements into multi-line. Using braces on
multi-line statements better conforms with the Google style guide.

Bug: 433996651
Change-Id: I615c0ecf3b94571f67fceadfe8c15914aea45ccb
This commit is contained in:
James Zern
2025-08-20 16:22:29 -07:00
parent dab2cf21fa
commit 235286fd78
5 changed files with 31 additions and 23 deletions

View File

@@ -355,22 +355,25 @@ static void ExtractGreen_C(const uint32_t* WEBP_RESTRICT argb,
//------------------------------------------------------------------------------
static int HasAlpha8b_C(const uint8_t* src, int length) {
while (length-- > 0)
while (length-- > 0) {
if (*src++ != 0xff) return 1;
}
return 0;
}
static int HasAlpha32b_C(const uint8_t* src, int length) {
int x;
for (x = 0; length-- > 0; x += 4)
for (x = 0; length-- > 0; x += 4) {
if (src[x] != 0xff) return 1;
}
return 0;
}
static void AlphaReplace_C(uint32_t* src, int length, uint32_t color) {
int x;
for (x = 0; x < length; ++x)
for (x = 0; x < length; ++x) {
if ((src[x] >> 24) == 0) src[x] = color;
}
}
//------------------------------------------------------------------------------

View File

@@ -274,8 +274,9 @@ static int HasAlpha8b_SSE2(const uint8_t* src, int length) {
const int mask = _mm_movemask_epi8(bits);
if (mask != 0xffff) return 1;
}
for (; i < length; ++i)
for (; i < length; ++i) {
if (src[i] != 0xff) return 1;
}
return 0;
}
@@ -314,8 +315,9 @@ static int HasAlpha32b_SSE2(const uint8_t* src, int length) {
const int mask = _mm_movemask_epi8(bits);
if (mask != 0xffff) return 1;
}
for (; i <= length; i += 4)
for (; i <= length; i += 4) {
if (src[i] != 0xff) return 1;
}
return 0;
}
@@ -337,8 +339,9 @@ static void AlphaReplace_SSE2(uint32_t* src, int length, uint32_t color) {
_mm_storeu_si128((__m128i*)(src + i + 0), _mm_or_si128(d0, e0));
_mm_storeu_si128((__m128i*)(src + i + 4), _mm_or_si128(d1, e1));
}
for (; i < length; ++i)
for (; i < length; ++i) {
if ((src[i] >> 24) == 0) src[i] = color;
}
}
// -----------------------------------------------------------------------------

View File

@@ -278,9 +278,10 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data,
ChunkRelease(&chunk);
goto PushImage;
default: // A non-image chunk.
if (wpi->is_partial)
if (wpi->is_partial) {
goto Err; // Encountered a non-image chunk before
// getting all chunks of an image.
}
if (chunk_list_ends[id] == NULL) {
chunk_list_ends[id] =
MuxGetChunkListFromId(mux, id); // List to add this chunk.