From 0c3f73c2b408699cf371e2a26210a4d5132268ef Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 21 Jan 2020 01:47:58 -0500 Subject: [PATCH] code style --- firmware/console/binary/tunerstudio.cpp | 2 +- firmware/console/binary/tunerstudio_io.cpp | 4 ++-- firmware/controllers/core/fsio_core.cpp | 10 +++++----- firmware/controllers/sensors/thermistors.cpp | 2 +- .../controllers/system/timer/pwm_generator_logic.cpp | 2 +- .../controllers/trigger/decoders/trigger_structure.cpp | 2 +- firmware/development/logic_analyzer.cpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 85ca0fdf9d..94d07d1b1d 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -294,7 +294,7 @@ static void handleGetStructContent(ts_channel_s *tsChannel, int structId, int si tsState.readPageCommandsCounter++; const void *addr = getStructAddr(structId); - if (addr == NULL) { + if (addr == nullptr) { // todo: add warning code - unexpected structId return; } diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 1b765bbd2e..1c2c44a54f 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -176,7 +176,7 @@ void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size) { int transferred = size; uartSendTimeout(TS_UART_DEVICE, (size_t *)&transferred, buffer, BINARY_IO_TIMEOUT); #else - if (tsChannel->channel == NULL) + if (tsChannel->channel == nullptr) return; // int transferred = chnWriteTimeout(tsChannel->channel, buffer, size, BINARY_IO_TIMEOUT); @@ -214,7 +214,7 @@ int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int uartReceiveTimeout(TS_UART_DEVICE, &received, buffer, timeout); return (int)received; #else /* TS_UART_DMA_MODE */ - if (tsChannel->channel == NULL) + if (tsChannel->channel == nullptr) return 0; return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, timeout); #endif /* TS_UART_DMA_MODE */ diff --git a/firmware/controllers/core/fsio_core.cpp b/firmware/controllers/core/fsio_core.cpp index ea25442204..7cdd6145bf 100644 --- a/firmware/controllers/core/fsio_core.cpp +++ b/firmware/controllers/core/fsio_core.cpp @@ -103,7 +103,7 @@ void LECalculator::reset(LEElement *element) { } void LECalculator::add(LEElement *element) { - if (first == NULL) { + if (first == nullptr) { first = element; } else { LEElement *last = first; @@ -411,7 +411,7 @@ LEElement *LEElementPool::parseExpression(const char * line) { while (true) { line = getNextToken(line, parsingBuffer, sizeof(parsingBuffer)); - if (line == NULL) { + if (line == nullptr) { /** * No more tokens in this line */ @@ -419,7 +419,7 @@ LEElement *LEElementPool::parseExpression(const char * line) { } LEElement *n = next(); - if (n == NULL) { + if (n == nullptr) { return first; } @@ -432,12 +432,12 @@ LEElement *LEElementPool::parseExpression(const char * line) { * Cannot recognize token */ warning(CUSTOM_ERR_PARSING_ERROR, "unrecognized [%s]", parsingBuffer); - return NULL; + return nullptr; } n->init(action); } - if (first == NULL) { + if (first == nullptr) { first = n; last = n; } else { diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp index 39ae81f9d6..e4268acb98 100644 --- a/firmware/controllers/sensors/thermistors.cpp +++ b/firmware/controllers/sensors/thermistors.cpp @@ -259,7 +259,7 @@ void set10K_4050K(ThermistorConf *thermistorConf, float pullup) { #if EFI_PROD_CODE static void testCltByR(float resistance) { - if (logger == NULL) { + if (logger == nullptr) { firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized"); return; } diff --git a/firmware/controllers/system/timer/pwm_generator_logic.cpp b/firmware/controllers/system/timer/pwm_generator_logic.cpp index 55125c22e4..0208e8bb9e 100644 --- a/firmware/controllers/system/timer/pwm_generator_logic.cpp +++ b/firmware/controllers/system/timer/pwm_generator_logic.cpp @@ -257,7 +257,7 @@ static void timerCallback(PwmConfig *state) { // we are here when PWM gets stopped return; } - if (state->executor == NULL) { + if (state->executor == nullptr) { firmwareError(CUSTOM_NULL_EXECUTOR, "exec on %s", state->name); return; } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index f6d259edc2..23c9d259ef 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -241,7 +241,7 @@ void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex for (int i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) { SingleChannelStateSequence *wave = &this->wave.channels[i]; - if (wave->pinStates == NULL) { + if (wave->pinStates == nullptr) { warning(CUSTOM_ERR_STATE_NULL, "wave pinStates is NULL"); setShapeDefinitionError(true); return; diff --git a/firmware/development/logic_analyzer.cpp b/firmware/development/logic_analyzer.cpp index 5b9b251779..bcb9e4cc36 100644 --- a/firmware/development/logic_analyzer.cpp +++ b/firmware/development/logic_analyzer.cpp @@ -161,7 +161,7 @@ static float getSignalPeriodMs(int index) { } static void reportWave(Logging *logging, int index) { - if (readers[index].hw == NULL) { + if (readers[index].hw == nullptr) { return; } if (readers[index].hw->started) {