Skip to content

Commit f0778e4

Browse files
committed
Cleanup (Windows)
1 parent b74f240 commit f0778e4

File tree

13 files changed

+7
-432
lines changed

13 files changed

+7
-432
lines changed

java-does-usb/jextract/windows/gen_win.cmd

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ call %JEXTRACT% --source --output ../../src/main/java ^
1212
--include-function GetModuleHandleW ^
1313
--include-function FormatMessageW ^
1414
--include-function LocalFree ^
15-
--include-constant ERROR_SUCCESS ^
1615
--include-constant ERROR_NO_MORE_ITEMS ^
1716
--include-constant ERROR_MORE_DATA ^
1817
--include-constant ERROR_INSUFFICIENT_BUFFER ^
1918
--include-constant ERROR_FILE_NOT_FOUND ^
20-
--include-constant ERROR_SEM_TIMEOUT ^
2119
--include-constant ERROR_GEN_FAILURE ^
2220
--include-constant ERROR_NOT_FOUND ^
2321
--include-constant ERROR_IO_PENDING ^
@@ -65,13 +63,6 @@ call %JEXTRACT% --source --output ../../src/main/java ^
6563
--include-constant DIREG_DEV ^
6664
windows_headers.h
6765

68-
call %JEXTRACT% --source --output ../../src/main/java ^
69-
-D _AMD64_ -D _M_AMD64=100 -D UNICODE -D _UNICODE ^
70-
--header-class-name StdLib ^
71-
--target-package net.codecrete.usb.windows.gen.stdlib ^
72-
--include-function wcslen ^
73-
windows_headers.h
74-
7566
call %JEXTRACT% --source --output ../../src/main/java ^
7667
-D _AMD64_ -D _M_AMD64=100 -D UNICODE -D _UNICODE ^
7768
-I "%SDK_DIR%\um" ^

java-does-usb/jextract/windows/windows_headers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <windows.h>
22
#include <setupapi.h>
3-
#include <string.h>
43
#include <usbioctl.h>
54
#include <winusb.h>
65
#include <dbt.h>

java-does-usb/src/main/java/net/codecrete/usb/linux/USBDevFS.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@
1212
*/
1313
public class USBDevFS {
1414

15-
public static final long CONTROL = 0xc0185500L;
16-
public static final long BULK = 0xc0185502L;
1715
public static final long CLAIMINTERFACE = 0x8004550FL;
1816
public static final long RELEASEINTERFACE = 0x80045510L;
1917
public static final long SETINTERFACE = 0x80085504L;
2018
public static final long CLEAR_HALT = 0x80045515L;
2119
public static final long SUBMITURB = 0x8038550AL;
2220
public static final long DISCARDURB = 0x550BL;
23-
public static final long REAPURB = 0x4008550CL;
2421
public static final long REAPURBNDELAY = 0x4008550DL;
25-
public static final long RESETEP = 0x80045503L;
2622

2723
}

java-does-usb/src/main/java/net/codecrete/usb/windows/Win.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package net.codecrete.usb.windows;
99

1010
import net.codecrete.usb.windows.gen.kernel32.GUID;
11-
import net.codecrete.usb.windows.gen.stdlib.StdLib;
1211

1312
import java.lang.foreign.*;
1413
import java.lang.invoke.VarHandle;
@@ -85,8 +84,12 @@ public static MemorySegment createSegmentFromString(String str, Arena arena) {
8584
* @return copied string
8685
*/
8786
public static String createStringFromSegment(MemorySegment segment) {
88-
long strLen = StdLib.wcslen(segment);
89-
return new String(segment.asSlice(0, 2L * strLen).toArray(JAVA_CHAR));
87+
int len = 0;
88+
while (segment.get(JAVA_CHAR, len) != 0) {
89+
len += 2;
90+
}
91+
92+
return new String(segment.asSlice(0, len).toArray(JAVA_CHAR));
9093
}
9194

9295
/**

java-does-usb/src/main/java/net/codecrete/usb/windows/gen/kernel32/Kernel32.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,6 @@ public static int GENERIC_WRITE() {
176176
public static int INFINITE() {
177177
return (int)4294967295L;
178178
}
179-
/**
180-
* {@snippet :
181-
* #define ERROR_SUCCESS 0
182-
* }
183-
*/
184-
public static int ERROR_SUCCESS() {
185-
return (int)0L;
186-
}
187179
/**
188180
* {@snippet :
189181
* #define ERROR_FILE_NOT_FOUND 2
@@ -200,14 +192,6 @@ public static int ERROR_FILE_NOT_FOUND() {
200192
public static int ERROR_GEN_FAILURE() {
201193
return (int)31L;
202194
}
203-
/**
204-
* {@snippet :
205-
* #define ERROR_SEM_TIMEOUT 121
206-
* }
207-
*/
208-
public static int ERROR_SEM_TIMEOUT() {
209-
return (int)121L;
210-
}
211195
/**
212196
* {@snippet :
213197
* #define ERROR_INSUFFICIENT_BUFFER 122

java-does-usb/src/main/java/net/codecrete/usb/windows/gen/kernel32/constants$1.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

java-does-usb/src/main/java/net/codecrete/usb/windows/gen/stdlib/Constants$root.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

java-does-usb/src/main/java/net/codecrete/usb/windows/gen/stdlib/RuntimeHelper.java

Lines changed: 0 additions & 217 deletions
This file was deleted.

0 commit comments

Comments
 (0)