Implement uc_hex_encode_delim without snprintf, fix length of
uc_hex_encode_delim when truncated output.
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user