diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-01-06 18:16:35 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-01-06 18:16:35 +0000 |
commit | e278e1613a0cc442b316ba26914dcf26a8e8243f (patch) | |
tree | 8225ce18fc89466b6c3ead500199085f2eb6a221 /cpp/src | |
parent | Fixing a bug where the makebindist script wasn't makedist'ing vb (diff) | |
download | ice-e278e1613a0cc442b316ba26914dcf26a8e8243f.tar.bz2 ice-e278e1613a0cc442b316ba26914dcf26a8e8243f.tar.xz ice-e278e1613a0cc442b316ba26914dcf26a8e8243f.zip |
Fixed SunOS C++ compiler warnings (bug 723)
Diffstat (limited to 'cpp/src')
28 files changed, 133 insertions, 131 deletions
diff --git a/cpp/src/FreezeScript/DumpDB.cpp b/cpp/src/FreezeScript/DumpDB.cpp index ed387a2f9e5..c1f0f789d91 100644 --- a/cpp/src/FreezeScript/DumpDB.cpp +++ b/cpp/src/FreezeScript/DumpDB.cpp @@ -191,8 +191,8 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) } if(opts.isSet("load")) { - vector<string> args = opts.argVec("load"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optArgs = opts.argVec("load"); + for(vector<string>::const_iterator i = optArgs.begin(); i != optArgs.end(); ++i) { slice.push_back(*i); } diff --git a/cpp/src/FreezeScript/DumpDescriptors.cpp b/cpp/src/FreezeScript/DumpDescriptors.cpp index 6c815f4eaa9..ab99ef3d9b8 100644 --- a/cpp/src/FreezeScript/DumpDescriptors.cpp +++ b/cpp/src/FreezeScript/DumpDescriptors.cpp @@ -1888,8 +1888,8 @@ FreezeScript::DumpVisitor::dump(const DataPtr& data) // object's actual type. If no descriptor is found, attempt to find a // descriptor for the object's base types (including Ice::Object). // - ObjectDataPtr data = obj->getValue(); - Slice::TypePtr cls = data->getType(); // Actual type + ObjectDataPtr objData = obj->getValue(); + Slice::TypePtr cls = objData->getType(); // Actual type bool checkContents = true; while(cls) { @@ -1899,7 +1899,7 @@ FreezeScript::DumpVisitor::dump(const DataPtr& data) if(p != _info->dumpMap.end()) { SymbolTablePtr sym = new SymbolTableI(_factory, _unit, _errorReporter, _info, _info->symbolTable); - sym->add("value", data); + sym->add("value", objData); p->second->execute(sym, _info); base = p->second->base(); if(checkContents) diff --git a/cpp/src/FreezeScript/Util.cpp b/cpp/src/FreezeScript/Util.cpp index dd5d58a982a..25c9d2f0b6d 100644 --- a/cpp/src/FreezeScript/Util.cpp +++ b/cpp/src/FreezeScript/Util.cpp @@ -19,7 +19,6 @@ FreezeScript::typeToString(const TypePtr& type) { BuiltinPtr b = BuiltinPtr::dynamicCast(type); ContainedPtr c = ContainedPtr::dynamicCast(type); - ProxyPtr p = ProxyPtr::dynamicCast(type); if(b) { return b->kindAsString(); @@ -53,20 +52,19 @@ FreezeScript::ignoreType(const string& type) } void -FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& unit) +FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& u) { - string scoped; Slice::TypeList l; Slice::ContainedList c; // // Create the Ice module if necessary. // - c = unit->lookupContained("Ice", false); + c = u->lookupContained("Ice", false); Slice::ModulePtr ice; if(c.empty()) { - ice = unit->createModule("Ice"); + ice = u->createModule("Ice"); } else { @@ -80,13 +78,13 @@ FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& unit) // // Create the Slice definition for Ice::Identity if it doesn't exist. // - scoped = "::Ice::Identity"; - l = unit->lookupTypeNoBuiltin(scoped, false); + string scoped = "::Ice::Identity"; + l = u->lookupTypeNoBuiltin(scoped, false); Slice::StructPtr identity; if(l.empty()) { identity = ice->createStruct("Identity", false); - Slice::TypePtr str = unit->builtin(Slice::Builtin::KindString); + Slice::TypePtr str = u->builtin(Slice::Builtin::KindString); identity->createDataMember("name", str); identity->createDataMember("category", str); } @@ -103,11 +101,11 @@ FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& unit) // // Create the Freeze module if necessary. // - c = unit->lookupContained("Freeze", false); + c = u->lookupContained("Freeze", false); Slice::ModulePtr freeze; if(c.empty()) { - freeze = unit->createModule("Freeze"); + freeze = u->createModule("Freeze"); } else { @@ -123,12 +121,12 @@ FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& unit) // Create the Slice definition for Freeze::Statistics if it doesn't exist. // scoped = "::Freeze::Statistics"; - l = unit->lookupTypeNoBuiltin(scoped, false); + l = u->lookupTypeNoBuiltin(scoped, false); Slice::StructPtr stats; if(l.empty()) { stats = freeze->createStruct("Statistics", false); - Slice::TypePtr tl = unit->builtin(Slice::Builtin::KindLong); + Slice::TypePtr tl = u->builtin(Slice::Builtin::KindLong); stats->createDataMember("creationTime", tl); stats->createDataMember("lastSaveTime", tl); stats->createDataMember("avgSaveTime", tl); @@ -147,11 +145,11 @@ FreezeScript::createEvictorSliceTypes(const Slice::UnitPtr& unit) // Create the Slice definition for Freeze::ObjectRecord if it doesn't exist. // scoped = "::Freeze::ObjectRecord"; - l = unit->lookupTypeNoBuiltin(scoped, false); + l = u->lookupTypeNoBuiltin(scoped, false); if(l.empty()) { Slice::StructPtr rec = freeze->createStruct("ObjectRecord", false); - Slice::TypePtr obj = unit->builtin(Slice::Builtin::KindObject); + Slice::TypePtr obj = u->builtin(Slice::Builtin::KindObject); rec->createDataMember("servant", obj); rec->createDataMember("stats", stats); } diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 9b3bd735605..11a265767ba 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -1388,9 +1388,9 @@ IceInternal::BasicStream::read(vector<string>& v) { startSeq(sz, 1); v.resize(sz); - for(int i = 0; i < sz; ++i) + for(int j = 0; j < sz; ++j) { - read(v[i]); + read(v[j]); checkSeq(); endElement(); } diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 86da0b44186..647d4bec834 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -967,11 +967,11 @@ Ice::ConnectionI::flushBatchRequests() // No compression, just fill in the message size. // Int sz = static_cast<Int>(_batchStream.b.size()); - const Byte* p = reinterpret_cast<const Byte*>(&sz); + const Byte* q = reinterpret_cast<const Byte*>(&sz); #ifdef ICE_BIG_ENDIAN - reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + 10); + reverse_copy(q, q + sizeof(Int), _batchStream.b.begin() + 10); #else - copy(p, p + sizeof(Int), _batchStream.b.begin() + 10); + copy(q, q + sizeof(Int), _batchStream.b.begin() + 10); #endif // diff --git a/cpp/src/Ice/GC.cpp b/cpp/src/Ice/GC.cpp index b9b8bf76bfd..938ee6fab56 100755 --- a/cpp/src/Ice/GC.cpp +++ b/cpp/src/Ice/GC.cpp @@ -255,7 +255,7 @@ IceInternal::GC::collectGarbage() counts.clear(); { - Monitor<Mutex>::Lock sync(*this); + Monitor<Mutex>::Lock sync2(*this); _collecting = false; } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index d5ba170c076..8254bf3fb3c 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -88,16 +88,18 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) // // For compatibility with the old FacetPath. // - vector<string> facetPath; - _is.read(facetPath); string facet; - if(!facetPath.empty()) { - if(facetPath.size() > 1) + vector<string> facetPath; + _is.read(facetPath); + if(!facetPath.empty()) { - throw MarshalException(__FILE__, __LINE__); + if(facetPath.size() > 1) + { + throw MarshalException(__FILE__, __LINE__); + } + facet.swap(facetPath[0]); } - facet.swap(facetPath[0]); } _current.facet.swap(facet); diff --git a/cpp/src/IceGrid/AdapterCache.h b/cpp/src/IceGrid/AdapterCache.h index eaa1e99edea..77a10dd6d9c 100644 --- a/cpp/src/IceGrid/AdapterCache.h +++ b/cpp/src/IceGrid/AdapterCache.h @@ -107,8 +107,8 @@ public: protected: - AdapterEntryPtr addImpl(const std::string&, const AdapterEntryPtr&); - AdapterEntryPtr removeImpl(const std::string&); + virtual AdapterEntryPtr addImpl(const std::string&, const AdapterEntryPtr&); + virtual AdapterEntryPtr removeImpl(const std::string&); }; diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp index 09ed622c98a..13f10e87769 100644 --- a/cpp/src/IceGrid/AdminI.cpp +++ b/cpp/src/IceGrid/AdminI.cpp @@ -751,6 +751,7 @@ AdminI::getNodeHostname(const string& name, const Current&) const os << ex; throw NodeUnreachableException(name, os.str()); } + return ""; // Keep the compiler happy. } diff --git a/cpp/src/IceGrid/Cache.h b/cpp/src/IceGrid/Cache.h index 1dee9c8feb7..e3c248d7abb 100644 --- a/cpp/src/IceGrid/Cache.h +++ b/cpp/src/IceGrid/Cache.h @@ -35,14 +35,14 @@ public: { } - virtual bool + bool has(const Key& key) { Lock sync(*this); return getImpl(key); } - virtual ValuePtr + ValuePtr remove(const Key& key) { Lock sync(*this); @@ -85,7 +85,7 @@ protected: { if(create) { - return addImpl(key); + return createAndAddImpl(key); } else { @@ -95,7 +95,7 @@ protected: } virtual ValuePtr - addImpl(const Key& key) + createAndAddImpl(const Key& key) { return addImpl(key, createEntry(key)); } diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index 239fa302ba5..f88f4b139b2 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -732,14 +732,14 @@ Database::getAdapters(const string& id, bool allRegistered, int& endpointCount) StringAdapterInfoDict::const_iterator p = adapters.find(id); if(p != adapters.end()) { - vector<pair<string, AdapterPrx> > adapters; + vector<pair<string, AdapterPrx> > adpts; Ice::Identity identity; identity.category = "IceGridAdapter"; identity.name = id; AdapterPrx adpt = AdapterPrx::uncheckedCast(_internalAdapter->createDirectProxy(identity)); - adapters.push_back(make_pair(id, adpt)); + adpts.push_back(make_pair(id, adpt)); endpointCount = 1; - return adapters; + return adpts; } // diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index 2cf817d3c2a..4a48c07a0f9 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -946,8 +946,7 @@ Parser::endpointsAdapter(const list<string>& args) try { - list<string>::const_iterator p = args.begin(); - string adapterId = *p++; + string adapterId = args.front(); StringObjectProxyDict proxies = _admin->getAdapterEndpoints(adapterId); if(proxies.size() == 1 && proxies.begin()->first == adapterId) { diff --git a/cpp/src/IceGrid/ServerCache.h b/cpp/src/IceGrid/ServerCache.h index 1b8da043bc1..a04c2f97807 100644 --- a/cpp/src/IceGrid/ServerCache.h +++ b/cpp/src/IceGrid/ServerCache.h @@ -83,7 +83,7 @@ public: ServerEntryPtr add(const ServerInfo&); ServerEntryPtr get(const std::string&); - virtual bool has(const std::string&); + bool has(const std::string&); ServerEntryPtr remove(const std::string&, bool = true); void clear(const std::string&); diff --git a/cpp/src/IceGrid/Topics.cpp b/cpp/src/IceGrid/Topics.cpp index fad7c26c99b..45c57407493 100644 --- a/cpp/src/IceGrid/Topics.cpp +++ b/cpp/src/IceGrid/Topics.cpp @@ -196,7 +196,6 @@ NodeObserverTopic::subscribe(const NodeObserverPrx& observer, int serial) if(serial == -1) { NodeDynamicInfoSeq nodes; - int serial; { Lock sync(*this); nodes.reserve(_nodes.size()); @@ -328,7 +327,6 @@ RegistryObserverTopic::subscribe(const RegistryObserverPrx& observer, int serial if(serial == -1) { ApplicationDescriptorSeq applications; - int serial; { Lock sync(*this); assert(_serial != -1); diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index dd4d6b0a7ef..09bfbce039a 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -38,6 +38,9 @@ const char* IcePatch2::logFile = "IcePatch2.log"; // #ifdef __sun +extern "C" +{ + static int scandir(const char* dir, struct dirent*** namelist, int (*select)(const struct dirent*), @@ -101,6 +104,8 @@ alphasort(const void* v1, const void* v2) return(strcmp((*a)->d_name, (*b)->d_name)); } +} + #endif using namespace std; diff --git a/cpp/src/IceXML/Parser.cpp b/cpp/src/IceXML/Parser.cpp index f5d980d1e3e..b44351603c4 100644 --- a/cpp/src/IceXML/Parser.cpp +++ b/cpp/src/IceXML/Parser.cpp @@ -304,6 +304,9 @@ struct CallbackData Handler* handler; }; +extern "C" +{ + static void startElementHandler(void* data, const XML_Char* name, const XML_Char** attr) { @@ -340,6 +343,8 @@ characterDataHandler(void* data, const XML_Char* s, int len) cb->handler->characters(str, line, column); } +} + // // Parser // diff --git a/cpp/src/Slice/Checksum.cpp b/cpp/src/Slice/Checksum.cpp index 500d3a62c60..152d76e6e76 100644 --- a/cpp/src/Slice/Checksum.cpp +++ b/cpp/src/Slice/Checksum.cpp @@ -307,12 +307,12 @@ Slice::ChecksumVisitor::updateMap(const string& scoped, const string& data) } Slice::ChecksumMap -Slice::createChecksums(const UnitPtr& unit) +Slice::createChecksums(const UnitPtr& u) { ChecksumMap result; ChecksumVisitor visitor(result); - unit->visit(&visitor, false); + u->visit(&visitor, false); return result; } diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index b7535d70b40..37f1c116301 100755 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -976,10 +976,10 @@ Slice::CsGenerator::toArrayAlloc(const string& decl, const string& sz) } void -Slice::CsGenerator::validateMetaData(const UnitPtr& unit) +Slice::CsGenerator::validateMetaData(const UnitPtr& u) { MetaDataVisitor visitor; - unit->visit(&visitor, true); + u->visit(&visitor, true); } Slice::CsGenerator::MetaDataVisitor::MetaDataVisitor() diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index a03e26191b5..90de6fdc8fd 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -2923,10 +2923,10 @@ Slice::JavaGenerator::createOutput() } void -Slice::JavaGenerator::validateMetaData(const UnitPtr& unit) +Slice::JavaGenerator::validateMetaData(const UnitPtr& u) { MetaDataVisitor visitor; - unit->visit(&visitor, true); + u->visit(&visitor, true); } bool diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp index 8c2677bc9f3..6b80180f0af 100755 --- a/cpp/src/Slice/VbUtil.cpp +++ b/cpp/src/Slice/VbUtil.cpp @@ -1025,10 +1025,10 @@ Slice::VbGenerator::toArrayAlloc(const string& decl, const string& sz) } void -Slice::VbGenerator::validateMetaData(const UnitPtr& unit) +Slice::VbGenerator::validateMetaData(const UnitPtr& u) { MetaDataVisitor visitor; - unit->visit(&visitor, false); + u->visit(&visitor, false); } Slice::VbGenerator::MetaDataVisitor::MetaDataVisitor() diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index ade23430bf9..a80c8b3946b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -326,15 +326,15 @@ Slice::Gen::generate(const UnitPtr& p) { C << sp << nl << "static const char* __sliceChecksums[] ="; C << sb; - for(ChecksumMap::const_iterator p = map.begin(); p != map.end(); ++p) + for(ChecksumMap::const_iterator q = map.begin(); q != map.end(); ++q) { - C << nl << "\"" << p->first << "\", \""; + C << nl << "\"" << q->first << "\", \""; ostringstream str; str.flags(ios_base::hex); str.fill('0'); - for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q) + for(vector<unsigned char>::const_iterator r = q->second.begin(); r != q->second.end(); ++r) { - str << (int)(*q); + str << (int)(*r); } C << str.str() << "\","; } @@ -1078,7 +1078,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << "while(sz--)"; C << sb; C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;"; - string pf = string("const_cast<") + ks + "&>(pair.first)"; + const string pf = string("const_cast<") + ks + "&>(pair.first)"; writeMarshalUnmarshalCode(C, keyType, pf, false); C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);"; writeMarshalUnmarshalCode(C, valueType, "__i->second", false); @@ -1106,7 +1106,6 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << "while(sz--)"; C << sb; C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;"; - string pf = string("const_cast<") + ks + "&>(pair.first)"; writeStreamMarshalUnmarshalCode(C, keyType, pf, false); C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);"; writeStreamMarshalUnmarshalCode(C, valueType, "__i->second", false); @@ -1982,7 +1981,6 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) #endif for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { - string scoped = (*i)->scoped(); C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; C << sb; C << nl << "throw;"; @@ -2280,7 +2278,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } DataMemberList dataMembers = p->dataMembers(); DataMemberList allDataMembers = p->allDataMembers(); - DataMemberList::const_iterator q; H << sp << nl << "class " << _dllExport << name << " : "; H.useCurrentPosAsIndent(); @@ -2317,6 +2314,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) vector<string> allTypes; vector<string> allParamDecls; vector<string>::const_iterator pi; + DataMemberList::const_iterator q; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { @@ -2544,8 +2542,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) assert(scopedIter != ids.end()); StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter); - StringList::const_iterator q; - H << sp; H << nl << "virtual bool ice_isA" << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;"; @@ -2563,11 +2559,12 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << sp; C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] ="; C << sb; - q = ids.begin(); - while(q != ids.end()) + + StringList::const_iterator r = ids.begin(); + while(r != ids.end()) { - C << nl << '"' << *q << '"'; - if(++q != ids.end()) + C << nl << '"' << *r << '"'; + if(++r != ids.end()) { C << ','; } @@ -4461,10 +4458,10 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) } void -Slice::Gen::validateMetaData(const UnitPtr& unit) +Slice::Gen::validateMetaData(const UnitPtr& u) { MetaDataVisitor visitor; - unit->visit(&visitor, false); + u->visit(&visitor, false); } bool diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 15566bff723..f667d4274e2 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -1565,7 +1565,6 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) #endif for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { - string scoped = (*i)->scoped(); C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; C << sb; C << nl << "throw;"; @@ -1693,7 +1692,6 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } DataMemberList dataMembers = p->dataMembers(); DataMemberList allDataMembers = p->allDataMembers(); - DataMemberList::const_iterator q; if(!p->isLocal()) { @@ -1734,6 +1732,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) vector<string> params; vector<string> allTypes; vector<string> allParamDecls; + DataMemberList::const_iterator q; vector<string>::const_iterator pi; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) @@ -3000,10 +2999,10 @@ Slice::Gen::MetaDataVisitor::validate(const ContainedPtr& cont) } void -Slice::Gen::validateMetaData(const UnitPtr& unit) +Slice::Gen::validateMetaData(const UnitPtr& u) { MetaDataVisitor visitor; - unit->visit(&visitor, false); + u->visit(&visitor, false); } void diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 298fe1a280c..83d88e96385 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -190,13 +190,15 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) _out << sp << nl << "public static new string[] ids__ = "; _out << sb; - StringList::const_iterator q = ids.begin(); - while(q != ids.end()) { - _out << nl << '"' << *q << '"'; - if(++q != ids.end()) + StringList::const_iterator q = ids.begin(); + while(q != ids.end()) { - _out << ','; + _out << nl << '"' << *q << '"'; + if(++q != ids.end()) + { + _out << ','; + } } } _out << eb << ";"; @@ -1001,9 +1003,9 @@ Slice::Gen::generateImplTie(const UnitPtr& p) } void -Slice::Gen::generateChecksums(const UnitPtr& p) +Slice::Gen::generateChecksums(const UnitPtr& u) { - ChecksumMap map = createChecksums(p); + ChecksumMap map = createChecksums(u); if(!map.empty()) { string className = "X" + IceUtil::generateUUID(); @@ -2256,7 +2258,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) // // Emit placeholder functions to catch errors. // - string scoped = p->scoped(); _out << sp << nl << "public override void write__(Ice.OutputStream outS__)"; _out << sb; _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();"; @@ -3183,8 +3184,8 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) { OperationPtr op = *r; bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd")); - string name = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true); - + string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true); + TypePtr ret; vector<string> params; @@ -3203,7 +3204,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) _out << sp << nl; emitAttributes(op); - _out << retS << ' ' << name << spar << params; + _out << retS << ' ' << opname << spar << params; if(!noCurrent && !p->isLocal()) { _out << "Ice.Current current__"; @@ -4157,35 +4158,35 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) { bool amd = p->hasMetaData("amd") || (*op)->hasMetaData("amd"); - string name = (*op)->name(); + string opname = (*op)->name(); vector<string> params; vector<string> args; TypePtr ret; if(amd) { - name = name + "_async"; + opname = opname + "_async"; params = getParamsAsync(*op, true); args = getArgsAsync(*op); } else { - name = fixId(name, DotNet::ICloneable, true); + opname = fixId(opname, DotNet::ICloneable, true); params = getParams(*op); ret = (*op)->returnType(); args = getArgs(*op); } - _out << sp << nl << "public " << typeToString(ret) << " " << name << spar << params << epar; + _out << sp << nl << "public " << typeToString(ret) << " " << opname << spar << params << epar; _out << sb << nl; if(ret) { _out << "return "; } - _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';'; + _out << opname << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';'; _out << eb; - _out << sp << nl << "public abstract " << typeToString(ret) << " " << name << spar << params; + _out << sp << nl << "public abstract " << typeToString(ret) << " " << opname << spar << params; if(!p->isLocal()) { _out << "Ice.Current current__"; @@ -4777,7 +4778,6 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment TypePtr ret = op->returnType(); string retS = typeToString(ret); ParamDeclList params = op->parameters(); - ParamDeclList::const_iterator i; if(comment) { @@ -4788,6 +4788,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment _out << sp << nl; } + ParamDeclList::const_iterator i; if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"))) { vector<string> pDecl = getParamsAsync(op, true); diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index 692bfdec12c..3f4fe0a93ee 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -856,16 +856,16 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c } dataMembers = structDecl->dataMembers(); } - DataMemberList::const_iterator q = dataMembers.begin(); - while(q != dataMembers.end() && dataMember == 0) + DataMemberList::const_iterator d = dataMembers.begin(); + while(d != dataMembers.end() && dataMember == 0) { - if((*q)->name() == index.member) + if((*d)->name() == index.member) { - dataMember = *q; + dataMember = *d; } else { - ++q; + ++d; } } @@ -1237,8 +1237,8 @@ main(int argc, char* argv[]) } if(opts.isSet("dict")) { - vector<string> args = opts.argVec("dict"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optargs = opts.argVec("dict"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = *i; s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end()); @@ -1323,8 +1323,8 @@ main(int argc, char* argv[]) } if(opts.isSet("index")) { - vector<string> args = opts.argVec("index"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optargs = opts.argVec("index"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = *i; s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end()); @@ -1392,8 +1392,8 @@ main(int argc, char* argv[]) } if(opts.isSet("dict-index")) { - vector<string> args = opts.argVec("dict-index"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optargs = opts.argVec("dict-index"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = *i; s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end()); diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index 742dd125491..e9fdd75b3d4 100644 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp @@ -1145,8 +1145,8 @@ main(int argc, char* argv[]) } if(opts.isSet("dict")) { - vector<string> args = opts.argVec("dict"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optargs = opts.argVec("dict"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = *i; s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end()); @@ -1194,8 +1194,8 @@ main(int argc, char* argv[]) } if(opts.isSet("index")) { - vector<string> args = opts.argVec("index"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optargs = opts.argVec("index"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = *i; s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end()); @@ -1263,8 +1263,8 @@ main(int argc, char* argv[]) } if(opts.isSet("dict-index")) { - vector<string> args = opts.argVec("dict-index"); - for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) + vector<string> optargs = opts.argVec("dict-index"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) { string s = *i; s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end()); diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index b4beb679591..28a361c6a95 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -482,7 +482,6 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) // // The operation is not defined in this class. // - ClassList bases = p->bases(); if(!bases.empty()) { // @@ -1112,7 +1111,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) OperationPtr op = *r; ContainerPtr container = op->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - string name = op->name(); + string opname = op->name(); TypePtr ret; vector<string> params; @@ -1134,7 +1133,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) ExceptionList throws = op->throws(); throws.sort(); throws.unique(); - out << sp << nl << retS << ' ' << (amd ? name + "_async" : fixKwd(name)) << spar << params; + out << sp << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params; if(!noCurrent && !p->isLocal()) { out << "Ice.Current __current"; @@ -2080,7 +2079,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) // // Emit placeholder functions to catch errors. // - string scoped = p->scoped(); out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)"; out << sb; out << nl << "Ice.MarshalException ex = new Ice.MarshalException();"; diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp index 69e06826012..b43c0f1049d 100644 --- a/cpp/src/slice2javae/Gen.cpp +++ b/cpp/src/slice2javae/Gen.cpp @@ -371,7 +371,6 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) // // The operation is not defined in this class. // - ClassList bases = p->bases(); if(!bases.empty()) { // @@ -843,8 +842,8 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) OperationPtr op = *r; ContainerPtr container = op->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - string name = op->name(); - + string opname = op->name(); + TypePtr ret; vector<string> params; @@ -856,7 +855,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) ExceptionList throws = op->throws(); throws.sort(); throws.unique(); - out << sp << nl << retS << ' ' << fixKwd(name) << spar << params; + out << sp << nl << retS << ' ' << fixKwd(opname) << spar << params; if(!noCurrent && !p->isLocal()) { out << "Ice.Current __current"; diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index 360b5a2d699..cba61b713cd 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -220,15 +220,17 @@ Slice::VbVisitor::writeDispatch(const ClassDefPtr& p) _out << nl << "{ _"; _out.inc(); - StringList::const_iterator q = ids.begin(); - while(q != ids.end()) { - _out << nl << '"' << *q << '"'; - if(++q != ids.end()) + StringList::const_iterator q = ids.begin(); + while(q != ids.end()) { - _out << ','; + _out << nl << '"' << *q << '"'; + if(++q != ids.end()) + { + _out << ','; + } + _out << " _"; } - _out << " _"; } _out.dec(); _out << nl << '}'; @@ -1007,15 +1009,15 @@ Slice::Gen::generateChecksums(const UnitPtr& p) << " = new _System.Collections.Hashtable()"; _out << sp << nl << "Shared Sub New()"; _out.inc(); - for(ChecksumMap::const_iterator p = map.begin(); p != map.end(); ++p) + for(ChecksumMap::const_iterator q = map.begin(); q != map.end(); ++q) { - _out << nl << "map.Add(\"" << p->first << "\", \""; + _out << nl << "map.Add(\"" << q->first << "\", \""; ostringstream str; str.flags(ios_base::hex); str.fill('0'); - for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q) + for(vector<unsigned char>::const_iterator r = q->second.begin(); r != q->second.end(); ++r) { - str << (int)(*q); + str << (int)(*r); } _out << str.str() << "\")"; } @@ -1339,7 +1341,6 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) writeDispatch(p); DataMemberList members = p->dataMembers(); - DataMemberList::const_iterator d; _out.zeroIndent(); _out << sp << nl << "#Region \"Marshaling support\""; @@ -2396,7 +2397,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) // // Emit placeholder functions to catch errors. // - string scoped = p->scoped(); _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)"; _out.inc(); _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException"; @@ -3497,7 +3497,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) { OperationPtr op = *r; bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd")); - string name = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true); + string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true); TypePtr ret; vector<string> params; @@ -3516,7 +3516,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) _out << sp << nl; emitAttributes(op); - _out << vbOp << ' ' << name << spar << params; + _out << vbOp << ' ' << opname << spar << params; if(!noCurrent && !p->isLocal()) { _out << "ByVal current__ As Ice.Current"; @@ -5407,7 +5407,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment } } _out.inc(); - for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i) + for(i = params.begin(); i != params.end(); ++i) { if((*i)->isOutParam()) { |