summaryrefslogtreecommitdiff
path: root/source/fitz/ucdn.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-08-25 11:29:50 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-09-01 10:38:56 +0200
commitb669c925dd5eca8f514bad92b42d41821d2d0be7 (patch)
treef35b6313e14c5f4299d3069537cca65842061ef8 /source/fitz/ucdn.c
parent8de9a416c4df45968ceb8b2119c7f40838514127 (diff)
downloadmupdf-b669c925dd5eca8f514bad92b42d41821d2d0be7.tar.xz
Update UCDN database.
Diffstat (limited to 'source/fitz/ucdn.c')
-rw-r--r--source/fitz/ucdn.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/source/fitz/ucdn.c b/source/fitz/ucdn.c
index 1bbdfb3c..59d49487 100644
--- a/source/fitz/ucdn.c
+++ b/source/fitz/ucdn.c
@@ -14,10 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "mupdf/fitz/ucdn.h"
+#include "mupdf/fitz.h"
typedef struct {
unsigned char category;
@@ -51,7 +48,7 @@ typedef struct {
#define TCOUNT 28
#define NCOUNT (VCOUNT * TCOUNT)
-static const UCDRecord *get_ucd_record(unsigned int code)
+static const UCDRecord *get_ucd_record(uint32_t code)
{
int index, offset;
@@ -68,7 +65,7 @@ static const UCDRecord *get_ucd_record(unsigned int code)
return &ucd_records[index];
}
-static const unsigned short *get_decomp_record(unsigned int code)
+static const unsigned short *get_decomp_record(uint32_t code)
{
int index, offset;
@@ -86,7 +83,7 @@ static const unsigned short *get_decomp_record(unsigned int code)
return &decomp_data[index];
}
-static int get_comp_index(unsigned int code, const Reindex *idx)
+static int get_comp_index(uint32_t code, const Reindex *idx)
{
int i;
@@ -109,7 +106,7 @@ static int compare_mp(const void *a, const void *b)
return mpa->from - mpb->from;
}
-static int hangul_pair_decompose(unsigned int code, unsigned int *a, unsigned int *b)
+static int hangul_pair_decompose(uint32_t code, uint32_t *a, uint32_t *b)
{
int si = code - SBASE;
@@ -129,7 +126,7 @@ static int hangul_pair_decompose(unsigned int code, unsigned int *a, unsigned in
}
}
-static int hangul_pair_compose(unsigned int *code, unsigned int a, unsigned int b)
+static int hangul_pair_compose(uint32_t *code, uint32_t a, uint32_t b)
{
if (b < VBASE || b >= (TBASE + TCOUNT))
return 0;
@@ -151,17 +148,17 @@ static int hangul_pair_compose(unsigned int *code, unsigned int a, unsigned int
}
}
-static unsigned int decode_utf16(const unsigned short **code_ptr)
+static uint32_t decode_utf16(const unsigned short **code_ptr)
{
const unsigned short *code = *code_ptr;
if ((code[0] & 0xd800) != 0xd800) {
*code_ptr += 1;
- return (unsigned int)code[0];
+ return (uint32_t)code[0];
} else {
*code_ptr += 2;
- return 0x10000 + ((unsigned int)code[1] - 0xdc00) +
- (((unsigned int)code[0] - 0xd800) << 10);
+ return 0x10000 + ((uint32_t)code[1] - 0xdc00) +
+ (((uint32_t)code[0] - 0xd800) << 10);
}
}
@@ -170,37 +167,37 @@ const char *ucdn_get_unicode_version(void)
return UNIDATA_VERSION;
}
-int ucdn_get_combining_class(unsigned int code)
+int ucdn_get_combining_class(uint32_t code)
{
return get_ucd_record(code)->combining;
}
-int ucdn_get_east_asian_width(unsigned int code)
+int ucdn_get_east_asian_width(uint32_t code)
{
return get_ucd_record(code)->east_asian_width;
}
-int ucdn_get_general_category(unsigned int code)
+int ucdn_get_general_category(uint32_t code)
{
return get_ucd_record(code)->category;
}
-int ucdn_get_bidi_class(unsigned int code)
+int ucdn_get_bidi_class(uint32_t code)
{
return get_ucd_record(code)->bidi_class;
}
-int ucdn_get_mirrored(unsigned int code)
+int ucdn_get_mirrored(uint32_t code)
{
return get_ucd_record(code)->mirrored;
}
-int ucdn_get_script(unsigned int code)
+int ucdn_get_script(uint32_t code)
{
return get_ucd_record(code)->script;
}
-unsigned int ucdn_mirror(unsigned int code)
+uint32_t ucdn_mirror(uint32_t code)
{
MirrorPair mp = {0};
MirrorPair *res;
@@ -208,7 +205,7 @@ unsigned int ucdn_mirror(unsigned int code)
if (get_ucd_record(code)->mirrored == 0)
return code;
- mp.from = (unsigned short)code;
+ mp.from = code;
res = bsearch(&mp, mirror_pairs, BIDI_MIRROR_LEN, sizeof(MirrorPair),
compare_mp);
@@ -218,7 +215,7 @@ unsigned int ucdn_mirror(unsigned int code)
return res->to;
}
-int ucdn_decompose(unsigned int code, unsigned int *a, unsigned int *b)
+int ucdn_decompose(uint32_t code, uint32_t *a, uint32_t *b)
{
const unsigned short *rec;
int len;
@@ -242,7 +239,7 @@ int ucdn_decompose(unsigned int code, unsigned int *a, unsigned int *b)
return 1;
}
-int ucdn_compose(unsigned int *code, unsigned int a, unsigned int b)
+int ucdn_compose(uint32_t *code, uint32_t a, uint32_t b)
{
int l, r, index, indexi, offset;
@@ -265,7 +262,7 @@ int ucdn_compose(unsigned int *code, unsigned int a, unsigned int b)
return *code != 0;
}
-int ucdn_compat_decompose(unsigned int code, unsigned int *decomposed)
+int ucdn_compat_decompose(uint32_t code, uint32_t *decomposed)
{
int i, len;
const unsigned short *rec = get_decomp_record(code);