mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-19 09:57:49 +00:00
8029362: [Parfait] warnings from b117 for jdk.src.share.native.com.sun.media.sound: JNI exception pending
Reviewed-by: pchelko, azvegint
This commit is contained in:
parent
eb2ad0bddf
commit
87514d9f0e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
// for malloc
|
||||
#ifdef _ALLBSD_SOURCE
|
||||
#include <stdlib.h>
|
||||
@ -603,6 +604,7 @@ JNIEXPORT jint JNICALL Java_com_sun_media_sound_DirectAudioDevice_nWrite
|
||||
if (len == 0) return 0;
|
||||
if (info && info->handle) {
|
||||
data = (UINT8*) ((*env)->GetByteArrayElements(env, jData, &didCopy));
|
||||
CHECK_NULL_RETURN(data, ret);
|
||||
dataOffset = data;
|
||||
dataOffset += (int) offset;
|
||||
convertedData = dataOffset;
|
||||
@ -671,6 +673,7 @@ JNIEXPORT jint JNICALL Java_com_sun_media_sound_DirectAudioDevice_nRead
|
||||
}
|
||||
if (info && info->handle) {
|
||||
data = (char*) ((*env)->GetByteArrayElements(env, jData, NULL));
|
||||
CHECK_NULL_RETURN(data, ret);
|
||||
dataOffset = data;
|
||||
dataOffset += (int) offset;
|
||||
ret = DAUDIO_Read(info->handle, dataOffset, (int) len);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include "SoundDefs.h"
|
||||
#include "DirectAudio.h"
|
||||
#include "Utilities.h"
|
||||
@ -70,6 +71,11 @@ JNIEXPORT jobject JNICALL Java_com_sun_media_sound_DirectAudioDeviceProvider_nNe
|
||||
jmethodID directAudioDeviceInfoConstructor;
|
||||
DirectAudioDeviceDescription desc;
|
||||
jobject info = NULL;
|
||||
jstring name;
|
||||
jstring vendor;
|
||||
jstring description;
|
||||
jstring version;
|
||||
|
||||
TRACE1("Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo(%d).\n", mixerIndex);
|
||||
|
||||
// retrieve class and constructor of DirectAudioDeviceProvider.DirectAudioDeviceInfo
|
||||
@ -89,14 +95,18 @@ JNIEXPORT jobject JNICALL Java_com_sun_media_sound_DirectAudioDeviceProvider_nNe
|
||||
|
||||
if (getDirectAudioDeviceDescription(mixerIndex, &desc)) {
|
||||
// create a new DirectAudioDeviceInfo object and return it
|
||||
info = (*env)->NewObject(env, directAudioDeviceInfoClass, directAudioDeviceInfoConstructor,
|
||||
mixerIndex,
|
||||
desc.deviceID,
|
||||
desc.maxSimulLines,
|
||||
(*env)->NewStringUTF(env, desc.name),
|
||||
(*env)->NewStringUTF(env, desc.vendor),
|
||||
(*env)->NewStringUTF(env, desc.description),
|
||||
(*env)->NewStringUTF(env, desc.version));
|
||||
name = (*env)->NewStringUTF(env, desc.name);
|
||||
CHECK_NULL_RETURN(name, info);
|
||||
vendor = (*env)->NewStringUTF(env, desc.vendor);
|
||||
CHECK_NULL_RETURN(vendor, info);
|
||||
description = (*env)->NewStringUTF(env, desc.description);
|
||||
CHECK_NULL_RETURN(description, info);
|
||||
version = (*env)->NewStringUTF(env, desc.version);
|
||||
CHECK_NULL_RETURN(version, info);
|
||||
info = (*env)->NewObject(env, directAudioDeviceInfoClass,
|
||||
directAudioDeviceInfoConstructor, mixerIndex,
|
||||
desc.deviceID, desc.maxSimulLines,
|
||||
name, vendor, description, version);
|
||||
} else {
|
||||
ERROR1("ERROR: getDirectAudioDeviceDescription(%d, desc) returned FALSE!\n", mixerIndex);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include "SoundDefs.h"
|
||||
#include "Ports.h"
|
||||
#include "Utilities.h"
|
||||
@ -170,6 +171,7 @@ typedef struct tag_ControlCreatorJNI {
|
||||
void* PORT_NewBooleanControl(void* creatorV, void* controlID, char* type) {
|
||||
ControlCreatorJNI* creator = (ControlCreatorJNI*) creatorV;
|
||||
jobject ctrl = NULL;
|
||||
jstring typeString;
|
||||
|
||||
#ifdef USE_TRACE
|
||||
if (((UINT_PTR) type) <= CONTROL_TYPE_MAX) {
|
||||
@ -199,8 +201,11 @@ void* PORT_NewBooleanControl(void* creatorV, void* controlID, char* type) {
|
||||
type = "Select";
|
||||
}
|
||||
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->boolCtrlClass, creator->boolCtrlConstructor,
|
||||
(jlong) (UINT_PTR) controlID, (*creator->env)->NewStringUTF(creator->env, type));
|
||||
typeString = (*creator->env)->NewStringUTF(creator->env, type);
|
||||
CHECK_NULL_RETURN(typeString, (void*) ctrl);
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->boolCtrlClass,
|
||||
creator->boolCtrlConstructor,
|
||||
(jlong) (UINT_PTR) controlID, typeString);
|
||||
if (!ctrl) {
|
||||
ERROR0("PORT_NewBooleanControl: ctrl is NULL\n");
|
||||
}
|
||||
@ -216,6 +221,7 @@ void* PORT_NewCompoundControl(void* creatorV, char* type, void** controls, int c
|
||||
jobject ctrl = NULL;
|
||||
jobjectArray controlArray;
|
||||
int i;
|
||||
jstring typeString;
|
||||
|
||||
TRACE2("PORT_NewCompoundControl: creating '%s' with %d controls\n", type, controlCount);
|
||||
if (!creator->compCtrlClass) {
|
||||
@ -250,8 +256,11 @@ void* PORT_NewCompoundControl(void* creatorV, char* type, void** controls, int c
|
||||
(*creator->env)->SetObjectArrayElement(creator->env, controlArray, i, (jobject) controls[i]);
|
||||
}
|
||||
TRACE0("PORT_NewCompoundControl: creating compound control\n");
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->compCtrlClass, creator->compCtrlConstructor,
|
||||
(*creator->env)->NewStringUTF(creator->env, type), controlArray);
|
||||
typeString = (*creator->env)->NewStringUTF(creator->env, type);
|
||||
CHECK_NULL_RETURN(typeString, (void*) ctrl);
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->compCtrlClass,
|
||||
creator->compCtrlConstructor,
|
||||
typeString, controlArray);
|
||||
if (!ctrl) {
|
||||
ERROR0("PORT_NewCompoundControl: ctrl is NULL\n");
|
||||
}
|
||||
@ -266,6 +275,8 @@ void* PORT_NewFloatControl(void* creatorV, void* controlID, char* type,
|
||||
float min, float max, float precision, char* units) {
|
||||
ControlCreatorJNI* creator = (ControlCreatorJNI*) creatorV;
|
||||
jobject ctrl = NULL;
|
||||
jstring unitsString;
|
||||
jstring typeString;
|
||||
|
||||
#ifdef USE_TRACE
|
||||
if (((UINT_PTR) type) <= CONTROL_TYPE_MAX) {
|
||||
@ -294,18 +305,24 @@ void* PORT_NewFloatControl(void* creatorV, void* controlID, char* type,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
unitsString = (*creator->env)->NewStringUTF(creator->env, units);
|
||||
CHECK_NULL_RETURN(unitsString, (void*) ctrl);
|
||||
if (((UINT_PTR) type) <= CONTROL_TYPE_MAX) {
|
||||
// constructor with int parameter
|
||||
TRACE1("PORT_NewFloatControl: calling constructor2 with type %d\n", (int) (UINT_PTR) type);
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->floatCtrlClass, creator->floatCtrlConstructor2,
|
||||
(jlong) (UINT_PTR) controlID, (jint) (UINT_PTR) type,
|
||||
min, max, precision, (*creator->env)->NewStringUTF(creator->env, units));
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->floatCtrlClass,
|
||||
creator->floatCtrlConstructor2,
|
||||
(jlong) (UINT_PTR) controlID, (jint) (UINT_PTR) type,
|
||||
min, max, precision, unitsString);
|
||||
} else {
|
||||
TRACE0("PORT_NewFloatControl: calling constructor1\n");
|
||||
// constructor with string parameter
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->floatCtrlClass, creator->floatCtrlConstructor1,
|
||||
(jlong) (UINT_PTR) controlID, (*creator->env)->NewStringUTF(creator->env, type),
|
||||
min, max, precision, (*creator->env)->NewStringUTF(creator->env, units));
|
||||
typeString = (*creator->env)->NewStringUTF(creator->env, type);
|
||||
CHECK_NULL_RETURN(typeString, (void*) ctrl);
|
||||
ctrl = (*creator->env)->NewObject(creator->env, creator->floatCtrlClass,
|
||||
creator->floatCtrlConstructor1,
|
||||
(jlong) (UINT_PTR) controlID, typeString,
|
||||
min, max, precision, unitsString);
|
||||
}
|
||||
if (!ctrl) {
|
||||
ERROR0("PORT_NewFloatControl: ctrl is NULL!\n");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
#include "SoundDefs.h"
|
||||
#include "Ports.h"
|
||||
#include "Utilities.h"
|
||||
@ -65,6 +66,11 @@ JNIEXPORT jobject JNICALL Java_com_sun_media_sound_PortMixerProvider_nNewPortMix
|
||||
jmethodID portMixerInfoConstructor;
|
||||
PortMixerDescription desc;
|
||||
jobject info = NULL;
|
||||
jstring name;
|
||||
jstring vendor;
|
||||
jstring description;
|
||||
jstring version;
|
||||
|
||||
TRACE1("Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo(%d).\n", mixerIndex);
|
||||
|
||||
// retrieve class and constructor of PortMixerProvider.PortMixerInfo
|
||||
@ -82,11 +88,17 @@ JNIEXPORT jobject JNICALL Java_com_sun_media_sound_PortMixerProvider_nNewPortMix
|
||||
|
||||
if (getPortMixerDescription(mixerIndex, &desc)) {
|
||||
// create a new PortMixerInfo object and return it
|
||||
info = (*env)->NewObject(env, portMixerInfoClass, portMixerInfoConstructor, mixerIndex,
|
||||
(*env)->NewStringUTF(env, desc.name),
|
||||
(*env)->NewStringUTF(env, desc.vendor),
|
||||
(*env)->NewStringUTF(env, desc.description),
|
||||
(*env)->NewStringUTF(env, desc.version));
|
||||
name = (*env)->NewStringUTF(env, desc.name);
|
||||
CHECK_NULL_RETURN(name, info);
|
||||
vendor = (*env)->NewStringUTF(env, desc.vendor);
|
||||
CHECK_NULL_RETURN(vendor, info);
|
||||
description = (*env)->NewStringUTF(env, desc.description);
|
||||
CHECK_NULL_RETURN(description, info);
|
||||
version = (*env)->NewStringUTF(env, desc.version);
|
||||
CHECK_NULL_RETURN(version, info);
|
||||
info = (*env)->NewObject(env, portMixerInfoClass,
|
||||
portMixerInfoConstructor, mixerIndex,
|
||||
name, vendor, description, version);
|
||||
}
|
||||
|
||||
TRACE0("Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo succeeded.\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user