Implement uc_hex_encode_delim without snprintf, fix length of

uc_hex_encode_delim when truncated output.
This commit is contained in:
Nils O. Selåsdal
2013-12-06 22:47:16 +01:00
parent 25f83f36ee
commit 59b4c3f57e
2 changed files with 28 additions and 10 deletions
+2 -1
View File
@@ -135,6 +135,7 @@ START_TEST (test_uc_hex_encode_delim_1)
res = uc_hex_encode_delim(binary, sizeof binary, hex, sizeof hex, " ");
fail_if(strcmp(hex, "FF 00 7F 0A ") != 0, "hex was '%s'", hex);
*res = 0;
fail_if(res != hex + 12);
END_TEST
@@ -147,7 +148,7 @@ START_TEST (test_uc_hex_encode_delim_2)
res = uc_hex_encode_delim(binary, sizeof binary, hex, sizeof hex, " \n");
fail_if(strcmp(hex, "FF \n00 ") != 0, "hex was '%s'", hex);
fail_if(res != hex + 8);
fail_if(res != hex + 7, "sz was %zu", res - hex);
END_TEST