Method: GPGME.gpgme_data_read
- Defined in:
- ext/gpgme/gpgme_n.c
permalink .gpgme_data_read ⇒ Object
Manipulating Data Buffers
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'ext/gpgme/gpgme_n.c', line 403 static VALUE rb_s_gpgme_data_read (VALUE dummy, VALUE vdh, VALUE vlength) { gpgme_data_t dh; ssize_t length = NUM2LONG(vlength), nread; void *buffer; VALUE vbuffer = Qnil; UNWRAP_GPGME_DATA(vdh, dh); buffer = ALLOC_N (char, length); nread = gpgme_data_read (dh, buffer, length); if (nread > 0) vbuffer = rb_str_new (buffer, nread); xfree (buffer); if (nread < 0) rb_sys_fail ("rb_s_gpgme_data_read"); return vbuffer; } |