aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@smyrno.hos.anvin.org>2005-12-04 18:55:04 -0800
committerH. Peter Anvin <hpa@smyrno.hos.anvin.org>2005-12-04 18:55:04 -0800
commitf6d64d8c89c2048cdac0e854bc2208fbe413324d (patch)
tree4c9e08e6923aaf8bdc1c92df4291dcbac82a6289
parent50488e74f30eeaf8bb1aaae8f1e08252cd0b690b (diff)
downloadlibucd-f6d64d8c89c2048cdac0e854bc2208fbe413324d.tar.gz
Compilation fixes
-rw-r--r--libucd_int.h7
-rw-r--r--ucd.h2
-rw-r--r--ucslookup.c18
3 files changed, 16 insertions, 11 deletions
diff --git a/libucd_int.h b/libucd_int.h
index aa4354d..955607b 100644
--- a/libucd_int.h
+++ b/libucd_int.h
@@ -12,6 +12,9 @@
#include "int24.h"
#include "compiler.h"
+#define UCS_CNT 0x110000
+#define UCS_MAX (UCS_CNT-1)
+
extern const char _libucd_hangul_jamo_l[][4];
extern const char _libucd_hangul_jamo_v[][4];
extern const char _libucd_hangul_jamo_t[][4];
@@ -56,7 +59,7 @@ struct _libucd_nametoucs_tab {
};
extern const struct _libucd_nametoucs_tab _libucd_nametoucs_tab[];
-#define UCS_CNT 0x110000
-#define UCS_MAX (UCS_CNT-1)
+extern const unsigned char _libucd_names_list[];
+extern const char * const _libucd_nameslist_dict[256];
#endif
diff --git a/ucd.h b/ucd.h
index 36447f1..ebbc8f4 100644
--- a/ucd.h
+++ b/ucd.h
@@ -571,4 +571,6 @@ struct unicode_character_data {
enum unicode_line_break line_break;
};
+struct unicode_character_data *unicode_character_data(int32_t);
+
#endif /* UCD_H */
diff --git a/ucslookup.c b/ucslookup.c
index c38e162..3192080 100644
--- a/ucslookup.c
+++ b/ucslookup.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
+#include <stdio.h> /* For snprintf() */
#include <inttypes.h>
#include <errno.h>
#include "libucd_int.h"
@@ -16,8 +17,8 @@ libucd_mkname(char *buf, const unsigned char *nameslist_ptr)
{
const unsigned char *p = nameslist_ptr;
char *q = buf;
- uint8_t c;
- char *pp, cc;
+ const char *pp;
+ char cc;
int n = *p++; /* Characters remaining */
while ( n ) {
@@ -58,9 +59,9 @@ hangul_name(char *buf, size_t n, int32_t codepoint)
T = SIndex % TCount;
return snprintf(buf, n, "HANGUL SYLLABLE %s%s%s",
- libucd_hangul_jamo_l[L],
- libucd_hangul_jamo_v[V],
- libucd_hangul_jamo_t[T]);
+ _libucd_hangul_jamo_l[L],
+ _libucd_hangul_jamo_v[V],
+ _libucd_hangul_jamo_t[T]);
}
/*
@@ -76,7 +77,7 @@ search_prop_array(int32_t ucs)
h = _libucd_property_array_count-1;
for (;;) {
- m = (l+h) >> 2;
+ m = (l+h) >> 1;
pa = &_libucd_property_array[m];
if ( ucs >= pa[0].ucs ) {
if ( ucs < pa[1].ucs )
@@ -151,7 +152,6 @@ unicode_character_data(int32_t ucs)
const struct _libucd_property_array *prop;
size_t namelen;
struct unicode_character_data *ucd;
- char *nameptr;
if ( ucs < 0 || ucs > UCS_MAX ) {
errno = EINVAL;
@@ -163,7 +163,7 @@ unicode_character_data(int32_t ucs)
if ( hash >= PHASHNKEYS ) {
unt = NULL;
} else {
- unt = _libucd_ucstoname_tab[hash];
+ unt = &_libucd_ucstoname_tab[hash];
if ( getint24(unt->ucs) != ucs )
unt = NULL;
}
@@ -193,7 +193,7 @@ unicode_character_data(int32_t ucs)
ucd = alloc_copy_properties(prop, ucs, namelen);
if ( !ucd )
return NULL;
- snprintf((char *)ucd->name, namelen+1, "CJK UNIFIED IDEOGRAPH-%04X", ucd);
+ snprintf((char *)ucd->name, namelen+1, "CJK UNIFIED IDEOGRAPH-%04X", ucs);
} else {
/* Unnamed character */
namelen = -1;