summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/utf8proc/test/tests.c
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2021-10-09 12:16:17 +1100
committer GitHub <noreply@github.com>2021-10-09 12:16:17 +1100
commit38082ccbee749d650ccea886ae376a5d1dec337c (patch)
tree9ba9a900ba826bda58832834278025ced17f42f5 /3rdparty/utf8proc/test/tests.c
parent34b3bf701098082feb9077db49987507962c1578 (diff)
Overdue internal UI enhancements (#8674)
* frontend: Added support for message context to localisations. * frontend: Added string_view versions of the message lookup functions. * frontend: Added a few more folder options to the internal UI. * emu/softlist.cpp: Use more appropriate containers. * Switched to Python 3 by default - this will become a requirement. * Updated msgfmt.py for message context support. * frontend: Show all software item info in the internal UI. * frontend: Search alternate titles in software selection menu. * 3rdparty/utf8proc: Updated to v2.6.1 (has several fixes). * frontend: Added software filters for common info fields. * frontend: Allow UI manager to hold onto persistent session data. * frontend: Cache software lists for eight machines. * frontend: Added support for loading localised system names. * frontend: Add UI for selecting localised system names.
Diffstat (limited to '3rdparty/utf8proc/test/tests.c')
-rw-r--r--3rdparty/utf8proc/test/tests.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/3rdparty/utf8proc/test/tests.c b/3rdparty/utf8proc/test/tests.c
index 0fb0da36305..629edfff373 100644
--- a/3rdparty/utf8proc/test/tests.c
+++ b/3rdparty/utf8proc/test/tests.c
@@ -17,7 +17,7 @@ void check(int cond, const char *format, ...)
}
}
-size_t skipspaces(const char *buf, size_t i)
+size_t skipspaces(const unsigned char *buf, size_t i)
{
while (isspace(buf[i])) ++i;
return i;
@@ -27,7 +27,7 @@ size_t skipspaces(const char *buf, size_t i)
separated by whitespace, and terminated by any character not in
[0-9a-fA-F] or whitespace, then stores the corresponding utf8 string
in dest, returning the number of bytes read from buf */
-size_t encode(char *dest, const char *buf)
+size_t encode(unsigned char *dest, const unsigned char *buf)
{
size_t i = 0, j, d = 0;
for (;;) {
@@ -39,8 +39,20 @@ size_t encode(char *dest, const char *buf)
dest[d] = 0; /* NUL-terminate destination string */
return i + 1;
}
- check(sscanf(buf + i, "%x", (unsigned int *)&c) == 1, "invalid hex input %s", buf+i);
+ check(sscanf((char *) (buf + i), "%x", (unsigned int *)&c) == 1, "invalid hex input %s", buf+i);
i = j; /* skip to char after hex input */
d += utf8proc_encode_char(c, (utf8proc_uint8_t *) (dest + d));
}
}
+
+/* simplistic, portable replacement for getline, sufficient for our tests */
+size_t simple_getline(unsigned char buf[8192], FILE *f) {
+ size_t i = 0;
+ while (i < 8191) {
+ int c = getc(f);
+ if (c == EOF || c == '\n') break;
+ buf[i++] = (unsigned char) c;
+ }
+ buf[i] = 0;
+ return i;
+}