mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-07 06:01:35 +03:00
Use direct member initialization instead of ctr initialisation (#7558)
* Use direct member initialization instead of ctr initialisation This removes a bit of code repetition. * Add symbolic names for member initializers
This commit is contained in:
@ -35,17 +35,15 @@
|
||||
|
||||
class Print {
|
||||
private:
|
||||
int write_error;
|
||||
int write_error = 0;
|
||||
template<typename T> size_t printNumber(T n, uint8_t base);
|
||||
template<typename T, typename... P> inline size_t _println(T v, P... args);
|
||||
protected:
|
||||
protected:
|
||||
void setWriteError(int err = 1) {
|
||||
write_error = err;
|
||||
}
|
||||
public:
|
||||
Print() :
|
||||
write_error(0) {
|
||||
}
|
||||
Print() {}
|
||||
|
||||
int getWriteError() {
|
||||
return write_error;
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
class Stream: public Print {
|
||||
protected:
|
||||
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
|
||||
unsigned long _timeout = 1000; // number of milliseconds to wait for the next char before aborting timed read
|
||||
unsigned long _startMillis; // used for timeout measurement
|
||||
int timedRead(); // private method to read stream with timeout
|
||||
int timedPeek(); // private method to peek stream with timeout
|
||||
@ -48,9 +48,7 @@ class Stream: public Print {
|
||||
virtual int read() = 0;
|
||||
virtual int peek() = 0;
|
||||
|
||||
Stream() {
|
||||
_timeout = 1000;
|
||||
}
|
||||
Stream() {}
|
||||
|
||||
// parsing methods
|
||||
|
||||
|
@ -27,18 +27,6 @@ extern "C" uint32_t _FS_start;
|
||||
extern "C" uint32_t _FS_end;
|
||||
|
||||
UpdaterClass::UpdaterClass()
|
||||
: _async(false)
|
||||
, _error(0)
|
||||
, _buffer(0)
|
||||
, _bufferLen(0)
|
||||
, _size(0)
|
||||
, _startAddress(0)
|
||||
, _currentAddress(0)
|
||||
, _command(U_FLASH)
|
||||
, _ledPin(-1)
|
||||
, _hash(nullptr)
|
||||
, _verify(nullptr)
|
||||
, _progress_callback(nullptr)
|
||||
{
|
||||
#if ARDUINO_SIGNING
|
||||
installSignature(&esp8266::updaterSigningHash, &esp8266::updaterSigningVerifier);
|
||||
|
@ -182,27 +182,27 @@ class UpdaterClass {
|
||||
|
||||
void _setError(int error);
|
||||
|
||||
bool _async;
|
||||
uint8_t _error;
|
||||
uint8_t *_buffer;
|
||||
size_t _bufferLen; // amount of data written into _buffer
|
||||
size_t _bufferSize; // total size of _buffer
|
||||
size_t _size;
|
||||
uint32_t _startAddress;
|
||||
uint32_t _currentAddress;
|
||||
uint32_t _command;
|
||||
bool _async = false;
|
||||
uint8_t _error = 0;
|
||||
uint8_t *_buffer = nullptr;
|
||||
size_t _bufferLen = 0; // amount of data written into _buffer
|
||||
size_t _bufferSize = 0; // total size of _buffer
|
||||
size_t _size = 0;
|
||||
uint32_t _startAddress = 0;
|
||||
uint32_t _currentAddress = 0;
|
||||
uint32_t _command = U_FLASH;
|
||||
|
||||
String _target_md5;
|
||||
MD5Builder _md5;
|
||||
|
||||
int _ledPin;
|
||||
int _ledPin = -1;
|
||||
uint8_t _ledOn;
|
||||
|
||||
// Optional signed binary verification
|
||||
UpdaterHashClass *_hash;
|
||||
UpdaterVerifyClass *_verify;
|
||||
UpdaterHashClass *_hash = nullptr;
|
||||
UpdaterVerifyClass *_verify = nullptr;
|
||||
// Optional progress callback function
|
||||
THandlerFunction_Progress _progress_callback;
|
||||
THandlerFunction_Progress _progress_callback = nullptr;
|
||||
};
|
||||
|
||||
extern UpdaterClass Update;
|
||||
|
Reference in New Issue
Block a user