Re: [xml] Return value of xmlCharEncodingInputFunc


Ralf Junker wrote:
I am in doubt about the -1 return value of these function prototypes:

  * xmlCharEncodingInputFunc
  * xmlCharEncodingOutputFunc

The documentation says that -1 means "lack of space". However, in various implementations of these function 
prototype I see this:

  if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1);

So I wonder if the -1 result value means

  1. lack of space in the output buffer
  2. illegal arguments passed

The difference is that with 1 I would need to provide more output, but with 2. I would issue a parameter 

Does anyone which one of the two (or yet another) is the corret understanding of -1?

I think that's easy: you control what goes in and out, so the NULL checks will
not apply to you. All that can really go wrong is malloc problems. So the docs
are (mainly) correct.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]