Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6afadbe2
Commit
6afadbe2
authored
Sep 12, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove extra va_end; code factorization
parent
3a7e1af1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
src/stream_output/sdp.c
src/stream_output/sdp.c
+22
-24
No files found.
src/stream_output/sdp.c
View file @
6afadbe2
...
...
@@ -161,18 +161,28 @@ static char *
vsdp_AddAttribute
(
char
**
sdp
,
const
char
*
name
,
const
char
*
fmt
,
va_list
ap
)
{
size_t
oldlen
=
strlen
(
*
sdp
);
va_list
aq
;
va_copy
(
aq
,
ap
);
size_t
addlen
=
sizeof
(
"a=:
\r\n
"
)
+
strlen
(
name
)
+
vsnprintf
(
NULL
,
0
,
fmt
,
ap
);
char
*
ret
=
realloc
(
*
sdp
,
oldlen
+
addlen
);
size_t
addlen
=
sizeof
(
"a=
\r\n
"
)
+
strlen
(
name
);
if
(
fmt
!=
NULL
)
{
va_list
aq
;
va_copy
(
aq
,
ap
);
addlen
+=
1
+
vsnprintf
(
NULL
,
0
,
fmt
,
aq
);
va_end
(
aq
);
}
char
*
ret
=
realloc
(
*
sdp
,
oldlen
+
addlen
);
if
(
ret
==
NULL
)
return
NULL
;
oldlen
+=
sprintf
(
ret
+
oldlen
,
"a=%s:"
,
name
);
oldlen
+=
vsprintf
(
ret
+
oldlen
,
fmt
,
aq
);
va_end
(
aq
);
oldlen
+=
sprintf
(
ret
+
oldlen
,
"a=%s"
,
name
);
if
(
fmt
!=
NULL
)
{
ret
[
oldlen
++
]
=
':'
;
oldlen
+=
vsprintf
(
ret
+
oldlen
,
fmt
,
ap
);
}
strcpy
(
ret
+
oldlen
,
"
\r\n
"
);
return
*
sdp
=
ret
;
}
...
...
@@ -181,24 +191,12 @@ vsdp_AddAttribute (char **sdp, const char *name, const char *fmt, va_list ap)
char
*
sdp_AddAttribute
(
char
**
sdp
,
const
char
*
name
,
const
char
*
fmt
,
...)
{
char
*
ret
;
va_list
ap
;
if
(
fmt
!=
NULL
)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
ret
=
vsdp_AddAttribute
(
sdp
,
name
,
fmt
,
ap
);
va_end
(
ap
)
;
va_start
(
ap
,
fmt
);
ret
=
vsdp_AddAttribute
(
sdp
,
name
,
fmt
,
ap
);
va_end
(
ap
);
}
else
{
size_t
oldlen
=
strlen
(
*
sdp
);
ret
=
realloc
(
*
sdp
,
oldlen
+
strlen
(
name
)
+
sizeof
(
"a=
\r\n
"
));
if
(
ret
==
NULL
)
return
NULL
;
sprintf
(
ret
+
oldlen
,
"a=%s
\r\n
"
,
name
);
}
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment