autogenerate a minimal NULL value sequence for unknown pointer types This

* gentest.py testapi.c: autogenerate a minimal NULL value sequence
  for unknown pointer types
* HTMLparser.c SAX2.c chvalid.c encoding.c entities.c parser.c
  parserInternals.c relaxng.c valid.c xmlIO.c xmlreader.c
  xmlsave.c xmlschemas.c xmlschemastypes.c xmlstring.c xpath.c
  xpointer.c: This uncovered an impressive amount of entry points
  not checking for NULL pointers when they ought to, closing all
  the open gaps.
Daniel
diff --git a/xmlIO.c b/xmlIO.c
index 34d10b3..3e212ca 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -773,11 +773,13 @@
  *
  * Read @len bytes to @buffer from the I/O channel.
  *
- * Returns the number of bytes written
+ * Returns the number of bytes written or < 0 in case of failure
  */
 int
 xmlFileRead (void * context, char * buffer, int len) {
     int ret;
+    if ((context == NULL) || (buffer == NULL)) 
+        return(-1);
     ret = fread(&buffer[0], 1,  len, (FILE *) context);
     if (ret < 0) xmlIOErr(0, "fread()");
     return(ret);
@@ -798,6 +800,8 @@
 xmlFileWrite (void * context, const char * buffer, int len) {
     int items;
 
+    if ((context == NULL) || (buffer == NULL)) 
+        return(-1);
     items = fwrite(&buffer[0], len, 1, (FILE *) context);
     if ((items == 0) && (ferror((FILE *) context))) {
         xmlIOErr(0, "fwrite()");