diff options
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-x | cpp/src/Slice/CsUtil.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index 2156728494d..ddd87d8a4c3 100755 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -179,23 +179,6 @@ Slice::CsGenerator::typeToString(const TypePtr& type) return "???"; } -static string -toArrayAlloc(const string& decl, const string& sz) -{ - int count = 0; - string::size_type pos = decl.size(); - while(pos > 1 && decl.substr(pos - 2, 2) == "[]") - { - ++count; - pos -= 2; - } - assert(count > 0); - - ostringstream o; - o << decl.substr(0, pos) << '[' << sz << ']' << decl.substr(pos + 2); - return o.str(); -} - bool Slice::CsGenerator::isValueType(const TypePtr& type) { @@ -618,7 +601,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << param << " = new "; if(isArray) { - out << toArrayAlloc(typeS + "[]", "sz"); + out << toArrayAlloc(typeS + "[]", "sz"); } else { @@ -775,6 +758,23 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, return; } +string +Slice::CsGenerator::toArrayAlloc(const string& decl, const string& sz) +{ + int count = 0; + string::size_type pos = decl.size(); + while(pos > 1 && decl.substr(pos - 2, 2) == "[]") + { + ++count; + pos -= 2; + } + assert(count > 0); + + ostringstream o; + o << decl.substr(0, pos) << '[' << sz << ']' << decl.substr(pos + 2); + return o.str(); +} + void Slice::CsGenerator::validateMetaData(const UnitPtr& unit) { |