diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 96 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 12 | ||||
-rw-r--r-- | cpp/src/Ice/IncomingAsync.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.cpp | 19 | ||||
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 108 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 20 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 41 |
11 files changed, 204 insertions, 120 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 11a265767ba..69da348ba6e 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -705,32 +705,33 @@ IceInternal::BasicStream::readBlob(Ice::Byte* v, Container::size_type sz) } void -IceInternal::BasicStream::write(const vector<Byte>& v) +IceInternal::BasicStream::write(const Byte* begin, const Byte* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz); - memcpy(&b[pos], &v[0], sz); + memcpy(&b[pos], begin, sz); } } void -IceInternal::BasicStream::read(vector<Byte>& v) +IceInternal::BasicStream::read(pair<const Byte*, const Byte*>& v) { Int sz; readSize(sz); if(sz > 0) { - checkFixedSeq(sz, 1); - vector<Byte>(i, i + sz).swap(v); - i += sz; + checkFixedSeq(sz, 1); + v.first = i; + v.second = i + sz; + i += sz; } else { - v.clear(); + v.first = v.second = i; } } @@ -748,20 +749,40 @@ IceInternal::BasicStream::write(const vector<bool>& v) } void +IceInternal::BasicStream::write(const bool* begin, const bool* end) +{ + Int sz = end - begin; + writeSize(sz); + if(sz > 0) + { + Container::size_type pos = b.size(); + resize(pos + sz); +#if defined(__APPLE__) + for(int idx = 0; idx < sz; ++idx) + { + b[pos + idx] = static_cast<Ice::Byte>(*(begin + idx)); + } +#else + memcpy(&b[pos], begin, sz); +#endif + } +} + +void IceInternal::BasicStream::read(vector<bool>& v) { Int sz; readSize(sz); if(sz > 0) { - checkFixedSeq(sz, 1); - v.resize(sz); - copy(i, i + sz, v.begin()); - i += sz; + checkFixedSeq(sz, 1); + v.resize(sz); + copy(i, i + sz, v.begin()); + i += sz; } else { - v.clear(); + v.clear(); } } @@ -783,16 +804,16 @@ IceInternal::BasicStream::write(Short v) } void -IceInternal::BasicStream::write(const vector<Short>& v) +IceInternal::BasicStream::write(const Short* begin, const Short* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Short)); #ifdef ICE_BIG_ENDIAN - const Byte* src = reinterpret_cast<const Byte*>(&v[0]) + sizeof(Short) - 1; + const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { @@ -801,7 +822,7 @@ IceInternal::BasicStream::write(const vector<Short>& v) src += 2 * sizeof(Short); } #else - memcpy(&b[pos], reinterpret_cast<const Byte*>(&v[0]), sz * sizeof(Short)); + memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short)); #endif } } @@ -878,16 +899,16 @@ IceInternal::BasicStream::write(Int v) } void -IceInternal::BasicStream::write(const vector<Int>& v) +IceInternal::BasicStream::write(const Int* begin, const Int* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Int)); #ifdef ICE_BIG_ENDIAN - const Byte* src = reinterpret_cast<const Byte*>(&v[0]) + sizeof(Int) - 1; + const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { @@ -898,7 +919,7 @@ IceInternal::BasicStream::write(const vector<Int>& v) src += 2 * sizeof(Int); } #else - memcpy(&b[pos], reinterpret_cast<const Byte*>(&v[0]), sz * sizeof(Int)); + memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int)); #endif } } @@ -989,16 +1010,16 @@ IceInternal::BasicStream::write(Long v) } void -IceInternal::BasicStream::write(const vector<Long>& v) +IceInternal::BasicStream::write(const Long* begin, const Long* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Long)); #ifdef ICE_BIG_ENDIAN - const Byte* src = reinterpret_cast<const Byte*>(&v[0]) + sizeof(Long) - 1; + const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { @@ -1013,7 +1034,7 @@ IceInternal::BasicStream::write(const vector<Long>& v) src += 2 * sizeof(Long); } #else - memcpy(&b[pos], reinterpret_cast<const Byte*>(&v[0]), sz * sizeof(Long)); + memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long)); #endif } } @@ -1108,16 +1129,16 @@ IceInternal::BasicStream::write(Float v) } void -IceInternal::BasicStream::write(const vector<Float>& v) +IceInternal::BasicStream::write(const Float* begin, const Float* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Float)); #ifdef ICE_BIG_ENDIAN - const Byte* src = reinterpret_cast<const Byte*>(&v[0]) + sizeof(Float) - 1; + const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { @@ -1128,7 +1149,7 @@ IceInternal::BasicStream::write(const vector<Float>& v) src += 2 * sizeof(Float); } #else - memcpy(&b[pos], reinterpret_cast<const Byte*>(&v[0]), sz * sizeof(Float)); + memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float)); #endif } } @@ -1219,16 +1240,16 @@ IceInternal::BasicStream::write(Double v) } void -IceInternal::BasicStream::write(const vector<Double>& v) +IceInternal::BasicStream::write(const Double* begin, const Double* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { Container::size_type pos = b.size(); resize(pos + sz * sizeof(Double)); #ifdef ICE_BIG_ENDIAN - const Byte* src = reinterpret_cast<const Byte*>(&v[0]) + sizeof(Double) - 1; + const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1; Byte* dest = &(*(b.begin() + pos)); for(int j = 0 ; j < sz ; ++j) { @@ -1243,7 +1264,7 @@ IceInternal::BasicStream::write(const vector<Double>& v) src += 2 * sizeof(Double); } #else - memcpy(&b[pos], reinterpret_cast<const Byte*>(&v[0]), sz * sizeof(Double)); + memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double)); #endif } } @@ -1344,16 +1365,15 @@ IceInternal::BasicStream::write(const string& v) } void -IceInternal::BasicStream::write(const vector<string>& v) +IceInternal::BasicStream::write(const string* begin, const string* end) { - Int sz = static_cast<Int>(v.size()); + Int sz = end - begin; writeSize(sz); if(sz > 0) { - vector<string>::const_iterator p; - for(p = v.begin(); p != v.end(); ++p) + for(int i = 0; i < sz; ++i) { - write(*p); + write(begin[i]); } } } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 8254bf3fb3c..11e89e1a37e 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -240,13 +240,11 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) // if(ex.facet.empty()) { - _os.write(vector<string>()); + _os.write(static_cast<string*>(0), static_cast<string*>(0)); } else { - vector<string> facetPath; - facetPath.push_back(ex.facet); - _os.write(facetPath); + _os.write(&ex.facet, &ex.facet + 1); } _os.write(ex.operation); @@ -502,13 +500,11 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) // if(_current.facet.empty()) { - _os.write(vector<string>()); + _os.write(static_cast<string*>(0), static_cast<string*>(0)); } else { - vector<string> facetPath; - facetPath.push_back(_current.facet); - _os.write(facetPath); + _os.write(&_current.facet, &_current.facet + 1); } _os.write(_current.operation); diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index f50e6564947..aa2ddc7a766 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -145,13 +145,11 @@ IceInternal::IncomingAsync::__exception(const Exception& exc) // if(ex.facet.empty()) { - _os.write(vector<string>()); + _os.write(static_cast<string*>(0), static_cast<string*>(0)); } else { - vector<string> facetPath; - facetPath.push_back(ex.facet); - _os.write(facetPath); + _os.write(&ex.facet, &ex.facet + 1); } _os.write(ex.operation); diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 4cc7a9edf32..7a0150506dd 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -119,7 +119,7 @@ Ice::Object::___ice_ids(Incoming& __inS, const Current& __current) { BasicStream* __os = __inS.os(); vector<string> __ret = ice_ids(__current); - __os->write(__ret); + __os->write(&__ret[0], &__ret[0] + __ret.size()); return DispatchOK; } diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 038641be760..0a081181f0a 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -71,13 +71,12 @@ IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const s // if(_reference->getFacet().empty()) { - _os.write(vector<string>()); + _os.write(static_cast<string*>(0), static_cast<string*>(0)); } else { - vector<string> facetPath; - facetPath.push_back(_reference->getFacet()); - _os.write(facetPath); + string facet = _reference->getFacet(); + _os.write(&facet, &facet + 1); } _os.write(operation); diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index fca226a66be..c1dcb5f3871 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -317,13 +317,12 @@ IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operat // if(_reference->getFacet().empty()) { - __os->write(vector<string>()); + __os->write(static_cast<string*>(0), static_cast<string*>(0)); } else { - vector<string> facetPath; - facetPath.push_back(_reference->getFacet()); - __os->write(facetPath); + string facet = _reference->getFacet(); + __os->write(&facet, &facet + 1); } __os->write(operation); diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index a80d2f79d8c..e0096536a94 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -160,13 +160,11 @@ IceInternal::Reference::streamWrite(BasicStream* s) const // if(_facet.empty()) { - s->write(vector<string>()); + s->write(static_cast<string*>(0), static_cast<string*>(0)); } else { - vector<string> facetPath; - facetPath.push_back(_facet); - s->write(facetPath); + s->write(&_facet, &_facet + 1); } s->write(static_cast<Byte>(_mode)); diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp index aeaaecf9b33..54fd4cfc47c 100644 --- a/cpp/src/Ice/StreamI.cpp +++ b/cpp/src/Ice/StreamI.cpp @@ -82,8 +82,9 @@ Ice::InputStreamI::readByte() vector<Byte> Ice::InputStreamI::readByteSeq() { - vector<Byte> v; - _is.read(v); + pair<const Byte*, const Byte*> p; + _is.read(p); + vector<Byte> v(p.first, p.second); return v; } @@ -303,7 +304,7 @@ Ice::OutputStreamI::writeByte(Byte v) void Ice::OutputStreamI::writeByteSeq(const vector<Byte>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void @@ -315,7 +316,7 @@ Ice::OutputStreamI::writeShort(Short v) void Ice::OutputStreamI::writeShortSeq(const vector<Short>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void @@ -327,7 +328,7 @@ Ice::OutputStreamI::writeInt(Int v) void Ice::OutputStreamI::writeIntSeq(const vector<Int>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void @@ -339,7 +340,7 @@ Ice::OutputStreamI::writeLong(Long v) void Ice::OutputStreamI::writeLongSeq(const vector<Long>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void @@ -351,7 +352,7 @@ Ice::OutputStreamI::writeFloat(Float v) void Ice::OutputStreamI::writeFloatSeq(const vector<Float>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void @@ -363,7 +364,7 @@ Ice::OutputStreamI::writeDouble(Double v) void Ice::OutputStreamI::writeDoubleSeq(const vector<Double>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void @@ -375,7 +376,7 @@ Ice::OutputStreamI::writeString(const string& v) void Ice::OutputStreamI::writeStringSeq(const vector<string>& v) { - _os.write(v); + _os.write(&v[0], &v[0] + v.size()); } void diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index cd711376f1f..9892dcdad80 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -496,37 +496,111 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& { string seqType = findMetaData(metaData); builtin = BuiltinPtr::dynamicCast(seq->type()); - if(builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy) + if(marshal) { - if(seqType == "array" && builtin->kind() != Builtin::KindByte) + string scope = fixKwd(seq->scope()); + if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) + { + if(seqType == "array") + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " + << fixedParam << ".first, " << fixedParam << ".second, " << scope + << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", &" + << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size(), " << scope + << "__U__" << fixKwd(seq->name()) << "());"; + } + } + else if(builtin->kind() == Builtin::KindBool) { - out << nl << typeToString(type) << " __" << fixedParam << ";"; - out << nl << stream << deref << func << "__" << fixedParam << ");"; + if(seqType == "array") + { + out << nl << stream << deref << func << fixedParam << ".first, " << fixedParam << ".second);"; + } + else + { + out << nl << stream << deref << func << fixedParam << ");"; + } } else { - out << nl << stream << deref << func << fixedParam << ");"; + if(seqType == "array") + { + out << nl << stream << deref << func << fixedParam << ".first, " << fixedParam << ".second);"; + } + else + { + out << nl << stream << deref << func << "&" << fixedParam << "[0], &" << fixedParam + << "[0] + " << fixedParam << ".size());"; + } } } else { - string scope = fixKwd(seq->scope()); - if(seqType == "array") + if(builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy) { - out << nl << typeToString(type) << " __" << fixedParam << ";"; - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", __" - << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + if(seqType == "array") + { + if(builtin->kind() == Builtin::KindByte) + { + out << nl << stream << deref << func << fixedParam << ");"; + } + else if(builtin->kind() == Builtin::KindBool) + { + out << nl << "IceUtil::auto_array<bool> __" << fixedParam << ";"; + out << nl << stream << deref << func << fixedParam << ", __" << fixedParam << ");"; + } + else + { + out << nl << typeToString(type) << " __" << fixedParam << ";"; + out << nl << stream << deref << func << "__" << fixedParam << ");"; + } + } + else if(builtin->kind() == Builtin::KindByte) + { + StringList md; + md.push_back("cpp:array"); + string tmpParam = "__" + fixedParam; + string::size_type pos = tmpParam.find("[i]"); + if(pos != string::npos) + { + tmpParam = tmpParam.substr(0, pos); + } + out << nl << typeToString(type, md) << " " << tmpParam << ";"; + out << nl << stream << deref << func << tmpParam << ");"; + out << nl << "::std::vector< ::Ice::Byte>(" << tmpParam << ".first, " << tmpParam + << ".second).swap(" << fixedParam << ");"; + } + else + { + out << nl << stream << deref << func << fixedParam << ");"; + } } else { - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " - << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + string scope = fixKwd(seq->scope()); + if(seqType == "array") + { + out << nl << typeToString(type) << " __" << fixedParam << ";"; + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", __" + << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + } + else + { + out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " + << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + } + } + if(seqType == "array" && + (!builtin || (builtin->kind() != Builtin::KindByte && builtin->kind() != Builtin::KindBool))) + { + out << nl << fixedParam << ".first" << " = &__" << fixedParam << "[0];"; + out << nl << fixedParam << ".second" << " = " << fixedParam << ".first + " << "__" + << fixedParam << ".size();"; } - } - if(seqType == "array" && (!builtin || builtin->kind() != Builtin::KindByte)) - { - out << nl << fixedParam << ".first" << " = &__" << fixedParam << ".front();"; - out << nl << fixedParam << ".second" << " = &__" << fixedParam << ".back() + 1;"; } return; } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index c5649df1a49..b94cdc7719c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -917,11 +917,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string name = fixKwd(p->name()); TypePtr type = p->type(); string s = typeToString(type); - if(s[0] == ':') - { - s.insert(0, " "); - } - H << sp << nl << "typedef ::std::vector<" << s << "> " << name << ';'; + H << sp << nl << "typedef ::std::vector<" << (s[0] == ':' ? " " : "") << s << "> " << name << ';'; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(!p->isLocal() && @@ -931,8 +927,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string scope = fixKwd(p->scope()); H << sp << nl << "class __U__" << name << " { };"; - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__" << name - << ");"; + H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s + << "*, __U__" << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");"; if(_stream) @@ -943,13 +939,13 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) } C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << scoped << "& v, " << scope << "__U__" << name << ")"; + << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")"; C << sb; - C << nl << "__os->writeSize(::Ice::Int(v.size()));"; - C << nl << scoped << "::const_iterator p;"; - C << nl << "for(p = v.begin(); p != v.end(); ++p)"; + C << nl << "::Ice::Int size = end - begin;"; + C << nl << "__os->writeSize(size);"; + C << nl << "for(int i = 0; i < size; ++i)"; C << sb; - writeMarshalUnmarshalCode(C, type, "(*p)", true); + writeMarshalUnmarshalCode(C, type, "begin[i]", true); C << eb; C << eb; diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index f667d4274e2..5ef7510641f 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -774,11 +774,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string name = fixKwd(p->name()); TypePtr type = p->type(); string s = typeToString(type); - if(s[0] == ':') - { - s.insert(0, " "); - } - H << sp << nl << "typedef ::std::vector<" << s << "> " << name << ';'; + H << sp << nl << "typedef ::std::vector<" << (s[0] == ':' ? " " : "") << s << "> " << name << ';'; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(!p->isLocal() && @@ -788,18 +784,18 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string scope = fixKwd(p->scope()); H << sp << nl << "class __U__" << name << " { };"; - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__" << name - << ");"; + H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s + << "*, __U__" << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");"; C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << scoped << "& v, " << scope << "__U__" << name << ")"; + << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")"; C << sb; - C << nl << "__os->writeSize(::Ice::Int(v.size()));"; - C << nl << scoped << "::const_iterator p;"; - C << nl << "for(p = v.begin(); p != v.end(); ++p)"; + C << nl << "::Ice::Int size = end - begin;"; + C << nl << "__os->writeSize(size);"; + C << nl << "for(int i = 0; i < size; ++i)"; C << sb; - writeMarshalUnmarshalCode(C, type, "(*p)", true); + writeMarshalUnmarshalCode(C, type, "begin[i]", true); C << eb; C << eb; @@ -1279,6 +1275,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { string paramName = fixKwd((*q)->name()); + StringList metaData = (*q)->getMetaData(); #if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) // // Work around for Sun CC 5.5 bug #4853566 @@ -1290,11 +1287,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } else { - typeString = inputTypeToString((*q)->type()); + typeString = inputTypeToString((*q)->type(), metaData); } #else string typeString = (*q)->isOutParam() ? - outputTypeToString((*q)->type()) : inputTypeToString((*q)->type()); + outputTypeToString((*q)->type()) : inputTypeToString((*q)->type(), metaData); #endif params.push_back(typeString); @@ -1475,7 +1472,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) vector<string> params; vector<string> paramsDecl; - TypeStringList inParams; + ParamDeclList inParams; TypeStringList outParams; ParamDeclList paramList = p->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) @@ -1483,6 +1480,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) string paramName = fixKwd((*q)->name()); TypePtr type = (*q)->type(); bool isOutParam = (*q)->isOutParam(); + StringList metaData = (*q)->getMetaData(); string typeString; if(isOutParam) @@ -1492,8 +1490,8 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) } else { - inParams.push_back(make_pair(type, paramName)); - typeString = inputTypeToString(type); + inParams.push_back(*q); + typeString = inputTypeToString(type, metaData); } params.push_back(typeString); @@ -1514,7 +1512,12 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl << "::IceInternal::BasicStream* __os = __out.os();"; - writeMarshalCode(C, inParams, 0); + ParamDeclList::const_iterator pli; + for(pli = inParams.begin(); pli != inParams.end(); ++pli) + { + writeMarshalUnmarshalCode(C, (*pli)->type(), fixKwd((*pli)->name()), true, "", true, + (*pli)->getMetaData()); + } C << eb; C << nl << "catch(const ::Ice::LocalException& __ex)"; C << sb; @@ -1743,7 +1746,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q) { string paramName = fixKwd((*q)->name()); - string typeName = inputTypeToString((*q)->type()); + string typeName = inputTypeToString((*q)->type(), (*q)->getMetaData()); allTypes.push_back(typeName); allParamDecls.push_back(typeName + " __ice_" + paramName); } |