comparison buffer.c @ 179:161557a9dde8

* fix longstanding bug with connections being closed on failure to connect to auth socket (server) * differentiate between get_byte and get_bool * get rid of some // comments * general tidying
author Matt Johnston <matt@ucc.asn.au>
date Sun, 13 Mar 2005 13:58:14 +0000
parents 0cfba3034be5
children c5d3ef11155f
comparison
equal deleted inserted replaced
178:058cc7892636 179:161557a9dde8
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);