[Scummvm-cvs-logs] SF.net SVN: scummvm:[53586] scummvm/trunk/common

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Oct 18 22:20:14 CEST 2010


Revision: 53586
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53586&view=rev
Author:   sev
Date:     2010-10-18 20:20:14 +0000 (Mon, 18 Oct 2010)

Log Message:
-----------
Revert "COMMON: Implement Common::vprintf(). Patch by littleboy"

Modified Paths:
--------------
    scummvm/trunk/common/str.cpp
    scummvm/trunk/common/str.h

Modified: scummvm/trunk/common/str.cpp
===================================================================
--- scummvm/trunk/common/str.cpp	2010-10-18 20:19:58 UTC (rev 53585)
+++ scummvm/trunk/common/str.cpp	2010-10-18 20:20:14 UTC (rev 53586)
@@ -30,18 +30,6 @@
 
 #include <stdarg.h>
 
-#ifndef VA_COPY
-#if defined(HAVE_VA_COPY) || defined(va_copy)
-#define VA_COPY(dest, src) va_copy(dest, src)
-#else
-#ifdef HAVE___VA_COPY
-#define VA_COPY(dest, src) __va_copy(dest, src)
-#else
-#define VA_COPY(dest, src) (dest) = (src)
-#endif
-#endif
-#endif
-
 namespace Common {
 
 MemoryPool *g_refCountPool = 0; // FIXME: This is never freed right now
@@ -443,22 +431,13 @@
 
 // static
 String String::printf(const char *fmt, ...) {
-	va_list argptr;
-
-	va_start(argptr, fmt);
-	Common::String output = vprintf(fmt, argptr);
-	va_end (argptr);
-
-	return output;
-}
-
-String String::vprintf(const char *fmt, va_list argptr) {
 	String output;
 	assert(output.isStorageIntern());
 
 	va_list va;
-	VA_COPY(va, argptr);
+	va_start(va, fmt);
 	int len = vsnprintf(output._str, _builtinCapacity, fmt, va);
+	va_end(va);
 
 	if (len == -1 || len == _builtinCapacity - 1) {
 		// MSVC and IRIX don't return the size the full string would take up.
@@ -481,7 +460,9 @@
 			assert(!output.isStorageIntern());
 			size = output._extern._capacity;
 
+			va_start(va, fmt);
 			len = vsnprintf(output._str, size, fmt, va);
+			va_end(va);
 		} while (len == -1 || len >= size - 1);
 		output._size = len;
 	} else if (len < (int)_builtinCapacity) {
@@ -490,7 +471,9 @@
 	} else {
 		// vsnprintf didn't have enough space, so grow buffer
 		output.ensureCapacity(len, false);
+		va_start(va, fmt);
 		int len2 = vsnprintf(output._str, len+1, fmt, va);
+		va_end(va);
 		assert(len == len2);
 		output._size = len2;
 	}

Modified: scummvm/trunk/common/str.h
===================================================================
--- scummvm/trunk/common/str.h	2010-10-18 20:19:58 UTC (rev 53585)
+++ scummvm/trunk/common/str.h	2010-10-18 20:20:14 UTC (rev 53586)
@@ -220,8 +220,6 @@
 	 */
 	static Common::String printf(const char *fmt, ...) GCC_PRINTF(1,2);
 
-	static Common::String vprintf(const char *fmt, va_list argptr);
-
 public:
 	typedef char *        iterator;
 	typedef const char *  const_iterator;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list