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



On Thu, Oct 27, 2005 at 06:04:26AM -0400, Daniel Veillard wrote:
  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 ?

How's this?

-- 
albert chin (china thewrittenword com)

-- snip snip
Index: error.c
===================================================================
--- error.c.orig        2005-08-25 12:29:02.000000000 -0500
+++ error.c     2005-10-27 17:29:28.993659000 -0500
@@ -21,7 +21,7 @@
                                 ...);
 
 #define XML_GET_VAR_STR(msg, str) {                            \
-    int       size;                                            \
+    int       size, prev_size = -1;                            \
     int       chars;                                           \
     char      *larger;                                         \
     va_list   ap;                                              \
@@ -36,7 +36,10 @@
        chars = vsnprintf(str, size, msg, ap);                  \
        va_end(ap);                                             \
        if ((chars > -1) && (chars < size))                     \
-           break;                                              \
+           if (prev_size == chars)                             \
+               break;                                          \
+           else                                                \
+               prev_size = chars;                              \
        if (chars > -1)                                         \
            size += chars + 1;                                  \
        else                                                    \



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