comparison buffer.c @ 219:654bc8327787

merge of 9522146cb07d4576f161fc4567c2c2fbd6f61fbb and b11630c15bc4d0649dba51c3572cac6f44e0ab0e
author Matt Johnston <matt@ucc.asn.au>
date Fri, 08 Jul 2005 13:28:03 +0000
parents 161557a9dde8
children c5d3ef11155f
comparison
equal deleted inserted replaced
218:3ee0c2f85e1e 219:654bc8327787
158 dropbear_exit("bad buf_getbyte"); 158 dropbear_exit("bad buf_getbyte");
159 } 159 }
160 return buf->data[buf->pos++]; 160 return buf->data[buf->pos++];
161 } 161 }
162 162
163 /* Get a bool from the buffer and increment the pos */
164 unsigned char buf_getbool(buffer* buf) {
165
166 unsigned char b;
167 b = buf_getbyte(buf);
168 if (b != 0)
169 b = 1;
170 return b;
171 }
172
163 /* put a byte, incrementing the length if required */ 173 /* put a byte, incrementing the length if required */
164 void buf_putbyte(buffer* buf, unsigned char val) { 174 void buf_putbyte(buffer* buf, unsigned char val) {
165 175
166 if (buf->pos >= buf->len) { 176 if (buf->pos >= buf->len) {
167 buf_incrlen(buf, 1); 177 buf_incrlen(buf, 1);