From: Darrick J. Wong Date: Mon, 29 Jul 2024 23:23:09 +0000 (-0700) Subject: xfs_scrub: use proper UChar string iterators X-Git-Tag: v6.10.0~15^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd1b68a5262a5de3c1e83a9ded1ae5881fb368e2;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: use proper UChar string iterators For code that wants to examine a UChar string, use libicu's string iterators to walk UChar strings, instead of the open-coded U16_NEXT* macros that perform no typechecking. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/scrub/unicrash.c b/scrub/unicrash.c index dd301643..02a1b94e 100644 --- a/scrub/unicrash.c +++ b/scrub/unicrash.c @@ -330,13 +330,12 @@ name_entry_examine( struct name_entry *entry, unsigned int *badflags) { + UCharIterator uiter; UChar32 uchr; - int32_t i; uint8_t mask = 0; - for (i = 0; i < entry->normstrlen;) { - U16_NEXT_UNSAFE(entry->normstr, i, uchr); - + uiter_setString(&uiter, entry->normstr, entry->normstrlen); + while ((uchr = uiter_next32(&uiter)) != U_SENTINEL) { /* zero width character sequences */ switch (uchr) { case 0x200B: /* zero width space */