MT#55283 shortcut a=fingerprint printing

No need for a temporary buffer to write the hex string to as we're using
a GString.

Change-Id: I56c98f4d03583d7f7518f912c6558197c7be1050
pull/1592/head
Richard Fuchs 3 years ago
parent 4009d58f3c
commit 5a2981b3ec

@ -2377,9 +2377,7 @@ static void insert_candidates(GString *s, struct packet_stream *rtp, struct pack
}
static void insert_dtls(GString *s, struct call_media *media) {
char hexbuf[DTLS_MAX_DIGEST_LEN * 3 + 2];
unsigned char *p;
char *o;
int i;
const struct dtls_hash_func *hf;
const char *actpass;
@ -2409,12 +2407,6 @@ static void insert_dtls(GString *s, struct call_media *media) {
assert(hf->num_bytes > 0);
p = fp->digest;
o = hexbuf;
for (i = 0; i < hf->num_bytes; i++)
o += sprintf(o, "%02X:", *p++);
*(--o) = '\0';
actpass = "holdconn";
if (MEDIA_ARESET2(media, SETUP_PASSIVE, SETUP_ACTIVE))
actpass = "actpass";
@ -2428,7 +2420,12 @@ static void insert_dtls(GString *s, struct call_media *media) {
g_string_append(s, "\r\na=fingerprint:");
g_string_append(s, hf->name);
g_string_append(s, " ");
g_string_append_len(s, hexbuf, o - hexbuf);
p = fp->digest;
for (i = 0; i < hf->num_bytes; i++)
g_string_append_printf(s, "%02X:", *p++);
g_string_truncate(s, s->len - 1);
g_string_append(s, "\r\n");
}

Loading…
Cancel
Save