Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply scram b code-checks to Core bin files #20420

Merged
merged 1 commit into from
Sep 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion FWCore/Framework/bin/cmsRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ int main(int argc, char* argv[]) {
}
}
if (!ex.alreadyPrinted()) {
if (jobRep.get() != 0) {
if (jobRep.get() != nullptr) {
edm::printCmsException(ex, &(jobRep->get()), returnCode);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion FWCore/PluginManager/bin/refresh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int main (int argc, char **argv) try {

path filename (*file);
path shortName(file->path().filename());
std::string stringName = shortName.string();
const std::string& stringName = shortName.string();

static std::string const kPluginPrefix(standard::pluginPrefix());
if (stringName.size() < kPluginPrefix.size()) {
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Services/bin/cmsGetFnConnect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
#include "FWCore/Utilities/interface/Exception.h"
#include <iostream>
#include <string.h>
#include <cstring>

int
main(int argc, char* argv[])
Expand Down
30 changes: 15 additions & 15 deletions IOPool/Common/bin/CollUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace edm {
TFile* openFileHdl(std::string const& fname) {
TFile *hdl = TFile::Open(fname.c_str(), "read");

if (0 == hdl) {
if (nullptr == hdl) {
std::cout << "ERR Could not open file " << fname.c_str() << std::endl;
exit(1);
}
Expand All @@ -36,7 +36,7 @@ namespace edm {
hdl->ls();
TList *keylist = hdl->GetListOfKeys();
TIterator *iter = keylist->MakeIterator();
TKey *key = 0;
TKey *key = nullptr;
while ((key = (TKey*)iter->Next())) {
TObject *obj = hdl->Get(key->GetName());
if (obj->IsA() == TTree::Class()) {
Expand Down Expand Up @@ -71,7 +71,7 @@ namespace edm {
}

void printBranchNames(TTree *tree) {
if (tree != 0) {
if (tree != nullptr) {
Long64_t nB = tree->GetListOfBranches()->GetEntries();
for (Long64_t i = 0; i < nB; ++i) {
Long64_t size = 0LL;
Expand All @@ -85,7 +85,7 @@ namespace edm {
}

void longBranchPrint(TTree *tr) {
if (tr != 0) {
if (tr != nullptr) {
Long64_t nB = tr->GetListOfBranches()->GetEntries();
for (Long64_t i = 0; i < nB; ++i) {
tr->GetListOfBranches()->At(i)->Print();
Expand Down Expand Up @@ -115,7 +115,7 @@ namespace edm {
static void preIndexIntoFilePrintEventLists(TFile*, FileFormatVersion const& fileFormatVersion, TTree *metaDataTree) {
FileIndex fileIndex;
FileIndex *findexPtr = &fileIndex;
if (metaDataTree->FindBranch(poolNames::fileIndexBranchName().c_str()) != 0) {
if (metaDataTree->FindBranch(poolNames::fileIndexBranchName().c_str()) != nullptr) {
TBranch *fndx = metaDataTree->GetBranch(poolNames::fileIndexBranchName().c_str());
fndx->SetAddress(&findexPtr);
fndx->GetEntry(0);
Expand Down Expand Up @@ -150,7 +150,7 @@ namespace edm {
static void postIndexIntoFilePrintEventLists(TFile* tfl, FileFormatVersion const& fileFormatVersion, TTree *metaDataTree) {
IndexIntoFile indexIntoFile;
IndexIntoFile *findexPtr = &indexIntoFile;
if (metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != 0) {
if (metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != nullptr) {
TBranch *fndx = metaDataTree->GetBranch(poolNames::indexIntoFileBranchName().c_str());
fndx->SetAddress(&findexPtr);
fndx->GetEntry(0);
Expand All @@ -162,10 +162,10 @@ namespace edm {
}
//need to read event # from the EventAuxiliary branch
TTree* eventsTree = dynamic_cast<TTree*>(tfl->Get(poolNames::eventTreeName().c_str()));
TBranch* eventAuxBranch = 0;
assert(0 != eventsTree);
TBranch* eventAuxBranch = nullptr;
assert(nullptr != eventsTree);
char const* const kEventAuxiliaryBranchName = "EventAuxiliary";
if(eventsTree->FindBranch(kEventAuxiliaryBranchName) != 0){
if(eventsTree->FindBranch(kEventAuxiliaryBranchName) != nullptr){
eventAuxBranch = eventsTree->GetBranch(kEventAuxiliaryBranchName);
} else {
std::cout << "Failed to find " << kEventAuxiliaryBranchName << " branch in Events TTree. Something is wrong with this file." << std::endl;
Expand Down Expand Up @@ -228,11 +228,11 @@ namespace edm {

void printEventLists(TFile *tfl) {
TTree *metaDataTree = dynamic_cast<TTree *>(tfl->Get(poolNames::metaDataTreeName().c_str()));
assert(0 != metaDataTree);
assert(nullptr != metaDataTree);

FileFormatVersion fileFormatVersion;
FileFormatVersion *fftPtr = &fileFormatVersion;
if (metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != 0) {
if (metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != nullptr) {
TBranch *fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str());
fft->SetAddress(&fftPtr);
fft->GetEntry(0);
Expand All @@ -247,7 +247,7 @@ namespace edm {
static void preIndexIntoFilePrintEventsInLumis(TFile*, FileFormatVersion const& fileFormatVersion, TTree *metaDataTree) {
FileIndex fileIndex;
FileIndex *findexPtr = &fileIndex;
if (metaDataTree->FindBranch(poolNames::fileIndexBranchName().c_str()) != 0) {
if (metaDataTree->FindBranch(poolNames::fileIndexBranchName().c_str()) != nullptr) {
TBranch *fndx = metaDataTree->GetBranch(poolNames::fileIndexBranchName().c_str());
fndx->SetAddress(&findexPtr);
fndx->GetEntry(0);
Expand Down Expand Up @@ -296,7 +296,7 @@ namespace edm {
static void postIndexIntoFilePrintEventsInLumis(TFile* tfl, FileFormatVersion const& fileFormatVersion, TTree *metaDataTree) {
IndexIntoFile indexIntoFile;
IndexIntoFile *findexPtr = &indexIntoFile;
if (metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != 0) {
if (metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != nullptr) {
TBranch *fndx = metaDataTree->GetBranch(poolNames::indexIntoFileBranchName().c_str());
fndx->SetAddress(&findexPtr);
fndx->GetEntry(0);
Expand Down Expand Up @@ -353,11 +353,11 @@ namespace edm {

void printEventsInLumis(TFile *tfl) {
TTree *metaDataTree = dynamic_cast<TTree *>(tfl->Get(poolNames::metaDataTreeName().c_str()));
assert(0 != metaDataTree);
assert(nullptr != metaDataTree);

FileFormatVersion fileFormatVersion;
FileFormatVersion *fftPtr = &fileFormatVersion;
if (metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != 0) {
if (metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != nullptr) {
TBranch *fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str());
fft->SetAddress(&fftPtr);
fft->GetEntry(0);
Expand Down
8 changes: 4 additions & 4 deletions IOPool/Common/bin/EdmFileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int argc, char* argv[]) {
bool print = more && (vm.count("print") > 0 ? true : false);
bool printBranchDetails = more && (vm.count("printBranchDetails") > 0 ? true : false);
bool onlyDecodeLFN = decodeLFN && !(uuid || adler32 || allowRecovery || json || events || tree || ls || print || printBranchDetails);
std::string selectedTree = tree ? vm["tree"].as<std::string>() : edm::poolNames::eventTreeName().c_str();
std::string selectedTree = tree ? vm["tree"].as<std::string>() : edm::poolNames::eventTreeName();

if (events||eventsInLumis) {
try {
Expand Down Expand Up @@ -179,7 +179,7 @@ int main(int argc, char* argv[]) {
// Ok. Do we have the expected trees?
for (unsigned int i = 0; i < expectedTrees.size(); ++i) {
TTree *t = (TTree*) tfile->Get(expectedTrees[i].c_str());
if (t == 0) {
if (t == nullptr) {
std::cout << "Tree " << expectedTrees[i] << " appears to be missing. Not a valid collection\n";
std::cout << "Exiting\n";
return 1;
Expand Down Expand Up @@ -260,7 +260,7 @@ int main(int argc, char* argv[]) {
// Print out each tree
if (print) {
TTree *printTree = (TTree*)tfile->Get(selectedTree.c_str());
if (printTree == 0) {
if (printTree == nullptr) {
std::cout << "Tree " << selectedTree << " appears to be missing. Could not find it in the file.\n";
std::cout << "Exiting\n";
return 1;
Expand All @@ -270,7 +270,7 @@ int main(int argc, char* argv[]) {

if (printBranchDetails) {
TTree *printTree = (TTree*)tfile->Get(selectedTree.c_str());
if (printTree == 0) {
if (printTree == nullptr) {
std::cout << "Tree " << selectedTree << " appears to be missing. Could not find it in the file.\n";
std::cout << "Exiting\n";
return 1;
Expand Down
42 changes: 21 additions & 21 deletions IOPool/Common/bin/EdmProvDump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ operator<<(std::ostream& os, edm::ProcessHistory& iHist) {

void HistoryNode::printHistory(std::string const& iIndent) const {
std::string const indentDelta(" ");
std::string indent = iIndent;
const std::string& indent = iIndent;
for(auto const& item : *this) {
std::cout << indent << item;
item.printHistory(indent + indentDelta);
Expand All @@ -163,7 +163,7 @@ std::string eventSetupComponent(char const* iType,
std::ostringstream result;
edm::ParameterSet const& pset = iProcessConfig.getParameterSet(iCompName);
std::string name(pset.getParameter<std::string>("@module_label"));
if(0 == name.size()) {
if(name.empty()) {
name = pset.getParameter<std::string>("@module_type");
}

Expand Down Expand Up @@ -341,7 +341,7 @@ void HistoryNode::printTopLevelPSetsHistory(ParameterSetMap const& iPSM,

std::vector<std::string> results;
for(auto const& name: allNames){
if (name.size() == 0 || '@' == name[0] || namesToExclude.find(name)!=namesToExclude.end()) {
if (name.empty() || '@' == name[0] || namesToExclude.find(name)!=namesToExclude.end()) {
continue;
}
std::string retValue = topLevelPSet(name,processConfig,itH.processName());
Expand Down Expand Up @@ -592,7 +592,7 @@ void
ProvenanceDumper::dumpEventFilteringParameterSets_(TFile* file) {

TTree* history = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventHistoryTreeName().c_str()));
if(history != 0) {
if(history != nullptr) {
edm::History h;
edm::History* ph = &h;

Expand All @@ -604,9 +604,9 @@ ProvenanceDumper::dumpEventFilteringParameterSets_(TFile* file) {
}
} else {
TTree* events = dynamic_cast<TTree*>(file->Get(edm::poolNames::eventTreeName().c_str()));
assert (events != 0);
assert (events != nullptr);
TBranch* eventSelectionsBranch = events->GetBranch(edm::poolNames::eventSelectionsBranchName().c_str());
assert (eventSelectionsBranch != 0);
assert (eventSelectionsBranch != nullptr);
edm::EventSelectionIDVector ids;
edm::EventSelectionIDVector* pids = &ids;
eventSelectionsBranch->SetAddress(&pids);
Expand Down Expand Up @@ -687,17 +687,17 @@ void
ProvenanceDumper::work_() {

TTree* meta = dynamic_cast<TTree*>(inputFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
assert(0 != meta);
assert(nullptr != meta);

edm::ProductRegistry* pReg = &reg_;
meta->SetBranchAddress(edm::poolNames::productDescriptionBranchName().c_str(), &pReg);

ParameterSetMap* pPsm = &psm_;
if(meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != 0) {
if(meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
meta->SetBranchAddress(edm::poolNames::parameterSetMapBranchName().c_str(), &pPsm);
} else {
TTree* psetTree = dynamic_cast<TTree *>(inputFile_->Get(edm::poolNames::parameterSetsTreeName().c_str()));
assert(0 != psetTree);
assert(nullptr != psetTree);
typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
IdToBlobs idToBlob;
IdToBlobs* pIdToBlob = &idToBlob;
Expand All @@ -709,21 +709,21 @@ ProvenanceDumper::work_() {
}

edm::ProcessHistoryVector* pPhv = &phv_;
if(meta->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != 0) {
if(meta->FindBranch(edm::poolNames::processHistoryBranchName().c_str()) != nullptr) {
meta->SetBranchAddress(edm::poolNames::processHistoryBranchName().c_str(), &pPhv);
}

edm::ProcessHistoryMap phm;
edm::ProcessHistoryMap* pPhm = &phm;
if(meta->FindBranch(edm::poolNames::processHistoryMapBranchName().c_str()) != 0) {
if(meta->FindBranch(edm::poolNames::processHistoryMapBranchName().c_str()) != nullptr) {
meta->SetBranchAddress(edm::poolNames::processHistoryMapBranchName().c_str(), &pPhm);
}

if(meta->FindBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str()) != 0) {
if(meta->FindBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str()) != nullptr) {
if(meta->GetBranch(edm::poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
meta->SetBranchStatus((edm::poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0);
meta->SetBranchStatus((edm::poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), false);
} else {
meta->SetBranchStatus(edm::poolNames::moduleDescriptionMapBranchName().c_str(), 0);
meta->SetBranchStatus(edm::poolNames::moduleDescriptionMapBranchName().c_str(), false);
}
}

Expand Down Expand Up @@ -795,21 +795,21 @@ ProvenanceDumper::work_() {
registry.insertMapped(parentageBuffer);
orderedParentageIDs.push_back(parentageBuffer.id());
}
parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), 0);
parentageTree->SetBranchAddress(edm::poolNames::parentageBranchName().c_str(), nullptr);

TTree* eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToMetaDataTreeName(edm::InEvent).c_str()));
if(0 == eventMetaTree) {
if(nullptr == eventMetaTree) {
eventMetaTree = dynamic_cast<TTree*>(inputFile_->Get(edm::BranchTypeToProductTreeName(edm::InEvent).c_str()));
}
if(0 == eventMetaTree) {
if(nullptr == eventMetaTree) {
std::cerr << "ERROR, no '" << edm::BranchTypeToProductTreeName(edm::InEvent)<< "' Tree in file so can not show dependencies\n";
showDependencies_ = false;
extendedAncestors_ = false;
extendedDescendants_ = false;
} else {
TBranch* storedProvBranch = eventMetaTree->GetBranch(edm::BranchTypeToProductProvenanceBranchName(edm::InEvent).c_str());

if(0!=storedProvBranch) {
if(nullptr!=storedProvBranch) {
std::vector<edm::StoredProductProvenance> info;
std::vector<edm::StoredProductProvenance>* pInfo = &info;
storedProvBranch->SetAddress(&pInfo);
Expand All @@ -823,7 +823,7 @@ ProvenanceDumper::work_() {
} else {
//backwards compatible check
TBranch* productProvBranch = eventMetaTree->GetBranch(edm::BranchTypeToBranchEntryInfoBranchName(edm::InEvent).c_str());
if (0 != productProvBranch) {
if (nullptr != productProvBranch) {
std::vector<edm::ProductProvenance> info;
std::vector<edm::ProductProvenance>* pInfo = &info;
productProvBranch->SetAddress(&pInfo);
Expand Down Expand Up @@ -852,7 +852,7 @@ ProvenanceDumper::work_() {
edm::BranchID childBranchID = itParentageSet.first;
for (auto const& itParentageID : itParentageSet.second) {
edm::Parentage const* parentage = registry.getMapped(itParentageID);
if(0 != parentage) {
if(nullptr != parentage) {
for(auto const& branch : parentage->parents()) {
parentToChildren[branch].insert(childBranchID);
}
Expand Down Expand Up @@ -1039,7 +1039,7 @@ ProvenanceDumper::addAncestors(edm::BranchID const& branchID, std::set<edm::Bran
std::set<edm::ParentageID> const& parentIDs = perProductParentage[branchID];
for (auto const& parentageID : parentIDs) {
edm::Parentage const* parentage = registry.getMapped(parentageID);
if(0 != parentage) {
if(nullptr != parentage) {
for(auto const& branch : parentage->parents()) {

if(ancestorBranchIDs.insert(branch).second) {
Expand Down