Fixed bug #153937, making sure the conversion functions return the number
* encoding.c doc/examples/testWriter.c: Fixed bug #153937, making
sure the conversion functions return the number of byte written.
Had to fix one of the examples.
Daniel
diff --git a/ChangeLog b/ChangeLog
index ddcf7e3..3dca693 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Oct 31 16:33:54 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+ * encoding.c doc/examples/testWriter.c: Fixed bug #153937, making
+ sure the conversion functions return the number of byte written.
+ Had to fix one of the examples.
+
Fri Oct 29 14:16:56 CEST 2004 Daniel Veillard <daniel@veillard.com>
* doc/xmllint.1 doc/xmllint.xml: indicate - means stdin closing #156626
diff --git a/configure.in b/configure.in
index ed6b94c..53b8a24 100644
--- a/configure.in
+++ b/configure.in
@@ -309,7 +309,7 @@
CFLAGS="${CFLAGS} -fexceptions"
fi
- CFLAGS="${CFLAGS} -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
+ CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
case "${host}" in
alpha*-*-linux* )
CFLAGS="${CFLAGS} -mieee"
@@ -447,7 +447,7 @@
fi
fi
if test "${CC}" = "gcc" ; then
- CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
+ CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
fi
STATIC_BINARIES="-static"
dnl -Wcast-qual -ansi
diff --git a/doc/examples/testWriter.c b/doc/examples/testWriter.c
index c5e9c39..e158f97 100644
--- a/doc/examples/testWriter.c
+++ b/doc/examples/testWriter.c
@@ -1168,8 +1168,8 @@
if (out != 0) {
temp = size - 1;
ret = handler->input(out, &out_size, (const xmlChar *) in, &temp);
- if (ret || temp - size + 1) {
- if (ret) {
+ if ((ret < 0) || (temp - size + 1)) {
+ if (ret < 0) {
printf("ConvertInput: conversion wasn't successful.\n");
} else {
printf
diff --git a/encoding.c b/encoding.c
index e05c375..cf45cba 100644
--- a/encoding.c
+++ b/encoding.c
@@ -125,7 +125,7 @@
}
*outlen = out - outstart;
*inlen = processed - base;
- return(0);
+ return(*outlen);
}
#ifdef LIBXML_OUTPUT_ENABLED
@@ -209,7 +209,7 @@
}
*outlen = out - outstart;
*inlen = processed - instart;
- return(0);
+ return(*outlen);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -255,7 +255,7 @@
}
*outlen = out - outstart;
*inlen = in - base;
- return(0);
+ return(*outlen);
}
/**
@@ -291,7 +291,7 @@
*outlen = len;
*inlenb = len;
- return(0);
+ return(*outlen);
}
@@ -381,7 +381,7 @@
}
*outlen = out - outstart;
*inlen = processed - instart;
- return(0);
+ return(*outlen);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -470,7 +470,7 @@
}
*outlen = out - outstart;
*inlenb = processed - inb;
- return(0);
+ return(*outlen);
}
#ifdef LIBXML_OUTPUT_ENABLED
@@ -578,7 +578,7 @@
}
*outlen = (out - outstart) * 2;
*inlen = processed - instart;
- return(0);
+ return(*outlen);
}
/**
@@ -710,7 +710,7 @@
}
*outlen = out - outstart;
*inlenb = processed - inb;
- return(0);
+ return(*outlen);
}
#ifdef LIBXML_OUTPUT_ENABLED
@@ -815,7 +815,7 @@
}
*outlen = (out - outstart) * 2;
*inlen = processed - instart;
- return(0);
+ return(*outlen);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -2290,7 +2290,7 @@
}
*outlen = out - outstart;
*inlen = in - instart;
- return(0);
+ return(*outlen);
}
/**
@@ -2350,7 +2350,7 @@
}
*outlen = out - outstart;
*inlen = in - instart;
- return (0);
+ return (*outlen);
}