mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Fixed some warnings printed during wpilibC++Sim build
Change-Id: I11eea8a577af7c37c61978edd721ca16e4e41748
This commit is contained in:
committed by
Brad Miller (WPI)
parent
771b5807f4
commit
a7feaddd6b
@@ -56,7 +56,7 @@ uint32_t Resource::Allocate(const std::string &resourceDesc) {
|
||||
}
|
||||
}
|
||||
wpi_setWPIErrorWithContext(NoAvailableResources, resourceDesc);
|
||||
return ~0ul;
|
||||
return std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,11 +69,11 @@ uint32_t Resource::Allocate(uint32_t index, const std::string &resourceDesc) {
|
||||
std::unique_lock<priority_recursive_mutex> sync(m_allocateLock);
|
||||
if (index >= m_isAllocated.size()) {
|
||||
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, resourceDesc);
|
||||
return ~0ul;
|
||||
return std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
if (m_isAllocated[index]) {
|
||||
wpi_setWPIErrorWithContext(ResourceAlreadyAllocated, resourceDesc);
|
||||
return ~0ul;
|
||||
return std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
m_isAllocated[index] = true;
|
||||
return index;
|
||||
@@ -88,7 +88,7 @@ uint32_t Resource::Allocate(uint32_t index, const std::string &resourceDesc) {
|
||||
*/
|
||||
void Resource::Free(uint32_t index) {
|
||||
std::unique_lock<priority_recursive_mutex> sync(m_allocateLock);
|
||||
if (index == ~0ul) return;
|
||||
if (index == std::numeric_limits<uint32_t>::max()) return;
|
||||
if (index >= m_isAllocated.size()) {
|
||||
wpi_setWPIError(NotAllocated);
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,8 @@ AnalogInput::AnalogInput(uint32_t channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inputs->Allocate(channel, buf.str()) == ~0ul) {
|
||||
if (inputs->Allocate(channel, buf.str()) ==
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*inputs);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ AnalogOutput::AnalogOutput(uint32_t channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (outputs->Allocate(channel, buf.str()) == ~0ul) {
|
||||
if (outputs->Allocate(channel, buf.str()) ==
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*outputs);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ void AnalogTrigger::SetFiltered(bool useFilteredValue) {
|
||||
* @return The index of the analog trigger.
|
||||
*/
|
||||
uint32_t AnalogTrigger::GetIndex() const {
|
||||
if (StatusIsFatal()) return ~0ul;
|
||||
if (StatusIsFatal()) return std::numeric_limits<uint32_t>::max();
|
||||
return m_index;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,8 @@ CANJaguar::CANJaguar(uint8_t deviceNumber)
|
||||
buf << "CANJaguar device number " << m_deviceNumber;
|
||||
Resource::CreateResourceObject(allocated, 63);
|
||||
|
||||
if (allocated->Allocate(m_deviceNumber - 1, buf.str()) == ~0ul) {
|
||||
if (allocated->Allocate(m_deviceNumber - 1, buf.str()) ==
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*allocated);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ DigitalOutput::DigitalOutput(uint32_t channel) {
|
||||
return;
|
||||
}
|
||||
m_channel = channel;
|
||||
m_pwmGenerator = (void *)~0ul;
|
||||
m_pwmGenerator = (void *)std::numeric_limits<uint32_t>::max();
|
||||
|
||||
int32_t status = 0;
|
||||
allocateDIO(m_digital_ports[channel], false, &status);
|
||||
@@ -128,7 +128,7 @@ void DigitalOutput::SetPWMRate(float rate) {
|
||||
* @param initialDutyCycle The duty-cycle to start generating. [0..1]
|
||||
*/
|
||||
void DigitalOutput::EnablePWM(float initialDutyCycle) {
|
||||
if (m_pwmGenerator != (void *)~0ul) return;
|
||||
if (m_pwmGenerator != (void *)std::numeric_limits<uint32_t>::max()) return;
|
||||
|
||||
int32_t status = 0;
|
||||
|
||||
@@ -152,7 +152,7 @@ void DigitalOutput::EnablePWM(float initialDutyCycle) {
|
||||
*/
|
||||
void DigitalOutput::DisablePWM() {
|
||||
if (StatusIsFatal()) return;
|
||||
if (m_pwmGenerator == (void *)~0ul) return;
|
||||
if (m_pwmGenerator == (void *)std::numeric_limits<uint32_t>::max()) return;
|
||||
|
||||
int32_t status = 0;
|
||||
|
||||
@@ -163,7 +163,7 @@ void DigitalOutput::DisablePWM() {
|
||||
freePWM(m_pwmGenerator, &status);
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
|
||||
m_pwmGenerator = (void *)~0ul;
|
||||
m_pwmGenerator = (void *)std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ DoubleSolenoid::DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
|
||||
<< ")";
|
||||
if (m_allocated->Allocate(
|
||||
m_moduleNumber * kSolenoidChannels + m_forwardChannel, buf.str()) ==
|
||||
~0ul) {
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*m_allocated);
|
||||
return;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ DoubleSolenoid::DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
|
||||
<< ")";
|
||||
if (m_allocated->Allocate(
|
||||
m_moduleNumber * kSolenoidChannels + m_reverseChannel, buf.str()) ==
|
||||
~0ul) {
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*m_allocated);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ void InterruptableSensorBase::RequestInterrupts(
|
||||
InterruptHandlerFunction handler, void *param) {
|
||||
if (StatusIsFatal()) return;
|
||||
uint32_t index = m_interrupts->Allocate("Async Interrupt");
|
||||
if (index == ~0ul) {
|
||||
if (index == std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*m_interrupts);
|
||||
return;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ void InterruptableSensorBase::RequestInterrupts(
|
||||
void InterruptableSensorBase::RequestInterrupts() {
|
||||
if (StatusIsFatal()) return;
|
||||
uint32_t index = m_interrupts->Allocate("Sync Interrupt");
|
||||
if (index == ~0ul) {
|
||||
if (index == std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*m_interrupts);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ Relay::Relay(uint32_t channel, Relay::Direction direction)
|
||||
|
||||
if (m_direction == kBothDirections || m_direction == kForwardOnly) {
|
||||
buf << "Forward Relay " << m_channel;
|
||||
if (relayChannels->Allocate(m_channel * 2, buf.str()) == ~0ul) {
|
||||
if (relayChannels->Allocate(m_channel * 2, buf.str()) ==
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*relayChannels);
|
||||
return;
|
||||
}
|
||||
@@ -49,7 +50,8 @@ Relay::Relay(uint32_t channel, Relay::Direction direction)
|
||||
}
|
||||
if (m_direction == kBothDirections || m_direction == kReverseOnly) {
|
||||
buf << "Reverse Relay " << m_channel;
|
||||
if (relayChannels->Allocate(m_channel * 2 + 1, buf.str()) == ~0ul) {
|
||||
if (relayChannels->Allocate(m_channel * 2 + 1, buf.str()) ==
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*relayChannels);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ Solenoid::Solenoid(uint8_t moduleNumber, uint32_t channel)
|
||||
|
||||
buf << "Solenoid " << m_channel << " (Module: " << m_moduleNumber << ")";
|
||||
if (m_allocated->Allocate(m_moduleNumber * kSolenoidChannels + m_channel,
|
||||
buf.str()) == ~0ul) {
|
||||
buf.str()) ==
|
||||
std::numeric_limits<uint32_t>::max()) {
|
||||
CloneError(*m_allocated);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user