first steps towards enabling support for wide chars in our libroot: reverted mbrtowc.c to glibc 2.2.5, added necessary iconv support to let it compile, added dl*** wrappers for needed glibc functions. Not sure it's the correct path, but let's try, at least.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24150 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -68,3 +68,25 @@ dlerror(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// __libc_dl*** wrappers
|
||||||
|
// We use a mixed glibc / bsd libc, and glibc wants these
|
||||||
|
void *
|
||||||
|
__libc_dlopen(const char *name)
|
||||||
|
{
|
||||||
|
return dlopen(name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *
|
||||||
|
__libc_dlsym(void *handle, const char *name)
|
||||||
|
{
|
||||||
|
return dlsym(handle, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
__libc_dlclose(void *handle)
|
||||||
|
{
|
||||||
|
dlclose(handle);
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ MergeObject posix_gnu_iconv.o :
|
|||||||
gconv_db.c
|
gconv_db.c
|
||||||
# gconv_dl.c
|
# gconv_dl.c
|
||||||
gconv_simple.c
|
gconv_simple.c
|
||||||
|
gconv_trans.c
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <[email protected]>, 1996.
|
Contributed by Ulrich Drepper <[email protected]>, 1996.
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <gconv.h>
|
#include <gconv.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
//#include <wcsmbsload.h>
|
#include <wcsmbsload.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -35,19 +35,6 @@ static mbstate_t state;
|
|||||||
size_t
|
size_t
|
||||||
__mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
__mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||||
{
|
{
|
||||||
// ToDo: this is a dummy implementation to get it going
|
|
||||||
if (s == NULL)
|
|
||||||
n = 1, s = "";
|
|
||||||
|
|
||||||
if (pwc == NULL || n == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (ps == NULL)
|
|
||||||
ps = &state;
|
|
||||||
|
|
||||||
pwc[0] = s[0];
|
|
||||||
return s[0] == 0 ? 0 : 1;
|
|
||||||
#if 0
|
|
||||||
wchar_t buf[1];
|
wchar_t buf[1];
|
||||||
struct __gconv_step_data data;
|
struct __gconv_step_data data;
|
||||||
int status;
|
int status;
|
||||||
@@ -55,7 +42,6 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
|||||||
size_t dummy;
|
size_t dummy;
|
||||||
const unsigned char *inbuf;
|
const unsigned char *inbuf;
|
||||||
char *outbuf = (char *) (pwc ?: buf);
|
char *outbuf = (char *) (pwc ?: buf);
|
||||||
const struct gconv_fcts *fcts;
|
|
||||||
|
|
||||||
/* Set information for this step. */
|
/* Set information for this step. */
|
||||||
data.__invocation_counter = 0;
|
data.__invocation_counter = 0;
|
||||||
@@ -77,13 +63,13 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
|||||||
data.__outbuf = outbuf;
|
data.__outbuf = outbuf;
|
||||||
data.__outbufend = outbuf + sizeof (wchar_t);
|
data.__outbufend = outbuf + sizeof (wchar_t);
|
||||||
|
|
||||||
/* Get the conversion functions. */
|
/* Make sure we use the correct function. */
|
||||||
fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
|
update_conversion_ptrs ();
|
||||||
|
|
||||||
/* Do a normal conversion. */
|
/* Do a normal conversion. */
|
||||||
inbuf = (const unsigned char *) s;
|
inbuf = (const unsigned char *) s;
|
||||||
status = DL_CALL_FCT (fcts->towc->__fct,
|
status = DL_CALL_FCT (__wcsmbs_gconv_fcts.towc->__fct,
|
||||||
(fcts->towc, &data, &inbuf, inbuf + n,
|
(__wcsmbs_gconv_fcts.towc, &data, &inbuf, inbuf + n,
|
||||||
NULL, &dummy, 0, 1));
|
NULL, &dummy, 0, 1));
|
||||||
|
|
||||||
/* There must not be any problems with the conversion but illegal input
|
/* There must not be any problems with the conversion but illegal input
|
||||||
@@ -117,8 +103,5 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
libc_hidden_def (__mbrtowc)
|
|
||||||
weak_alias (__mbrtowc, mbrtowc)
|
weak_alias (__mbrtowc, mbrtowc)
|
||||||
libc_hidden_weak (mbrtowc)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user