From bf92b3d33fdf15bc8eacacb1baf35fdd17131ee6 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Tue, 25 Sep 2007 17:59:25 -0400 Subject: Fixed bug #2440 --- cpp/src/Slice/PythonUtil.cpp | 48 +++----------------------------------------- 1 file changed, 3 insertions(+), 45 deletions(-) (limited to 'cpp/src/Slice/PythonUtil.cpp') diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 1a88d964376..2add3c47571 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #ifdef __BCPLUSPLUS__ # include #endif @@ -255,7 +255,7 @@ Slice::Python::ModuleVisitor::visitModuleStart(const ModulePtr& p) if(!pkg.empty()) { vector v; - splitString(pkg, v, "."); + splitString(pkg, ".", v); string mod; for(vector::iterator q = v.begin(); q != v.end(); ++q) { @@ -318,7 +318,7 @@ Slice::Python::CodeVisitor::visitModuleStart(const ModulePtr& p) if(!pkg.empty()) { vector v; - splitString(pkg, v, "."); + splitString(pkg, ".", v); string mod; for(vector::iterator q = v.begin(); q != v.end(); ++q) { @@ -1865,48 +1865,6 @@ Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector out << nl; // Trailing newline. } -bool -Slice::Python::splitString(const string& str, vector& args, const string& delim) -{ - string::size_type beg; - string::size_type end = 0; - while(true) - { - beg = str.find_first_not_of(delim, end); - if(beg == string::npos) - { - break; - } - - // - // Check for quoted argument. - // - char ch = str[beg]; - if(ch == '"' || ch == '\'') - { - beg++; - end = str.find(ch, beg); - if(end == string::npos) - { - return false; - } - args.push_back(str.substr(beg, end - beg)); - end++; // Skip end quote. - } - else - { - end = str.find_first_of(delim + "'\"", beg); - if(end == string::npos) - { - end = str.length(); - } - args.push_back(str.substr(beg, end - beg)); - } - } - - return true; -} - string Slice::Python::scopedToName(const string& scoped) { -- cgit v1.2.3