Skip to content

Commit

Permalink
Handle new binary efile ABI
Browse files Browse the repository at this point in the history
  • Loading branch information
krestenkrab committed Aug 15, 2013
1 parent e4418ba commit 075ff45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/erjang/driver/IO.java
Expand Up @@ -206,9 +206,10 @@ public static void putstr(ByteBuffer buf, String err, boolean term) {

public static String getstr(ByteBuffer buf, boolean term) {
if (term) {
/* TODO: charset! */
StringBuilder sb = new StringBuilder();
byte b;
while ((b=buf.get()) != 0) {
while (buf.hasRemaining() && (b=buf.get()) != 0) {
sb.append((char)(0xff & b));
}
return sb.toString();
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/erjang/driver/efile/EFile.java
Expand Up @@ -789,7 +789,7 @@ public void ready() throws Pausable {
}

ByteBuffer last = ev[ev.length - 1];
final String name = IO.getstr(last, false);
final String name = IO.getstr(last, true);

if (name.length() == 0) {
reply_posix_error(Posix.ENOENT);
Expand All @@ -801,7 +801,12 @@ public void ready() throws Pausable {
if (data == null) {
reply_posix_error(Posix.ENOENT);
} else {
if (isUnicodeDriverInterface()) {

task.output_from_driver(new EBinList(FILE_RESP_ALL_DATA_HEADER, data));
} else {
task.output_from_driver(new EBinList(FILE_RESP_OK_HEADER, data));
}
}

return;
Expand Down

0 comments on commit 075ff45

Please sign in to comment.