mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Cleaned up integer type usage in wpilibc (#92)
Replaced all unsigned types to signed and int32_t with int in wpilibc
This commit is contained in:
committed by
Peter Johnson
parent
ff93050b31
commit
0cd05d1a42
@@ -28,7 +28,7 @@ class ErrorBase;
|
||||
*/
|
||||
class Error {
|
||||
public:
|
||||
typedef int32_t Code;
|
||||
typedef int Code;
|
||||
|
||||
Error() = default;
|
||||
|
||||
@@ -40,12 +40,12 @@ class Error {
|
||||
std::string GetMessage() const;
|
||||
std::string GetFilename() const;
|
||||
std::string GetFunction() const;
|
||||
uint32_t GetLineNumber() const;
|
||||
int GetLineNumber() const;
|
||||
const ErrorBase* GetOriginatingObject() const;
|
||||
double GetTimestamp() const;
|
||||
void Clear();
|
||||
void Set(Code code, llvm::StringRef contextMessage, llvm::StringRef filename,
|
||||
llvm::StringRef function, uint32_t lineNumber,
|
||||
llvm::StringRef function, int lineNumber,
|
||||
const ErrorBase* originatingObject);
|
||||
|
||||
private:
|
||||
@@ -55,7 +55,7 @@ class Error {
|
||||
std::string m_message;
|
||||
std::string m_filename;
|
||||
std::string m_function;
|
||||
uint32_t m_lineNumber = 0;
|
||||
int m_lineNumber = 0;
|
||||
const ErrorBase* m_originatingObject = nullptr;
|
||||
double m_timestamp = 0.0;
|
||||
};
|
||||
|
||||
@@ -81,32 +81,32 @@ class ErrorBase {
|
||||
virtual const Error& GetError() const;
|
||||
virtual void SetErrnoError(llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const;
|
||||
int lineNumber) const;
|
||||
virtual void SetImaqError(int success, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const;
|
||||
int lineNumber) const;
|
||||
virtual void SetError(Error::Code code, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const;
|
||||
int lineNumber) const;
|
||||
virtual void SetErrorRange(Error::Code code, int32_t minRange,
|
||||
int32_t maxRange, int32_t requestedValue,
|
||||
llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const;
|
||||
int lineNumber) const;
|
||||
virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code,
|
||||
llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const;
|
||||
int lineNumber) const;
|
||||
virtual void CloneError(const ErrorBase& rhs) const;
|
||||
virtual void ClearError() const;
|
||||
virtual bool StatusIsFatal() const;
|
||||
static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber);
|
||||
int lineNumber);
|
||||
static void SetGlobalWPIError(llvm::StringRef errorMessage,
|
||||
llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename,
|
||||
llvm::StringRef function, uint32_t lineNumber);
|
||||
llvm::StringRef function, int lineNumber);
|
||||
static Error& GetGlobalError();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -84,7 +84,7 @@ class LinearDigitalFilter : public Filter {
|
||||
static LinearDigitalFilter HighPass(std::shared_ptr<PIDSource> source,
|
||||
double timeConstant, double period);
|
||||
static LinearDigitalFilter MovingAverage(std::shared_ptr<PIDSource> source,
|
||||
unsigned int taps);
|
||||
int taps);
|
||||
|
||||
// Filter interface
|
||||
double Get() const override;
|
||||
|
||||
@@ -23,12 +23,12 @@ class GenericHID {
|
||||
virtual float GetZ() const = 0;
|
||||
virtual float GetTwist() const = 0;
|
||||
virtual float GetThrottle() const = 0;
|
||||
virtual float GetRawAxis(uint32_t axis) const = 0;
|
||||
virtual float GetRawAxis(int axis) const = 0;
|
||||
|
||||
virtual bool GetTrigger(JoystickHand hand = kRightHand) const = 0;
|
||||
virtual bool GetTop(JoystickHand hand = kRightHand) const = 0;
|
||||
virtual bool GetBumper(JoystickHand hand = kRightHand) const = 0;
|
||||
virtual bool GetRawButton(uint32_t button) const = 0;
|
||||
virtual bool GetRawButton(int button) const = 0;
|
||||
|
||||
virtual int GetPOV(uint32_t pov = 0) const = 0;
|
||||
virtual int GetPOV(int pov = 0) const = 0;
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ class PIDController : public LiveWindowSendable,
|
||||
virtual void SetTolerance(float percent);
|
||||
virtual void SetAbsoluteTolerance(float absValue);
|
||||
virtual void SetPercentTolerance(float percentValue);
|
||||
virtual void SetToleranceBuffer(unsigned buf = 1);
|
||||
virtual void SetToleranceBuffer(int buf = 1);
|
||||
virtual bool OnTarget() const;
|
||||
|
||||
void Enable() override;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
class Task : public ErrorBase {
|
||||
public:
|
||||
static const uint32_t kDefaultPriority = 60;
|
||||
static const int kDefaultPriority = 60;
|
||||
|
||||
Task() = default;
|
||||
Task(const Task&) = delete;
|
||||
@@ -38,9 +38,9 @@ class Task : public ErrorBase {
|
||||
|
||||
bool Verify();
|
||||
|
||||
int32_t GetPriority();
|
||||
int GetPriority();
|
||||
|
||||
bool SetPriority(int32_t priority);
|
||||
bool SetPriority(int priority);
|
||||
|
||||
std::string GetName() const;
|
||||
|
||||
|
||||
@@ -32,21 +32,21 @@
|
||||
__FUNCTION__)
|
||||
|
||||
bool wpi_assert_impl(bool conditionValue, const char* conditionText,
|
||||
const char* message, const char* fileName,
|
||||
uint32_t lineNumber, const char* funcName);
|
||||
const char* message, const char* fileName, int lineNumber,
|
||||
const char* funcName);
|
||||
bool wpi_assertEqual_impl(int valueA, int valueB, const char* valueAString,
|
||||
const char* valueBString, const char* message,
|
||||
const char* fileName, uint32_t lineNumber,
|
||||
const char* fileName, int lineNumber,
|
||||
const char* funcName);
|
||||
bool wpi_assertNotEqual_impl(int valueA, int valueB, const char* valueAString,
|
||||
const char* valueBString, const char* message,
|
||||
const char* fileName, uint32_t lineNumber,
|
||||
const char* fileName, int lineNumber,
|
||||
const char* funcName);
|
||||
|
||||
void wpi_suspendOnAssertEnabled(bool enabled);
|
||||
|
||||
int32_t GetFPGAVersion();
|
||||
int GetFPGAVersion();
|
||||
int64_t GetFPGARevision();
|
||||
uint64_t GetFPGATime();
|
||||
bool GetUserButton();
|
||||
std::string GetStackTrace(uint32_t offset);
|
||||
std::string GetStackTrace(int offset);
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#ifdef WPI_ERRORS_DEFINE_STRINGS
|
||||
#define S(label, offset, message) \
|
||||
const char* wpi_error_s_##label = message; \
|
||||
const int32_t wpi_error_value_##label = offset
|
||||
const int wpi_error_value_##label = offset
|
||||
#else
|
||||
#define S(label, offset, message) \
|
||||
extern const char* wpi_error_s_##label; \
|
||||
const int32_t wpi_error_value_##label = offset
|
||||
const int wpi_error_value_##label = offset
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user