diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-02-05 11:29:55 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-02-05 11:29:55 +0000 |
commit | d4dfd9db575dacacc350b29faa3229de4796fa6e (patch) | |
tree | 51df5a0b6c6e8f2d2db38824575c308ab3290a15 /cpp/src | |
parent | verifier should also use default host (diff) | |
download | ice-d4dfd9db575dacacc350b29faa3229de4796fa6e.tar.bz2 ice-d4dfd9db575dacacc350b29faa3229de4796fa6e.tar.xz ice-d4dfd9db575dacacc350b29faa3229de4796fa6e.zip |
Fixed bug 1745
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/Preprocessor.cpp | 32 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2cs/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2docbook/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2freeze/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2freezej/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2html/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2java/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2javae/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2py/Main.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2rb/Main.cpp | 6 | ||||
-rw-r--r-- | cpp/src/slice2vb/Main.cpp | 2 |
13 files changed, 43 insertions, 17 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index e52188a4a7e..ead6a4b90a3 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -56,13 +56,39 @@ 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. + // with spaces 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, "\\") + "\""; } +string +Slice::Preprocessor::normalizeIncludePath(const string& path) +{ + string result = path; + + replace(result.begin(), result.end(), '\\', '/'); + + string::size_type pos; + while((pos = result.find("//")) != string::npos) + { + result.replace(pos, 2, "/"); + } + + if(result == "/" || result.size() == 3 && isalpha(result[0]) && result[1] == ':' && result[2] == '/') + { + return result; + } + + if(result.size() > 1 && result[result.size() - 1] == '/') + { + result.erase(result.size() - 1); + } + + return "\"" + result + "\""; +} + FILE* Slice::Preprocessor::preprocess(bool keepComments) { diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 8d3c6db4d78..77f3eaf458b 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -114,7 +114,7 @@ main(int argc, char* argv[]) includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2cppe/Main.cpp b/cpp/src/slice2cppe/Main.cpp index 1fda6e41dcd..2d776d8eb8d 100644 --- a/cpp/src/slice2cppe/Main.cpp +++ b/cpp/src/slice2cppe/Main.cpp @@ -109,7 +109,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp index a34d32301cb..c0eb644f719 100644 --- a/cpp/src/slice2cs/Main.cpp +++ b/cpp/src/slice2cs/Main.cpp @@ -102,7 +102,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp index 4f0f063526b..ed077cdb4fc 100644 --- a/cpp/src/slice2docbook/Main.cpp +++ b/cpp/src/slice2docbook/Main.cpp @@ -98,7 +98,7 @@ main(int argc, char* argv[]) optargs = opts.argVec("I"); for(i = optargs.begin(); i != optargs.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index 97a495da2c2..bb52497625b 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -1241,7 +1241,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess= opts.isSet("E"); diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index bbca3691695..b4f9ee1e88c 100644 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp @@ -1132,7 +1132,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp index bda3228acbe..5552987b908 100644 --- a/cpp/src/slice2html/Main.cpp +++ b/cpp/src/slice2html/Main.cpp @@ -108,7 +108,7 @@ main(int argc, char* argv[]) optargs = opts.argVec("I"); for(i = optargs.begin(); i != optargs.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index 6daeac74c03..b52e6623d19 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -108,7 +108,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2javae/Main.cpp b/cpp/src/slice2javae/Main.cpp index a431e9f5865..a06269a78bc 100644 --- a/cpp/src/slice2javae/Main.cpp +++ b/cpp/src/slice2javae/Main.cpp @@ -98,7 +98,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp index c0ff6b7dce0..a038f99002e 100644 --- a/cpp/src/slice2py/Main.cpp +++ b/cpp/src/slice2py/Main.cpp @@ -441,7 +441,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp index 47867199325..6a6c7fa5e53 100644 --- a/cpp/src/slice2rb/Main.cpp +++ b/cpp/src/slice2rb/Main.cpp @@ -97,19 +97,19 @@ main(int argc, char* argv[]) vector<string>::const_iterator i; for(i = optargs.begin(); i != optargs.end(); ++i) { - cppArgs += " -D" + *i; + cppArgs += " -D" + Preprocessor::addQuotes(*i); } optargs = opts.argVec("U"); for(i = optargs.begin(); i != optargs.end(); ++i) { - cppArgs += " -U" + *i; + cppArgs += " -U" + Preprocessor::addQuotes(*i); } vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + *i; + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); diff --git a/cpp/src/slice2vb/Main.cpp b/cpp/src/slice2vb/Main.cpp index e16990e3c3a..07d384d7dc6 100644 --- a/cpp/src/slice2vb/Main.cpp +++ b/cpp/src/slice2vb/Main.cpp @@ -102,7 +102,7 @@ main(int argc, char* argv[]) vector<string> includePaths = opts.argVec("I"); for(i = includePaths.begin(); i != includePaths.end(); ++i) { - cppArgs += " -I" + Preprocessor::addQuotes(*i); + cppArgs += " -I" + Preprocessor::normalizeIncludePath(*i); } bool preprocess = opts.isSet("E"); |