Skip to content

Commit 2771c1a

Browse files
committed
Address review: use HANDLEByReference and UNICODE_OPTIONS
1 parent da652b6 commit 2771c1a

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

contrib/platform/src/com/sun/jna/platform/win32/BluetoothApis.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import com.sun.jna.Union;
3030
import com.sun.jna.platform.win32.WinBase.SYSTEMTIME;
3131
import com.sun.jna.platform.win32.WinNT.HANDLE;
32-
import com.sun.jna.ptr.PointerByReference;
32+
import com.sun.jna.platform.win32.WinNT.HANDLEByReference;
3333
import com.sun.jna.win32.StdCallLibrary;
3434
import com.sun.jna.win32.W32APIOptions;
3535

@@ -41,7 +41,7 @@
4141
public interface BluetoothApis extends StdCallLibrary {
4242

4343
/** Instance of BluetoothApis. */
44-
BluetoothApis INSTANCE = Native.load("BluetoothApis", BluetoothApis.class, W32APIOptions.DEFAULT_OPTIONS);
44+
BluetoothApis INSTANCE = Native.load("BluetoothApis", BluetoothApis.class, W32APIOptions.UNICODE_OPTIONS);
4545

4646
/** Maximum Bluetooth device name length. */
4747
int BLUETOOTH_MAX_NAME_SIZE = 248;
@@ -202,7 +202,7 @@ public BLUETOOTH_RADIO_INFO() {
202202
* @see <a href=
203203
* "https://learn.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothfindfirstradio">BluetoothFindFirstRadio</a>
204204
*/
205-
HANDLE BluetoothFindFirstRadio(BLUETOOTH_FIND_RADIO_PARAMS pbtfrp, PointerByReference phRadio);
205+
HANDLE BluetoothFindFirstRadio(BLUETOOTH_FIND_RADIO_PARAMS pbtfrp, HANDLEByReference phRadio);
206206

207207
/**
208208
* Finds the next installed Bluetooth radio.
@@ -213,7 +213,7 @@ public BLUETOOTH_RADIO_INFO() {
213213
* @see <a href=
214214
* "https://learn.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothfindnextradio">BluetoothFindNextRadio</a>
215215
*/
216-
boolean BluetoothFindNextRadio(HANDLE hFind, PointerByReference phRadio);
216+
boolean BluetoothFindNextRadio(HANDLE hFind, HANDLEByReference phRadio);
217217

218218
/**
219219
* Closes the enumeration handle for Bluetooth radios.

contrib/platform/test/com/sun/jna/platform/win32/BluetoothApisTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import com.sun.jna.platform.win32.BluetoothApis.BLUETOOTH_FIND_RADIO_PARAMS;
3434
import com.sun.jna.platform.win32.BluetoothApis.BLUETOOTH_RADIO_INFO;
3535
import com.sun.jna.platform.win32.WinNT.HANDLE;
36-
import com.sun.jna.ptr.PointerByReference;
36+
import com.sun.jna.platform.win32.WinNT.HANDLEByReference;
3737

3838
/**
3939
* Tests for {@link BluetoothApis}.
@@ -58,13 +58,13 @@ public void testStructureSizes() {
5858
@Test
5959
public void testBluetoothFindFirstRadio() {
6060
BLUETOOTH_FIND_RADIO_PARAMS radioParams = new BLUETOOTH_FIND_RADIO_PARAMS();
61-
PointerByReference phRadio = new PointerByReference();
61+
HANDLEByReference phRadio = new HANDLEByReference();
6262

6363
// This may return null if no Bluetooth radio is present, which is acceptable
6464
HANDLE hFind = BluetoothApis.INSTANCE.BluetoothFindFirstRadio(radioParams, phRadio);
6565
if (hFind != null) {
6666
try {
67-
HANDLE hRadio = new HANDLE(phRadio.getValue());
67+
HANDLE hRadio = phRadio.getValue();
6868
try {
6969
assertNotNull("Radio handle should not be null", hRadio);
7070

0 commit comments

Comments
 (0)