stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r416530 - /incubator/stdcxx/trunk/tests/src/printf.cpp
Date Fri, 23 Jun 2006 00:30:10 GMT
Author: sebor
Date: Thu Jun 22 17:30:10 2006
New Revision: 416530

URL: http://svn.apache.org/viewvc?rev=416530&view=rev
Log:
2006-06-22  Martin Sebor  <sebor@roguewave.com>

	* printf.cpp (rw_vasnprintf): Used the number of bytes,
	not elements, in the call to memcpy.

Modified:
    incubator/stdcxx/trunk/tests/src/printf.cpp

Modified: incubator/stdcxx/trunk/tests/src/printf.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/printf.cpp?rev=416530&r1=416529&r2=416530&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/printf.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/printf.cpp Thu Jun 22 17:30:10 2006
@@ -769,10 +769,11 @@
 
         if (spec_bufsize == paramno) {
             // grow the buffer of conversion specifiers
-            FmtSpec* const tmp =
-                (FmtSpec*)malloc (spec_bufsize * 2 * sizeof (FmtSpec));
+            const size_t bytesize = spec_bufsize * sizeof (FmtSpec);
+
+            FmtSpec* const tmp = (FmtSpec*)malloc (bytesize * 2);
             if (tmp) {
-                memcpy (tmp, pspec, spec_bufsize);
+                memcpy (tmp, pspec, bytesize);
                 if (pspec != specbuf)
                     free (pspec);
                 pspec = tmp;



Mime
View raw message