comparison buffer.c @ 1122:aaf576b27a10

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 23:08:50 +0800
parents 16584026a1f0
children 2bb4c662d1c2
comparison
equal deleted inserted replaced
1087:1e486f368ec3 1122:aaf576b27a10
201 } 201 }
202 202
203 /* Return a null-terminated string, it is malloced, so must be free()ed 203 /* Return a null-terminated string, it is malloced, so must be free()ed
204 * Note that the string isn't checked for null bytes, hence the retlen 204 * Note that the string isn't checked for null bytes, hence the retlen
205 * may be longer than what is returned by strlen */ 205 * may be longer than what is returned by strlen */
206 unsigned char* buf_getstring(buffer* buf, unsigned int *retlen) { 206 char* buf_getstring(buffer* buf, unsigned int *retlen) {
207 207
208 unsigned int len; 208 unsigned int len;
209 unsigned char* ret; 209 char* ret;
210 len = buf_getint(buf); 210 len = buf_getint(buf);
211 if (len > MAX_STRING_LEN) { 211 if (len > MAX_STRING_LEN) {
212 dropbear_exit("String too long"); 212 dropbear_exit("String too long");
213 } 213 }
214 214
260 buf_incrwritepos(buf, 4); 260 buf_incrwritepos(buf, 4);
261 261
262 } 262 }
263 263
264 /* put a SSH style string into the buffer, increasing buffer len if required */ 264 /* put a SSH style string into the buffer, increasing buffer len if required */
265 void buf_putstring(buffer* buf, const unsigned char* str, unsigned int len) { 265 void buf_putstring(buffer* buf, const char* str, unsigned int len) {
266 266
267 buf_putint(buf, len); 267 buf_putint(buf, len);
268 buf_putbytes(buf, str, len); 268 buf_putbytes(buf, (const unsigned char*)str, len);
269 269
270 } 270 }
271 271
272 /* puts an entire buffer as a SSH string. ignore pos of buf_str. */ 272 /* puts an entire buffer as a SSH string. ignore pos of buf_str. */
273 void buf_putbufstring(buffer *buf, const buffer* buf_str) { 273 void buf_putbufstring(buffer *buf, const buffer* buf_str) {
274 buf_putstring(buf, buf_str->data, buf_str->len); 274 buf_putstring(buf, (const char*)buf_str->data, buf_str->len);
275 } 275 }
276 276
277 /* put the set of len bytes into the buffer, incrementing the pos, increasing 277 /* put the set of len bytes into the buffer, incrementing the pos, increasing
278 * len if required */ 278 * len if required */
279 void buf_putbytes(buffer *buf, const unsigned char *bytes, unsigned int len) { 279 void buf_putbytes(buffer *buf, const unsigned char *bytes, unsigned int len) {