mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 07:12:05 +02:00
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:
@@ -235,33 +235,33 @@ int main(int argc, const char* argv[]) {
|
||||
format = RAW_YUV;
|
||||
} else if (!strcmp(argv[c], "-pixel_format") && c < argc - 1) {
|
||||
const char* const fmt = argv[++c];
|
||||
if (!strcmp(fmt, "RGB"))
|
||||
if (!strcmp(fmt, "RGB")) {
|
||||
format = RGB;
|
||||
else if (!strcmp(fmt, "RGBA"))
|
||||
} else if (!strcmp(fmt, "RGBA")) {
|
||||
format = RGBA;
|
||||
else if (!strcmp(fmt, "BGR"))
|
||||
} else if (!strcmp(fmt, "BGR")) {
|
||||
format = BGR;
|
||||
else if (!strcmp(fmt, "BGRA"))
|
||||
} else if (!strcmp(fmt, "BGRA")) {
|
||||
format = BGRA;
|
||||
else if (!strcmp(fmt, "ARGB"))
|
||||
} else if (!strcmp(fmt, "ARGB")) {
|
||||
format = ARGB;
|
||||
else if (!strcmp(fmt, "RGBA_4444"))
|
||||
} else if (!strcmp(fmt, "RGBA_4444")) {
|
||||
format = RGBA_4444;
|
||||
else if (!strcmp(fmt, "RGB_565"))
|
||||
} else if (!strcmp(fmt, "RGB_565")) {
|
||||
format = RGB_565;
|
||||
else if (!strcmp(fmt, "rgbA"))
|
||||
} else if (!strcmp(fmt, "rgbA")) {
|
||||
format = rgbA;
|
||||
else if (!strcmp(fmt, "bgrA"))
|
||||
} else if (!strcmp(fmt, "bgrA")) {
|
||||
format = bgrA;
|
||||
else if (!strcmp(fmt, "Argb"))
|
||||
} else if (!strcmp(fmt, "Argb")) {
|
||||
format = Argb;
|
||||
else if (!strcmp(fmt, "rgbA_4444"))
|
||||
} else if (!strcmp(fmt, "rgbA_4444")) {
|
||||
format = rgbA_4444;
|
||||
else if (!strcmp(fmt, "YUV"))
|
||||
} else if (!strcmp(fmt, "YUV")) {
|
||||
format = YUV;
|
||||
else if (!strcmp(fmt, "YUVA"))
|
||||
} else if (!strcmp(fmt, "YUVA")) {
|
||||
format = YUVA;
|
||||
else {
|
||||
} else {
|
||||
fprintf(stderr, "Can't parse pixel_format %s\n", fmt);
|
||||
parse_error = 1;
|
||||
}
|
||||
|
@@ -121,11 +121,12 @@ static uint16_t FromLinearSrgb(uint32_t value, int bit_depth) {
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
static WEBP_INLINE float Roundf(float x) {
|
||||
if (x < 0)
|
||||
if (x < 0) {
|
||||
return (float)ceil((double)(x - 0.5f));
|
||||
else
|
||||
} else {
|
||||
return (float)floor((double)(x + 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
static WEBP_INLINE float Powf(float base, float exp) {
|
||||
return (float)pow((double)base, (double)exp);
|
||||
|
@@ -355,23 +355,26 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Simple channel manipulations.
|
||||
|
@@ -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,9 +339,10 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Apply alpha value to rows
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user