From 1fa9b0c10931c5015fca73cdbe05799c3709f366 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 11 May 2021 13:12:35 +0900 Subject: [PATCH] flood_fill_seed: Add assertions --- lib/identify.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/identify.c b/lib/identify.c index 90f41ff..41b87dd 100644 --- a/lib/identify.c +++ b/lib/identify.c @@ -133,11 +133,12 @@ static void flood_fill_line(struct quirc *q, int x, int y, int right; int i; + row = q->pixels + y * q->w; + QUIRC_ASSERT(row[x] == from); + left = x; right = x; - row = q->pixels + y * q->w; - while (left > 0 && row[left - 1] == from) left--; @@ -163,6 +164,9 @@ static void flood_fill_seed(struct quirc *q, const struct quirc_flood_fill_vars *const last_vars = &stack[stack_size - 1]; + QUIRC_ASSERT(from != to); + QUIRC_ASSERT(q->pixels[y0 * q->w + x0] == from); + struct quirc_flood_fill_vars *vars; struct quirc_flood_fill_vars *next_vars; int i;