add support for default values

This commit is contained in:
James McKaskill 2013-05-12 00:58:08 -04:00
parent c85722874d
commit 2eb6628ae4
7 changed files with 700 additions and 466 deletions

3
capn.c
View file

@ -1053,7 +1053,8 @@ int capn_set_text(capn_ptr p, int off, capn_text tgt) {
}
capn_data capn_get_data(capn_ptr p, int off) {
capn_data ret = {capn_getp(p, off)};
capn_data ret;
ret.p = capn_getp(p, off);
if (ret.p.type != CAPN_LIST || ret.p.datasz != 1) {
memset(&ret, 0, sizeof(ret));
}