mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Replaced C-style casts found by GCC in HAL, wpilibc, and JNI (#211)
This commit is contained in:
committed by
Peter Johnson
parent
2ec6132fcb
commit
93b486b6ba
@@ -71,7 +71,7 @@ THandle DigitalHandleResource<THandle, TStruct, size>::Allocate(
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
m_structures[index] = std::make_shared<TStruct>();
|
||||
return (THandle)hal::createHandle(index, enumValue);
|
||||
return static_cast<THandle>(hal::createHandle(index, enumValue));
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size>
|
||||
|
||||
@@ -51,7 +51,7 @@ static inline int16_t getHandleIndex(HAL_Handle handle) {
|
||||
}
|
||||
static inline HAL_HandleEnum getHandleType(HAL_Handle handle) {
|
||||
// mask first 8 bits and cast to enum
|
||||
return (HAL_HandleEnum)((handle >> 24) & 0xff);
|
||||
return static_cast<HAL_HandleEnum>((handle >> 24) & 0xff);
|
||||
}
|
||||
static inline bool isHandleType(HAL_Handle handle, HAL_HandleEnum handleType) {
|
||||
return handleType == getHandleType(handle);
|
||||
|
||||
@@ -75,7 +75,7 @@ THandle IndexedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
m_structures[index] = std::make_shared<TStruct>();
|
||||
return (THandle)hal::createHandle(index, enumValue);
|
||||
return static_cast<THandle>(hal::createHandle(index, enumValue));
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
|
||||
@@ -73,7 +73,7 @@ LimitedClassedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
|
||||
// and allocate it.
|
||||
std::lock_guard<priority_mutex> sync(m_handleMutexes[i]);
|
||||
m_structures[i] = toSet;
|
||||
return (THandle)createHandle(i, enumValue);
|
||||
return static_cast<THandle>(createHandle(i, enumValue));
|
||||
}
|
||||
}
|
||||
return HAL_kInvalidHandle;
|
||||
|
||||
@@ -69,7 +69,7 @@ THandle LimitedHandleResource<THandle, TStruct, size, enumValue>::Allocate() {
|
||||
// and allocate it.
|
||||
std::lock_guard<priority_mutex> sync(m_handleMutexes[i]);
|
||||
m_structures[i] = std::make_shared<TStruct>();
|
||||
return (THandle)createHandle(i, enumValue);
|
||||
return static_cast<THandle>(createHandle(i, enumValue));
|
||||
}
|
||||
}
|
||||
return HAL_kInvalidHandle;
|
||||
|
||||
@@ -57,13 +57,13 @@ THandle UnlimitedHandleResource<THandle, TStruct, enumValue>::Allocate(
|
||||
for (i = 0; i < m_structures.size(); i++) {
|
||||
if (m_structures[i] == nullptr) {
|
||||
m_structures[i] = structure;
|
||||
return (THandle)createHandle(i, enumValue);
|
||||
return static_cast<THandle>(createHandle(i, enumValue));
|
||||
}
|
||||
}
|
||||
if (i >= INT16_MAX) return HAL_kInvalidHandle;
|
||||
|
||||
m_structures.push_back(structure);
|
||||
return (THandle)createHandle(static_cast<int16_t>(i), enumValue);
|
||||
return static_cast<THandle>(createHandle(static_cast<int16_t>(i), enumValue));
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, HAL_HandleEnum enumValue>
|
||||
|
||||
Reference in New Issue
Block a user