From 3464e80165950a2733e6f532b2c05e93354a2416 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Fri, 20 Apr 2018 01:00:01 +0100 Subject: [PATCH] nsgmls: resolve coverity warnings related to uninitialed members in C++ classes --- cde/programs/nsgmls/ArcEngine.C | 7 ++++--- cde/programs/nsgmls/Attribute.C | 2 +- cde/programs/nsgmls/CharsetDecl.C | 11 ++++++++--- cde/programs/nsgmls/ContentState.C | 6 +++++- cde/programs/nsgmls/ContentToken.C | 13 ++++++++----- cde/programs/nsgmls/ContentToken.h | 2 +- cde/programs/nsgmls/ExtendEntityManager.C | 11 +++++++++-- cde/programs/nsgmls/ExternalId.C | 2 +- cde/programs/nsgmls/Group.h | 2 +- cde/programs/nsgmls/InputSource.C | 3 ++- cde/programs/nsgmls/Location.C | 2 ++ cde/programs/nsgmls/Message.C | 6 ++++-- cde/programs/nsgmls/OutputCharStream.C | 2 +- cde/programs/nsgmls/OutputState.C | 3 ++- cde/programs/nsgmls/Param.h | 2 +- cde/programs/nsgmls/ParserState.C | 5 ++++- cde/programs/nsgmls/PosixStorage.C | 8 ++++++-- cde/programs/nsgmls/RewindStorageObject.C | 3 ++- cde/programs/nsgmls/SOEntityCatalog.C | 2 +- cde/programs/nsgmls/SdText.C | 2 ++ cde/programs/nsgmls/SgmlsEventHandler.C | 2 +- cde/programs/nsgmls/ShortReferenceMap.C | 2 +- cde/programs/nsgmls/Syntax.C | 4 +++- cde/programs/nsgmls/Text.C | 1 + cde/programs/nsgmls/Trie.h | 4 ++-- 25 files changed, 73 insertions(+), 34 deletions(-) diff --git a/cde/programs/nsgmls/ArcEngine.C b/cde/programs/nsgmls/ArcEngine.C index eca9df9c..99970e06 100644 --- a/cde/programs/nsgmls/ArcEngine.C +++ b/cde/programs/nsgmls/ArcEngine.C @@ -208,7 +208,7 @@ ArcEngineImpl::ArcEngineImpl(Messenger &mgr, parser_(parser), stage_(0), gatheringContent_(0), startAgain_(0), haveLinkProcess_(0), allocator_(maxSize(sizes, SIZEOF(sizes)), 50), - nullHandler_(mgr), docName_(docName) + nullHandler_(mgr), docName_(docName), linkAttributes_(NULL) { eventHandler_ = director.arcEventHandler(notation, docName, table); if (!eventHandler_) @@ -544,7 +544,7 @@ void ArcEngineImpl::initMessage(Message &msg) ArcProcessor::ArcProcessor() : errorIdref_(1), notationSetArch_(0), docHandler_(0), arcAuto_(1), - arcDtdIsParam_(0) + arcDtdIsParam_(0), valid_(false), mgr_(NULL), director_(NULL), docIndex_(0) { } @@ -1817,6 +1817,7 @@ ArcProcessor::MetaMapCache::MetaMapCache() for (int i = 0; i < nNoSpec; i++) noSpec[i] = invalidAtt; linkAtts = 0; + suppressFlags = 0; } void ArcProcessor::MetaMapCache::clear() @@ -1828,7 +1829,7 @@ void ArcProcessor::MetaMapCache::clear() } ArcProcessor::MetaMap::MetaMap() -: attributed(0) +: attributed(0), suppressFlags(0) { } diff --git a/cde/programs/nsgmls/Attribute.C b/cde/programs/nsgmls/Attribute.C index 9471b128..de5d6544 100644 --- a/cde/programs/nsgmls/Attribute.C +++ b/cde/programs/nsgmls/Attribute.C @@ -1069,7 +1069,7 @@ AttributeList::AttributeList(const ConstPtr &def) } AttributeList::AttributeList() -: nSpec_(0), conref_(0) +: nSpec_(0), conref_(0), nIdrefs_(0), nEntityNames_(0) { } diff --git a/cde/programs/nsgmls/CharsetDecl.C b/cde/programs/nsgmls/CharsetDecl.C index ba626f89..b4429d24 100644 --- a/cde/programs/nsgmls/CharsetDecl.C +++ b/cde/programs/nsgmls/CharsetDecl.C @@ -38,6 +38,10 @@ namespace SP_NAMESPACE { #endif CharsetDeclRange::CharsetDeclRange() +: descMin_(0), + count_(0), + type_(unused), + baseMin_(0) { } @@ -53,8 +57,8 @@ CharsetDeclRange::CharsetDeclRange(WideChar descMin, Number count, CharsetDeclRange::CharsetDeclRange(WideChar descMin, Number count) : descMin_(descMin), count_(count), - type_(unused) - + type_(unused), + baseMin_(0) { } @@ -63,7 +67,8 @@ CharsetDeclRange::CharsetDeclRange(WideChar descMin, Number count, : descMin_(descMin), count_(count), type_(string), - str_(str) + str_(str), + baseMin_(0) { } diff --git a/cde/programs/nsgmls/ContentState.C b/cde/programs/nsgmls/ContentState.C index cd85cfa7..996c84c6 100644 --- a/cde/programs/nsgmls/ContentState.C +++ b/cde/programs/nsgmls/ContentState.C @@ -45,7 +45,11 @@ typedef IListIter Dummy_IListIter_OpenElement; #endif ContentState::ContentState() -: documentElementContainer_(StringC(), size_t(-1)) +: documentElementContainer_(StringC(), size_t(-1)), +totalExcludeCount_(0), +tagLevel_(0), +netEnablingCount_(0), +lastEndedElementType_(NULL) { } diff --git a/cde/programs/nsgmls/ContentToken.C b/cde/programs/nsgmls/ContentToken.C index 2d95b2ce..86b5b93e 100644 --- a/cde/programs/nsgmls/ContentToken.C +++ b/cde/programs/nsgmls/ContentToken.C @@ -42,7 +42,8 @@ namespace SP_NAMESPACE { AndModelGroup::AndModelGroup(NCVector > &v, ContentToken::OccurrenceIndicator oi) -: ModelGroup(v, oi) +: ModelGroup(v, oi), andDepth_(0), andIndex_(0), andGroupIndex_(0), + andAncestor_(NULL) { } @@ -108,7 +109,8 @@ ElementToken::ElementToken(const ElementType *element, OccurrenceIndicator oi) } ContentToken::ContentToken(OccurrenceIndicator oi) -: occurrenceIndicator_(oi) +: occurrenceIndicator_(oi), +inherentlyOptional_(0) { } @@ -134,7 +136,8 @@ const LeafContentToken *ContentToken::asLeafContentToken() const LeafContentToken::LeafContentToken(const ElementType *element, OccurrenceIndicator oi) : element_(element), ContentToken(oi), isFinal_(0), orGroupMember_(0), - requiredIndex_(size_t(-1)) + requiredIndex_(size_t(-1)), leafIndex_(0), typeIndex_(0), pcdataTransitionType_(0), + simplePcdataTransition_(NULL) { } @@ -211,7 +214,7 @@ GroupInfo::GroupInfo(size_t nType) } CompiledModelGroup::CompiledModelGroup(Owner &modelGroup) -: modelGroup_(modelGroup.extract()) +: modelGroup_(modelGroup.extract()), andStateSize_(0), containsPcdata_(false) { } @@ -611,7 +614,7 @@ void AndState::clearFrom1(unsigned i) } MatchState::MatchState() -: andState_(0) +: andState_(0), pos_(NULL), minAndDepth_(0) { } diff --git a/cde/programs/nsgmls/ContentToken.h b/cde/programs/nsgmls/ContentToken.h index ec46575e..01d81885 100644 --- a/cde/programs/nsgmls/ContentToken.h +++ b/cde/programs/nsgmls/ContentToken.h @@ -208,7 +208,7 @@ class AndState; class SP_API AndInfo { public: - AndInfo() { } + AndInfo() : andAncestor(NULL), andGroupIndex(0) { } const AndModelGroup *andAncestor; unsigned andGroupIndex; Vector follow; diff --git a/cde/programs/nsgmls/ExtendEntityManager.C b/cde/programs/nsgmls/ExtendEntityManager.C index cc0a9de9..7425b306 100644 --- a/cde/programs/nsgmls/ExtendEntityManager.C +++ b/cde/programs/nsgmls/ExtendEntityManager.C @@ -500,7 +500,11 @@ ExternalInputSource::ExternalInputSource(ParsedSystemId &parsedSysid, : InputSource(origin, 0, 0), mayRewind_(mayRewind), mayNotExist_(mayNotExist), - sov_(parsedSysid.size()) + sov_(parsedSysid.size()), + readSize_(0), + decoder_(NULL), + recordType_(unknown), + zapEof_(false) { init(); info_ = new ExternalInfoImpl(parsedSysid); @@ -921,8 +925,11 @@ ExternalInfoImpl::ExternalInfoImpl(ParsedSystemId &parsedSysid) : currentIndex_(0), position_(parsedSysid.size()) { parsedSysid.swap(parsedSysid_); - if (parsedSysid_.size() > 0) + if (parsedSysid_.size() > 0) { notrack_ = parsedSysid_[0].notrack; + } else { + notrack_ = false; + } } StringC &ExternalInfoImpl::id(size_t i) diff --git a/cde/programs/nsgmls/ExternalId.C b/cde/programs/nsgmls/ExternalId.C index 56ed885b..78349a55 100644 --- a/cde/programs/nsgmls/ExternalId.C +++ b/cde/programs/nsgmls/ExternalId.C @@ -61,7 +61,7 @@ void ExternalId::setLocation(const Location &loc) } PublicId::PublicId() -: formal_(0) +: formal_(0), ownerType_(ISO), textClass_(CAPACITY), unavailable_(false), haveDisplayVersion_(false) { } diff --git a/cde/programs/nsgmls/Group.h b/cde/programs/nsgmls/Group.h index d4983c8a..cd5f0d3e 100644 --- a/cde/programs/nsgmls/Group.h +++ b/cde/programs/nsgmls/Group.h @@ -44,7 +44,7 @@ namespace SP_NAMESPACE { class GroupToken { public: - GroupToken() { } + GroupToken() : type(invalid) { } enum Type { invalid, nameToken, diff --git a/cde/programs/nsgmls/InputSource.C b/cde/programs/nsgmls/InputSource.C index c13f8ea9..666d7885 100644 --- a/cde/programs/nsgmls/InputSource.C +++ b/cde/programs/nsgmls/InputSource.C @@ -38,7 +38,8 @@ namespace SP_NAMESPACE { InputSource::InputSource(InputSourceOrigin *origin, const Char *start, const Char *end) : origin_(origin), start_(start), end_(end), cur_(start), accessError_(0), - startLocation_(origin, 0), multicode_(0), scanSuppress_(0) + startLocation_(origin, 0), multicode_(0), scanSuppress_(0), + scanSuppressSingle_(false), scanSuppressIndex_(0) { } diff --git a/cde/programs/nsgmls/Location.C b/cde/programs/nsgmls/Location.C index aad19340..1a0c7837 100644 --- a/cde/programs/nsgmls/Location.C +++ b/cde/programs/nsgmls/Location.C @@ -35,6 +35,7 @@ namespace SP_NAMESPACE { #endif Location::Location() +: index_(0) { } @@ -272,6 +273,7 @@ ExternalInfo::~ExternalInfo() RTTI_DEF0(ExternalInfo) NamedCharRef::NamedCharRef() +: refStartIndex_(0), refEndType_(endOmitted) { } diff --git a/cde/programs/nsgmls/Message.C b/cde/programs/nsgmls/Message.C index 607d37e0..54bb0990 100644 --- a/cde/programs/nsgmls/Message.C +++ b/cde/programs/nsgmls/Message.C @@ -45,7 +45,8 @@ MessageFragment::MessageFragment(unsigned module, unsigned number, const char * #ifndef SP_NO_MESSAGE_TEXT text_(text), #endif - number_(number) + number_(number), + spare_(0) { } @@ -124,11 +125,12 @@ OpenElementInfo::OpenElementInfo() } Message::Message() +: type(NULL) { } Message::Message(int nArgs) -: args(nArgs) +: args(nArgs), type(NULL) { } diff --git a/cde/programs/nsgmls/OutputCharStream.C b/cde/programs/nsgmls/OutputCharStream.C index 20f444fc..a8fa09f9 100644 --- a/cde/programs/nsgmls/OutputCharStream.C +++ b/cde/programs/nsgmls/OutputCharStream.C @@ -94,7 +94,7 @@ OutputCharStream &OutputCharStream::operator<<(int n) IosOutputCharStream::IosOutputCharStream() -: buf_(0), byteStream_(0) +: buf_(0), byteStream_(0), encoder_(NULL) { } diff --git a/cde/programs/nsgmls/OutputState.C b/cde/programs/nsgmls/OutputState.C index c3d2348a..8e51f2c7 100644 --- a/cde/programs/nsgmls/OutputState.C +++ b/cde/programs/nsgmls/OutputState.C @@ -37,6 +37,7 @@ namespace SP_NAMESPACE { #endif OutputState::OutputState() +: re_(0) { init(); } @@ -49,7 +50,7 @@ void OutputState::init() } OutputStateLevel::OutputStateLevel() -: state(OutputState::afterStartTag) +: state(OutputState::afterStartTag), reSerial(0) { } diff --git a/cde/programs/nsgmls/Param.h b/cde/programs/nsgmls/Param.h index 37887a36..3d55a568 100644 --- a/cde/programs/nsgmls/Param.h +++ b/cde/programs/nsgmls/Param.h @@ -53,7 +53,7 @@ class ElementType; class Param { public: - Param() { } + Param() : type(invalid), lita(false) { } typedef unsigned char Type; enum { invalid, diff --git a/cde/programs/nsgmls/ParserState.C b/cde/programs/nsgmls/ParserState.C index 55a39bd3..e8f23950 100644 --- a/cde/programs/nsgmls/ParserState.C +++ b/cde/programs/nsgmls/ParserState.C @@ -97,7 +97,10 @@ ParserState::ParserState(const Ptr &em, currentMarkup_(0), cancelPtr_(&dummyCancel_), finalPhase_(finalPhase), - hadAfdrDecl_(0) + hadAfdrDecl_(0), + pass2StartOffset_(0), + phase_(noPhase), + specialParseMode_() { } diff --git a/cde/programs/nsgmls/PosixStorage.C b/cde/programs/nsgmls/PosixStorage.C index 00d520cc..513b1dfb 100644 --- a/cde/programs/nsgmls/PosixStorage.C +++ b/cde/programs/nsgmls/PosixStorage.C @@ -108,7 +108,8 @@ private: PosixBaseStorageObject::PosixBaseStorageObject(int fd, Boolean mayRewind) : fd_(fd), eof_(0), - RewindStorageObject(mayRewind, mayRewind && canSeek(fd)) + RewindStorageObject(mayRewind, mayRewind && canSeek(fd)), + startOffset_(0) { } @@ -391,7 +392,10 @@ PosixStorageObject::PosixStorageObject(int fd, PosixBaseStorageObject(fd, mayRewind), suspended_(0), filename_(filename), - cfilename_(cfilename) + cfilename_(cfilename), + suspendPos_(0), + suspendFailedMessage_(NULL), + suspendErrno_(0) { } diff --git a/cde/programs/nsgmls/RewindStorageObject.C b/cde/programs/nsgmls/RewindStorageObject.C index 67969055..3522ebdd 100644 --- a/cde/programs/nsgmls/RewindStorageObject.C +++ b/cde/programs/nsgmls/RewindStorageObject.C @@ -38,7 +38,8 @@ namespace SP_NAMESPACE { RewindStorageObject::RewindStorageObject(Boolean mayRewind, Boolean canSeek) : mayRewind_(mayRewind), canSeek_(canSeek), - savingBytes_(mayRewind && canSeek), readingSaved_(0) + savingBytes_(mayRewind && canSeek), readingSaved_(0), + nBytesRead_(0) { } diff --git a/cde/programs/nsgmls/SOEntityCatalog.C b/cde/programs/nsgmls/SOEntityCatalog.C index 3f6f86b3..718140eb 100644 --- a/cde/programs/nsgmls/SOEntityCatalog.C +++ b/cde/programs/nsgmls/SOEntityCatalog.C @@ -400,7 +400,7 @@ void SOCatalogManagerImpl::addCatalogsForDocument(CatalogParser &parser, SOEntityCatalog::SOEntityCatalog(Ptr em) : em_(em), catalogNumber_(0), haveSgmlDecl_(0), haveDocument_(0), - haveCurrentBase_(0) + haveCurrentBase_(0), sgmlDeclBaseNumber_(0), documentBaseNumber_(0) { } diff --git a/cde/programs/nsgmls/SdText.C b/cde/programs/nsgmls/SdText.C index ba2d5a67..848dcb99 100644 --- a/cde/programs/nsgmls/SdText.C +++ b/cde/programs/nsgmls/SdText.C @@ -35,6 +35,7 @@ namespace SP_NAMESPACE { #endif SdText::SdText() +: lita_(false) { } @@ -78,6 +79,7 @@ Location SdText::endDelimLocation() const } SdTextItem::SdTextItem() +: index(0) { } diff --git a/cde/programs/nsgmls/SgmlsEventHandler.C b/cde/programs/nsgmls/SgmlsEventHandler.C index 77abf022..92313345 100644 --- a/cde/programs/nsgmls/SgmlsEventHandler.C +++ b/cde/programs/nsgmls/SgmlsEventHandler.C @@ -102,7 +102,7 @@ SgmlsEventHandler::SgmlsEventHandler(const SgmlParser *parser, outputId_((outputFlags & outputId) != 0), outputNotationSysid_((outputFlags & outputNotationSysid) != 0), outputIncluded_((outputFlags & outputIncluded) != 0), - haveData_(0), lastSos_(0) + haveData_(0), lastSos_(0), lastLineno_(0) { os_->setEscaper(escape); } diff --git a/cde/programs/nsgmls/ShortReferenceMap.C b/cde/programs/nsgmls/ShortReferenceMap.C index a1434e2d..6b941b2d 100644 --- a/cde/programs/nsgmls/ShortReferenceMap.C +++ b/cde/programs/nsgmls/ShortReferenceMap.C @@ -41,7 +41,7 @@ ShortReferenceMap::ShortReferenceMap() } ShortReferenceMap::ShortReferenceMap(const StringC &name) -: Named(name) +: Named(name), used_(false) { } diff --git a/cde/programs/nsgmls/Syntax.C b/cde/programs/nsgmls/Syntax.C index f5a64622..20596388 100644 --- a/cde/programs/nsgmls/Syntax.C +++ b/cde/programs/nsgmls/Syntax.C @@ -64,7 +64,9 @@ Syntax::Syntax(const Sd &sd) categoryTable_(otherCategory), shuncharControls_(0), multicode_(0), - markupScanTable_(MarkupScan::normal) + markupScanTable_(MarkupScan::normal), + namecaseGeneral_(false), + namecaseEntity_(false) { static const char lcletter[] = "abcdefghijklmnopqrstuvwxyz"; static const char ucletter[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/cde/programs/nsgmls/Text.C b/cde/programs/nsgmls/Text.C index 37f3aad2..54cd2041 100644 --- a/cde/programs/nsgmls/Text.C +++ b/cde/programs/nsgmls/Text.C @@ -248,6 +248,7 @@ Boolean Text::delimType(Boolean &lita) const } TextItem::TextItem() +: type(data), c(0), index(0) { } diff --git a/cde/programs/nsgmls/Trie.h b/cde/programs/nsgmls/Trie.h index 0e026f2b..c6b1bb6e 100644 --- a/cde/programs/nsgmls/Trie.h +++ b/cde/programs/nsgmls/Trie.h @@ -42,7 +42,7 @@ class BlankTrie; class Trie { public: - Trie() : next_(0), nCodes_(0) { } + Trie() : next_(0), nCodes_(0), token_(0), tokenLength_(0), priority_(Priority::data) { } Trie(const Trie &); ~Trie(); Trie &operator=(const Trie &); @@ -66,7 +66,7 @@ private: class BlankTrie : public Trie { public: - BlankTrie() { } + BlankTrie() : additionalLength_(0), maxBlanksToScan_(0) { } Boolean codeIsBlank(EquivCode c) const { return codeIsBlank_[c]; } // maximum number of blanks to scan (minimum is 0) size_t maxBlanksToScan() const { return maxBlanksToScan_; } -- 2.25.1