Prefix other C99 typedefs with utf8proc_

This commit is contained in:
Tony Kelman
2015-04-06 22:36:33 -07:00
parent ad27722923
commit 0a818c7003
7 changed files with 102 additions and 94 deletions

View File

@@ -5,7 +5,7 @@ int main(int argc, char **argv)
char *buf = NULL;
size_t bufsize = 0;
FILE *f = argc > 1 ? fopen(argv[1], "r") : NULL;
uint8_t src[1024];
utf8proc_uint8_t src[1024];
check(f != NULL, "error opening GraphemeBreakTest.txt");
while (getline(&buf, &bufsize, f) > 0) {
@@ -39,10 +39,10 @@ int main(int argc, char **argv)
src[si] = 0; /* NUL-terminate */
if (si) {
uint8_t utf8[1024]; /* copy src without 0xff grapheme separators */
utf8proc_uint8_t utf8[1024]; /* copy src without 0xff grapheme separators */
size_t i = 0, j = 0;
utf8proc_ssize_t glen;
uint8_t *g; /* utf8proc_map grapheme results */
utf8proc_uint8_t *g; /* utf8proc_map grapheme results */
while (i < si) {
if (src[i] != '/')
utf8[j++] = src[i++];

View File

@@ -1,7 +1,7 @@
#include "tests.h"
#define CHECK_NORM(NRM, norm, src) { \
char *src_norm = (char*) utf8proc_ ## NRM((uint8_t*) src); \
char *src_norm = (char*) utf8proc_ ## NRM((utf8proc_uint8_t*) src); \
check(!strcmp(norm, src_norm), \
"normalization failed for %s -> %s", src, norm); \
free(src_norm); \

View File

@@ -47,7 +47,7 @@ size_t encode(char *dest, const char *buf)
}
check(sscanf(buf + i, "%x", &c) == 1, "invalid hex input %s", buf+i);
i = j; /* skip to char after hex input */
d += utf8proc_encode_char(c, (uint8_t *) (dest + d));
d += utf8proc_encode_char(c, (utf8proc_uint8_t *) (dest + d));
} while (1);
}