mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Replaced STL streams with LLVM's raw_ostream (#344)
std::cout and std::printf were replaced with llvm::outs() and std::cerr was replaced with llvm::errs().
This commit is contained in:
committed by
Peter Johnson
parent
c57a7f0a41
commit
9d93820717
@@ -11,6 +11,7 @@
|
||||
#include <errno.h>
|
||||
#include <jni.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
@@ -21,6 +22,7 @@
|
||||
#include "HAL/cpp/Log.h"
|
||||
#include "edu_wpi_first_wpilibj_hal_HALUtil.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/raw_ostream.h"
|
||||
#include "support/jni_util.h"
|
||||
|
||||
using namespace wpi::java;
|
||||
@@ -56,7 +58,7 @@ static JClass pwmConfigDataResultCls;
|
||||
|
||||
namespace frc {
|
||||
|
||||
void ThrowAllocationException(JNIEnv *env, int32_t minRange, int32_t maxRange,
|
||||
void ThrowAllocationException(JNIEnv *env, int32_t minRange, int32_t maxRange,
|
||||
int32_t requestedValue, int32_t status) {
|
||||
const char *message = HAL_GetErrorMessage(status);
|
||||
llvm::SmallString<1024> buf;
|
||||
@@ -76,7 +78,7 @@ void ThrowHalHandleException(JNIEnv *env, int32_t status) {
|
||||
halHandleExCls.Throw(env, buf.c_str());
|
||||
}
|
||||
|
||||
constexpr const char wpilibjPrefix[] = "edu.wpi.first.wpilibj";
|
||||
constexpr const char wpilibjPrefix[] = "edu.wpi.first.wpilibj";
|
||||
|
||||
void ReportError(JNIEnv *env, int32_t status, bool do_throw) {
|
||||
if (status == 0) return;
|
||||
@@ -96,11 +98,11 @@ void ReportError(JNIEnv *env, int32_t status, bool do_throw) {
|
||||
}
|
||||
}
|
||||
|
||||
void ThrowError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange,
|
||||
void ThrowError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange,
|
||||
int32_t requestedValue) {
|
||||
if (status == 0) return;
|
||||
if (status == NO_AVAILABLE_RESOURCES ||
|
||||
status == RESOURCE_IS_ALLOCATED ||
|
||||
if (status == NO_AVAILABLE_RESOURCES ||
|
||||
status == RESOURCE_IS_ALLOCATED ||
|
||||
status == RESOURCE_OUT_OF_RANGE) {
|
||||
ThrowAllocationException(env, minRange, maxRange, requestedValue, status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user