unsigned pgp_write_length(pgp_output_t *output, unsigned len) { uint8_t c[2]; if (len < 192) { c[0] = len; return base_write(output, c, 1); } if (len < 8192 + 192) { c[0] = ((len - 192) >> 8) + 192; c[1] = (len - 192) % 256; return base_write(output, c, 2); }
unsigned pgp_write_ptag(pgp_output_t *output, pgp_content_enum tag) { uint8_t c; c = tag | PGP_PTAG_ALWAYS_SET | PGP_PTAG_NEW_FORMAT; return base_write(output, &c, 1); }
unsigned pgp_write_scalar(pgp_output_t *output, unsigned n, unsigned len) { uint8_t c; while (len-- > 0) { c = n >> (len * 8); if (!base_write(output, &c, 1)) { return 0; } } return 1; }
unsigned pgp_write(pgp_output_t *output, const void *src, unsigned len) { return base_write(output, src, len); }
int ydb_write(struct ydb *ydb, struct ydb_batch *ybatch, int do_fsync) { struct batch *batch = (struct batch *)ybatch; return base_write(ydb->base, batch, do_fsync); }