Re: [xml] Tru64 UNIX 5.1/IRIX 6.5 test suite errors



On Wed, Oct 26, 2005 at 06:59:15PM -0500, Albert Chin wrote:
On Wed, Oct 26, 2005 at 01:48:03PM -0500, Albert Chin wrote:
On Wed, Oct 26, 2005 at 01:27:43PM -0500, Albert Chin wrote:

I replaced vsnprintf() with trio_vsnprintf() on these platforms in
error.c and:
  ./runtest "Error cases regression tests"
  ## Error cases regression tests
  Total 8 tests, no errors

Does libxml assume a C99 vsnprintf() in error.c?

All tests pass with trio_vsnprintf() on these two platforms.

On IRIX and Tru64 UNIX, vsnprintf() returns the number of characters
transmitted, _not_ the number of characters that would have been
transmitted if the buffer were large enough. From error.c:
        va_start(ap, msg);                                      \
        chars = vsnprintf(str, size, msg, ap);                  \
        va_end(ap);                                             \
        if ((chars > -1) && (chars < size))                     \
            break;                                              \
        if (chars > -1)                                         \
            size += chars + 1;                                  \
        else                                                    \
            size += 100;                                        \

This definitely assumes a C99 vsnprintf().

  Okay, what's the alternative ? Set str[size - 1] to 0 after va_end
and use chars = strlen() instead, then compare size with chars and
increase size if equals else break ? That should work I think on all platforms
avoiding a dependancy on a cornercase of the *printf behaviour that other
libc are likely to get wrong too.
  Would you design such a patch, I have little time for libxml2 ATM ?

   thanks !

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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