/* $OpenLDAP$ */
-/*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2007 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
-/*
- * Copyright 2001 Computing Research Labs, New Mexico State University
+/* Copyright 2001 Computing Research Labs, New Mexico State University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "ldap_config.h"
#include <stdio.h>
-#include <ac/bytes.h>
#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/unistd.h>
+#include <ac/bytes.h>
+#include "lber_pvt.h"
#include "ucdata.h"
+#ifndef HARDCODE_DATA
+#define HARDCODE_DATA 1
+#endif
+
+#if HARDCODE_DATA
+#include "uctable.h"
+#endif
+
/**************************************************************************
*
* Miscellaneous types, data, and support functions.
**************************************************************************/
typedef struct {
- ac_uint4 bom;
- ac_uint4 cnt;
+ ac_uint2 bom;
+ ac_uint2 cnt;
union {
ac_uint4 bytes;
ac_uint2 len[2];
/*
* A simple array of 32-bit masks for lookup.
*/
-static unsigned long masks32[32] = {
+static ac_uint4 masks32[32] = {
0x00000001UL, 0x00000002UL, 0x00000004UL, 0x00000008UL,
0x00000010UL, 0x00000020UL, 0x00000040UL, 0x00000080UL,
0x00000100UL, 0x00000200UL, 0x00000400UL, 0x00000800UL,
#define endian_long(cc) ((((cc) & 0xff) << 24)|((((cc) >> 8) & 0xff) << 16)|\
((((cc) >> 16) & 0xff) << 8)|((cc) >> 24))
+#if !HARDCODE_DATA
static FILE *
_ucopenfile(char *paths, char *filename, char *mode)
{
return 0;
}
+#endif
/**************************************************************************
*
*
**************************************************************************/
-static unsigned long _ucprop_size;
-static unsigned short *_ucprop_offsets;
-static unsigned long *_ucprop_ranges;
+#if !HARDCODE_DATA
+
+static ac_uint4 _ucprop_size;
+static ac_uint2 *_ucprop_offsets;
+static ac_uint4 *_ucprop_ranges;
/*
* Return -1 on error, 0 if okay
_ucprop_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_ucprop_size > 0) {
/*
* Allocate all the storage needed for the lookup table.
*/
- _ucprop_offsets = (unsigned short *) malloc(hdr.size.bytes);
+ _ucprop_offsets = (ac_uint2 *) malloc(hdr.size.bytes);
/*
* Calculate the offset into the storage for the ranges. The offsets
* the header count field. This means the offset to the ranges must be
* calculated after aligning the count to a 4-byte boundary.
*/
- if ((size = ((hdr.cnt + 1) * sizeof(unsigned short))) & 3)
+ if ((size = ((hdr.cnt + 1) * sizeof(ac_uint2))) & 3)
size += 4 - (size & 3);
size >>= 1;
- _ucprop_ranges = (unsigned long *) (_ucprop_offsets + size);
+ _ucprop_ranges = (ac_uint4 *) (_ucprop_offsets + size);
/*
* Load the offset array.
*/
- fread((char *) _ucprop_offsets, sizeof(unsigned short), size, in);
+ fread((char *) _ucprop_offsets, sizeof(ac_uint2), size, in);
/*
* Do an endian swap if necessary. Don't forget there is an extra node on
* Load the ranges. The number of elements is in the last array position
* of the offsets.
*/
- fread((char *) _ucprop_ranges, sizeof(unsigned long),
+ fread((char *) _ucprop_ranges, sizeof(ac_uint4),
_ucprop_offsets[_ucprop_size], in);
fclose(in);
free((char *) _ucprop_offsets);
_ucprop_size = 0;
}
+#endif
static int
-_ucprop_lookup(unsigned long code, unsigned long n)
+_ucprop_lookup(ac_uint4 code, ac_uint4 n)
{
long l, r, m;
}
int
-ucisprop(unsigned long code, unsigned long mask1, unsigned long mask2)
+ucisprop(ac_uint4 code, ac_uint4 mask1, ac_uint4 mask2)
{
- unsigned long i;
+ ac_uint4 i;
if (mask1 == 0 && mask2 == 0)
return 0;
*
**************************************************************************/
-static unsigned long _uccase_size;
-static unsigned short _uccase_len[2];
-static unsigned long *_uccase_map;
+#if !HARDCODE_DATA
+
+/* These record the number of slots in the map.
+ * There are 3 words per slot.
+ */
+static ac_uint4 _uccase_size;
+static ac_uint2 _uccase_len[2];
+static ac_uint4 *_uccase_map;
/*
* Return -1 on error, 0 if okay
_uccase_load(char *paths, int reload)
{
FILE *in;
- unsigned long i;
+ ac_uint4 i;
_ucheader_t hdr;
if (_uccase_size > 0) {
* Set the node count and lengths of the upper and lower case mapping
* tables.
*/
- _uccase_size = hdr.cnt * 3;
- _uccase_len[0] = hdr.size.len[0] * 3;
- _uccase_len[1] = hdr.size.len[1] * 3;
+ _uccase_size = hdr.cnt;
+ _uccase_len[0] = hdr.size.len[0];
+ _uccase_len[1] = hdr.size.len[1];
- _uccase_map = (unsigned long *)
- malloc(_uccase_size * sizeof(unsigned long));
+ _uccase_map = (ac_uint4 *)
+ malloc(_uccase_size * 3 * sizeof(ac_uint4));
/*
* Load the case mapping table.
*/
- fread((char *) _uccase_map, sizeof(unsigned long), _uccase_size, in);
+ fread((char *) _uccase_map, sizeof(ac_uint4), _uccase_size * 3, in);
/*
* Do an endian swap if necessary.
*/
if (hdr.bom == 0xfffe) {
- for (i = 0; i < _uccase_size; i++)
+ for (i = 0; i < _uccase_size * 3; i++)
_uccase_map[i] = endian_long(_uccase_map[i]);
}
fclose(in);
free((char *) _uccase_map);
_uccase_size = 0;
}
+#endif
-static unsigned long
-_uccase_lookup(unsigned long code, long l, long r, int field)
+static ac_uint4
+_uccase_lookup(ac_uint4 code, long l, long r, int field)
{
long m;
+ const ac_uint4 *tmp;
/*
* Do the binary search.
* the beginning of a case mapping triple.
*/
m = (l + r) >> 1;
- m -= (m % 3);
- if (code > _uccase_map[m])
- l = m + 3;
- else if (code < _uccase_map[m])
- r = m - 3;
- else if (code == _uccase_map[m])
- return _uccase_map[m + field];
+ tmp = &_uccase_map[m*3];
+ if (code > *tmp)
+ l = m + 1;
+ else if (code < *tmp)
+ r = m - 1;
+ else if (code == *tmp)
+ return tmp[field];
}
return code;
}
-unsigned long
-uctoupper(unsigned long code)
+ac_uint4
+uctoupper(ac_uint4 code)
{
int field;
long l, r;
*/
field = 2;
l = _uccase_len[0];
- r = (l + _uccase_len[1]) - 3;
+ r = (l + _uccase_len[1]) - 1;
} else {
/*
* The character is title case.
*/
field = 1;
l = _uccase_len[0] + _uccase_len[1];
- r = _uccase_size - 3;
+ r = _uccase_size - 1;
}
return _uccase_lookup(code, l, r, field);
}
-unsigned long
-uctolower(unsigned long code)
+ac_uint4
+uctolower(ac_uint4 code)
{
int field;
long l, r;
*/
field = 1;
l = 0;
- r = _uccase_len[0] - 3;
+ r = _uccase_len[0] - 1;
} else {
/*
* The character is title case.
*/
field = 2;
l = _uccase_len[0] + _uccase_len[1];
- r = _uccase_size - 3;
+ r = _uccase_size - 1;
}
return _uccase_lookup(code, l, r, field);
}
-unsigned long
-uctotitle(unsigned long code)
+ac_uint4
+uctotitle(ac_uint4 code)
{
int field;
long l, r;
* The character is upper case.
*/
l = 0;
- r = _uccase_len[0] - 3;
+ r = _uccase_len[0] - 1;
} else {
/*
* The character is lower case.
*/
l = _uccase_len[0];
- r = (l + _uccase_len[1]) - 3;
+ r = (l + _uccase_len[1]) - 1;
}
return _uccase_lookup(code, l, r, field);
}
*
**************************************************************************/
-static unsigned long _uccomp_size;
-static unsigned long *_uccomp_data;
+#if !HARDCODE_DATA
+
+static ac_uint4 _uccomp_size;
+static ac_uint4 *_uccomp_data;
/*
* Return -1 on error, 0 if okay
_uccomp_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_uccomp_size > 0) {
}
_uccomp_size = hdr.cnt;
- _uccomp_data = (unsigned long *) malloc(hdr.size.bytes);
+ _uccomp_data = (ac_uint4 *) malloc(hdr.size.bytes);
/*
* Read the composition data in.
*/
- size = hdr.size.bytes / sizeof(unsigned long);
- fread((char *) _uccomp_data, sizeof(unsigned long), size, in);
+ size = hdr.size.bytes / sizeof(ac_uint4);
+ fread((char *) _uccomp_data, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
free((char *) _uccomp_data);
_uccomp_size = 0;
}
+#endif
int
-uccomp(unsigned long node1, unsigned long node2, unsigned long *comp)
+uccomp(ac_uint4 node1, ac_uint4 node2, ac_uint4 *comp)
{
int l, r, m;
}
int
-uccomp_hangul(unsigned long *str, int len)
+uccomp_hangul(ac_uint4 *str, int len)
{
const int SBase = 0xAC00, LBase = 0x1100,
VBase = 0x1161, TBase = 0x11A7,
SCount = LCount * NCount; /* 11172 */
int i, rlen;
- unsigned long ch, last, lindex, sindex;
+ ac_uint4 ch, last, lindex, sindex;
last = str[0];
rlen = 1;
/* check if two current characters are L and V */
lindex = last - LBase;
- if (lindex < (unsigned long) LCount) {
- unsigned long vindex = ch - VBase;
- if (vindex < (unsigned long) VCount) {
+ if (lindex < (ac_uint4) LCount) {
+ ac_uint4 vindex = ch - VBase;
+ if (vindex < (ac_uint4) VCount) {
/* make syllable of form LV */
last = SBase + (lindex * VCount + vindex) * TCount;
str[rlen-1] = last; /* reset last */
/* check if two current characters are LV and T */
sindex = last - SBase;
- if (sindex < (unsigned long) SCount
+ if (sindex < (ac_uint4) SCount
&& (sindex % TCount) == 0)
{
- unsigned long tindex = ch - TBase;
- if (tindex <= (unsigned long) TCount) {
+ ac_uint4 tindex = ch - TBase;
+ if (tindex <= (ac_uint4) TCount) {
/* make syllable of form LVT */
last += tindex;
str[rlen-1] = last; /* reset last */
}
int
-uccanoncomp(unsigned long *str, int len)
+uccanoncomp(ac_uint4 *str, int len)
{
int i, stpos, copos;
- unsigned long cl, prevcl, st, ch, co;
+ ac_uint4 cl, prevcl, st, ch, co;
st = str[0];
stpos = 0;
*
**************************************************************************/
-static unsigned long _ucdcmp_size;
-static unsigned long *_ucdcmp_nodes;
-static unsigned long *_ucdcmp_decomp;
+#if !HARDCODE_DATA
+
+static ac_uint4 _ucdcmp_size;
+static ac_uint4 *_ucdcmp_nodes;
+static ac_uint4 *_ucdcmp_decomp;
-static unsigned long _uckdcmp_size;
-static unsigned long *_uckdcmp_nodes;
-static unsigned long *_uckdcmp_decomp;
+static ac_uint4 _uckdcmp_size;
+static ac_uint4 *_uckdcmp_nodes;
+static ac_uint4 *_uckdcmp_decomp;
/*
* Return -1 on error, 0 if okay
_ucdcmp_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_ucdcmp_size > 0) {
}
_ucdcmp_size = hdr.cnt << 1;
- _ucdcmp_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _ucdcmp_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_ucdcmp_decomp = _ucdcmp_nodes + (_ucdcmp_size + 1);
/*
* Read the decomposition data in.
*/
- size = hdr.size.bytes / sizeof(unsigned long);
- fread((char *) _ucdcmp_nodes, sizeof(unsigned long), size, in);
+ size = hdr.size.bytes / sizeof(ac_uint4);
+ fread((char *) _ucdcmp_nodes, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
_uckdcmp_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_uckdcmp_size > 0) {
}
_uckdcmp_size = hdr.cnt << 1;
- _uckdcmp_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _uckdcmp_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_uckdcmp_decomp = _uckdcmp_nodes + (_uckdcmp_size + 1);
/*
* Read the decomposition data in.
*/
- size = hdr.size.bytes / sizeof(unsigned long);
- fread((char *) _uckdcmp_nodes, sizeof(unsigned long), size, in);
+ size = hdr.size.bytes / sizeof(ac_uint4);
+ fread((char *) _uckdcmp_nodes, sizeof(ac_uint4), size, in);
/*
* Do an endian swap if necessary.
free((char *) _uckdcmp_nodes);
_uckdcmp_size = 0;
}
+#endif
int
-ucdecomp(unsigned long code, unsigned long *num, unsigned long **decomp)
+ucdecomp(ac_uint4 code, ac_uint4 *num, ac_uint4 **decomp)
{
long l, r, m;
r = m - 2;
else if (code == _ucdcmp_nodes[m]) {
*num = _ucdcmp_nodes[m + 3] - _ucdcmp_nodes[m + 1];
- *decomp = &_ucdcmp_decomp[_ucdcmp_nodes[m + 1]];
+ *decomp = (ac_uint4*)&_ucdcmp_decomp[_ucdcmp_nodes[m + 1]];
return 1;
}
}
}
int
-uckdecomp(unsigned long code, unsigned long *num, unsigned long **decomp)
+uckdecomp(ac_uint4 code, ac_uint4 *num, ac_uint4 **decomp)
{
long l, r, m;
r = m - 2;
else if (code == _uckdcmp_nodes[m]) {
*num = _uckdcmp_nodes[m + 3] - _uckdcmp_nodes[m + 1];
- *decomp = &_uckdcmp_decomp[_uckdcmp_nodes[m + 1]];
+ *decomp = (ac_uint4*)&_uckdcmp_decomp[_uckdcmp_nodes[m + 1]];
return 1;
}
}
}
int
-ucdecomp_hangul(unsigned long code, unsigned long *num, unsigned long decomp[])
+ucdecomp_hangul(ac_uint4 code, ac_uint4 *num, ac_uint4 decomp[])
{
if (!ucishangul(code))
return 0;
code -= 0xac00;
- decomp[0] = 0x1100 + (unsigned long) (code / 588);
- decomp[1] = 0x1161 + (unsigned long) ((code % 588) / 28);
- decomp[2] = 0x11a7 + (unsigned long) (code % 28);
+ decomp[0] = 0x1100 + (ac_uint4) (code / 588);
+ decomp[1] = 0x1161 + (ac_uint4) ((code % 588) / 28);
+ decomp[2] = 0x11a7 + (ac_uint4) (code % 28);
*num = (decomp[2] != 0x11a7) ? 3 : 2;
return 1;
/* mode == 0 for canonical, mode == 1 for compatibility */
static int
-uccanoncompatdecomp(const unsigned long *in, int inlen,
- unsigned long **out, int *outlen, short mode)
+uccanoncompatdecomp(const ac_uint4 *in, int inlen,
+ ac_uint4 **out, int *outlen, short mode, void *ctx)
{
int l, size;
unsigned i, j, k;
- unsigned long num, class, *decomp, hangdecomp[3];
+ ac_uint4 num, class, *decomp, hangdecomp[3];
- size = inlen;
- *out = (unsigned long *) malloc(size * sizeof(**out));
+ size = inlen * 2;
+ *out = (ac_uint4 *) ber_memalloc_x(size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
if (mode ? uckdecomp(in[j], &num, &decomp) : ucdecomp(in[j], &num, &decomp)) {
if ( size - i < num) {
size = inlen + i - j + num - 1;
- *out = (unsigned long *) realloc(*out, size * sizeof(**out));
+ *out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx );
if (*out == NULL)
return *outlen = -1;
}
} else if (ucdecomp_hangul(in[j], &num, hangdecomp)) {
if (size - i < num) {
size = inlen + i - j + num - 1;
- *out = (unsigned long *) realloc(*out, size * sizeof(**out));
+ *out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
}
} else {
if (size - i < 1) {
size = inlen + i - j;
- *out = (unsigned long *) realloc(*out, size * sizeof(**out));
+ *out = (ac_uint4 *) ber_memrealloc_x(*out, size * sizeof(**out), ctx);
if (*out == NULL)
return *outlen = -1;
}
}
int
-uccanondecomp(const unsigned long *in, int inlen,
- unsigned long **out, int *outlen)
+uccanondecomp(const ac_uint4 *in, int inlen,
+ ac_uint4 **out, int *outlen, void *ctx)
{
- return uccanoncompatdecomp(in, inlen, out, outlen, 0);
+ return uccanoncompatdecomp(in, inlen, out, outlen, 0, ctx);
}
int
-uccompatdecomp(const unsigned long *in, int inlen,
- unsigned long **out, int *outlen)
+uccompatdecomp(const ac_uint4 *in, int inlen,
+ ac_uint4 **out, int *outlen, void *ctx)
{
- return uccanoncompatdecomp(in, inlen, out, outlen, 1);
+ return uccanoncompatdecomp(in, inlen, out, outlen, 1, ctx);
}
/**************************************************************************
*
**************************************************************************/
-static unsigned long _uccmcl_size;
-static unsigned long *_uccmcl_nodes;
+#if !HARDCODE_DATA
+static ac_uint4 _uccmcl_size;
+static ac_uint4 *_uccmcl_nodes;
/*
* Return -1 on error, 0 if okay
_uccmcl_load(char *paths, int reload)
{
FILE *in;
- unsigned long i;
+ ac_uint4 i;
_ucheader_t hdr;
if (_uccmcl_size > 0) {
}
_uccmcl_size = hdr.cnt * 3;
- _uccmcl_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _uccmcl_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
/*
* Read the combining classes in.
*/
- fread((char *) _uccmcl_nodes, sizeof(unsigned long), _uccmcl_size, in);
+ fread((char *) _uccmcl_nodes, sizeof(ac_uint4), _uccmcl_size, in);
/*
* Do an endian swap if necessary.
free((char *) _uccmcl_nodes);
_uccmcl_size = 0;
}
+#endif
-unsigned long
-uccombining_class(unsigned long code)
+ac_uint4
+uccombining_class(ac_uint4 code)
{
long l, r, m;
*
**************************************************************************/
-static unsigned long *_ucnum_nodes;
-static unsigned long _ucnum_size;
+#if !HARDCODE_DATA
+static ac_uint4 *_ucnum_nodes;
+static ac_uint4 _ucnum_size;
static short *_ucnum_vals;
/*
_ucnumb_load(char *paths, int reload)
{
FILE *in;
- unsigned long size, i;
+ ac_uint4 size, i;
_ucheader_t hdr;
if (_ucnum_size > 0) {
}
_ucnum_size = hdr.cnt;
- _ucnum_nodes = (unsigned long *) malloc(hdr.size.bytes);
+ _ucnum_nodes = (ac_uint4 *) malloc(hdr.size.bytes);
_ucnum_vals = (short *) (_ucnum_nodes + _ucnum_size);
/*
* Determine the number of values that have to be adjusted.
*/
size = (hdr.size.bytes -
- (_ucnum_size * (sizeof(unsigned long) << 1))) /
+ (_ucnum_size * (sizeof(ac_uint4) << 1))) /
sizeof(short);
for (i = 0; i < size; i++)
free((char *) _ucnum_nodes);
_ucnum_size = 0;
}
+#endif
int
-ucnumber_lookup(unsigned long code, struct ucnumber *num)
+ucnumber_lookup(ac_uint4 code, struct ucnumber *num)
{
long l, r, m;
short *vp;
else if (code < _ucnum_nodes[m])
r = m - 2;
else {
- vp = _ucnum_vals + _ucnum_nodes[m + 1];
+ vp = (short *)_ucnum_vals + _ucnum_nodes[m + 1];
num->numerator = (int) *vp++;
num->denominator = (int) *vp;
return 1;
}
int
-ucdigit_lookup(unsigned long code, int *digit)
+ucdigit_lookup(ac_uint4 code, int *digit)
{
long l, r, m;
short *vp;
else if (code < _ucnum_nodes[m])
r = m - 2;
else {
- vp = _ucnum_vals + _ucnum_nodes[m + 1];
+ vp = (short *)_ucnum_vals + _ucnum_nodes[m + 1];
if (*vp == *(vp + 1)) {
*digit = *vp;
return 1;
}
struct ucnumber
-ucgetnumber(unsigned long code)
+ucgetnumber(ac_uint4 code)
{
struct ucnumber num;
}
int
-ucgetdigit(unsigned long code)
+ucgetdigit(ac_uint4 code)
{
int dig;
*
**************************************************************************/
+#if HARDCODE_DATA
+int ucdata_load(char *paths, int masks) { return 0; }
+void ucdata_unload(int masks) { }
+int ucdata_reload(char *paths, int masks) { return 0; }
+#else
/*
* Return 0 if okay, negative on error
*/
return -error;
}
+#endif
#ifdef TEST
main(void)
{
int dig;
- unsigned long i, lo, *dec;
+ ac_uint4 i, lo, *dec;
struct ucnumber num;
- ucdata_setup(".");
+/* ucdata_setup("."); */
if (ucisweak(0x30))
printf("WEAK\n");
printf("0x10000 NOT DEFINED\n");
if (ucnumber_lookup(0x30, &num)) {
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0x30 = %d\n", num.numerator);
printf("UCNUMBER: 0x30 NOT A NUMBER\n");
if (ucnumber_lookup(0xbc, &num)) {
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0xbc = %d\n", num.numerator);
if (ucnumber_lookup(0xff19, &num)) {
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0xff19 = %d\n", num.numerator);
printf("UCNUMBER: 0xff19 NOT A NUMBER\n");
if (ucnumber_lookup(0x4e00, &num)) {
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCNUMBER: 0x4e00 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0x4e00 = %d\n", num.numerator);
printf("UCGETDIGIT: 0x969 = %d\n", dig);
num = ucgetnumber(0x30);
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCGETNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0x30 = %d\n", num.numerator);
num = ucgetnumber(0xbc);
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCGETNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0xbc = %d\n", num.numerator);
num = ucgetnumber(0xff19);
- if (num.numerator != num.denominator)
+ if (num.denominator != 1)
printf("UCGETNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0xff19 = %d\n", num.numerator);
- ucdata_cleanup();
+/* ucdata_cleanup(); */
exit(0);
}