static VALUE rg_splice_async(int argc, VALUE *argv, VALUE self) { VALUE rbsource, rbflags, rbio_priority, rbcancellable, block; GInputStream *source; GOutputStreamSpliceFlags flags; int io_priority; GCancellable *cancellable; rb_scan_args(argc, argv, "12&", &rbsource, &rbflags, &rbio_priority, &rbcancellable, &block); source = RVAL2GINPUTSTREAM(rbsource); flags = RVAL2GOUTPUTSTREAMSPLICEFLAGSDEFAULT(rbflags); io_priority = RVAL2IOPRIORITYDEFAULT(rbio_priority); cancellable = RVAL2GCANCELLABLE(rbcancellable); SAVE_BLOCK(block); g_output_stream_splice_async(_SELF(self), source, flags, io_priority, cancellable, rbgio_async_ready_callback, (gpointer)block); return self; }
static VALUE rg_initialize(VALUE self, VALUE base_stream, VALUE converter) { G_INITIALIZE(self, g_converter_input_stream_new(RVAL2GINPUTSTREAM(base_stream), RVAL2GCONVERTER(converter))); return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE rbbase_stream, size; GInputStream *base_stream, *stream; rb_scan_args(argc, argv, "11", &rbbase_stream, &size); base_stream = RVAL2GINPUTSTREAM(rbbase_stream); stream = NIL_P(size) ? g_buffered_input_stream_new(base_stream) : g_buffered_input_stream_new_sized(base_stream, RVAL2GSIZE(size)); G_INITIALIZE(self, stream); return Qnil; }
static VALUE rg_splice(int argc, VALUE *argv, VALUE self) { VALUE source, flags, cancellable; GError *error = NULL; gssize bytes_spliced; rb_scan_args(argc, argv, "12", &source, &flags, &cancellable); bytes_spliced = g_output_stream_splice(_SELF(self), RVAL2GINPUTSTREAM(source), RVAL2GOUTPUTSTREAMSPLICEFLAGSDEFAULT(flags), RVAL2GCANCELLABLE(cancellable), &error); if (bytes_spliced == -1) rbgio_raise_error(error); return GSSIZE2RVAL(bytes_spliced); }