Lines Matching refs:cs
54 cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
59 next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
62 if (next - cs->c_buf + wordsize > cs->c_len)
69 cpack_init(struct cpack_state *cs, u_int8_t *buf, size_t buflen)
71 memset(cs, 0, sizeof(*cs));
73 cs->c_buf = buf;
74 cs->c_len = buflen;
75 cs->c_next = cs->c_buf;
82 cpack_uint64(struct cpack_state *cs, u_int64_t *u)
86 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
92 cs->c_next = next + sizeof(*u);
98 cpack_uint32(struct cpack_state *cs, u_int32_t *u)
102 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
108 cs->c_next = next + sizeof(*u);
114 cpack_uint16(struct cpack_state *cs, u_int16_t *u)
118 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
124 cs->c_next = next + sizeof(*u);
130 cpack_uint8(struct cpack_state *cs, u_int8_t *u)
133 if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len)
136 *u = *cs->c_next;
139 cs->c_next++;