mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-28 23:03:20 +02:00
anim_diff: normalize ok = ... && ok
statements
`ok &= ...` is more common in the codebase than `ok = ... && ok` when accumulating a result while unconditionally executing functions. (`ok = ok &&` is used in cases that should short circuit.) In this case multiple checks may fail and their error messages may aid in debugging. This will also improve the formatting when clang-format is applied to the codebase. Bug: 433996651 Change-Id: Ie4e2908b857122d90f6e93f06b10cb48dc86b18e
This commit is contained in:
@@ -137,12 +137,12 @@ static int CompareAnimatedImagePair(const AnimatedImage* const img1,
|
|||||||
const int is_multi_frame_image = (img1->num_frames > 1);
|
const int is_multi_frame_image = (img1->num_frames > 1);
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
ok = CompareValues(img1->canvas_width, img2->canvas_width,
|
ok &= CompareValues(img1->canvas_width, img2->canvas_width,
|
||||||
"Canvas width mismatch") && ok;
|
"Canvas width mismatch");
|
||||||
ok = CompareValues(img1->canvas_height, img2->canvas_height,
|
ok &= CompareValues(img1->canvas_height, img2->canvas_height,
|
||||||
"Canvas height mismatch") && ok;
|
"Canvas height mismatch");
|
||||||
ok = CompareValues(img1->num_frames, img2->num_frames,
|
ok &= CompareValues(img1->num_frames, img2->num_frames,
|
||||||
"Frame count mismatch") && ok;
|
"Frame count mismatch");
|
||||||
if (!ok) return 0; // These are fatal failures, can't proceed.
|
if (!ok) return 0; // These are fatal failures, can't proceed.
|
||||||
|
|
||||||
if (is_multi_frame_image) { // Checks relevant for multi-frame images only.
|
if (is_multi_frame_image) { // Checks relevant for multi-frame images only.
|
||||||
@@ -155,11 +155,10 @@ static int CompareAnimatedImagePair(const AnimatedImage* const img1,
|
|||||||
img2->format == ANIM_GIF && img2->loop_count == 65536)) {
|
img2->format == ANIM_GIF && img2->loop_count == 65536)) {
|
||||||
max_loop_count_workaround = 1;
|
max_loop_count_workaround = 1;
|
||||||
}
|
}
|
||||||
ok = (max_loop_count_workaround ||
|
ok &= (max_loop_count_workaround ||
|
||||||
CompareValues(img1->loop_count, img2->loop_count,
|
CompareValues(img1->loop_count, img2->loop_count,
|
||||||
"Loop count mismatch")) && ok;
|
"Loop count mismatch"));
|
||||||
ok = CompareBackgroundColor(img1->bgcolor, img2->bgcolor,
|
ok &= CompareBackgroundColor(img1->bgcolor, img2->bgcolor, premultiply);
|
||||||
premultiply) && ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < img1->num_frames; ++i) {
|
for (i = 0; i < img1->num_frames; ++i) {
|
||||||
|
Reference in New Issue
Block a user