Skip to content
Browse files

Fix JRUBY-3719 by using default (copy in & out) flags in place of cop…

…yout
  • Loading branch information...
1 parent 8e6c773 commit 1dbebb13d24ec0329747161e1827259a4077312d Wayne Meissner committed
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/org/jruby/ext/ffi/jffi/DefaultMethodFactory.java
View
9 src/org/jruby/ext/ffi/jffi/DefaultMethodFactory.java
@@ -661,16 +661,15 @@ public final void marshal(Invocation invocation, InvocationBuffer buffer, IRubyO
*/
static final class BufferMarshaller extends BaseMarshaller {
static final ParameterMarshaller IN = new BufferMarshaller(ArrayFlags.IN);
- static final ParameterMarshaller OUT = new BufferMarshaller(ArrayFlags.OUT);
- static final ParameterMarshaller INOUT = new BufferMarshaller(ArrayFlags.IN | ArrayFlags.OUT);
+ static final ParameterMarshaller OUT = new BufferMarshaller(0);
+ static final ParameterMarshaller INOUT = new BufferMarshaller(0);
private final int flags;
public BufferMarshaller(int flags) {
this.flags = flags;
}
private static final int bufferFlags(Buffer buffer) {
int f = buffer.getInOutFlags();
- return ((f & Buffer.IN) != 0 ? ArrayFlags.IN: 0)
- | ((f & Buffer.OUT) != 0 ? ArrayFlags.OUT : 0);
+ return ((f & (Buffer.OUT | Buffer.IN)) == Buffer.IN) ? ArrayFlags.IN: 0;
}
@Override
public boolean needsInvocationSession() {
@@ -679,7 +678,7 @@ public boolean needsInvocationSession() {
private static final void addBufferParameter(InvocationBuffer buffer, IRubyObject parameter, int flags) {
ArrayMemoryIO memory = (ArrayMemoryIO) ((Buffer) parameter).getMemoryIO();
buffer.putArray(memory.array(), memory.arrayOffset(), memory.arrayLength(),
- flags & bufferFlags((Buffer) parameter));
+ flags | bufferFlags((Buffer) parameter));
}
private static final long getAddress(Pointer ptr) {
return ((DirectMemoryIO) ptr.getMemoryIO()).getAddress();

0 comments on commit 1dbebb1

Please sign in to comment.
Something went wrong with that request. Please try again.