Fixed current and potential bugs caught by Coverity

Change-Id: I9f9d09dc797ffea062eeb49c881be1d5acb63d7b
This commit is contained in:
Tyler Veness
2015-11-15 14:49:50 -08:00
committed by Peter Johnson
parent b0fec4089b
commit 055ee09825
34 changed files with 105 additions and 65 deletions

View File

@@ -53,7 +53,6 @@ class AnalogAccelerometer : public SensorBase,
std::shared_ptr<AnalogInput> m_analogInput;
float m_voltsPerG = 1.0;
float m_zeroGVoltage = 2.5;
bool m_allocatedChannel;
std::shared_ptr<ITable> m_table;
};

View File

@@ -11,6 +11,7 @@
#include "SensorBase.h"
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
#include <cstdint>
/**
* MXP analog output class.

View File

@@ -87,5 +87,4 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
std::shared_ptr<AnalogInput> m_analog_input;
double m_fullRange, m_offset;
std::shared_ptr<ITable> m_table;
bool m_init_analog_input;
};

View File

@@ -177,7 +177,7 @@ class CANJaguar : public MotorSafety,
float m_value = 0.0f;
// Parameters/configuration
ControlMode m_controlMode;
ControlMode m_controlMode = kPercentVbus;
uint8_t m_speedReference = LM_REF_NONE;
uint8_t m_positionReference = LM_REF_NONE;
double m_p = 0.0;
@@ -227,7 +227,7 @@ class CANJaguar : public MotorSafety,
mutable std::atomic<bool> m_receivedStatusMessage1{false};
mutable std::atomic<bool> m_receivedStatusMessage2{false};
bool m_controlEnabled;
bool m_controlEnabled = false;
void verify();

View File

@@ -10,6 +10,7 @@
#include "LiveWindow/LiveWindowSendable.h"
#include <memory>
#include <cstdint>
/**
* Class to read a digital input.

View File

@@ -45,7 +45,7 @@ class InterruptableSensorBase : public SensorBase {
protected:
void *m_interrupt = nullptr;
uint32_t m_interruptIndex;
uint32_t m_interruptIndex = std::numeric_limits<uint32_t>::max();
void AllocateInterrupts(bool watcher);
static std::unique_ptr<Resource> m_interrupts;

View File

@@ -49,9 +49,9 @@ class SPI : public SensorBase {
protected:
uint8_t m_port;
bool m_msbFirst;
bool m_sampleOnTrailing;
bool m_clk_idle_high;
bool m_msbFirst = false; // default little-endian
bool m_sampleOnTrailing = false; // default data updated on falling edge
bool m_clk_idle_high = false; // default clock active high
private:
void Init();

View File

@@ -101,8 +101,7 @@ class Ultrasonic : public SensorBase,
std::shared_ptr<DigitalOutput> m_pingChannel;
std::shared_ptr<DigitalInput> m_echoChannel;
bool m_allocatedChannels;
bool m_enabled;
bool m_enabled = false;
Counter m_counter;
Ultrasonic *m_nextSensor;
DistanceUnit m_units;