fixed sign mismatches (as reported by gcc 4)
svn: r2626
This commit is contained in:
parent
ae02397890
commit
32f1ddc860
|
@ -303,7 +303,7 @@ static Scheme_Object *foreign_ffi_obj_name(int argc, Scheme_Object *argv[])
|
||||||
#define scheme_get_realint_val(x,y) \
|
#define scheme_get_realint_val(x,y) \
|
||||||
scheme_get_int_val(x,(long*)(y))
|
scheme_get_int_val(x,(long*)(y))
|
||||||
#define scheme_get_unsigned_realint_val(x,y) \
|
#define scheme_get_unsigned_realint_val(x,y) \
|
||||||
scheme_get_unsigned_int_val(x,(long*)(y))
|
scheme_get_unsigned_int_val(x,(unsigned long*)(y))
|
||||||
#define scheme_make_realinteger_value \
|
#define scheme_make_realinteger_value \
|
||||||
scheme_make_integer_value
|
scheme_make_integer_value
|
||||||
#define scheme_make_realinteger_value_from_unsigned \
|
#define scheme_make_realinteger_value_from_unsigned \
|
||||||
|
|
|
@ -234,7 +234,7 @@ static Scheme_Hash_Table *opened_libs;
|
||||||
#define scheme_get_realint_val(x,y) \
|
#define scheme_get_realint_val(x,y) \
|
||||||
scheme_get_int_val(x,(long*)(y))
|
scheme_get_int_val(x,(long*)(y))
|
||||||
#define scheme_get_unsigned_realint_val(x,y) \
|
#define scheme_get_unsigned_realint_val(x,y) \
|
||||||
scheme_get_unsigned_int_val(x,(long*)(y))
|
scheme_get_unsigned_int_val(x,(unsigned long*)(y))
|
||||||
#define scheme_make_realinteger_value \
|
#define scheme_make_realinteger_value \
|
||||||
scheme_make_integer_value
|
scheme_make_integer_value
|
||||||
#define scheme_make_realinteger_value_from_unsigned \
|
#define scheme_make_realinteger_value_from_unsigned \
|
||||||
|
|
|
@ -1165,8 +1165,8 @@ char *scheme_bignum_to_allocated_string(const Scheme_Object *b, int radix, int a
|
||||||
|
|
||||||
#ifdef MZ_PRECISE_GC
|
#ifdef MZ_PRECISE_GC
|
||||||
{
|
{
|
||||||
char *save = str;
|
unsigned char *save = str;
|
||||||
str = (char*)scheme_malloc_atomic(slen);
|
str = (unsigned char*)scheme_malloc_atomic(slen);
|
||||||
memcpy(str, save, slen);
|
memcpy(str, save, slen);
|
||||||
RELEASE(save);
|
RELEASE(save);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,9 @@ static long sch_vsprintf(char *s, long maxlen, const char *msg, va_list args)
|
||||||
buf[0] = c;
|
buf[0] = c;
|
||||||
tlen = 1;
|
tlen = 1;
|
||||||
} else {
|
} else {
|
||||||
tlen = scheme_utf8_encode_all(&c, 1, (unsigned char *)buf);
|
mzchar mc;
|
||||||
|
tlen = scheme_utf8_encode_all(&mc, 1, (unsigned char *)buf);
|
||||||
|
c = (int)mc;
|
||||||
}
|
}
|
||||||
t = buf;
|
t = buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1737,7 +1737,7 @@ static Scheme_Object *tcp_connect(int argc, Scheme_Object *argv[])
|
||||||
|
|
||||||
/* Check whether connect succeeded, or get error: */
|
/* Check whether connect succeeded, or get error: */
|
||||||
{
|
{
|
||||||
int so_len = sizeof(status);
|
unsigned int so_len = sizeof(status);
|
||||||
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (void *)&status, &so_len) != 0) {
|
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (void *)&status, &so_len) != 0) {
|
||||||
status = SOCK_ERRNO();
|
status = SOCK_ERRNO();
|
||||||
}
|
}
|
||||||
|
@ -2145,7 +2145,7 @@ tcp_accept(int argc, Scheme_Object *argv[])
|
||||||
Scheme_Object *listener;
|
Scheme_Object *listener;
|
||||||
# ifdef USE_SOCKETS_TCP
|
# ifdef USE_SOCKETS_TCP
|
||||||
tcp_t s;
|
tcp_t s;
|
||||||
int l;
|
unsigned int l;
|
||||||
GC_CAN_IGNORE char tcp_accept_addr[MZ_SOCK_NAME_MAX_LEN];
|
GC_CAN_IGNORE char tcp_accept_addr[MZ_SOCK_NAME_MAX_LEN];
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -2293,10 +2293,10 @@ static Scheme_Object *tcp_addresses(int argc, Scheme_Object *argv[])
|
||||||
|
|
||||||
# ifdef USE_SOCKETS_TCP
|
# ifdef USE_SOCKETS_TCP
|
||||||
{
|
{
|
||||||
int l;
|
unsigned int l;
|
||||||
char here[MZ_SOCK_NAME_MAX_LEN], there[MZ_SOCK_NAME_MAX_LEN];
|
char here[MZ_SOCK_NAME_MAX_LEN], there[MZ_SOCK_NAME_MAX_LEN];
|
||||||
char host_buf[MZ_SOCK_HOST_NAME_MAX_LEN];
|
char host_buf[MZ_SOCK_HOST_NAME_MAX_LEN];
|
||||||
int here_len, there_len;
|
unsigned int here_len, there_len;
|
||||||
|
|
||||||
l = sizeof(here);
|
l = sizeof(here);
|
||||||
if (getsockname(tcp->tcp, (struct sockaddr *)here, &l)) {
|
if (getsockname(tcp->tcp, (struct sockaddr *)here, &l)) {
|
||||||
|
@ -3079,7 +3079,7 @@ static int do_udp_recv(const char *name, Scheme_UDP *udp, char *bstr, long start
|
||||||
long x;
|
long x;
|
||||||
int errid = 0;
|
int errid = 0;
|
||||||
char src_addr[MZ_SOCK_NAME_MAX_LEN];
|
char src_addr[MZ_SOCK_NAME_MAX_LEN];
|
||||||
int asize = sizeof(src_addr);
|
unsigned int asize = sizeof(src_addr);
|
||||||
|
|
||||||
if (!udp->bound) {
|
if (!udp->bound) {
|
||||||
scheme_raise_exn(MZEXN_FAIL_NETWORK,
|
scheme_raise_exn(MZEXN_FAIL_NETWORK,
|
||||||
|
|
|
@ -148,7 +148,7 @@ static unsigned int _random_m(unsigned int *_x)
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _random_n(int *_x, int n)
|
static int _random_n(unsigned int *_x, int n)
|
||||||
{
|
{
|
||||||
return ((_random_m(_x) << 16) + _random_m(_x)) % n;
|
return ((_random_m(_x) << 16) + _random_m(_x)) % n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1257,7 +1257,7 @@ static void do_count_lines(Scheme_Port *ip, const char *buffer, long offset, lon
|
||||||
int state = ip->utf8state;
|
int state = ip->utf8state;
|
||||||
int n;
|
int n;
|
||||||
degot += state_len(state);
|
degot += state_len(state);
|
||||||
n = scheme_utf8_decode_count(buffer, offset, offset + i + 1, &state, 0, '?');
|
n = scheme_utf8_decode_count((const unsigned char *)buffer, offset, offset + i + 1, &state, 0, '?');
|
||||||
degot += (i + 1 - n);
|
degot += (i + 1 - n);
|
||||||
ip->utf8state = 0; /* assert: state == 0, because we ended with a newline */
|
ip->utf8state = 0; /* assert: state == 0, because we ended with a newline */
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1300,7 @@ static void do_count_lines(Scheme_Port *ip, const char *buffer, long offset, lon
|
||||||
col -= n;
|
col -= n;
|
||||||
for (i = prev_i; i < got; i++) {
|
for (i = prev_i; i < got; i++) {
|
||||||
if (buffer[offset + i] == '\t') {
|
if (buffer[offset + i] == '\t') {
|
||||||
n = scheme_utf8_decode_count(buffer, offset + prev_i, offset + i, &state, 0, '?');
|
n = scheme_utf8_decode_count((const unsigned char *)buffer, offset + prev_i, offset + i, &state, 0, '?');
|
||||||
degot += ((i - prev_i) - n);
|
degot += ((i - prev_i) - n);
|
||||||
col += n;
|
col += n;
|
||||||
col = col - (col & 0x7) + 8;
|
col = col - (col & 0x7) + 8;
|
||||||
|
@ -1308,7 +1308,7 @@ static void do_count_lines(Scheme_Port *ip, const char *buffer, long offset, lon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (prev_i < i) {
|
if (prev_i < i) {
|
||||||
n = scheme_utf8_decode_count(buffer, offset + prev_i, offset + i, &state, 1, '?');
|
n = scheme_utf8_decode_count((const unsigned char *)buffer, offset + prev_i, offset + i, &state, 1, '?');
|
||||||
n += state_len(state);
|
n += state_len(state);
|
||||||
col += n;
|
col += n;
|
||||||
degot += ((i - prev_i) - n);
|
degot += ((i - prev_i) - n);
|
||||||
|
@ -2130,7 +2130,7 @@ long scheme_get_char_string(const char *who,
|
||||||
NULL);
|
NULL);
|
||||||
if (got > 0) {
|
if (got > 0) {
|
||||||
long ulen, glen;
|
long ulen, glen;
|
||||||
glen = scheme_utf8_decode_as_prefix(s, 0, got + leftover,
|
glen = scheme_utf8_decode_as_prefix((const unsigned char *)s, 0, got + leftover,
|
||||||
buffer, offset, offset + size,
|
buffer, offset, offset + size,
|
||||||
&ulen, 0, '?');
|
&ulen, 0, '?');
|
||||||
if (glen && (ulen < got + leftover)) {
|
if (glen && (ulen < got + leftover)) {
|
||||||
|
@ -2200,7 +2200,7 @@ long scheme_get_char_string(const char *who,
|
||||||
if (got >= 0) {
|
if (got >= 0) {
|
||||||
long ulen, glen;
|
long ulen, glen;
|
||||||
|
|
||||||
glen = scheme_utf8_decode_as_prefix(s, 0, got + leftover,
|
glen = scheme_utf8_decode_as_prefix((const unsigned char *)s, 0, got + leftover,
|
||||||
buffer, offset, offset + size,
|
buffer, offset, offset + size,
|
||||||
&ulen, 0, '?');
|
&ulen, 0, '?');
|
||||||
|
|
||||||
|
@ -2257,7 +2257,7 @@ scheme_getc(Scheme_Object *port)
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
v = scheme_utf8_decode_prefix(s, delta + 1, r, 0);
|
v = scheme_utf8_decode_prefix((const unsigned char *)s, delta + 1, r, 0);
|
||||||
if (v > 0) {
|
if (v > 0) {
|
||||||
if (delta) {
|
if (delta) {
|
||||||
/* Need to read the peeked bytes (will ignore) */
|
/* Need to read the peeked bytes (will ignore) */
|
||||||
|
@ -2402,7 +2402,7 @@ static int do_peekc_skip(Scheme_Object *port, Scheme_Object *skip,
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
v = scheme_utf8_decode_prefix(s, delta + 1, r, 0);
|
v = scheme_utf8_decode_prefix((const unsigned char *)s, delta + 1, r, 0);
|
||||||
if (v > 0)
|
if (v > 0)
|
||||||
return r[0];
|
return r[0];
|
||||||
else if (v == -2) {
|
else if (v == -2) {
|
||||||
|
@ -3076,7 +3076,7 @@ scheme_put_char_string(const char *who, Scheme_Object *port,
|
||||||
bstr = buf;
|
bstr = buf;
|
||||||
else
|
else
|
||||||
bstr = (char *)scheme_malloc_atomic(blen);
|
bstr = (char *)scheme_malloc_atomic(blen);
|
||||||
scheme_utf8_encode(str, d, d + len, bstr, 0, 0);
|
scheme_utf8_encode(str, d, d + len, (unsigned char *)bstr, 0, 0);
|
||||||
|
|
||||||
return scheme_put_byte_string(who, port, bstr, 0, blen, 0);
|
return scheme_put_byte_string(who, port, bstr, 0, blen, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -984,7 +984,7 @@ static void do_print_string(int compact, int notdisplay,
|
||||||
reset = 0;
|
reset = 0;
|
||||||
}
|
}
|
||||||
el = scheme_utf8_encode(s, offset, offset + l,
|
el = scheme_utf8_encode(s, offset, offset + l,
|
||||||
buf, 0, 0);
|
(unsigned char *)buf, 0, 0);
|
||||||
if (compact) {
|
if (compact) {
|
||||||
print_compact(pp, CPT_CHAR_STRING);
|
print_compact(pp, CPT_CHAR_STRING);
|
||||||
print_compact_number(pp, el);
|
print_compact_number(pp, el);
|
||||||
|
@ -1391,7 +1391,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht,
|
||||||
mzchar us[1];
|
mzchar us[1];
|
||||||
int l;
|
int l;
|
||||||
us[0] = SCHEME_CHAR_VAL(obj);
|
us[0] = SCHEME_CHAR_VAL(obj);
|
||||||
l = scheme_utf8_encode(us, 0, 1, s, 0, 0);
|
l = scheme_utf8_encode(us, 0, 1, (unsigned char *)s, 0, 0);
|
||||||
print_char_string(s, l, us, 0, 1, notdisplay, 1, pp);
|
print_char_string(s, l, us, 0, 1, notdisplay, 1, pp);
|
||||||
} else
|
} else
|
||||||
print_char(obj, notdisplay, pp);
|
print_char(obj, notdisplay, pp);
|
||||||
|
|
|
@ -1579,9 +1579,9 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
|
||||||
ulen = scheme_char_strlen(tagbuf);
|
ulen = scheme_char_strlen(tagbuf);
|
||||||
blen = scheme_utf8_encode_all(tagbuf, ulen, NULL);
|
blen = scheme_utf8_encode_all(tagbuf, ulen, NULL);
|
||||||
lbuffer = (char *)scheme_malloc_atomic(blen + MAX_UTF8_CHAR_BYTES + 1);
|
lbuffer = (char *)scheme_malloc_atomic(blen + MAX_UTF8_CHAR_BYTES + 1);
|
||||||
scheme_utf8_encode_all(tagbuf, ulen, lbuffer);
|
scheme_utf8_encode_all(tagbuf, ulen, (unsigned char *)lbuffer);
|
||||||
blen += scheme_utf8_encode(&pch, 0, 1,
|
blen += scheme_utf8_encode((mzchar *)&pch, 0, 1,
|
||||||
lbuffer, blen,
|
(unsigned char *)lbuffer, blen,
|
||||||
0);
|
0);
|
||||||
lbuffer[blen] = 0;
|
lbuffer[blen] = 0;
|
||||||
|
|
||||||
|
@ -3932,7 +3932,7 @@ static Scheme_Object *read_compact(CPort *port, int use_stack)
|
||||||
RANGE_CHECK_GETS(el);
|
RANGE_CHECK_GETS(el);
|
||||||
s = read_compact_chars(port, buffer, BLK_BUF_SIZE, el);
|
s = read_compact_chars(port, buffer, BLK_BUF_SIZE, el);
|
||||||
us = (mzchar *)scheme_malloc_atomic((l + 1) * sizeof(mzchar));
|
us = (mzchar *)scheme_malloc_atomic((l + 1) * sizeof(mzchar));
|
||||||
scheme_utf8_decode_all(s, el, us, 0);
|
scheme_utf8_decode_all((const unsigned char *)s, el, us, 0);
|
||||||
us[l] = 0;
|
us[l] = 0;
|
||||||
v = scheme_make_immutable_sized_char_string(us, l, 0);
|
v = scheme_make_immutable_sized_char_string(us, l, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1963,7 +1963,7 @@ static unsigned char *make_room(unsigned char *r, int j, int need_extra, RoomSta
|
||||||
|
|
||||||
if ((rs->size - j - (rs->orig_len - rs->i)) < need_extra) {
|
if ((rs->size - j - (rs->orig_len - rs->i)) < need_extra) {
|
||||||
nrs = ((rs->size) * 2) + need_extra;
|
nrs = ((rs->size) * 2) + need_extra;
|
||||||
nr = (char *)scheme_malloc_atomic(nrs+1);
|
nr = (unsigned char *)scheme_malloc_atomic(nrs+1);
|
||||||
memcpy(nr, r, j);
|
memcpy(nr, r, j);
|
||||||
r = nr;
|
r = nr;
|
||||||
rs->size = nrs;
|
rs->size = nrs;
|
||||||
|
@ -1982,8 +1982,8 @@ static unsigned char *add_byte_range(const unsigned char *lo, const unsigned cha
|
||||||
through hi lexicographically. See add_range to get started. */
|
through hi lexicographically. See add_range to get started. */
|
||||||
{
|
{
|
||||||
int same_chars, j, i;
|
int same_chars, j, i;
|
||||||
const unsigned char *lowest = "\200\200\200\200\200";
|
const unsigned char *lowest = (unsigned char *)"\200\200\200\200\200";
|
||||||
const unsigned char *highest = "\277\277\277\277\277";
|
const unsigned char *highest = (unsigned char *)"\277\277\277\277\277";
|
||||||
unsigned char p, q;
|
unsigned char p, q;
|
||||||
|
|
||||||
/* Look for a common prefix: */
|
/* Look for a common prefix: */
|
||||||
|
@ -2178,7 +2178,7 @@ static unsigned char *add_range(unsigned char *r, int *_j, RoomState *rs,
|
||||||
return add_byte_range(lo, hi, count, r, _j, rs, did_alt, 0);
|
return add_byte_range(lo, hi, count, r, _j, rs, did_alt, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int translate(unsigned char *s, int len, char **result)
|
static int translate(unsigned char *s, int len, unsigned char **result)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
RoomState rs;
|
RoomState rs;
|
||||||
|
@ -2187,7 +2187,7 @@ static int translate(unsigned char *s, int len, char **result)
|
||||||
rs.orig_len = len;
|
rs.orig_len = len;
|
||||||
rs.size = len;
|
rs.size = len;
|
||||||
|
|
||||||
r = (char *)scheme_malloc_atomic(rs.size + 1);
|
r = (unsigned char *)scheme_malloc_atomic(rs.size + 1);
|
||||||
|
|
||||||
/* We need to translate if the pattern contains any use of ".", if
|
/* We need to translate if the pattern contains any use of ".", if
|
||||||
there's a big character in a range, if there's a not-range, or if
|
there's a big character in a range, if there's a not-range, or if
|
||||||
|
@ -2497,7 +2497,7 @@ static Scheme_Object *do_make_regexp(const char *who, int is_byte, int argc, Sch
|
||||||
slen = SCHEME_BYTE_STRTAG_VAL(bs);
|
slen = SCHEME_BYTE_STRTAG_VAL(bs);
|
||||||
|
|
||||||
if (!is_byte) {
|
if (!is_byte) {
|
||||||
slen = translate(s,slen, &s);
|
slen = translate((unsigned char *)s, slen, (unsigned char **)&s);
|
||||||
#if 0
|
#if 0
|
||||||
/* Debugging, to see the translated regexp: */
|
/* Debugging, to see the translated regexp: */
|
||||||
{
|
{
|
||||||
|
@ -2699,7 +2699,7 @@ static Scheme_Object *gen_compare(char *name, int pos,
|
||||||
0 /* not UTF-16 */);
|
0 /* not UTF-16 */);
|
||||||
full_s = (char *)scheme_malloc_atomic(blen);
|
full_s = (char *)scheme_malloc_atomic(blen);
|
||||||
scheme_utf8_encode(SCHEME_CHAR_STR_VAL(argv[1]), offset, endset,
|
scheme_utf8_encode(SCHEME_CHAR_STR_VAL(argv[1]), offset, endset,
|
||||||
full_s, 0,
|
(unsigned char *)full_s, 0,
|
||||||
0 /* not UTF-16 */);
|
0 /* not UTF-16 */);
|
||||||
orig_offset = offset;
|
orig_offset = offset;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -2744,12 +2744,12 @@ static Scheme_Object *gen_compare(char *name, int pos,
|
||||||
unicode chars, so the start and end points can't be in
|
unicode chars, so the start and end points can't be in
|
||||||
the middle of encoded characters. */
|
the middle of encoded characters. */
|
||||||
int uspd, uepd;
|
int uspd, uepd;
|
||||||
uspd = scheme_utf8_decode(full_s, offset, startp[i],
|
uspd = scheme_utf8_decode((const unsigned char *)full_s, offset, startp[i],
|
||||||
NULL, 0, -1,
|
NULL, 0, -1,
|
||||||
NULL, 0, 0);
|
NULL, 0, 0);
|
||||||
uspd += orig_offset;
|
uspd += orig_offset;
|
||||||
startpd = scheme_make_integer(uspd);
|
startpd = scheme_make_integer(uspd);
|
||||||
uepd = scheme_utf8_decode(full_s, startp[i], endp[i],
|
uepd = scheme_utf8_decode((const unsigned char *)full_s, startp[i], endp[i],
|
||||||
NULL, 0, -1,
|
NULL, 0, -1,
|
||||||
NULL, 0, 0);
|
NULL, 0, 0);
|
||||||
uepd += uspd;
|
uepd += uspd;
|
||||||
|
|
|
@ -66,6 +66,7 @@ static iconv_proc_t iconv;
|
||||||
static iconv_open_proc_t iconv_open;
|
static iconv_open_proc_t iconv_open;
|
||||||
static iconv_close_proc_t iconv_close;
|
static iconv_close_proc_t iconv_close;
|
||||||
static locale_charset_proc_t locale_charset; /* Not used, currently */
|
static locale_charset_proc_t locale_charset; /* Not used, currently */
|
||||||
|
#define mzCHK_PROC(x) x
|
||||||
static char *nl_langinfo(int which)
|
static char *nl_langinfo(int which)
|
||||||
{
|
{
|
||||||
return "UTF-8";
|
return "UTF-8";
|
||||||
|
@ -118,6 +119,7 @@ static void init_iconv()
|
||||||
#else
|
#else
|
||||||
# define ICONV_errno errno
|
# define ICONV_errno errno
|
||||||
# define iconv_ready 1
|
# define iconv_ready 1
|
||||||
|
# define mzCHK_PROC(x) 1
|
||||||
static void init_iconv() { }
|
static void init_iconv() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ static void init_iconv() { }
|
||||||
# define mzLOCALE_IS_UTF_8(s) (!s || !(*s))
|
# define mzLOCALE_IS_UTF_8(s) (!s || !(*s))
|
||||||
#endif
|
#endif
|
||||||
#ifndef mzLOCALE_IS_UTF_8
|
#ifndef mzLOCALE_IS_UTF_8
|
||||||
# define mzLOCALE_IS_UTF_8(s) !iconv_open
|
# define mzLOCALE_IS_UTF_8(s) !mzCHK_PROC(iconv_open)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define mz_iconv_nl_langinfo() ""
|
#define mz_iconv_nl_langinfo() ""
|
||||||
|
@ -1124,7 +1126,7 @@ do_byte_string_to_char_string_locale(const char *who,
|
||||||
reset_locale();
|
reset_locale();
|
||||||
if (!iconv_ready) init_iconv();
|
if (!iconv_ready) init_iconv();
|
||||||
|
|
||||||
if (mzLOCALE_IS_UTF_8(current_locale_name) || !locale_on || !iconv_open)
|
if (mzLOCALE_IS_UTF_8(current_locale_name) || !locale_on || !mzCHK_PROC(iconv_open))
|
||||||
return do_byte_string_to_char_string(who, bstr, istart, ifinish, perm, 1);
|
return do_byte_string_to_char_string(who, bstr, istart, ifinish, perm, 1);
|
||||||
|
|
||||||
if (istart < ifinish) {
|
if (istart < ifinish) {
|
||||||
|
@ -1183,7 +1185,7 @@ do_string_to_vector(const char *who, int mode, int argc, Scheme_Object *argv[])
|
||||||
unsigned char *s;
|
unsigned char *s;
|
||||||
long i, len;
|
long i, len;
|
||||||
len = ifinish - istart;
|
len = ifinish - istart;
|
||||||
s = SCHEME_BYTE_STR_VAL(argv[0]);
|
s = (unsigned char *)SCHEME_BYTE_STR_VAL(argv[0]);
|
||||||
us = (mzchar *)scheme_malloc_atomic((len + 1) * sizeof(mzchar));
|
us = (mzchar *)scheme_malloc_atomic((len + 1) * sizeof(mzchar));
|
||||||
for (i = istart; i < ifinish; i++) {
|
for (i = istart; i < ifinish; i++) {
|
||||||
us[i - istart] = s[i];
|
us[i - istart] = s[i];
|
||||||
|
@ -1236,7 +1238,7 @@ static Scheme_Object *do_char_string_to_byte_string(Scheme_Object *s, long istar
|
||||||
0 /* UTF-16 */);
|
0 /* UTF-16 */);
|
||||||
bs = (char *)scheme_malloc_atomic(slen + 1);
|
bs = (char *)scheme_malloc_atomic(slen + 1);
|
||||||
scheme_utf8_encode(SCHEME_CHAR_STR_VAL(s), istart, ifinish,
|
scheme_utf8_encode(SCHEME_CHAR_STR_VAL(s), istart, ifinish,
|
||||||
bs, 0,
|
(unsigned char *)bs, 0,
|
||||||
0 /* UTF-16 */);
|
0 /* UTF-16 */);
|
||||||
bs[slen] = 0;
|
bs[slen] = 0;
|
||||||
|
|
||||||
|
@ -1255,7 +1257,7 @@ do_char_string_to_byte_string_locale(const char *who,
|
||||||
reset_locale();
|
reset_locale();
|
||||||
if (!iconv_ready) init_iconv();
|
if (!iconv_ready) init_iconv();
|
||||||
|
|
||||||
if (mzLOCALE_IS_UTF_8(current_locale_name) || !locale_on || !iconv_open)
|
if (mzLOCALE_IS_UTF_8(current_locale_name) || !locale_on || !mzCHK_PROC(iconv_open))
|
||||||
return do_char_string_to_byte_string(cstr, istart, ifinish, 1);
|
return do_char_string_to_byte_string(cstr, istart, ifinish, 1);
|
||||||
|
|
||||||
if (istart < ifinish) {
|
if (istart < ifinish) {
|
||||||
|
@ -1339,7 +1341,7 @@ static Scheme_Object *do_chars_to_bytes(const char *who, int mode,
|
||||||
}
|
}
|
||||||
s[len] = 0;
|
s[len] = 0;
|
||||||
|
|
||||||
return scheme_make_sized_byte_string(s, len, 0);
|
return scheme_make_sized_byte_string((char *)s, len, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1758,7 +1760,7 @@ char *scheme_format_utf8(char *format, int flen, int argc, Scheme_Object **argv,
|
||||||
long srlen;
|
long srlen;
|
||||||
if (flen == -1)
|
if (flen == -1)
|
||||||
flen = strlen(format);
|
flen = strlen(format);
|
||||||
s = scheme_utf8_decode_to_buffer_len(format, flen, NULL, 0, &srlen);
|
s = scheme_utf8_decode_to_buffer_len((unsigned char *)format, flen, NULL, 0, &srlen);
|
||||||
if (s)
|
if (s)
|
||||||
return scheme_format(s, srlen, argc, argv, rlen);
|
return scheme_format(s, srlen, argc, argv, rlen);
|
||||||
else
|
else
|
||||||
|
@ -1771,7 +1773,7 @@ void scheme_printf_utf8(char *format, int flen, int argc, Scheme_Object **argv)
|
||||||
long srlen;
|
long srlen;
|
||||||
if (flen == -1)
|
if (flen == -1)
|
||||||
flen = strlen(format);
|
flen = strlen(format);
|
||||||
s = scheme_utf8_decode_to_buffer_len(format, flen, NULL, 0, &srlen);
|
s = scheme_utf8_decode_to_buffer_len((unsigned char *)format, flen, NULL, 0, &srlen);
|
||||||
if (s)
|
if (s)
|
||||||
scheme_printf(s, srlen, argc, argv);
|
scheme_printf(s, srlen, argc, argv);
|
||||||
}
|
}
|
||||||
|
@ -2315,7 +2317,7 @@ static char *do_convert(iconv_t cd,
|
||||||
|
|
||||||
if (cd == (iconv_t)-1) {
|
if (cd == (iconv_t)-1) {
|
||||||
if (!iconv_ready) init_iconv();
|
if (!iconv_ready) init_iconv();
|
||||||
if (iconv_open) {
|
if (mzCHK_PROC(iconv_open)) {
|
||||||
if (!from_e)
|
if (!from_e)
|
||||||
from_e = mz_iconv_nl_langinfo();
|
from_e = mz_iconv_nl_langinfo();
|
||||||
if (!to_e)
|
if (!to_e)
|
||||||
|
@ -2373,7 +2375,7 @@ static char *do_convert(iconv_t cd,
|
||||||
0);
|
0);
|
||||||
if (opos <= iolen) {
|
if (opos <= iolen) {
|
||||||
opos = scheme_utf8_encode((const unsigned int *)in, uid, uilen,
|
opos = scheme_utf8_encode((const unsigned int *)in, uid, uilen,
|
||||||
out, od + dop,
|
(unsigned char *)out, od + dop,
|
||||||
0);
|
0);
|
||||||
dop += opos;
|
dop += opos;
|
||||||
dip += iilen;
|
dip += iilen;
|
||||||
|
@ -2388,7 +2390,7 @@ static char *do_convert(iconv_t cd,
|
||||||
/* We assume that out + od is mzchar-aligned */
|
/* We assume that out + od is mzchar-aligned */
|
||||||
long ipos, opos;
|
long ipos, opos;
|
||||||
|
|
||||||
r = utf8_decode_x(in, id + dip, iilen,
|
r = utf8_decode_x((unsigned char *)in, id + dip, iilen,
|
||||||
(unsigned int *)out, (od + dop) >> 2, iolen >> 2,
|
(unsigned int *)out, (od + dop) >> 2, iolen >> 2,
|
||||||
&ipos, &opos,
|
&ipos, &opos,
|
||||||
0, 0, NULL, 0, 0);
|
0, 0, NULL, 0, 0);
|
||||||
|
@ -2836,8 +2838,10 @@ int mz_native_strcoll(char *s1, int d1, int l1, char *s2, int d2, int l2, int cv
|
||||||
CFStringRef str1, str2;
|
CFStringRef str1, str2;
|
||||||
CFComparisonResult r;
|
CFComparisonResult r;
|
||||||
|
|
||||||
str1 = CFStringCreateWithBytes(NULL, s1 XFORM_OK_PLUS (d1 * 2), (l1 * 2), kCFStringEncodingUnicode, FALSE);
|
str1 = CFStringCreateWithBytes(NULL, (unsigned char *)s1 XFORM_OK_PLUS (d1 * 2), (l1 * 2),
|
||||||
str2 = CFStringCreateWithBytes(NULL, s2 XFORM_OK_PLUS (d2 * 2), (l2 * 2), kCFStringEncodingUnicode, FALSE);
|
kCFStringEncodingUnicode, FALSE);
|
||||||
|
str2 = CFStringCreateWithBytes(NULL, (unsigned char *)s2 XFORM_OK_PLUS (d2 * 2), (l2 * 2),
|
||||||
|
kCFStringEncodingUnicode, FALSE);
|
||||||
|
|
||||||
r = CFStringCompare(str1, str2, (kCFCompareLocalized
|
r = CFStringCompare(str1, str2, (kCFCompareLocalized
|
||||||
| (cvt_case ? kCFCompareCaseInsensitive : 0)));
|
| (cvt_case ? kCFCompareCaseInsensitive : 0)));
|
||||||
|
@ -3009,7 +3013,8 @@ mzchar *do_native_recase(int to_up, mzchar *in, int delta, int len, long *olen)
|
||||||
GC_CAN_IGNORE CFRange rng;
|
GC_CAN_IGNORE CFRange rng;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
str = CFStringCreateWithBytes(NULL, ((char *)in) XFORM_OK_PLUS (delta * 2), (len * 2), kCFStringEncodingUnicode, FALSE);
|
str = CFStringCreateWithBytes(NULL, ((unsigned char *)in) XFORM_OK_PLUS (delta * 2), (len * 2),
|
||||||
|
kCFStringEncodingUnicode, FALSE);
|
||||||
mstr = CFStringCreateMutableCopy(NULL, 0, str);
|
mstr = CFStringCreateMutableCopy(NULL, 0, str);
|
||||||
CFRelease(str);
|
CFRelease(str);
|
||||||
|
|
||||||
|
@ -3098,7 +3103,7 @@ static Scheme_Object *mz_recase(const char *who, int to_up, mzchar *us, long ule
|
||||||
us1 = mz_do_recase(to_up, us, delta, i - delta, &ulen1);
|
us1 = mz_do_recase(to_up, us, delta, i - delta, &ulen1);
|
||||||
|
|
||||||
if (utf16) {
|
if (utf16) {
|
||||||
us1 = scheme_utf16_to_ucs4((short *)us1, 0, ulen1, NULL, 0, &ulen1, 1);
|
us1 = scheme_utf16_to_ucs4((unsigned short *)us1, 0, ulen1, NULL, 0, &ulen1, 1);
|
||||||
us1[ulen1] = 0;
|
us1[ulen1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4029,7 +4034,7 @@ Scheme_Object *scheme_open_converter(const char *from_e, const char *to_e)
|
||||||
} else {
|
} else {
|
||||||
if (!iconv_ready) init_iconv();
|
if (!iconv_ready) init_iconv();
|
||||||
|
|
||||||
if (!iconv_open)
|
if (!mzCHK_PROC(iconv_open))
|
||||||
return scheme_false;
|
return scheme_false;
|
||||||
|
|
||||||
if (!*from_e || !*to_e)
|
if (!*from_e || !*to_e)
|
||||||
|
@ -4334,7 +4339,7 @@ static int utf8_decode_x(const unsigned char *s, int start, int end,
|
||||||
anything bad to the given "permissive" value. */
|
anything bad to the given "permissive" value. */
|
||||||
|
|
||||||
if (end < 0)
|
if (end < 0)
|
||||||
end = strlen(s);
|
end = strlen((char *)s);
|
||||||
if (dend < 0)
|
if (dend < 0)
|
||||||
dend = 0x7FFFFFFF;
|
dend = 0x7FFFFFFF;
|
||||||
|
|
||||||
|
@ -4775,7 +4780,7 @@ char *scheme_utf8_encode_to_buffer_len(const mzchar *s, int len,
|
||||||
if (slen + 1 > blen) {
|
if (slen + 1 > blen) {
|
||||||
buf = (char *)scheme_malloc_atomic(slen + 1);
|
buf = (char *)scheme_malloc_atomic(slen + 1);
|
||||||
}
|
}
|
||||||
scheme_utf8_encode(s, 0, len, buf, 0, 0);
|
scheme_utf8_encode(s, 0, len, (unsigned char *)buf, 0, 0);
|
||||||
buf[slen] = 0;
|
buf[slen] = 0;
|
||||||
*_slen = slen;
|
*_slen = slen;
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -4794,7 +4799,7 @@ unsigned short *scheme_ucs4_to_utf16(const mzchar *text, int start, int end,
|
||||||
{
|
{
|
||||||
mzchar v;
|
mzchar v;
|
||||||
int extra, i, j;
|
int extra, i, j;
|
||||||
short *utf16;
|
unsigned short *utf16;
|
||||||
|
|
||||||
/* Count characters that fall outside UCS-2: */
|
/* Count characters that fall outside UCS-2: */
|
||||||
for (i = start, extra = 0; i < end; i++) {
|
for (i = start, extra = 0; i < end; i++) {
|
||||||
|
|
|
@ -280,7 +280,7 @@ X__(string_to_list) (int argc, Scheme_Object *argv[])
|
||||||
if (!SCHEME_X_STRINGP(argv[0]))
|
if (!SCHEME_X_STRINGP(argv[0]))
|
||||||
scheme_wrong_type(XSTRINGSTR "->list", XSTR "string", 0, argc, argv);
|
scheme_wrong_type(XSTRINGSTR "->list", XSTR "string", 0, argc, argv);
|
||||||
|
|
||||||
chars = SCHEME_X_STR_VAL(argv[0]);
|
chars = (uXchar *)SCHEME_X_STR_VAL(argv[0]);
|
||||||
len = SCHEME_X_STRTAG_VAL(argv[0]);
|
len = SCHEME_X_STRTAG_VAL(argv[0]);
|
||||||
|
|
||||||
if (len < 0xFFF) {
|
if (len < 0xFFF) {
|
||||||
|
|
|
@ -525,7 +525,7 @@ const char *scheme_symbol_name_and_size(Scheme_Object *sym, unsigned int *length
|
||||||
mzchar buf[2];
|
mzchar buf[2];
|
||||||
int ul = 2;
|
int ul = 2;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (scheme_utf8_decode(s, i, i + ul,
|
if (scheme_utf8_decode((unsigned char *)s, i, i + ul,
|
||||||
buf, 0, 1,
|
buf, 0, 1,
|
||||||
NULL, 0, 0) > 0)
|
NULL, 0, 0) > 0)
|
||||||
break;
|
break;
|
||||||
|
@ -554,7 +554,7 @@ const char *scheme_symbol_name_and_size(Scheme_Object *sym, unsigned int *length
|
||||||
mzchar cbuf[100], *cs;
|
mzchar cbuf[100], *cs;
|
||||||
long clen;
|
long clen;
|
||||||
dz = 0;
|
dz = 0;
|
||||||
cs = scheme_utf8_decode_to_buffer_len(s, len, cbuf, 100, &clen);
|
cs = scheme_utf8_decode_to_buffer_len((unsigned char *)s, len, cbuf, 100, &clen);
|
||||||
if (cs
|
if (cs
|
||||||
&& digit_start
|
&& digit_start
|
||||||
&& !(flags & SCHEME_SNF_FOR_TS)
|
&& !(flags & SCHEME_SNF_FOR_TS)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user