[Box Backup-commit] COMMIT r2659 - box/RELEASE/0.11rc7/lib/server

subversion at boxbackup.org subversion at boxbackup.org
Mon Mar 8 21:30:42 GMT 2010


Author: chris
Date: 2010-03-08 21:30:42 +0000 (Mon, 08 Mar 2010)
New Revision: 2659

Modified:
   box/RELEASE/0.11rc7/lib/server/LocalProcessStream.cpp
   box/RELEASE/0.11rc7/lib/server/LocalProcessStream.h
Log:
Merge remained of [2597] from trunk into 0.11rc7. Make 
LocalProcessStream? constructor take a std::string& for C++ style.


Modified: box/RELEASE/0.11rc7/lib/server/LocalProcessStream.cpp
===================================================================
--- box/RELEASE/0.11rc7/lib/server/LocalProcessStream.cpp	2010-03-08 21:30:10 UTC (rev 2658)
+++ box/RELEASE/0.11rc7/lib/server/LocalProcessStream.cpp	2010-03-08 21:30:42 UTC (rev 2659)
@@ -43,13 +43,14 @@
 //		Created: 12/3/04
 //
 // --------------------------------------------------------------------------
-std::auto_ptr<IOStream> LocalProcessStream(const char *CommandLine, pid_t &rPidOut)
+std::auto_ptr<IOStream> LocalProcessStream(const std::string& rCommandLine,
+	pid_t &rPidOut)
 {
 #ifndef WIN32
 
 	// Split up command
 	std::vector<std::string> command;
-	SplitString(std::string(CommandLine), ' ', command);
+	SplitString(rCommandLine, ' ', command);
 
 	// Build arguments
 	char *args[MAX_ARGUMENTS + 4];
@@ -137,8 +138,8 @@
 	startupInfo.hStdInput  = INVALID_HANDLE_VALUE;
 	startupInfo.dwFlags   |= STARTF_USESTDHANDLES;
 
-	CHAR* commandLineCopy = (CHAR*)malloc(strlen(CommandLine) + 1);
-	strcpy(commandLineCopy, CommandLine);
+	CHAR* commandLineCopy = (CHAR*)malloc(rCommandLine.size() + 1);
+	strcpy(commandLineCopy, rCommandLine.c_str());
 
 	BOOL result = CreateProcess(NULL, 
 		commandLineCopy, // command line 
@@ -155,7 +156,7 @@
    
 	if(!result)
 	{
-		BOX_ERROR("Failed to CreateProcess: '" << CommandLine <<
+		BOX_ERROR("Failed to CreateProcess: '" << rCommandLine <<
 			"': " << GetErrorMessage(GetLastError()));
 		CloseHandle(writeInChild);
 		CloseHandle(readFromChild);

Modified: box/RELEASE/0.11rc7/lib/server/LocalProcessStream.h
===================================================================
--- box/RELEASE/0.11rc7/lib/server/LocalProcessStream.h	2010-03-08 21:30:10 UTC (rev 2658)
+++ box/RELEASE/0.11rc7/lib/server/LocalProcessStream.h	2010-03-08 21:30:42 UTC (rev 2659)
@@ -13,7 +13,8 @@
 #include <memory>
 #include "IOStream.h"
 
-std::auto_ptr<IOStream> LocalProcessStream(const char *CommandLine, pid_t &rPidOut);
+std::auto_ptr<IOStream> LocalProcessStream(const std::string& rCommandLine,
+	pid_t &rPidOut);
 
 #endif // LOCALPROCESSSTREAM__H
 




More information about the Boxbackup-commit mailing list