This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 5ce786e3d810391c2ed259e2ac0bad2d8ac5a9eb (commit)
via d645b03e9c97856436b9fcd517b2c33b8aa3302c (commit)
via 909d51bece7d343f32a8f59351aad5c396101a2c (commit)
from ff2a74b6fa5c9d13647e61cee90d0699661416c4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ce786e3d810391c2ed259e2ac0bad2d8ac5a9eb
commit 5ce786e3d810391c2ed259e2ac0bad2d8ac5a9eb
Merge: ff2a74b d645b03
Author: Daniel Pfeifer
AuthorDate: Wed Jun 15 17:55:47 2016 -0400
Commit: CMake Topic Stage
CommitDate: Wed Jun 15 17:55:47 2016 -0400
Merge topic 'cmOutputConverter-stringstream' into next
d645b03e cmOutputConverter: implement Shell__GetArgument using ostringstream
909d51be CMake Nightly Date Stamp
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d645b03e9c97856436b9fcd517b2c33b8aa3302c
commit d645b03e9c97856436b9fcd517b2c33b8aa3302c
Author: Daniel Pfeifer
AuthorDate: Wed Jun 15 23:41:46 2016 +0200
Commit: Daniel Pfeifer
CommitDate: Wed Jun 15 23:44:37 2016 +0200
cmOutputConverter: implement Shell__GetArgument using ostringstream
This removes the need to calculate the resulting string length
beforehand.
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 8e80bd0..da43a11 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -15,6 +15,7 @@
#include "cmake.h"
#include
+#include
#include /* isalpha */
#include /* strlen */
@@ -328,19 +329,9 @@ std::string cmOutputConverter::EscapeForShell(const
std::string& str,
flags |= Shell_Flag_NMake;
}
- // Compute the buffer size needed.
- int size = (this->GetState()->UseWindowsShell()
-? Shell_GetArgumentSizeForWindows(str.c_str(), flags)
-: Shell_GetArgumentSizeForUnix(str.c_str(), flags));
-
- // Compute the shell argument itself.
- std::vector arg(size);
- if (this->GetState()->UseWindowsShell()) {
-Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
- } else {
-Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags);
- }
- return std::string(&arg[0]);
+ return this->GetState()->UseWindowsShell()
+? Shell_GetArgumentForWindows(str.c_str(), flags)
+: Shell_GetArgumentForUnix(str.c_str(), flags);
}
std::string cmOutputConverter::EscapeForCMake(const std::string& str)
@@ -369,18 +360,7 @@ std::string cmOutputConverter::EscapeForCMake(const
std::string& str)
std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg,
int shell_flags)
{
- char local_buffer[1024];
- char* buffer = local_buffer;
- int size = Shell_GetArgumentSizeForWindows(arg, shell_flags);
- if (size > 1024) {
-buffer = new char[size];
- }
- Shell_GetArgumentForWindows(arg, buffer, shell_flags);
- std::string result(buffer);
- if (buffer != local_buffer) {
-delete[] buffer;
- }
- return result;
+ return Shell_GetArgumentForWindows(arg, shell_flags);
}
cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
@@ -586,12 +566,10 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const
char* in, int isUnix,
return 0;
}
-int cmOutputConverter::Shell__GetArgumentSize(const char* in, int isUnix,
- int flags)
+std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
+ int flags)
{
- /* Start with the length of the original argument, plus one for
- either a terminating null or a separating space. */
- int size = (int)strlen(in) + 1;
+ std::ostringstream out;
/* String iterator. */
const char* c;
@@ -599,116 +577,17 @@ int cmOutputConverter::Shell__GetArgumentSize(const
char* in, int isUnix,
/* Keep track of how many backslashes have been encountered in a row. */
int windows_backslashes = 0;
- /* Scan the string for characters that require escaping or quoting. */
- for (c = in; *c; ++c) {
-/* Look for $(MAKEVAR) syntax if requested. */
-if (flags & Shell_Flag_AllowMakeVariables) {
- /* Skip over the make variable references if any are present. */
- c = Shell__SkipMakeVariables(c);
-
- /* Stop if we have reached the end of the string. */
- if (!*c) {
-break;
- }
-}
-
-/* Check whether this character needs escaping for the shell. */
-if (isUnix) {
- /* On Unix a few special characters need escaping even inside a
- quoted argument. */
- if (*c == '\\'