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
@@ -48,7 +48,7 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxSendMessage(
|
||||
if (dataBuffer) {
|
||||
std::ostringstream str;
|
||||
str << std::setfill('0') << std::hex;
|
||||
for (int i = 0; i < dataSize; i++) {
|
||||
for (int32_t i = 0; i < dataSize; i++) {
|
||||
str << std::setw(2) << (int)dataBuffer[i] << ' ';
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ Java_edu_wpi_first_wpilibj_can_CANJNI_FRCNetCommCANSessionMuxReceiveMessage(
|
||||
if (logDEBUG <= canJNILogLevel) {
|
||||
std::ostringstream str;
|
||||
str << std::setfill('0') << std::hex;
|
||||
for (int i = 0; i < dataSize; i++) {
|
||||
for (int32_t i = 0; i < dataSize; i++) {
|
||||
str << std::setw(2) << (int)buffer[i] << ' ';
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ void ReportError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange
|
||||
}
|
||||
}
|
||||
|
||||
void ReportCANError(JNIEnv *env, int32_t status, int message_id) {
|
||||
void ReportCANError(JNIEnv *env, int32_t status, int32_t message_id) {
|
||||
if (status >= 0) return;
|
||||
switch (status) {
|
||||
case kRioStatusSuccess:
|
||||
|
||||
@@ -30,9 +30,9 @@ inline bool CheckStatusRange(JNIEnv *env, int32_t status, int32_t minRange,
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
void ReportCANError(JNIEnv *env, int32_t status, int message_id);
|
||||
void ReportCANError(JNIEnv *env, int32_t status, int32_t message_id);
|
||||
|
||||
inline bool CheckCANStatus(JNIEnv *env, int32_t status, int message_id) {
|
||||
inline bool CheckCANStatus(JNIEnv *env, int32_t status, int32_t message_id) {
|
||||
if (status != 0) ReportCANError(env, status, message_id);
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrupts(
|
||||
* Method: waitForInterrupt
|
||||
* Signature: (JD)V
|
||||
*/
|
||||
JNIEXPORT int JNICALL
|
||||
JNIEXPORT int32_t JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt(
|
||||
JNIEnv* env, jclass, jint interruptHandle, jdouble timeout,
|
||||
jboolean ignorePrevious) {
|
||||
@@ -170,8 +170,8 @@ Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt(
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
int result = HAL_WaitForInterrupt((HAL_InterruptHandle)interruptHandle, timeout,
|
||||
ignorePrevious, &status);
|
||||
int32_t result = HAL_WaitForInterrupt((HAL_InterruptHandle)interruptHandle,
|
||||
timeout, ignorePrevious, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults6V(
|
||||
JNIEnv* env, jclass) {
|
||||
int32_t status = 0;
|
||||
int val = HAL_GetUserCurrentFaults6V(&status);
|
||||
int32_t val = HAL_GetUserCurrentFaults6V(&status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults5V(
|
||||
JNIEnv* env, jclass) {
|
||||
int32_t status = 0;
|
||||
int val = HAL_GetUserCurrentFaults5V(&status);
|
||||
int32_t val = HAL_GetUserCurrentFaults5V(&status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_PowerJNI_getUserCurrentFaults3V3(
|
||||
JNIEnv* env, jclass) {
|
||||
int32_t status = 0;
|
||||
int val = HAL_GetUserCurrentFaults3V3(&status);
|
||||
int32_t val = HAL_GetUserCurrentFaults3V3(&status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user