diff --git a/daemon/rtcp.c b/daemon/rtcp.c index 43da24bd3..4d0decf3e 100644 --- a/daemon/rtcp.c +++ b/daemon/rtcp.c @@ -1596,7 +1596,7 @@ void rtcp_send_report(struct call_media *media, struct ssrc_ctx *ssrc_out) { // handle crypto - str rtcp_packet = STR_INIT_GS(sr); + str rtcp_packet = STR_GS(sr); const struct streamhandler *crypt_handler = determine_handler(&transport_protocols[PROTO_RTP_AVP], media, true); diff --git a/daemon/sdp.c b/daemon/sdp.c index 146697e0a..939796bec 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -427,7 +427,7 @@ void sdp_append_str_attr(GString *s, const sdp_ng_flags *flags, enum media_type g_autoptr(GString) gs = g_string_new(""); g_string_vprintf(gs, fmt, ap); va_end(ap); - append_str_attr_to_gstring(s, name, &STR_INIT_GS(gs), flags, media_type); + append_str_attr_to_gstring(s, name, &STR_GS(gs), flags, media_type); } INLINE void append_attr_to_gstring(GString *s, const char * name, const str * value, @@ -2187,7 +2187,7 @@ static void insert_codec_parameters(GString *s, struct call_media *cm, fmtp = pt->codec_def->format_print(pt); /* try appending list of parameters */ if (fmtp && fmtp->len) append_int_tagged_attr_to_gstring(s, "fmtp", pt->payload_type, - &STR_INIT_GS(fmtp), flags, cm->type_id); + &STR_GS(fmtp), flags, cm->type_id); } if (!fmtp && pt->format_parameters.len) append_int_tagged_attr_to_gstring(s, "fmtp", pt->payload_type, @@ -2678,7 +2678,7 @@ static void insert_candidate(GString *s, stream_fd *sfd, insert_raddr_rport(s_dst, sfd, flags); /* append to the chop->output */ - append_tagged_attr_to_gstring(s, "candidate", &ifa->ice_foundation, &STR_INIT_GS(s_dst), flags, + append_tagged_attr_to_gstring(s, "candidate", &ifa->ice_foundation, &STR_GS(s_dst), flags, (sdp_media ? sdp_media->media_type_id : MT_UNKNOWN)); } @@ -2739,7 +2739,7 @@ static void insert_candidates(GString *s, struct packet_stream *rtp, struct pack sockaddr_print_buf(&cand->endpoint.address), cand->endpoint.port); } /* append to the chop->output */ - append_attr_to_gstring(s, "remote-candidates", &STR_INIT_GS(s_dst), flags, (sdp_media ? sdp_media->media_type_id : MT_UNKNOWN)); + append_attr_to_gstring(s, "remote-candidates", &STR_GS(s_dst), flags, (sdp_media ? sdp_media->media_type_id : MT_UNKNOWN)); } return; } @@ -2806,7 +2806,7 @@ static void insert_dtls(GString *s, struct call_media *media, struct dtls_connec g_string_truncate(s_dst, s_dst->len - 1); /* append to the chop->output */ - append_attr_to_gstring(s, "fingerprint", &STR_INIT_GS(s_dst), flags, media->type_id); + append_attr_to_gstring(s, "fingerprint", &STR_GS(s_dst), flags, media->type_id); if (dtls) { /* prepare tls-id */ @@ -2817,7 +2817,7 @@ static void insert_dtls(GString *s, struct call_media *media, struct dtls_connec g_string_append_printf(s_dst, "%02x", *p++); /* append to the chop->output */ - append_attr_to_gstring(s, "tls-id", &STR_INIT_GS(s_dst), flags, media->type_id); + append_attr_to_gstring(s, "tls-id", &STR_GS(s_dst), flags, media->type_id); } } @@ -2869,7 +2869,7 @@ static void insert_crypto1(GString *s, struct call_media *media, struct crypto_p g_string_append(s_dst, " UNAUTHENTICATED_SRTP"); /* append to the chop->output */ - append_int_tagged_attr_to_gstring(s, "crypto", cps->tag, &STR_INIT_GS(s_dst), flags, media->type_id); + append_int_tagged_attr_to_gstring(s, "crypto", cps->tag, &STR_GS(s_dst), flags, media->type_id); } static void insert_crypto(GString *s, struct call_media *media, const sdp_ng_flags *flags) { @@ -2897,7 +2897,7 @@ static void insert_rtcp_attr(GString *s, struct packet_stream *ps, const sdp_ng_ g_string_append_printf(s_dst, " IN %.*s", len, buf); } /* append to the chop->output */ - append_attr_to_gstring(s, "rtcp", &STR_INIT_GS(s_dst), flags, (sdp_media ? sdp_media->media_type_id : MT_UNKNOWN)); + append_attr_to_gstring(s, "rtcp", &STR_GS(s_dst), flags, (sdp_media ? sdp_media->media_type_id : MT_UNKNOWN)); } @@ -3030,7 +3030,7 @@ static void append_tagged_attr_to_gstring(GString *s, const char * name, const s g_autoptr(GString) n = g_string_new(name); g_string_append_c(n, ':'); g_string_append_len(n, tag->s, tag->len); - generic_append_attr_to_gstring(s, &STR_INIT_GS(n), ' ', value, flags, media_type); + generic_append_attr_to_gstring(s, &STR_GS(n), ' ', value, flags, media_type); } /* A function used to append attributes (`a=name:uint value`) to the output chop */ @@ -3041,7 +3041,7 @@ static void append_int_tagged_attr_to_gstring(GString *s, const char * name, uns return; g_autoptr(GString) n = g_string_new(name); g_string_append_printf(n, ":%u", tag); - generic_append_attr_to_gstring(s, &STR_INIT_GS(n), ' ', value, flags, media_type); + generic_append_attr_to_gstring(s, &STR_GS(n), ' ', value, flags, media_type); } /* A function used to append attributes to the output chop */ diff --git a/daemon/t38.c b/daemon/t38.c index 7edf25e81..8e285655d 100644 --- a/daemon/t38.c +++ b/daemon/t38.c @@ -719,7 +719,7 @@ int t38_gateway_input_udptl(struct t38_gateway *tg, const str *buf) { "packet with seq %i from FEC", seq_fec); - str rec_str = STR_INIT_GS(rec_s); + str rec_str = STR_GS(rec_s); __fec_save(tg, &rec_str, seq_fec); up = __make_udptl_packet(&rec_str, seq_fec); packet_sequencer_insert(&tg->sequencer, &up->p); diff --git a/lib/str.h b/lib/str.h index b98b6acba..3fdabd15f 100644 --- a/lib/str.h +++ b/lib/str.h @@ -38,7 +38,7 @@ TYPED_GQUEUE(str, str) #define STR_EMPTY ((str) { "", 0 }) #define STR_CONST(s) ((str) { s, sizeof(s)-1 }) #define STR(s) ((str) { (char *) (s), (s) ? strlen(s) : 0 }) -#define STR_INIT_GS(s) ((str) { (s)->str, (s)->len }) +#define STR_GS(s) ((str) { (s)->str, (s)->len }) #define STR_LEN(s, len) ((str) { (char *) (s), len }) #define STR_INIT_DUP(s) ((str) { g_strdup(s), strlen(s) }) #define STR_CONST_BUF(buf) ((str) { (char *) &buf, sizeof(buf) })