Mercurial > pidgin.yaz
comparison src/util.c @ 5450:bb1e160467b6
[gaim-migrate @ 5838]
Thanks to J P (j_pong) for tracking this down, this fixes base16, and might
fix the corrupt buddy lists for the win32 folk
also there's a cleanup for a compile warning
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 20 May 2003 00:45:35 +0000 |
parents | a2f26666de42 |
children | e1cc0c67e123 |
comparison
equal
deleted
inserted
replaced
5449:9442e8d0b21d | 5450:bb1e160467b6 |
---|---|
468 * Converts raw data to a pretty, null-terminated base16 string. | 468 * Converts raw data to a pretty, null-terminated base16 string. |
469 */ | 469 */ |
470 char *tobase16(const char *data, int length) | 470 char *tobase16(const char *data, int length) |
471 { | 471 { |
472 int i; | 472 int i; |
473 char *ascii = NULL; | 473 unsigned char *ascii = NULL; |
474 | 474 |
475 if (!data || !length) | 475 if (!data || !length) |
476 return NULL; | 476 return NULL; |
477 | 477 |
478 ascii = (char *)malloc(length*2 + 1); | 478 ascii = malloc(length*2 + 1); |
479 | 479 |
480 for (i=0; i<length; i++) | 480 for (i=0; i<length; i++) |
481 snprintf(&ascii[i*2], 3, "%02hhx", data[i]); | 481 snprintf(&ascii[i*2], 3, "%02hhx", data[i]); |
482 | 482 |
483 return ascii; | 483 return ascii; |