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

NULL->nullptr #1

Open
wants to merge 14 commits into
base: bt-trx
Choose a base branch
from
18 changes: 9 additions & 9 deletions src/Arduino.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "arduino-mock/Arduino.h"

static ArduinoMock* arduinoMock = NULL;
static ArduinoMock* arduinoMock = nullptr;
ArduinoMock* arduinoMockInstance() {
if(!arduinoMock) {
arduinoMock = new ArduinoMock();
Expand All @@ -11,29 +11,29 @@ ArduinoMock* arduinoMockInstance() {
void releaseArduinoMock() {
if(arduinoMock) {
delete arduinoMock;
arduinoMock = NULL;
arduinoMock = nullptr;
}
}

ArduinoMock::ArduinoMock() {
}

void pinMode(uint8_t a, uint8_t b) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
arduinoMock->pinMode(a, b);
}
void digitalWrite(uint8_t a, uint8_t b) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
arduinoMock->digitalWrite(a, b);
}

int digitalRead(uint8_t a) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
return arduinoMock->digitalRead(a);
}

int analogRead(uint8_t a) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
return arduinoMock->analogRead(a);
}

Expand All @@ -42,20 +42,20 @@ void analogReference(uint8_t mode) {
}

void analogWrite(uint8_t a, int b) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
arduinoMock->analogWrite(a, b);
}

unsigned long millis(void) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
return arduinoMock->millis();
}

