Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making file subsystem work better with both <=R14B and >=R14B01 versi…

…ons.
  • Loading branch information...
commit e6604b3a461363285b65667a617be888a25983b4 1 parent 753257a
@eriksoe authored
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
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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.