Lines Matching refs:cs
57 cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
62 next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
65 if (next - cs->c_buf + wordsize > cs->c_len)
72 cpack_init(struct cpack_state *cs, u_int8_t *buf, size_t buflen)
74 memset(cs, 0, sizeof(*cs));
76 cs->c_buf = buf;
77 cs->c_len = buflen;
78 cs->c_next = cs->c_buf;
85 cpack_uint64(struct cpack_state *cs, u_int64_t *u)
89 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
95 cs->c_next = next + sizeof(*u);
101 cpack_uint32(struct cpack_state *cs, u_int32_t *u)
105 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
111 cs->c_next = next + sizeof(*u);
117 cpack_uint16(struct cpack_state *cs, u_int16_t *u)
121 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
127 cs->c_next = next + sizeof(*u);
133 cpack_uint8(struct cpack_state *cs, u_int8_t *u)
136 if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len)
139 *u = *cs->c_next;
142 cs->c_next++;