static VALUE ssize_finish_method(SSizeFinishMethod method, VALUE self, VALUE result) { GError *error = NULL; gssize bytes_read; bytes_read = method(_SELF(self), RVAL2GASYNCRESULT(result), &error); if (error != NULL) rbgio_raise_error(error); return GSSIZE2RVAL(bytes_read); }
static VALUE rg_fill_finish(VALUE self, VALUE result) { GError *error = NULL; gsize bytes_read; bytes_read = g_buffered_input_stream_fill_finish(_SELF(self), RVAL2GASYNCRESULT(result), &error); if (error != NULL) rbgio_raise_error(error); return GSSIZE2RVAL(bytes_read); }
static VALUE rg_skip(int argc, VALUE *argv, VALUE self) { VALUE count, cancellable; GError *error = NULL; gssize bytes_skipped; rb_scan_args(argc, argv, "11", &count, &cancellable); bytes_skipped = g_input_stream_skip(_SELF(self), RVAL2GSIZE(count), RVAL2GCANCELLABLE(cancellable), &error); if (bytes_skipped == -1) rbgio_raise_error(error); return GSSIZE2RVAL(bytes_skipped); }
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); }
static VALUE rg_fill(int argc, VALUE *argv, VALUE self) { VALUE count, cancellable; GError *error = NULL; gsize bytes_read; rb_scan_args(argc, argv, "02", &count, &cancellable); bytes_read = g_buffered_input_stream_fill(_SELF(self), NIL_P(count) ? -1 : RVAL2GSSIZE(count), RVAL2GCANCELLABLE(cancellable), &error); if (error != NULL) rbgio_raise_error(error); return GSSIZE2RVAL(bytes_read); }
static VALUE rg_write(int argc, VALUE *argv, VALUE self) { VALUE rbbuffer, cancellable; const char *buffer; GError *error = NULL; gssize bytes_written; rb_scan_args(argc, argv, "11", &rbbuffer, &cancellable); buffer = RVAL2CSTR(rbbuffer); bytes_written = g_output_stream_write(_SELF(self), buffer, (gsize)RSTRING_LEN(rbbuffer), RVAL2GCANCELLABLE(cancellable), &error); if (bytes_written == -1) rbgio_raise_error(error); return GSSIZE2RVAL(bytes_written); }
static VALUE rg_op_res_gssize(VALUE self) { return GSSIZE2RVAL(g_simple_async_result_get_op_res_gssize(_SELF(self))); }