--- hexed.c-original 2015-05-09 00:24:13.791707625 +0200 +++ hexed.c 2015-05-09 00:54:07.538368884 +0200 @@ -29,26 +29,29 @@ int addx; int addCarray; int hexd; - unsigned char *str; + union { + char *str; + unsigned char *ustr; + }; } hexed_t; void hexed_hex_encode(hexed_t *hexed) { int index = 0; - for( index = 0; hexed->str[index] != 0; index++ ) { + for( index = 0; hexed->ustr[index] != 0; index++ ) { if ( hexed->addx ) - printf("\\x%x", hexed->str[index]); + printf("\\x%x", hexed->ustr[index]); else if ( hexed->addCarray ) - printf("0x%x,", hexed->str[index]); + printf("0x%x,", hexed->ustr[index]); else - printf("%x", hexed->str[index]); + printf("%x", hexed->ustr[index]); } putchar(0x0a); } void hexed_hex_decode(hexed_t *hexed) { - int index = 0; + size_t index = 0; short byte = 0x00; size_t len = strlen(hexed->str);