diff options
author | Mark Spruiell <mes@zeroc.com> | 2016-04-14 11:02:02 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2016-04-14 11:02:02 -0700 |
commit | 6b6794f5e4efcf84d406a7b2259708bd4aa3c9af (patch) | |
tree | 332845001d2330a191fbbe803e67cfa4f4b68c51 /cpp/src/Slice | |
parent | Minor style fixes to log file archiving change (diff) | |
download | ice-6b6794f5e4efcf84d406a7b2259708bd4aa3c9af.tar.bz2 ice-6b6794f5e4efcf84d406a7b2259708bd4aa3c9af.tar.xz ice-6b6794f5e4efcf84d406a7b2259708bd4aa3c9af.zip |
ICE-7014 - Slice comments that begin or end with a double quote can cause bogus Python code to be generated
Diffstat (limited to 'cpp/src/Slice')
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 2e714214052..4848dfcbcff 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -2291,14 +2291,10 @@ Slice::Python::CodeVisitor::writeDocstring(const string& comment, const string& for(StringVec::const_iterator q = lines.begin(); q != lines.end(); ++q) { - if(q != lines.begin()) - { - _out << nl; - } - _out << *q; + _out << nl << *q; } - _out << "\"\"\""; + _out << nl << "\"\"\""; } void @@ -2314,11 +2310,7 @@ Slice::Python::CodeVisitor::writeDocstring(const string& comment, const DataMemb for(StringVec::const_iterator q = lines.begin(); q != lines.end(); ++q) { - if(q != lines.begin()) - { - _out << nl; - } - _out << *q; + _out << nl << *q; } if(!members.empty()) @@ -2360,7 +2352,7 @@ Slice::Python::CodeVisitor::writeDocstring(const string& comment, const DataMemb } } - _out << "\"\"\""; + _out << nl << "\"\"\""; } void @@ -2376,11 +2368,7 @@ Slice::Python::CodeVisitor::writeDocstring(const string& comment, const Enumerat for(StringVec::const_iterator q = lines.begin(); q != lines.end(); ++q) { - if(q != lines.begin()) - { - _out << nl; - } - _out << *q; + _out << nl << *q; } if(!enums.empty()) @@ -2422,7 +2410,7 @@ Slice::Python::CodeVisitor::writeDocstring(const string& comment, const Enumerat } } - _out << "\"\"\""; + _out << nl << "\"\"\""; } bool @@ -2665,11 +2653,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode { for(StringVec::const_iterator q = comment.description.begin(); q != comment.description.end(); ++q) { - if(q != comment.description.begin()) - { - _out << nl; - } - _out << *q; + _out << nl << *q; } } @@ -2798,7 +2782,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode _out << nl << r->first << " -- " << r->second; } } - _out << "\"\"\""; + _out << nl << "\"\"\""; } void |