From: <sv...@ww...> - 2004-08-26 07:37:49
|
Author: mkrose Date: 2004-08-26 00:37:43 -0700 (Thu, 26 Aug 2004) New Revision: 1221 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/TaggedRecord.h trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h trunk/CSP/SimData/Include/SimData/Trace.h trunk/CSP/SimData/Tools/TaggedRecordCompiler/BaseTypes.py trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py Log: Clean up some compiler warnings, and a few misc. fixes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1221 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2004-08-26 07:29:53 UTC (rev 1220) +++ trunk/CSP/SimData/CHANGES.current 2004-08-26 07:37:43 UTC (rev 1221) @@ -1,6 +1,9 @@ Version 0.4.0 (in progress) =========================== +2004-08-25: onsight + * Clean up some compiler warnings, and a few misc. fixes. + 2004-08-08: onsight * Removed restriction on serializing null+none Links. Added a validation callback in ObjectInterface to catch null+none Links Modified: trunk/CSP/SimData/Include/SimData/TaggedRecord.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-08-26 07:29:53 UTC (rev 1220) +++ trunk/CSP/SimData/Include/SimData/TaggedRecord.h 2004-08-26 07:37:43 UTC (rev 1221) @@ -424,8 +424,8 @@ _lasttag = _tagstack.top(); _tagstack.pop(); } - int readLength() { - int length = 0; + unsigned int readLength() { + unsigned int length = 0; int sh = 0; unsigned char x; do { Modified: trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h =================================================================== --- trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h 2004-08-26 07:29:53 UTC (rev 1220) +++ trunk/CSP/SimData/Include/SimData/TaggedRecordRegistry.h 2004-08-26 07:37:43 UTC (rev 1221) @@ -90,7 +90,8 @@ * * @returns 0 if the interface is not found. */ - Ref<TaggedRecord> createRecord(hasht key) const { + Ref<TaggedRecord> createRecord(TaggedRecord::Id id) const { + HashT key(static_cast<uint32>(id), static_cast<uint32>(id>>32)); FactoryIdMap::const_iterator it = _id_map.find(key); if (it != _id_map.end()) return it->second->create(); return 0; @@ -109,7 +110,8 @@ * * @param key The object class hash. */ - bool hasFactory(hasht key) const { + bool hasFactory(TaggedRecord::Id id) const { + HashT key(static_cast<uint32>(id), static_cast<uint32>(id>>32)); FactoryIdMap::const_iterator it = _id_map.find(key); return it != _id_map.end(); } @@ -141,8 +143,10 @@ assert(factory != 0); assert(!hasFactory(factory->getName())); SIMDATA_LOG(LOG_ALL, LOG_INFO, "Registering TaggedRecordFactory<" << factory->getName() << "> [" << factory->getId() << "]"); + TaggedRecord::Id id = factory->getId(); + HashT key(static_cast<uint32>(id), static_cast<uint32>(id>>32)); _map[factory->getName()] = factory; - _id_map[factory->getId()] = factory; + _id_map[key] = factory; } TaggedRecordRegistry() { } Modified: trunk/CSP/SimData/Include/SimData/Trace.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Trace.h 2004-08-26 07:29:53 UTC (rev 1220) +++ trunk/CSP/SimData/Include/SimData/Trace.h 2004-08-26 07:37:43 UTC (rev 1221) @@ -136,12 +136,12 @@ #if defined(__GNUC__) && !defined(__MINGW32__) private: - static void __sigsegv(int sign) { + static void __sigsegv(int /*sig_n*/) { getTrace().error(3, true); abort(); } - static void __sigabort(int sign) { + static void __sigabort(int /*sig_n*/) { getTrace().error(3); } Modified: trunk/CSP/SimData/Tools/TaggedRecordCompiler/BaseTypes.py =================================================================== --- trunk/CSP/SimData/Tools/TaggedRecordCompiler/BaseTypes.py 2004-08-26 07:29:53 UTC (rev 1220) +++ trunk/CSP/SimData/Tools/TaggedRecordCompiler/BaseTypes.py 2004-08-26 07:37:43 UTC (rev 1221) @@ -376,16 +376,16 @@ def dump_save(self, format): format.write('writer.writeLength(%s.size());' % self.varname()) - format.write('for (int i=0; i < %s.size(); ++i) {' % self.varname()) + format.write('for (unsigned i=0; i < %s.size(); ++i) {' % self.varname()) format.indent() self.child.dump_save(format) format.dedent() format.write('}') def dump_load(self, format): - format.write('int %s_len = reader.readLength();' % self.id) + format.write('unsigned %s_len = reader.readLength();' % self.id) format.write('%s.resize(%s_len);' % (self.varname(), self.id)) - format.write('for (int i=0; i < %s_len; ++i) {' % self.id) + format.write('for (unsigned i=0; i < %s_len; ++i) {' % self.id) format.indent() self.child.dump_load(format) format.dedent() @@ -394,7 +394,7 @@ def dump_print(self, format): format.write('os << "[\\n";') format.write('++indent;') - format.write('for (int i=0; i < %s.size(); ++i) {' % self.varname()) + format.write('for (unsigned i=0; i < %s.size(); ++i) {' % self.varname()) format.indent() self.child.dump_print(format) format.write('os << "\\n";') @@ -434,7 +434,8 @@ def dump_source(self, format=None, file=None): if not format: format = CodeFormat.Format(file=file) - format.write('int %s::m_CustomId = 0;' % (self.id)) + custom_id = int(self.opts.get('ID', '0')) + format.write('int %s::m_CustomId = %d;' % (self.id, custom_id)) format.write('const %s::Id %s::_Id;' % (self.id, self.id)) format.write('namespace { simdata::TaggedRecordFactory<%s> __%s_factory; }' % (self.id, self.id)) Modified: trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py =================================================================== --- trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py 2004-08-26 07:29:53 UTC (rev 1220) +++ trunk/CSP/SimData/Tools/TaggedRecordCompiler/trc.py 2004-08-26 07:37:43 UTC (rev 1221) @@ -113,6 +113,8 @@ self.error('syntax error') if trim.startswith('//'): continue + idx = trim.rfind('//') + if idx >= 0: trim = trim[:idx] header = 0 while trim: rest = '' |