summaryrefslogtreecommitdiff
path: root/test/unit/unicode_test.cc
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2023-12-21 00:49:37 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2023-12-30 01:37:14 +0100
commit674e603e5575be906ae2926da3f94918f61700fb (patch)
treeac1656f03a66e00a686ffd4c62266bd9a87d5305 /test/unit/unicode_test.cc
parentc277f8d6a6714080194d451a69eda4e42aecdbe8 (diff)
Fix unicode_test infinite loop
Diffstat (limited to 'test/unit/unicode_test.cc')
-rw-r--r--test/unit/unicode_test.cc25
1 files changed, 22 insertions, 3 deletions
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 <sgeerken@dillo.org>
+ * Copyright 2023 Rodrigo Arias Mallo <rodarima@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
#include <string.h>
#include <stdio.h>
#include <FL/fl_utf8.h>
-#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)));