List:Commits« Previous MessageNext Message »
From:jack andrews Date:July 13 2009 11:58am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jack:2948) Bug#45733
View as plain text  
#At file:///D:/repo/more-than-4-ndbd-bug45733/ based on revid:jonas@stripped

 2948 jack andrews	2009-07-13
      Bug #45733  	Cluster with more than 4 storage node 
        . fixes basestring_vsnprintf() for windows
        . now, will run `ndb_mgm -e show` to completion

    modified:
      storage/ndb/src/common/util/BaseString.cpp
      storage/ndb/src/common/util/basestring_vsnprintf.c
=== modified file 'storage/ndb/src/common/util/BaseString.cpp'
--- a/storage/ndb/src/common/util/BaseString.cpp	2009-06-06 12:52:24 +0000
+++ b/storage/ndb/src/common/util/BaseString.cpp	2009-07-13 11:57:31 +0000
@@ -210,7 +210,8 @@ BaseString::assfmt(const char *fmt, ...)
 	m_chr = t;
     }
     va_start(ap, fmt);
-    basestring_vsnprintf(m_chr, l, fmt, ap);
+    l = basestring_vsnprintf(m_chr, l, fmt, ap);
+    assert(l<=(int)strlen(m_chr));
     va_end(ap);
     m_len = strlen(m_chr);
     return *this;

=== modified file 'storage/ndb/src/common/util/basestring_vsnprintf.c'
--- a/storage/ndb/src/common/util/basestring_vsnprintf.c	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/common/util/basestring_vsnprintf.c	2009-07-13 11:57:31 +0000
@@ -24,12 +24,6 @@
 #include <basestring_vsnprintf.h>
 #include <my_global.h>
 
-#ifdef _WINDOWS
-#define SNPRINTF_RETURN_TRUNC
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#endif
-
 int
 basestring_snprintf(char *str, size_t size, const char *format, ...)
 {
@@ -41,33 +35,24 @@ basestring_snprintf(char *str, size_t si
   return(ret);
 }
 
-#ifdef SNPRINTF_RETURN_TRUNC
-static char basestring_vsnprintf_buf[16*1024];
-#endif
 int
 basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap)
 {
+  int ret = -1;
   if (size == 0)
   {
-#ifdef SNPRINTF_RETURN_TRUNC
-    return vsnprintf(basestring_vsnprintf_buf,
-		     sizeof(basestring_vsnprintf_buf),
-		     format, ap);
-#else
     char buf[1];
-    return vsnprintf(buf, 1, format, ap);
-#endif
+    return basestring_vsnprintf(buf, 1, format, ap);
   }
+  ret = IF_WIN(_vsnprintf,vsnprintf)(str, size, format, ap);
+#ifdef _WIN32
+  if (ret == -1) 
   {
-    int ret= vsnprintf(str, size, format, ap);
-#ifdef SNPRINTF_RETURN_TRUNC
-    if (ret == size-1 || ret == -1)
-    {
-      ret= vsnprintf(basestring_vsnprintf_buf,
-		     sizeof(basestring_vsnprintf_buf),
-		     format, ap);
-    }
-#endif
-    return ret;
+    if (errno == EINVAL)
+      return ret;
+    // otherwise, more than size chars are needed:
+    return _vscprintf(format, ap);
   }
+#endif
+  return ret;
 }


Attachment: [text/bzr-bundle] bzr/jack@sun.com-20090713115731-jeztudk6yigpih71.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jack:2948) Bug#45733jack andrews13 Jul