comparison common-algo.c @ 1121:bb3a03feb31f

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 22:25:28 +0800
parents 1e486f368ec3 2052b53d3034
children d7b752525b91
comparison
equal deleted inserted replaced
1087:1e486f368ec3 1121:bb3a03feb31f
323 if (localalgos[i].usable) { 323 if (localalgos[i].usable) {
324 if (donefirst) 324 if (donefirst)
325 buf_putbyte(algolist, ','); 325 buf_putbyte(algolist, ',');
326 donefirst = 1; 326 donefirst = 1;
327 len = strlen(localalgos[i].name); 327 len = strlen(localalgos[i].name);
328 buf_putbytes(algolist, localalgos[i].name, len); 328 buf_putbytes(algolist, (const unsigned char *) localalgos[i].name, len);
329 } 329 }
330 } 330 }
331 buf_putstring(buf, algolist->data, algolist->len); 331 buf_putstring(buf, algolist->data, algolist->len);
332 buf_free(algolist); 332 buf_free(algolist);
333 } 333 }
339 * guessed correctly */ 339 * guessed correctly */
340 algo_type * buf_match_algo(buffer* buf, algo_type localalgos[], 340 algo_type * buf_match_algo(buffer* buf, algo_type localalgos[],
341 enum kexguess2_used *kexguess2, int *goodguess) 341 enum kexguess2_used *kexguess2, int *goodguess)
342 { 342 {
343 343
344 unsigned char * algolist = NULL; 344 char * algolist = NULL;
345 const unsigned char *remotenames[MAX_PROPOSED_ALGO], *localnames[MAX_PROPOSED_ALGO]; 345 const char *remotenames[MAX_PROPOSED_ALGO], *localnames[MAX_PROPOSED_ALGO];
346 unsigned int len; 346 unsigned int len;
347 unsigned int remotecount, localcount, clicount, servcount, i, j; 347 unsigned int remotecount, localcount, clicount, servcount, i, j;
348 algo_type * ret = NULL; 348 algo_type * ret = NULL;
349 const unsigned char **clinames, **servnames; 349 const char **clinames, **servnames;
350 350
351 if (goodguess) { 351 if (goodguess) {
352 *goodguess = 0; 352 *goodguess = 0;
353 } 353 }
354 354
355 /* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */ 355 /* get the comma-separated list from the buffer ie "algo1,algo2,algo3" */
356 algolist = buf_getstring(buf, &len); 356 algolist = (char *) buf_getstring(buf, &len);
357 TRACE(("buf_match_algo: %s", algolist)) 357 TRACE(("buf_match_algo: %s", algolist))
358 if (len > MAX_PROPOSED_ALGO*(MAX_NAME_LEN+1)) { 358 if (len > MAX_PROPOSED_ALGO*(MAX_NAME_LEN+1)) {
359 goto out; 359 goto out;
360 } 360 }
361 361
489 buffer *b = buf_new(200); 489 buffer *b = buf_new(200);
490 buf_put_algolist(b, algos); 490 buf_put_algolist(b, algos);
491 buf_setpos(b, b->len); 491 buf_setpos(b, b->len);
492 buf_putbyte(b, '\0'); 492 buf_putbyte(b, '\0');
493 buf_setpos(b, 4); 493 buf_setpos(b, 4);
494 ret_list = m_strdup(buf_getptr(b, b->len - b->pos)); 494 ret_list = m_strdup((const char *) buf_getptr(b, b->len - b->pos));
495 buf_free(b); 495 buf_free(b);
496 return ret_list; 496 return ret_list;
497 } 497 }
498 498
499 static algo_type* 499 static algo_type*