mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
fix window jni unhappy compiler (#9635)
This commit is contained in:
parent
993ff5fd81
commit
64b0f173c8
2 changed files with 11 additions and 9 deletions
|
@ -47,7 +47,7 @@ inline void MetricTransform(JNIEnv *env, jstring j_name, jstring j_description,
|
|||
// item when it already exists.
|
||||
std::transform(tag_key_str_list.begin(), tag_key_str_list.end(),
|
||||
std::back_inserter(tag_keys),
|
||||
[](std::string tag_key) { return TagKeyType::Register(tag_key); });
|
||||
[](std::string &tag_key) { return TagKeyType::Register(tag_key); });
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -70,7 +70,7 @@ JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerGaugeNat
|
|||
MetricTransform(env, j_name, j_description, j_unit, tag_key_list, &metric_name,
|
||||
&description, &unit, tag_keys);
|
||||
auto *gauge = new ray::stats::Gauge(metric_name, description, unit, tag_keys);
|
||||
return reinterpret_cast<long>(gauge);
|
||||
return reinterpret_cast<jlong>(gauge);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerCountNative(
|
||||
|
@ -83,7 +83,7 @@ JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerCountNat
|
|||
MetricTransform(env, j_name, j_description, j_unit, tag_key_list, &metric_name,
|
||||
&description, &unit, tag_keys);
|
||||
auto *count = new ray::stats::Count(metric_name, description, unit, tag_keys);
|
||||
return reinterpret_cast<long>(count);
|
||||
return reinterpret_cast<jlong>(count);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerSumNative(
|
||||
|
@ -96,7 +96,7 @@ JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerSumNativ
|
|||
MetricTransform(env, j_name, j_description, j_unit, tag_key_list, &metric_name,
|
||||
&description, &unit, tag_keys);
|
||||
auto *sum = new ray::stats::Sum(metric_name, description, unit, tag_keys);
|
||||
return reinterpret_cast<long>(sum);
|
||||
return reinterpret_cast<jlong>(sum);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerHistogramNative(
|
||||
|
@ -114,7 +114,7 @@ JNIEXPORT jlong JNICALL Java_io_ray_runtime_metric_NativeMetric_registerHistogra
|
|||
|
||||
auto *histogram =
|
||||
new ray::stats::Histogram(metric_name, description, unit, boundaries, tag_keys);
|
||||
return reinterpret_cast<long>(histogram);
|
||||
return reinterpret_cast<jlong>(histogram);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_io_ray_runtime_metric_NativeMetric_unregisterMetricNative(
|
||||
|
|
|
@ -289,8 +289,9 @@ inline void JavaLongArrayToNativeLongVector(JNIEnv *env, jlongArray long_array,
|
|||
std::vector<long> *native_vector) {
|
||||
jlong *long_array_ptr = env->GetLongArrayElements(long_array, nullptr);
|
||||
jsize vec_size = env->GetArrayLength(long_array);
|
||||
native_vector->insert(native_vector->begin(), long_array_ptr,
|
||||
long_array_ptr + vec_size);
|
||||
for (int i = 0; i < vec_size; ++i) {
|
||||
native_vector->push_back(static_cast<long>(long_array_ptr[i]));
|
||||
}
|
||||
env->ReleaseLongArrayElements(long_array, long_array_ptr, 0);
|
||||
}
|
||||
|
||||
|
@ -299,8 +300,9 @@ inline void JavaDoubleArrayToNativeDoubleVector(JNIEnv *env, jdoubleArray double
|
|||
std::vector<double> *native_vector) {
|
||||
jdouble *double_array_ptr = env->GetDoubleArrayElements(double_array, nullptr);
|
||||
jsize vec_size = env->GetArrayLength(double_array);
|
||||
native_vector->insert(native_vector->begin(), double_array_ptr,
|
||||
double_array_ptr + vec_size);
|
||||
for (int i = 0; i < vec_size; ++i) {
|
||||
native_vector->push_back(static_cast<double>(double_array_ptr[i]));
|
||||
}
|
||||
env->ReleaseDoubleArrayElements(double_array, double_array_ptr, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue