Sha256: 7289848f3f79abc8bfafcb81dbf3983ee1f556ba3f605f0b2d2141449d6ba161

Contents?: true

Size: 562 Bytes

Versions: 31

Compression:

Stored size: 562 Bytes

Contents

#include <xml_io.h>

int io_read_callback(void * ctx, char * buffer, int len) {
  VALUE io = (VALUE)ctx;
  VALUE string = rb_funcall(io, rb_intern("read"), 1, INT2NUM(len));

  if(Qnil == string) return 0;

  memcpy(buffer, StringValuePtr(string), (unsigned int)RSTRING_LEN(string));

  return RSTRING_LEN(string);
}

int io_write_callback(void * ctx, char * buffer, int len) {
  VALUE io = (VALUE)ctx;
  VALUE string = rb_str_new(buffer, len);

  rb_funcall(io, rb_intern("write"), 1, string);
  return len;
}

int io_close_callback(void * ctx) {
  return 0;
}

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/ext/nokogiri/xml_io.c
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/ext/nokogiri/xml_io.c
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/ext/nokogiri/xml_io.c
nokogiri-1.3.3-x86-mswin32 ext/nokogiri/xml_io.c
nokogiri-1.3.3-x86-mingw32 ext/nokogiri/xml_io.c
nokogiri-1.3.3-java ext/nokogiri/xml_io.c
nokogiri-1.3.2-x86-mswin32 ext/nokogiri/xml_io.c
nokogiri-1.3.2-x86-mingw32 ext/nokogiri/xml_io.c
nokogiri-1.3.2-java ext/nokogiri/xml_io.c
nokogiri-1.3.0-x86-mingw32 ext/nokogiri/xml_io.c
nokogiri-1.3.2 ext/nokogiri/xml_io.c
nokogiri-1.3.3 ext/nokogiri/xml_io.c
nokogiri-1.2.0-java ext/nokogiri/xml_io.c
nokogiri-1.2.0-x86-mswin32-60 ext/nokogiri/xml_io.c
nokogiri-1.2.1-java ext/nokogiri/xml_io.c
nokogiri-1.2.0 ext/nokogiri/xml_io.c
nokogiri-1.2.1-x86-mswin32-60 ext/nokogiri/xml_io.c
nokogiri-1.2.1 ext/nokogiri/xml_io.c
nokogiri-1.2.2 ext/nokogiri/xml_io.c
nokogiri-1.2.2-x86-mswin32-60 ext/nokogiri/xml_io.c