Skip to content

Commit

Permalink
cppcheck fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lexus2k committed Feb 19, 2024
1 parent 14ba930 commit f990c5c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/TinyProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace tinyproto
class Proto
{
public:
Proto(bool multithread = false);
explicit Proto(bool multithread = false);

~Proto();

Expand Down Expand Up @@ -132,7 +132,7 @@ class Proto
class SerialFdProto: public Proto
{
public:
SerialFdProto(HardwareSerial &port);
explicit SerialFdProto(HardwareSerial &port);

ArduinoSerialFdLink &getLink();

Expand All @@ -143,7 +143,7 @@ class SerialFdProto: public Proto
class SerialHdlcProto: public Proto
{
public:
SerialHdlcProto(HardwareSerial &port);
explicit SerialHdlcProto(HardwareSerial &port);

ArduinoSerialHdlcLink &getLink();

Expand All @@ -156,7 +156,7 @@ class SerialHdlcProto: public Proto
class SerialFdProto: public Proto
{
public:
SerialFdProto(char *dev, bool multithread = false);
explicit SerialFdProto(char *dev, bool multithread = false);

SerialFdLink &getLink();

Expand All @@ -167,7 +167,7 @@ class SerialFdProto: public Proto
class SerialHdlcProto: public Proto
{
public:
SerialHdlcProto(char *dev, bool multithread = false);
explicit SerialHdlcProto(char *dev, bool multithread = false);

SerialHdlcLink &getLink();

Expand Down
8 changes: 4 additions & 4 deletions src/link/TinySerialFdLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ namespace tinyproto
template <int MTU, int TX_WINDOW, int BUFFER_SIZE, int BLOCK> class StaticSerialFdLink: public ISerialLinkLayer<IFdLinkLayer, BLOCK>
{
public:
StaticSerialFdLink(char *dev)
explicit StaticSerialFdLink(char *dev)
: ISerialLinkLayer<IFdLinkLayer, BLOCK>(dev, this->m_buffer, BUFFER_SIZE)
{
this->setMtu(MTU);
this->setWindow(TX_WINDOW);
}

private:
uint8_t m_buffer[BUFFER_SIZE];
uint8_t m_buffer[BUFFER_SIZE] = {};
};


Expand All @@ -52,7 +52,7 @@ template <int MTU, int TX_WINDOW, int RX_WINDOW, int BLOCK> using ArduinoStaticS
class ArduinoSerialFdLink: public ArduinoStaticSerialFdLinkLayer<32, 2, 2, 4>
{
public:
ArduinoSerialFdLink(HardwareSerial *dev)
explicit ArduinoSerialFdLink(HardwareSerial *dev)
: ArduinoStaticSerialFdLinkLayer<32, 2, 2, 4>(reinterpret_cast<char *>(dev))
{
}
Expand All @@ -63,7 +63,7 @@ class ArduinoSerialFdLink: public ArduinoStaticSerialFdLinkLayer<32, 2, 2, 4>
class SerialFdLink: public ISerialLinkLayer<IFdLinkLayer, 32>
{
public:
SerialFdLink(char *dev)
explicit SerialFdLink(char *dev)
: ISerialLinkLayer<IFdLinkLayer, 32>(dev, nullptr, 0)
{
}
Expand Down
8 changes: 4 additions & 4 deletions src/link/TinySerialHdlcLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ namespace tinyproto
template <int MTU, int BUFFER_SIZE, int BLOCK> class StaticSerialHdlcLink: public ISerialLinkLayer<IHdlcLinkLayer, BLOCK>
{
public:
StaticSerialHdlcLink(char *dev)
explicit StaticSerialHdlcLink(char *dev)
: ISerialLinkLayer<IHdlcLinkLayer, BLOCK>(dev, this->m_buffer, BUFFER_SIZE)
{
this->setMtu(MTU);
}

private:
uint8_t m_buffer[BUFFER_SIZE];
uint8_t m_buffer[BUFFER_SIZE] = {};
};


Expand All @@ -51,7 +51,7 @@ template <int MTU, int RX_WINDOW, int BLOCK> using ArduinoStaticSerialHdlcLinkLa
class ArduinoSerialHdlcLink: public ArduinoStaticSerialHdlcLinkLayer<32, 2, 4>
{
public:
ArduinoSerialHdlcLink(HardwareSerial *dev)
explicit ArduinoSerialHdlcLink(HardwareSerial *dev)
: ArduinoStaticSerialHdlcLinkLayer<32, 2, 4>(reinterpret_cast<char *>(dev))
{
}
Expand All @@ -62,7 +62,7 @@ class ArduinoSerialHdlcLink: public ArduinoStaticSerialHdlcLinkLayer<32, 2, 4>
class SerialHdlcLink: public ISerialLinkLayer<IHdlcLinkLayer, 32>
{
public:
SerialHdlcLink(char *dev)
explicit SerialHdlcLink(char *dev)
: ISerialLinkLayer<IHdlcLinkLayer, 32>(dev, nullptr, 0)
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/proto/fd/tiny_fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ static uint8_t *tiny_fd_get_next_i_frame(tiny_fd_handle_t handle, int *len, uint

static uint8_t *tiny_fd_get_next_frame_to_send(tiny_fd_handle_t handle, int *len, uint8_t peer)
{
uint8_t *data = NULL;
uint8_t *data;
// Tx data available
tiny_mutex_lock(&handle->frames.mutex);
const uint8_t address = __peer_to_address_field( handle, peer );
Expand Down
2 changes: 2 additions & 0 deletions tinyproto.cppcheck
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
</libraries>
<suppressions>
<suppression>purgedConfiguration</suppression>
<suppression>nullPointerArithmeticRedundantCheck</suppression>
<suppression>ctuOneDefinitionRuleViolation</suppression>
</suppressions>
</project>

0 comments on commit f990c5c

Please sign in to comment.