Commit d72395dd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

sap: simplify

parent 3b97a380
...@@ -1184,8 +1184,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp) ...@@ -1184,8 +1184,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
while (*psz_sdp) while (*psz_sdp)
{ {
/* Extract one line */ /* Extract one line */
char *eol = strchr (psz_sdp, '\n'); size_t linelen = strcspn(psz_sdp, "\n");
size_t linelen = eol ? (size_t)(eol - psz_sdp) : strlen (psz_sdp);
char line[linelen + 1]; char line[linelen + 1];
memcpy (line, psz_sdp, linelen); memcpy (line, psz_sdp, linelen);
line[linelen] = '\0'; line[linelen] = '\0';
...@@ -1193,7 +1192,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp) ...@@ -1193,7 +1192,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
psz_sdp += linelen + 1; psz_sdp += linelen + 1;
/* Remove carriage return if present */ /* Remove carriage return if present */
eol = strchr (line, '\r'); char *eol = strchr (line, '\r');
if (eol != NULL) if (eol != NULL)
{ {
linelen = eol - line; linelen = eol - line;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment