Skip to content

Commit

Permalink
Corrections to the method write_to in C Api
Browse files Browse the repository at this point in the history
Signed-off-by: UpeksheJay <[email protected]>
  • Loading branch information
UpeksheJay committed Aug 17, 2016
1 parent c349c0a commit c58d5a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ext/nio4r/bytebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ static VALUE NIO_ByteBuffer_writeTo(VALUE self, VALUE io){
GetOpenFile(rb_convert_type(io, T_FILE, "IO", "to_io"), fptr);
rb_io_set_nonblock(fptr);

write(FPTR_TO_FD(fptr), StringValuePtr(NIO_ByteBuffer_get(self)), size);
VALUE content = NIO_ByteBuffer_get(self);
char* contentAsPointer = StringValuePtr(content);

write(FPTR_TO_FD(fptr), contentAsPointer , size);

return self;
}
Expand All @@ -215,8 +218,6 @@ static VALUE NIO_ByteBuffer_readFrom(VALUE self, VALUE file){
Data_Get_Struct(self, struct NIO_ByteBuffer, byteBuffer);
int size = byteBuffer->limit + 1 - byteBuffer->position;

//Still not complete...

return self;
}

Expand Down

0 comments on commit c58d5a9

Please sign in to comment.