From 674e603e5575be906ae2926da3f94918f61700fb Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 21 Dec 2023 00:49:37 +0100 Subject: Fix unicode_test infinite loop --- test/unit/unicode_test.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'test/unit/unicode_test.cc') diff --git a/test/unit/unicode_test.cc b/test/unit/unicode_test.cc index 7c079305..0824cdd0 100644 --- a/test/unit/unicode_test.cc +++ b/test/unit/unicode_test.cc @@ -1,7 +1,27 @@ +/* + * File: unicode_test.cc + * + * Copyright 2012 Sebastian Geerken + * Copyright 2023 Rodrigo Arias Mallo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include -#include "../lout/unicode.hh" +#include "lout/unicode.hh" using namespace lout::unicode; @@ -30,8 +50,7 @@ int main (int argc, char *argv[]) decodeUtf8(s, t2len - (s - t2))); puts ("===== Fltk, not 0-terminated ====="); - for (const char *s = t2; *s; - s - t2 < t2len && (s = fl_utf8fwd (s + 1, t2, t2 + t2len))) + for (const char *s = t2; s - t2 < t2len; s = fl_utf8fwd (s + 1, t2, t2 + t2len)) printf ("%3d -> U+%04x\n", (int)(s - t2), decodeUtf8(s, t2len - (s - t2))); -- cgit v1.2.3