Base: fix warnings reported by code analysers

* disable copy-constructor and assignment operator for Stream classes
* remove destructor of sub-classes of SequencerBase
* fix some old C-style cast warnings
This commit is contained in:
wmayer
2022-03-01 12:20:27 +01:00
parent 9a42b61fcb
commit 60ee579fb4
4 changed files with 40 additions and 32 deletions

View File

@@ -126,8 +126,8 @@ void SequencerBase::startStep()
bool SequencerBase::next(bool canAbort)
{
this->nProgress++;
float fDiv = this->nTotalSteps > 0 ? (float)this->nTotalSteps : 1000.0f;
int perc = (int)((float)this->nProgress * (100.0f / fDiv));
float fDiv = this->nTotalSteps > 0 ? static_cast<float>(this->nTotalSteps) : 1000.0f;
int perc = int((float(this->nProgress) * (100.0f / fDiv)));
// do only an update if we have increased by one percent
if (perc > this->_nLastPercentage) {
@@ -220,26 +220,8 @@ void SequencerBase::setText(const char*)
// ---------------------------------------------------------
EmptySequencer::EmptySequencer()
{
}
EmptySequencer::~EmptySequencer()
{
}
// ---------------------------------------------------------
using Base::ConsoleSequencer;
ConsoleSequencer::ConsoleSequencer ()
{
}
ConsoleSequencer::~ConsoleSequencer ()
{
}
void ConsoleSequencer::setText (const char* pszTxt)
{
printf("%s...\n", pszTxt);
@@ -252,7 +234,7 @@ void ConsoleSequencer::startStep()
void ConsoleSequencer::nextStep( bool )
{
if (this->nTotalSteps != 0)
printf("\t\t\t\t\t\t(%2.1f %%)\t\r", (float)progressInPercent());
printf("\t\t\t\t\t\t(%d %%)\t\r", progressInPercent());
}
void ConsoleSequencer::resetData()
@@ -353,8 +335,8 @@ Py::Object ProgressIndicatorPy::repr()
Py::Object ProgressIndicatorPy::start(const Py::Tuple& args)
{
char* text;
int steps;
if (!PyArg_ParseTuple(args.ptr(), "si",&text,&steps))
unsigned int steps;
if (!PyArg_ParseTuple(args.ptr(), "sI",&text,&steps))
throw Py::Exception();
if (!_seq.get())
_seq.reset(new SequencerLauncher(text,steps));