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

Clang-tidy checks for IOPool #20812

Merged
merged 2 commits into from Oct 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
26 changes: 13 additions & 13 deletions IOPool/Output/interface/PoolOutputModule.h
Expand Up @@ -40,7 +40,7 @@ namespace edm {
public:
enum DropMetaData { DropNone, DropDroppedPrior, DropPrior, DropAll };
explicit PoolOutputModule(ParameterSet const& ps);
virtual ~PoolOutputModule();
~PoolOutputModule() override;
PoolOutputModule(PoolOutputModule const&) = delete; // Disallow copying and moving
PoolOutputModule& operator=(PoolOutputModule const&) = delete; // Disallow copying and moving
std::string const& fileName() const {return fileName_;}
Expand Down Expand Up @@ -126,23 +126,23 @@ namespace edm {

protected:
///allow inheriting classes to override but still be able to call this method in the overridden version
virtual bool shouldWeCloseFile() const override;
virtual void write(EventForOutput const& e) override;
bool shouldWeCloseFile() const override;
void write(EventForOutput const& e) override;

virtual std::pair<std::string, std::string> physicalAndLogicalNameForNewFile();
virtual void doExtrasAfterCloseFile();
private:
virtual void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const override;

virtual void openFile(FileBlock const& fb) override;
virtual void respondToOpenInputFile(FileBlock const& fb) override;
virtual void respondToCloseInputFile(FileBlock const& fb) override;
virtual void writeLuminosityBlock(LuminosityBlockForOutput const& lb) override;
virtual void writeRun(RunForOutput const& r) override;
virtual bool isFileOpen() const override;
void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const override;

void openFile(FileBlock const& fb) override;
void respondToOpenInputFile(FileBlock const& fb) override;
void respondToCloseInputFile(FileBlock const& fb) override;
void writeLuminosityBlock(LuminosityBlockForOutput const& lb) override;
void writeRun(RunForOutput const& r) override;
bool isFileOpen() const override;
void reallyOpenFile();
virtual void reallyCloseFile() override;
virtual void beginJob() override;
void reallyCloseFile() override;
void beginJob() override;

typedef std::map<BranchID, std::set<ParentageID> > BranchParents;
void updateBranchParentsForOneBranch(ProductProvenanceRetriever const* provRetriever,
Expand Down
6 changes: 3 additions & 3 deletions IOPool/Output/interface/TimeoutPoolOutputModule.h
Expand Up @@ -23,15 +23,15 @@ namespace edm {
class TimeoutPoolOutputModule : public PoolOutputModule {
public:
explicit TimeoutPoolOutputModule(ParameterSet const& ps);
virtual ~TimeoutPoolOutputModule(){};
~TimeoutPoolOutputModule() override{};
TimeoutPoolOutputModule(TimeoutPoolOutputModule const&) = delete; // Disallow copying and moving
TimeoutPoolOutputModule& operator=(TimeoutPoolOutputModule const&) = delete; // Disallow copying and moving

static void fillDescriptions(ConfigurationDescriptions& descriptions);

protected:
virtual bool shouldWeCloseFile() const override;
virtual void write(EventForOutput const& e) override;
bool shouldWeCloseFile() const override;
void write(EventForOutput const& e) override;

private:
mutable time_t m_lastEvent;
Expand Down
8 changes: 4 additions & 4 deletions IOPool/Output/src/PoolOutputModule.cc
Expand Up @@ -119,16 +119,16 @@ namespace edm {
basketSize_(BranchDescription::invalidBasketSize) {}

PoolOutputModule::OutputItem::OutputItem() :
branchDescription_(0),
branchDescription_(nullptr),
token_(),
product_(0),
product_(nullptr),
splitLevel_(BranchDescription::invalidSplitLevel),
basketSize_(BranchDescription::invalidBasketSize) {}

PoolOutputModule::OutputItem::OutputItem(BranchDescription const* bd, EDGetToken const& token, int splitLevel, int basketSize) :
branchDescription_(bd),
token_(token),
product_(0),
product_(nullptr),
splitLevel_(splitLevel),
basketSize_(basketSize) {}

Expand Down Expand Up @@ -200,7 +200,7 @@ namespace edm {
int basketSize = BranchDescription::invalidBasketSize;

BranchDescription const& prod = *kept.first;
TBranch* theBranch = ((!prod.produced() && theInputTree != nullptr && !overrideInputFileSplitLevels_) ? theInputTree->GetBranch(prod.branchName().c_str()) : 0);
TBranch* theBranch = ((!prod.produced() && theInputTree != nullptr && !overrideInputFileSplitLevels_) ? theInputTree->GetBranch(prod.branchName().c_str()) : nullptr);

if(theBranch != nullptr) {
splitLevel = theBranch->GetSplitLevel();
Expand Down
4 changes: 2 additions & 2 deletions IOPool/Output/src/TimeoutPoolOutputModule.cc
Expand Up @@ -13,7 +13,7 @@ namespace edm {
TimeoutPoolOutputModule::TimeoutPoolOutputModule(ParameterSet const& ps):
edm::one::OutputModuleBase::OutputModuleBase(ps),
PoolOutputModule(ps),
m_lastEvent(time(NULL)),
m_lastEvent(time(nullptr)),
eventsWrittenInCurrentFile(0),
m_timeout(-1) // we want the first event right away
{ }
Expand All @@ -26,7 +26,7 @@ namespace edm {
}

bool TimeoutPoolOutputModule::shouldWeCloseFile() const {
time_t now(time(NULL));
time_t now(time(nullptr));
if ( PoolOutputModule::shouldWeCloseFile() ) {
edm::LogVerbatim("TimeoutPoolOutputModule") <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile <<" events.";
eventsWrittenInCurrentFile = 0;
Expand Down
18 changes: 9 additions & 9 deletions IOPool/Streamer/interface/StreamerInputSource.h
Expand Up @@ -33,7 +33,7 @@ namespace edm {
public:
explicit StreamerInputSource(ParameterSet const& pset,
InputSourceDescription const& desc);
virtual ~StreamerInputSource();
~StreamerInputSource() override;
static void fillDescription(ParameterSetDescription& description);

std::unique_ptr<SendJobHeader> deserializeRegistry(InitMsgView const& initView);
Expand Down Expand Up @@ -71,16 +71,16 @@ namespace edm {
class EventPrincipalHolder : public EDProductGetter {
public:
EventPrincipalHolder();
virtual ~EventPrincipalHolder();
~EventPrincipalHolder() override;

virtual WrapperBase const* getIt(ProductID const& id) const override;
virtual WrapperBase const* getThinnedProduct(ProductID const&, unsigned int&) const override;
virtual void getThinnedProducts(ProductID const& pid,
WrapperBase const* getIt(ProductID const& id) const override;
WrapperBase const* getThinnedProduct(ProductID const&, unsigned int&) const override;
void getThinnedProducts(ProductID const& pid,
std::vector<WrapperBase const*>& wrappers,
std::vector<unsigned int>& keys) const override;


virtual unsigned int transitionIndex_() const override;
unsigned int transitionIndex_() const override;

void setEventPrincipal(EventPrincipal* ep);

Expand All @@ -89,11 +89,11 @@ namespace edm {
EventPrincipal const* eventPrincipal_;
};

virtual void read(EventPrincipal& eventPrincipal);
void read(EventPrincipal& eventPrincipal) override;

virtual void setRun(RunNumber_t r);
void setRun(RunNumber_t r) override;

virtual std::unique_ptr<FileBlock> readFile_();
std::unique_ptr<FileBlock> readFile_() override;

edm::propagate_const<TClass*> tc_;
std::vector<unsigned char> dest_;
Expand Down
14 changes: 7 additions & 7 deletions IOPool/Streamer/interface/StreamerOutputModule.h
Expand Up @@ -19,16 +19,16 @@ namespace edm {

public:
explicit StreamerOutputModule(ParameterSet const& ps);
virtual ~StreamerOutputModule();
~StreamerOutputModule() override;
static void fillDescriptions(ConfigurationDescriptions& descriptions);

private:
virtual void start() override;
virtual void stop() override;
virtual void doOutputHeader(InitMsgBuilder const& init_message) override;
virtual void doOutputEvent(EventMsgBuilder const& msg) override;
virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const&) override;
virtual void endLuminosityBlock(edm::LuminosityBlockForOutput const&) override;
void start() override;
void stop() override;
void doOutputHeader(InitMsgBuilder const& init_message) override;
void doOutputEvent(EventMsgBuilder const& msg) override;
void beginLuminosityBlock(edm::LuminosityBlockForOutput const&) override;
void endLuminosityBlock(edm::LuminosityBlockForOutput const&) override;

private:
edm::propagate_const<std::unique_ptr<Consumer>> c_;
Expand Down
16 changes: 8 additions & 8 deletions IOPool/Streamer/interface/StreamerOutputModuleBase.h
Expand Up @@ -18,17 +18,17 @@ namespace edm {
class StreamerOutputModuleBase : public one::OutputModule<one::WatchRuns, one::WatchLuminosityBlocks> {
public:
explicit StreamerOutputModuleBase(ParameterSet const& ps);
virtual ~StreamerOutputModuleBase();
~StreamerOutputModuleBase() override;
static void fillDescription(ParameterSetDescription & desc);

private:
virtual void beginRun(RunForOutput const&) override;
virtual void endRun(RunForOutput const&) override;
virtual void beginJob() override;
virtual void endJob() override;
virtual void writeRun(RunForOutput const&) override;
virtual void writeLuminosityBlock(LuminosityBlockForOutput const&) override;
virtual void write(EventForOutput const& e) override;
void beginRun(RunForOutput const&) override;
void endRun(RunForOutput const&) override;
void beginJob() override;
void endJob() override;
void writeRun(RunForOutput const&) override;
void writeLuminosityBlock(LuminosityBlockForOutput const&) override;
void write(EventForOutput const& e) override;

virtual void start() = 0;
virtual void stop() = 0;
Expand Down
4 changes: 2 additions & 2 deletions IOPool/Streamer/src/ClassFiller.cc
Expand Up @@ -22,7 +22,7 @@ namespace edm {
void doBuildRealData(std::string const& name) {
FDEBUG(3) << "doing BuildRealData for " << name << "\n";
TClass* ttest = TClass::GetClass(name.c_str());
if (ttest != 0) {
if (ttest != nullptr) {
ttest->BuildRealData();
} else {
throw edm::Exception(errors::Configuration)
Expand Down Expand Up @@ -52,7 +52,7 @@ namespace edm {
TClass* getRootClass(std::string const& name) {
TClass* tc = TClass::GetClass(name.c_str());

if(tc == 0) {
if(tc == nullptr) {
throw edm::Exception(errors::Configuration,"getRootClass")
<< "could not find TClass for " << name
<< "\n";
Expand Down
2 changes: 1 addition & 1 deletion IOPool/Streamer/src/DumpTools.cc
Expand Up @@ -100,7 +100,7 @@ void dumpInitVerbose(const InitMsgView* view)
(char*)view->descData(), kFALSE);
std::unique_ptr<SendJobHeader> sd((SendJobHeader*)xbuf.ReadObjectAny(desc));

if (sd.get() == 0) {
if (sd.get() == nullptr) {
std::cout << "Unable to determine the product registry - "
<< "Registry deserialization error." << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion IOPool/Streamer/src/FRDEventMessage.cc
Expand Up @@ -16,7 +16,7 @@
*/
FRDEventMsgView::FRDEventMsgView(void* buf)
: buf_((uint8*)buf),
payload_(0),
payload_(nullptr),
size_(0),
version_(0),
run_(0),
Expand Down
16 changes: 8 additions & 8 deletions IOPool/Streamer/src/InitMessage.cc
Expand Up @@ -7,26 +7,26 @@
InitMsgView::InitMsgView(void* buf) :
buf_((uint8*)buf),
head_(buf),
release_start_(0),
release_start_(nullptr),
release_len_(0),
processName_start_(0),
processName_start_(nullptr),
processName_len_(0),
outputModuleLabel_start_(0),
outputModuleLabel_start_(nullptr),
outputModuleLabel_len_(0),
outputModuleId_(0),
hlt_trig_start_(0),
hlt_trig_start_(nullptr),
hlt_trig_count_(0),
hlt_trig_len_(0),
hlt_select_start_(0),
hlt_select_start_(nullptr),
hlt_select_count_(0),
hlt_select_len_(0),
l1_trig_start_(0),
l1_trig_start_(nullptr),
l1_trig_count_(0),
l1_trig_len_(0),
adler32_chksum_(0),
host_name_start_(0),
host_name_start_(nullptr),
host_name_len_(0),
desc_start_(0),
desc_start_(nullptr),
desc_len_(0) {
if (protocolVersion() == 2) {
std::cout << "Protocol Version 2 encountered" << std::endl;
Expand Down
8 changes: 4 additions & 4 deletions IOPool/Streamer/src/StreamerFileIO.cc
Expand Up @@ -6,7 +6,7 @@

OutputFile::OutputFile(const std::string& name):
current_offset_(1),
do_adler_(0),
do_adler_(false),
adlera_(1),
adlerb_(0),
ost_(new std::ofstream(name.c_str(), std::ios_base::binary | std::ios_base::out)),
Expand All @@ -16,7 +16,7 @@
throw cms::Exception("OutputFile","OutputFile")
<< "Error Opening Output File: "<<name<<"\n";
}
ost_->rdbuf()->pubsetbuf(0,0);
ost_->rdbuf()->pubsetbuf(nullptr,0);
}

OutputFile::~OutputFile()
Expand All @@ -31,8 +31,8 @@
current_offset_ += (uint64)(n);
if (do_adler_)
cms::Adler32(ptr,n,adlera_,adlerb_);
return 0;
return false;
}
return 1;
return true;
}

10 changes: 5 additions & 5 deletions IOPool/Streamer/src/StreamerFileReader.h
Expand Up @@ -21,18 +21,18 @@ namespace edm {
class StreamerFileReader : public StreamerInputSource {
public:
StreamerFileReader(ParameterSet const& pset, InputSourceDescription const& desc);
virtual ~StreamerFileReader();
~StreamerFileReader() override;

InitMsgView const* getHeader();
EventMsgView const* getNextEvent();
bool newHeader();
static void fillDescriptions(ConfigurationDescriptions& descriptions);

private:
virtual bool checkNextEvent() override;
virtual void skip(int toSkip) override;
virtual void genuineCloseFile() override;
virtual void reset_() override;
bool checkNextEvent() override;
void skip(int toSkip) override;
void genuineCloseFile() override;
void reset_() override;

std::shared_ptr<EventSkipperByID const> eventSkipperByID() const {return get_underlying_safe(eventSkipperByID_);}
std::shared_ptr<EventSkipperByID>& eventSkipperByID() {return get_underlying_safe(eventSkipperByID_);}
Expand Down
4 changes: 2 additions & 2 deletions IOPool/Streamer/src/StreamerInputFile.cc
Expand Up @@ -72,9 +72,9 @@ namespace edm {
logFileAction(" Initiating request to open file ");

IOOffset size = -1;
if(StorageFactory::get()->check(name.c_str(), &size)) {
if(StorageFactory::get()->check(name, &size)) {
try {
storage_ =StorageFactory::get()->open(name.c_str(),
storage_ =StorageFactory::get()->open(name,
IOFlags::OpenRead);
}
catch(cms::Exception& e) {
Expand Down
2 changes: 1 addition & 1 deletion IOPool/Streamer/src/StreamerOutputFile.cc
Expand Up @@ -7,7 +7,7 @@
StreamerOutputFile::StreamerOutputFile(const std::string& name):
streamerfile_(new OutputFile(name))
{
streamerfile_->set_do_adler(1);
streamerfile_->set_do_adler(true);
}

uint64 StreamerOutputFile::write(const EventMsgBuilder& ineview)
Expand Down
2 changes: 1 addition & 1 deletion IOPool/Streamer/src/StreamerOutputModuleBase.cc
Expand Up @@ -34,7 +34,7 @@ namespace {

void packIntoString(std::vector<unsigned char> const& source,
std::vector<unsigned char>& package) {
if (source.size() < 1) {return;}
if (source.empty()) {return;}
unsigned int packInOneByte = 4;
unsigned int sizeOfPackage = 1+((source.size()-1)/packInOneByte); //Two bits per HLT

Expand Down
16 changes: 8 additions & 8 deletions IOPool/TFileAdaptor/interface/TStorageFactorySystem.h
Expand Up @@ -18,18 +18,18 @@ class TStorageFactorySystem : public TSystem

TStorageFactorySystem(const char *, Bool_t); // For compatibility with TXNetFile, we don't actually use the arguments
TStorageFactorySystem(void);
~TStorageFactorySystem(void);
~TStorageFactorySystem(void) override;

virtual Int_t MakeDirectory(const char *name);
virtual void * OpenDirectory(const char *name);
virtual void FreeDirectory(void *dirp);
virtual const char * GetDirEntry(void *dirp);
Int_t MakeDirectory(const char *name) override;
void * OpenDirectory(const char *name) override;
void FreeDirectory(void *dirp) override;
const char * GetDirEntry(void *dirp) override;

virtual Int_t GetPathInfo(const char *path, FileStat_t &info);
Int_t GetPathInfo(const char *path, FileStat_t &info) override;

virtual Bool_t AccessPathName(const char *path, EAccessMode mode);
Bool_t AccessPathName(const char *path, EAccessMode mode) override;

virtual int Unlink(const char *name);
int Unlink(const char *name) override;

};

Expand Down
2 changes: 1 addition & 1 deletion IOPool/TFileAdaptor/src/ReadRepacker.cc
@@ -1,6 +1,6 @@

#include <cassert>
#include <string.h>
#include <cstring>

#include "ReadRepacker.h"

Expand Down