mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +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
@@ -232,7 +232,7 @@ void Scheduler::UpdateTable() {
|
||||
if (!toCancel.empty()) {
|
||||
for (commandIter = m_commands.begin(); commandIter != m_commands.end();
|
||||
++commandIter) {
|
||||
for (unsigned i = 0; i < toCancel.size(); i++) {
|
||||
for (size_t i = 0; i < toCancel.size(); i++) {
|
||||
Command* c = *commandIter;
|
||||
if (c->GetID() == toCancel[i]) {
|
||||
c->Cancel();
|
||||
|
||||
@@ -31,7 +31,7 @@ std::string Error::GetFilename() const { return m_filename; }
|
||||
|
||||
std::string Error::GetFunction() const { return m_function; }
|
||||
|
||||
uint32_t Error::GetLineNumber() const { return m_lineNumber; }
|
||||
int Error::GetLineNumber() const { return m_lineNumber; }
|
||||
|
||||
const ErrorBase* Error::GetOriginatingObject() const {
|
||||
return m_originatingObject;
|
||||
@@ -41,7 +41,7 @@ double Error::GetTimestamp() const { return m_timestamp; }
|
||||
|
||||
void Error::Set(Code code, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber, const ErrorBase* originatingObject) {
|
||||
int lineNumber, const ErrorBase* originatingObject) {
|
||||
bool report = true;
|
||||
|
||||
if (code == m_code && GetTime() - m_timestamp < 1) {
|
||||
|
||||
@@ -41,8 +41,7 @@ void ErrorBase::ClearError() const { m_error.Clear(); }
|
||||
*/
|
||||
void ErrorBase::SetErrnoError(llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename,
|
||||
llvm::StringRef function,
|
||||
uint32_t lineNumber) const {
|
||||
llvm::StringRef function, int lineNumber) const {
|
||||
std::string err;
|
||||
int errNo = errno;
|
||||
if (errNo == 0) {
|
||||
@@ -77,7 +76,7 @@ void ErrorBase::SetErrnoError(llvm::StringRef contextMessage,
|
||||
*/
|
||||
void ErrorBase::SetImaqError(int success, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const {
|
||||
int lineNumber) const {
|
||||
// If there was an error
|
||||
if (success <= 0) {
|
||||
std::stringstream err;
|
||||
@@ -105,7 +104,7 @@ void ErrorBase::SetImaqError(int success, llvm::StringRef contextMessage,
|
||||
*/
|
||||
void ErrorBase::SetError(Error::Code code, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const {
|
||||
int lineNumber) const {
|
||||
// If there was an error
|
||||
if (code != 0) {
|
||||
// Set the current error information for this object.
|
||||
@@ -136,8 +135,7 @@ void ErrorBase::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 {
|
||||
llvm::StringRef function, int lineNumber) const {
|
||||
// If there was an error
|
||||
if (code != 0) {
|
||||
size_t size = contextMessage.size() + 100;
|
||||
@@ -169,7 +167,7 @@ void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange,
|
||||
void ErrorBase::SetWPIError(llvm::StringRef errorMessage, Error::Code code,
|
||||
llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
uint32_t lineNumber) const {
|
||||
int lineNumber) const {
|
||||
std::string err = errorMessage.str() + ": " + contextMessage.str();
|
||||
|
||||
// Set the current error information for this object.
|
||||
@@ -195,7 +193,7 @@ bool ErrorBase::StatusIsFatal() const { return m_error.GetCode() < 0; }
|
||||
|
||||
void ErrorBase::SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename,
|
||||
llvm::StringRef function, uint32_t lineNumber) {
|
||||
llvm::StringRef function, int lineNumber) {
|
||||
// If there was an error
|
||||
if (code != 0) {
|
||||
std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
|
||||
@@ -209,8 +207,7 @@ void ErrorBase::SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
|
||||
void ErrorBase::SetGlobalWPIError(llvm::StringRef errorMessage,
|
||||
llvm::StringRef contextMessage,
|
||||
llvm::StringRef filename,
|
||||
llvm::StringRef function,
|
||||
uint32_t lineNumber) {
|
||||
llvm::StringRef function, int lineNumber) {
|
||||
std::string err = errorMessage.str() + ": " + contextMessage.str();
|
||||
|
||||
std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
|
||||
|
||||
@@ -119,7 +119,7 @@ LinearDigitalFilter LinearDigitalFilter::HighPass(
|
||||
* slower
|
||||
*/
|
||||
LinearDigitalFilter LinearDigitalFilter::MovingAverage(
|
||||
std::shared_ptr<PIDSource> source, unsigned int taps) {
|
||||
std::shared_ptr<PIDSource> source, int taps) {
|
||||
assert(taps > 0);
|
||||
|
||||
std::vector<double> gains(taps, 1.0 / taps);
|
||||
@@ -130,10 +130,10 @@ double LinearDigitalFilter::Get() const {
|
||||
double retVal = 0.0;
|
||||
|
||||
// Calculate the new value
|
||||
for (unsigned int i = 0; i < m_inputGains.size(); i++) {
|
||||
for (size_t i = 0; i < m_inputGains.size(); i++) {
|
||||
retVal += m_inputs[i] * m_inputGains[i];
|
||||
}
|
||||
for (unsigned int i = 0; i < m_outputGains.size(); i++) {
|
||||
for (size_t i = 0; i < m_outputGains.size(); i++) {
|
||||
retVal -= m_outputs[i] * m_outputGains[i];
|
||||
}
|
||||
|
||||
@@ -157,10 +157,10 @@ double LinearDigitalFilter::PIDGet() {
|
||||
m_inputs.PushFront(PIDGetSource());
|
||||
|
||||
// Calculate the new value
|
||||
for (unsigned int i = 0; i < m_inputGains.size(); i++) {
|
||||
for (size_t i = 0; i < m_inputGains.size(); i++) {
|
||||
retVal += m_inputs[i] * m_inputGains[i];
|
||||
}
|
||||
for (unsigned int i = 0; i < m_outputGains.size(); i++) {
|
||||
for (size_t i = 0; i < m_outputGains.size(); i++) {
|
||||
retVal -= m_outputs[i] * m_outputGains[i];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user