Sha256: 95ff0078a9b0c9c400c8f6aadab1b71673b1c4cdd047485862fcaf2d8210f3e6

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

#include <archive.h>
#include <ruby.h>

static int rb_str_write_open(struct archive *a, void *client_data) {
  if (archive_write_get_bytes_in_last_block(a) == -1) {
    archive_write_set_bytes_in_last_block(a, 1);
  }

  return ARCHIVE_OK;
}

static int rb_str_write_close(struct archive *a, void *client_data) {
  return ARCHIVE_OK;
}


static ssize_t rb_str_write(struct archive *a, void *client_data, const void *buff, size_t length) {
  VALUE str = (VALUE) client_data;
  rb_str_cat(str, buff, length);
  return length;
}

int archive_write_open_rb_str(struct archive *a, VALUE str) {
  return archive_write_open(a, (void *) str, rb_str_write_open, rb_str_write, rb_str_write_close);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
libarchive-ruby-fs-0.2.4 ext/rblibarchive/archive_write_open_rb_str.c
libarchive-ruby-fs-0.2.3 ext/rblibarchive/archive_write_open_rb_str.c
libarchive-ruby-fs-0.2.2 ext/rblibarchive/archive_write_open_rb_str.c