unsigned long micros(void) {
return 0;
}
void delay(unsigned long a) {
assert (arduinoMock != NULL);
assert (arduinoMock != nullptr);
arduinoMock->delay(a);
}
void delayMicroseconds(unsigned int us) {
Expand Down
8 changes: 4 additions & 4 deletions src/EEPROM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "arduino-mock/EEPROM.h"

static EEPROMMock* p_EEPROMMock = NULL;
static EEPROMMock* p_EEPROMMock = nullptr;
EEPROMMock* EEPROMMockInstance() {
if (!p_EEPROMMock) {
p_EEPROMMock = new EEPROMMock();
Expand All @@ -11,20 +11,20 @@ EEPROMMock* EEPROMMockInstance() {
}

void releaseEEPROMMock() {
assert (p_EEPROMMock != NULL);
assert (p_EEPROMMock != nullptr);
if (p_EEPROMMock) {
delete p_EEPROMMock;
p_EEPROMMock = NULL;
}
}

uint8_t EEPROM_::read(int a) {
assert (p_EEPROMMock != NULL);
assert (p_EEPROMMock != nullptr);
return p_EEPROMMock->read(a);
}

void EEPROM_::write(int a, uint8_t b) {
assert (p_EEPROMMock != NULL);
assert (p_EEPROMMock != nullptr);
p_EEPROMMock->write(a, b);
}

Expand Down
12 changes: 6 additions & 6 deletions src/IRremote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define ERR 0
#define DECODED 1

static IRrecvMock* gIRrecvMock = NULL;
static IRrecvMock* gIRrecvMock = nullptr;
IRrecvMock* irrecvMockInstance() {
if(!gIRrecvMock) {
gIRrecvMock = new IRrecvMock();
Expand All @@ -15,7 +15,7 @@ IRrecvMock* irrecvMockInstance() {
void releaseIRrecvMock() {
if(gIRrecvMock) {
delete gIRrecvMock;
gIRrecvMock = NULL;
gIRrecvMock = nullptr;
}
}

Expand All @@ -37,20 +37,20 @@ IRrecv_::IRrecv_(int16_t recvpin) {
}

int16_t IRrecv_::decode(decode_results *results) {
assert (gIRrecvMock != NULL);
assert (gIRrecvMock != nullptr);
gIRrecvMock->decode(results);
assert (results != NULL);
assert (results != nullptr);
results->value = gIRrecvMock->getIRValue();
return DECODED;
}

void IRrecv_::enableIRIn() {
assert (gIRrecvMock != NULL);
assert (gIRrecvMock != nullptr);
gIRrecvMock->enableIRIn();
}

void IRrecv_::resume() {
assert (gIRrecvMock != NULL);
assert (gIRrecvMock != nullptr);
gIRrecvMock->resume();
}

Expand Down
4 changes: 2 additions & 2 deletions src/SPI.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "arduino-mock/SPI.h"

static SPIMock* p_SPIMock = NULL;
static SPIMock* p_SPIMock = nullptr;
SPIMock* SPIMockInstance() {
if (!p_SPIMock) {
p_SPIMock = new SPIMock();
Expand All @@ -11,7 +11,7 @@ SPIMock* SPIMockInstance() {
void releaseSPIMock() {
if (p_SPIMock) {
delete p_SPIMock;
p_SPIMock = NULL;
p_SPIMock = nullptr;
}
}

Expand Down
56 changes: 28 additions & 28 deletions src/Serial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "arduino-mock/Serial.h"

static SerialMock* gSerialMock = NULL;
static SerialMock* gSerialMock = nullptr;
SerialMock* serialMockInstance() {
if(!gSerialMock) {
gSerialMock = new SerialMock();
Expand All @@ -13,7 +13,7 @@ SerialMock* serialMockInstance() {
void releaseSerialMock() {
if(gSerialMock) {
delete gSerialMock;
gSerialMock = NULL;
gSerialMock = nullptr;
}
}

Expand Down Expand Up @@ -61,7 +61,7 @@ size_t Stream::print(const char *s) {
std::cout << s;
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(s);
}

Expand All @@ -70,7 +70,7 @@ size_t Stream::print(char c) {
std::cout << c;
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(c);
}

Expand All @@ -79,7 +79,7 @@ size_t Stream::print(unsigned char c, int base) {
printBase(c, base);
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(c, base);
}

Expand All @@ -88,7 +88,7 @@ size_t Stream::print(int num, int base) {
printBase(num, base);
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(num, base);
}

Expand All @@ -97,7 +97,7 @@ size_t Stream::print(unsigned int num, int base) {
printBase(num, base);
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(num, base);
}

Expand All @@ -106,7 +106,7 @@ size_t Stream::print(long num, int base) {
printBase(num, base);
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(num, base);
}

Expand All @@ -115,7 +115,7 @@ size_t Stream::print(unsigned long num, int base) {
printBase(num, base);
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(num, base);
}

Expand All @@ -124,7 +124,7 @@ size_t Stream::print(double num, int digits) {
printDouble(num, digits);
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->print(num, digits);
}

Expand All @@ -133,7 +133,7 @@ size_t Stream::println(const char *s) {
std::cout << s << std::endl;
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(s);
}

Expand All @@ -142,37 +142,37 @@ size_t Stream::println(char c) {
std::cout << c << std::endl;
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(c);
}

size_t Stream::println(unsigned char c, int base) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(c, base);
}

size_t Stream::println(int num, int base) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(num, base);
}

size_t Stream::println(unsigned int num, int base) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(num, base);
}

size_t Stream::println(long num, int base) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(num, base);
}

size_t Stream::println(unsigned long num, int base) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(num, base);
}

size_t Stream::println(double num, int digits) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println(num, digits);
}

Expand All @@ -181,52 +181,52 @@ size_t Stream::println(void) {
std::cout << std::endl;
return 0;
}
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->println();
}

size_t Stream::write(uint8_t val) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->write(val);
}

size_t Stream::write(const char *str) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->write(str);
}

size_t Stream::write(const uint8_t *buffer, size_t size) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->write(buffer, size);
}

uint8_t Stream::begin(uint32_t port) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->begin(port);
}

void Stream::flush() {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->flush();
}

uint8_t Stream::available() {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->available();
}

uint8_t Stream::read() {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->read();
}

uint8_t Stream::readBytesUntil(char delimiter, char* buffer, int length) {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->readBytesUntil(delimiter, buffer, length);
}

Stream::operator bool() {
assert (gSerialMock != NULL);
assert (gSerialMock != nullptr);
return gSerialMock->BoolOp();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Spark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "arduino-mock/Spark.h"

static SparkMock* gSparkMock = NULL;
static SparkMock* gSparkMock = nullptr;
SparkMock* sparkMockInstance() {
if(!gSparkMock) {
gSparkMock = new SparkMock();
Expand All @@ -13,7 +13,7 @@ SparkMock* sparkMockInstance() {
void releaseSparkMock() {
if(gSparkMock) {
delete gSparkMock;
gSparkMock = NULL;
gSparkMock = nullptr;
}
}

Expand Down
Loading