From 8b232dc44464a70b53c3b6e1616de21b52e13e67 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Thu, 30 Dec 2021 21:48:43 +0100 Subject: Add pointless likelihood macros --- fiv-io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fiv-io.c b/fiv-io.c index e82265d..2faecb1 100644 --- a/fiv-io.c +++ b/fiv-io.c @@ -1004,7 +1004,7 @@ parse_jpeg_metadata(cairo_surface_t *surface, const gchar *data, gsize len) // Do not bother validating the structure. guint16 length = p[0] << 8 | p[1]; const guint8 *payload = p + 2; - if ((p += length) > end) + if (G_UNLIKELY((p += length) > end)) break; // https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf 4.7.2 @@ -2726,8 +2726,8 @@ fiv_io_exif_orientation(const guint8 *tiff, gsize len) for (const guint8 *p = ifd0 + 2; fields-- && p + 12 <= end; p += 12) { uint16_t tag = u16(p), type = u16(p + 2), value16 = u16(p + 8); uint32_t count = u32(p + 4); - if (tag == Orientation && type == SHORT && count == 1 && - value16 >= 1 && value16 <= 8) + if (G_UNLIKELY(tag == Orientation && type == SHORT && count == 1 && + value16 >= 1 && value16 <= 8)) return value16; } return FivIoOrientationUnknown; -- cgit v1.2.3-70-g09d2