#include <sys/stat.h>
#include <atalk/logger.h>
#include <errno.h>
-
-#include <netatalk/endian.h>
+#include <arpa/inet.h>
#include <atalk/unicode.h>
#include "precompose.h"
while (*s) {
if ((0xD800 <= *s) && (*s < 0xDC00)) {
if ((0xDC00 <= s[1]) && (s[1] < 0xE000)) {
- u_int32_t s_sp = (u_int32_t)*s << 16 | (u_int32_t)s[1];
- u_int32_t v_sp = tolower_sp(s_sp);
+ uint32_t s_sp = (uint32_t)*s << 16 | (uint32_t)s[1];
+ uint32_t v_sp = tolower_sp(s_sp);
if (v_sp != s_sp) {
*s = v_sp >> 16;
s++;
while (*s) {
if ((0xD800 <= *s) && (*s < 0xDC00)) {
if ((0xDC00 <= s[1]) && (s[1] < 0xE000)) {
- u_int32_t s_sp = (u_int32_t)*s << 16 | (u_int32_t)s[1];
- u_int32_t v_sp = toupper_sp(s_sp);
+ uint32_t s_sp = (uint32_t)*s << 16 | (uint32_t)s[1];
+ uint32_t v_sp = toupper_sp(s_sp);
if (v_sp != s_sp) {
*s = v_sp >> 16;
s++;
return ( c == tolower_w(c));
}
-int islower_sp(u_int32_t c_sp)
+int islower_sp(uint32_t c_sp)
{
return ( c_sp == tolower_sp(c_sp));
}
return ( c == toupper_w(c));
}
-int isupper_sp(u_int32_t c_sp)
+int isupper_sp(uint32_t c_sp)
{
return ( c_sp == toupper_sp(c_sp));
}
return NULL;
}
-ucs2_t *strcasechr_sp(const ucs2_t *s, u_int32_t c_sp)
+ucs2_t *strcasechr_sp(const ucs2_t *s, uint32_t c_sp)
{
if (*s == 0) return NULL;
while (s[1] != 0) {
- if (tolower_sp(c_sp) == tolower_sp((u_int32_t)*s << 16 | (u_int32_t)s[1])) return (ucs2_t *)s;
+ if (tolower_sp(c_sp) == tolower_sp((uint32_t)*s << 16 | (uint32_t)s[1])) return (ucs2_t *)s;
s++;
}
while (*a && *b) {
if ((0xD800 <= *a) && (*a < 0xDC00)) {
- if (ret = tolower_sp((u_int32_t)*a << 16 | (u_int32_t)a[1]) - tolower_sp((u_int32_t)*b << 16 | (u_int32_t)b[1])) return ret;
+ if (ret = tolower_sp((uint32_t)*a << 16 | (uint32_t)a[1]) - tolower_sp((uint32_t)*b << 16 | (uint32_t)b[1])) return ret;
a++;
b++;
if (!(*a && *b)) return (tolower_w(*a) - tolower_w(*b)); /* avoid buffer over run */
while ((n < len) && *a && *b) {
if ((0xD800 <= *a) && (*a < 0xDC00)) {
- if (ret = tolower_sp((u_int32_t)*a << 16 | (u_int32_t)a[1]) - tolower_sp((u_int32_t)*b << 16 | (u_int32_t)b[1])) return ret;
+ if (ret = tolower_sp((uint32_t)*a << 16 | (uint32_t)a[1]) - tolower_sp((uint32_t)*b << 16 | (uint32_t)b[1])) return ret;
a++;
b++;
n++;
int min = 0;
int max = PRECOMP_COUNT - 1;
int mid;
- u_int32_t sought = (base << 16) | comb, that;
+ uint32_t sought = (base << 16) | comb, that;
/* binary search */
while (max >= min) {
}
/* ------------------------ */
-static u_int32_t do_precomposition_sp(unsigned int base_sp, unsigned int comb_sp)
+static uint32_t do_precomposition_sp(unsigned int base_sp, unsigned int comb_sp)
{
int min = 0;
int max = PRECOMP_SP_COUNT - 1;
int mid;
- u_int64_t sought_sp = ((u_int64_t)base_sp << 32) | (u_int64_t)comb_sp, that_sp;
+ uint64_t sought_sp = ((uint64_t)base_sp << 32) | (uint64_t)comb_sp, that_sp;
/* binary search */
while (max >= min) {
mid = (min + max) / 2;
- that_sp = ((u_int64_t)precompositions_sp[mid].base_sp << 32) | ((u_int64_t)precompositions_sp[mid].comb_sp);
+ that_sp = ((uint64_t)precompositions_sp[mid].base_sp << 32) | ((uint64_t)precompositions_sp[mid].comb_sp);
if (that_sp < sought_sp) {
min = mid + 1;
} else if (that_sp > sought_sp) {
}
/* -------------------------- */
-static u_int32_t do_decomposition(ucs2_t base)
+static uint32_t do_decomposition(ucs2_t base)
{
int min = 0;
int max = DECOMP_COUNT - 1;
int mid;
- u_int32_t sought = base;
- u_int32_t result, that;
+ uint32_t sought = base;
+ uint32_t result, that;
/* binary search */
while (max >= min) {
}
/* -------------------------- */
-static u_int64_t do_decomposition_sp(unsigned int base_sp)
+static uint64_t do_decomposition_sp(unsigned int base_sp)
{
int min = 0;
int max = DECOMP_SP_COUNT - 1;
int mid;
- u_int32_t sought_sp = base_sp;
- u_int32_t that_sp;
- u_int64_t result_sp;
+ uint32_t sought_sp = base_sp;
+ uint32_t that_sp;
+ uint64_t result_sp;
/* binary search */
while (max >= min) {
} else if (that_sp > sought_sp) {
max = mid - 1;
} else {
- result_sp = ((u_int64_t)decompositions_sp[mid].base_sp << 32) | ((u_int64_t)decompositions_sp[mid].comb_sp);
+ result_sp = ((uint64_t)decompositions_sp[mid].base_sp << 32) | ((uint64_t)decompositions_sp[mid].comb_sp);
return result_sp;
}
}
{
size_t i;
ucs2_t base, comb;
- u_int32_t base_sp, comb_sp;
+ uint32_t base_sp, comb_sp;
ucs2_t *in, *out;
ucs2_t lindex, vindex;
ucs2_t result;
- u_int32_t result_sp;
+ uint32_t result_sp;
size_t o_len = *outlen;
if (!inplen || (inplen & 1) || inplen > o_len)
/* Binary Search for Surrogate Pair */
else if ((0xD800 <= base) && (base < 0xDC00)) {
if ((0xDC00 <= comb) && (comb < 0xE000) && (i + 6 <= inplen)) {
- base_sp = ((u_int32_t)base << 16) | (u_int32_t)comb;
+ base_sp = ((uint32_t)base << 16) | (uint32_t)comb;
do {
- comb_sp = ((u_int32_t)in[1] << 16) | (u_int32_t)in[2];
+ comb_sp = ((uint32_t)in[1] << 16) | (uint32_t)in[2];
if (result_sp = do_precomposition_sp(base_sp, comb_sp)) {
base_sp = result_sp;
i += 4;
size_t i;
size_t comblen;
ucs2_t base, comb[COMBBUFLEN];
- u_int32_t base_sp;
+ uint32_t base_sp;
ucs2_t sindex, tjamo;
ucs2_t *in, *out;
unsigned int result;
- u_int64_t result_sp;
+ uint64_t result_sp;
size_t o_len = *outlen;
if (!inplen || (inplen & 1))
/* Binary Search for Surrogate Pair */
else if ((0xD800 <= base) && (base < 0xDC00)) {
if (i + 2 < inplen) {
- base_sp = ((u_int32_t)base << 16) | (u_int32_t)in[1];
+ base_sp = ((uint32_t)base << 16) | (uint32_t)in[1];
do {
if ( !(result_sp = do_decomposition_sp(base_sp))) break;
comblen += 2;