From 4c303c67f7e204e1eaa68a88e9feb338ece8af46 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Fri, 5 Jan 2007 15:33:38 +0000 Subject: Fixed bug 1653 --- cpp/src/Slice/Preprocessor.cpp | 80 ++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 35 deletions(-) (limited to 'cpp/src/Slice/Preprocessor.cpp') diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index b76d1054e3f..77b28ece361 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -6,18 +6,16 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** - -#include +#include +#include #include #include - - #include #include #ifndef _WIN32 - + # include #endif @@ -53,6 +51,18 @@ Slice::Preprocessor::getBaseName() return base; } +string +Slice::Preprocessor::addQuotes(const string& arg) +{ + // + // Add quotes around the given argument to ensure that arguments + // with spaces (such as PATHs) will be preserved as a single + // argument. We also escape the "\" character to ensure that we + // don't end up with a \" at the end of the string. + // + return "\"" + IceUtil::escapeString(arg, "\\") + "\""; +} + FILE* Slice::Preprocessor::preprocess(bool keepComments) { @@ -232,37 +242,37 @@ Slice::Preprocessor::printMakefileDependencies(Language lang) } break; } - case VisualBasic: - { - // - // Change .cpp suffix to .vb suffix. - // + case VisualBasic: + { + // + // Change .cpp suffix to .vb suffix. + // char buf[1024]; - while(fgets(buf, static_cast(sizeof(buf)), cppHandle) != NULL) - { - char* dot; - char* colon = strchr(buf, ':'); - if(colon != NULL) - { - *colon = '\0'; - dot = strrchr(buf, '.'); - *colon = ':'; - if(dot != NULL) - { - if(strncmp(dot, ".cpp:", 5) == 0) - { - *dot = '\0'; - fputs(buf, stdout); - fputs(".vb", stdout); - fputs(colon, stdout); - continue; - } - } - } - fputs(buf, stdout); - } - break; - } + while(fgets(buf, static_cast(sizeof(buf)), cppHandle) != NULL) + { + char* dot; + char* colon = strchr(buf, ':'); + if(colon != NULL) + { + *colon = '\0'; + dot = strrchr(buf, '.'); + *colon = ':'; + if(dot != NULL) + { + if(strncmp(dot, ".cpp:", 5) == 0) + { + *dot = '\0'; + fputs(buf, stdout); + fputs(".vb", stdout); + fputs(colon, stdout); + continue; + } + } + } + fputs(buf, stdout); + } + break; + } default: { abort(); -- cgit v1.2.3