1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-23 01:52:48 +03:00

encoding: Rework xmlCharEncodingHandler layout

Reuse some of the old members.

The "input" and "output" function pointers are actually of type
xmlCharEncConvFunc, accepting an additional argument. For default
handlers, this argument is unused, so this should work with most ABIs.
For iconv handlers, these function pointers used to be NULL but now
point to a function which requires the extra argument.

"iconv_in" and "iconv_out" are made void pointers. "uconv_in" and
"uconv_out" are renamed and made void pointers. This is unlikely to
cause issues.

We now expect that the built-in conversion functions correctly report
XML_ENC_ERR_SPACE. For UTF8ToHtml and the ISO-8859-X code, this will be
done in the following commits.
This commit is contained in:
Nick Wellnhofer
2024-06-28 19:06:57 +02:00
parent 57e37dff4e
commit 282ec1d548
3 changed files with 186 additions and 96 deletions

View File

@@ -521,8 +521,8 @@ testBuildRelativeUri(void) {
static int charEncConvImplError;
static int
rot13Convert(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
rot13Convert(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, void *vctxt) {
int *ctxt = vctxt;
int inSize = *inlen;
int outSize = *outlen;
@@ -564,7 +564,8 @@ rot13ConvImpl(void *vctxt ATTRIBUTE_UNUSED, const char *name,
return XML_ERR_UNSUPPORTED_ENCODING;
}
conv->convert = rot13Convert;
conv->input = rot13Convert;
conv->output = rot13Convert;
conv->ctxtDtor = rot13ConvCtxtDtor;
inputCtxt = xmlMalloc(sizeof(*inputCtxt));