commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r802772 - /commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c
Date Mon, 10 Aug 2009 12:53:55 GMT
Author: mturk
Date: Mon Aug 10 12:53:54 2009
New Revision: 802772

URL: http://svn.apache.org/viewvc?rev=802772&view=rev
Log:
MSVC doesn't have va_copy. Use simple assignment instead

Modified:
    commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c?rev=802772&r1=802771&r2=802772&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/sbuf.c Mon Aug 10 12:53:54 2009
@@ -303,11 +303,19 @@
         return -1;
 
     do {
+#if defined(_MSC_VER)
+        ap_copy = ap;
+#else
         va_copy(ap_copy, ap);
+#endif
         len = vsnprintf((char *)&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
                         fmt, ap_copy);
+#if defined(_MSC_VER)
+
+#else
         va_end(ap_copy);
-    } while (len > SBUF_FREESPACE(s) &&
+#endif
+    } while ((size_t)len > SBUF_FREESPACE(s) &&
              acr_sbuf_extend(s, (size_t)(len - SBUF_FREESPACE(s))) == 0);
 
     /*
@@ -319,7 +327,7 @@
      * vsnprintf() returns the amount that would have been copied,
      * given sufficient space, hence the min() calculation below.
      */
-    s->s_len += ACR_MIN(len, SBUF_FREESPACE(s));
+    s->s_len += ACR_MIN((size_t)len, SBUF_FREESPACE(s));
     if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s))
         SBUF_SETFLAG(s, ACR_SBUF_OVERFLOWED);
 



Mime
View raw message