Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

File subsystem - working better with both new and old prim_file versions. #58

Merged
merged 2 commits into from

2 participants

This page is out of date. Refresh to see the latest.
View
16 src/main/java/erjang/driver/efile/EFile.java
@@ -434,9 +434,16 @@ public EFile(EString command, Driver driver) {
* @throws Pausable
*/
public void reply_Uint(int value) throws Pausable {
- ByteBuffer response = ByteBuffer.allocate(4);
- response.putInt(value);
- driver_output2(response, null);
+ if (isUnicodeDriverInterface()) {
+ ByteBuffer response = ByteBuffer.allocate(9);
+ response.put(FILE_RESP_NUMBER);
+ response.putLong(value);
+ driver_output2(response, null);
+ } else {
+ ByteBuffer response = ByteBuffer.allocate(4);
+ response.putInt(value);
+ driver_output2(response, null);
+ }
}
public void reply_Uint_error(int value, int posix_error) throws Pausable {
@@ -1958,7 +1965,7 @@ void reply_list_directory(String[] files) throws Pausable {
*
* @see http://www.erlang.org/doc/apps/stdlib/unicode_usage.html#id60205
*/
- static boolean unicodeDriverInterface = ("R14B".compareTo(erjang.Main.OTP_VERSION) <= 0);
+ static boolean unicodeDriverInterface = ("R14B".compareTo(erjang.Main.OTP_VERSION) < 0);
/**
* Determine whether to use the new unicode driver interface
@@ -1973,5 +1980,4 @@ void reply_list_directory(String[] files) throws Pausable {
private static boolean isUnicodeDriverInterface() {
return unicodeDriverInterface;
}
-
}
View
4 src/main/java/erjang/m/erlang/ErlBif.java
@@ -178,8 +178,8 @@ static ESmall iolist_size(EObject val) {
}
- ESeq seq;
- if ((seq = val.testSeq()) == null) {
+ ECons seq;
+ if ((seq = val.testCons()) == null) {
throw ERT.badarg(val);
}
View
5 src/main/java/erjang/m/prim_file/Native.java
@@ -52,15 +52,12 @@ else if (arg.testBinary() != null) {
public static EObject internal_native2name(EObject arg) {
EBinary bin = arg.testBinary();
byte[] binbytes;
- byte[] outbytes;
if (bin == null) {
throw ERT.badarg(arg);
}
binbytes = bin.getByteArray();
- outbytes = new byte[binbytes.length - 1];
- System.arraycopy(binbytes, 0, outbytes, 0, binbytes.length - 1);
- String out = new String(outbytes);
+ String out = new String(binbytes);
return new EString(out);
}
Something went wrong with that request. Please try again.