diff --git a/src/Base/Sequencer.cpp b/src/Base/Sequencer.cpp index 5bfae5b28e..eb195d2295 100644 --- a/src/Base/Sequencer.cpp +++ b/src/Base/Sequencer.cpp @@ -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(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)); diff --git a/src/Base/Sequencer.h b/src/Base/Sequencer.h index d60040e516..0b5e22f786 100644 --- a/src/Base/Sequencer.h +++ b/src/Base/Sequencer.h @@ -206,6 +206,8 @@ protected: protected: /** construction */ SequencerBase(); + SequencerBase(const SequencerBase&) = default; + SequencerBase& operator=(const SequencerBase&) = default; /** Destruction */ virtual ~SequencerBase(); /** @@ -253,9 +255,7 @@ class BaseExport EmptySequencer : public Base::SequencerBase { public: /** construction */ - EmptySequencer(); - /** Destruction */ - ~EmptySequencer(); + EmptySequencer() = default; }; /** @@ -265,9 +265,7 @@ class BaseExport ConsoleSequencer : public SequencerBase { public: /** construction */ - ConsoleSequencer (); - /** Destruction */ - ~ConsoleSequencer (); + ConsoleSequencer () = default; protected: /** Starts the sequencer */ @@ -374,6 +372,10 @@ public: bool next(bool canAbort = false); void setProgress(size_t); bool wasCanceled() const; + +private: + SequencerLauncher(const SequencerLauncher&); + void operator=(const SequencerLauncher&); }; /** Access to the only SequencerBase instance */ diff --git a/src/Base/Stream.cpp b/src/Base/Stream.cpp index 8c7b94b6b0..5c4c4a7fbd 100644 --- a/src/Base/Stream.cpp +++ b/src/Base/Stream.cpp @@ -239,7 +239,7 @@ std::streambuf::int_type ByteArrayOStreambuf::overflow(std::streambuf::int_type c) { if (c != EOF) { - char z = c; + char z = static_cast(c); if (_buffer->write (&z, 1) != 1) { return EOF; } @@ -375,7 +375,7 @@ std::streambuf::int_type IODeviceOStreambuf::overflow(std::streambuf::int_type c) { if (c != EOF) { - char z = c; + char z = static_cast(c); if (device->write (&z, 1) != 1) { return EOF; } @@ -601,7 +601,7 @@ PyStreambuf::overflow(PyStreambuf::int_type ch) #ifdef PYSTREAM_BUFFERED sync(); if (ch != traits_type::eof()) { - *pptr() = ch; + *pptr() = static_cast(ch); pbump(1); return ch; } diff --git a/src/Base/Stream.h b/src/Base/Stream.h index 399a555a71..5ebba8999b 100644 --- a/src/Base/Stream.h +++ b/src/Base/Stream.h @@ -52,6 +52,8 @@ public: protected: Stream(); + Stream(const Stream&) = default; + Stream& operator=(const Stream&) = default; virtual ~Stream(); bool _swap; @@ -147,6 +149,10 @@ protected: std::ios_base::openmode which = std::ios::in | std::ios::out); +private: + ByteArrayOStreambuf(const ByteArrayOStreambuf&); + ByteArrayOStreambuf& operator=(const ByteArrayOStreambuf&); + private: QBuffer* _buffer; }; @@ -174,6 +180,9 @@ protected: virtual pos_type seekpos(std::streambuf::pos_type pos, std::ios_base::openmode which = std::ios::in | std::ios::out); +private: + ByteArrayIStreambuf(const ByteArrayIStreambuf&); + ByteArrayIStreambuf& operator=(const ByteArrayIStreambuf&); private: const QByteArray& _buffer; @@ -201,6 +210,10 @@ protected: virtual pos_type seekpos(std::streambuf::pos_type sp, std::ios_base::openmode which = std::ios::in | std::ios::out); +private: + IODeviceOStreambuf(const IODeviceOStreambuf&); + IODeviceOStreambuf& operator=(const IODeviceOStreambuf&); + protected: QIODevice* device; }; @@ -225,6 +238,9 @@ protected: virtual pos_type seekpos(std::streambuf::pos_type sp, std::ios_base::openmode which = std::ios::in | std::ios::out); +private: + IODeviceIStreambuf(const IODeviceIStreambuf&); + IODeviceIStreambuf& operator=(const IODeviceIStreambuf&); protected: QIODevice* device; @@ -270,6 +286,10 @@ private: bool flushBuffer(); bool writeStr(const char* s, std::streamsize num); +private: + PyStreambuf(const PyStreambuf&); + PyStreambuf& operator=(const PyStreambuf&); + private: PyObject* inp; Type type; @@ -296,6 +316,10 @@ protected: std::ios_base::openmode which = std::ios::in | std::ios::out); +private: + Streambuf(const Streambuf&); + Streambuf& operator=(const Streambuf&); + private: std::string::const_iterator _beg; std::string::const_iterator _end;