Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
ff3ff3ee
Commit
ff3ff3ee
authored
Apr 09, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "win32: make vlc_vsnprintf more like c99 vsnprintf"
This reverts commit
30f33e7a
.
parent
db01e438
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
+8
-25
include/vlc_fixups.h
include/vlc_fixups.h
+8
-25
No files found.
include/vlc_fixups.h
View file @
ff3ff3ee
...
...
@@ -123,7 +123,6 @@ static inline int vlc_vsprintf (char *str, const char *format, va_list ap)
}
# define vsprintf vlc_vsprintf
static
inline
int
vasprintf
(
char
**
strp
,
const
char
*
fmt
,
va_list
ap
);
static
inline
int
vlc_vsnprintf
(
char
*
str
,
size_t
size
,
const
char
*
format
,
va_list
ap
)
{
int
must_free
=
vlc_fix_format_string
(
&
format
);
...
...
@@ -131,18 +130,7 @@ static inline int vlc_vsnprintf (char *str, size_t size, const char *format, va_
* to 'aid' portability/standards compliance, mingw provides a
* static version of vsnprintf that is buggy. Be sure to use
* MSVCRT version, at least it behaves as expected */
/* MSVCRT _vsnprintf does not:
* - null terminate string if insufficient storage
* - return the number of characters that would've been written
*/
int
ret
=
_vsnprintf
(
str
,
size
-
1
,
format
,
ap
);
str
[
size
-
1
]
=
0
;
/* ensure the null gets written */
if
(
ret
==
-
1
)
{
/* work out the number of chars that should've been written */
ret
=
vasprintf
(
&
str
,
format
,
ap
);
if
(
ret
>=
0
&&
str
)
free
(
str
);
}
int
ret
=
_vsnprintf
(
str
,
size
,
format
,
ap
);
if
(
must_free
)
free
((
char
*
)
format
);
return
ret
;
}
...
...
@@ -207,7 +195,7 @@ static inline int vlc_snprintf (char *str, size_t size, const char *format, ...)
# include <stdarg.h>
static
inline
int
vasprintf
(
char
**
strp
,
const
char
*
fmt
,
va_list
ap
)
{
#ifndef
WIN32
#ifndef
UNDER_CE
int
len
=
vsnprintf
(
NULL
,
0
,
fmt
,
ap
)
+
1
;
char
*
res
=
(
char
*
)
malloc
(
len
);
if
(
res
==
NULL
)
...
...
@@ -215,31 +203,27 @@ static inline int vasprintf (char **strp, const char *fmt, va_list ap)
*
strp
=
res
;
return
vsnprintf
(
res
,
len
,
fmt
,
ap
);
#else
/* HACK: vsnprintf in the Win
32
API behaves like
/* HACK: vsnprintf in the Win
CE
API behaves like
* the one in glibc 2.0 and doesn't return the number of characters
* it needed to copy the string.
* cf http://msdn.microsoft.com/en-us/library/1kt27hek.aspx
* and cf the man page of vsnprintf
*
/
int
must_free
=
vlc_fix_format_string
(
&
fmt
);
int
n
,
size
=
2
*
strlen
(
fmt
)
;
*
Guess we need no more than 50 bytes. */
int
n
,
size
=
50
;
char
*
res
,
*
np
;
if
((
res
=
(
char
*
)
malloc
(
size
))
==
NULL
)
{
if
(
must_free
)
free
((
char
*
)
fmt
);
return
-
1
;
}
while
(
1
)
{
n
=
_
vsnprintf
(
res
,
size
,
fmt
,
ap
);
n
=
vsnprintf
(
res
,
size
,
fmt
,
ap
);
/* If that worked, return the string. */
if
(
n
>
-
1
&&
n
<
size
)
{
*
strp
=
res
;
if
(
must_free
)
free
((
char
*
)
fmt
);
return
n
;
}
...
...
@@ -249,7 +233,6 @@ static inline int vasprintf (char **strp, const char *fmt, va_list ap)
if
((
np
=
(
char
*
)
realloc
(
res
,
size
))
==
NULL
)
{
free
(
res
);
if
(
must_free
)
free
((
char
*
)
fmt
);
return
-
1
;
}
else
...
...
@@ -258,7 +241,7 @@ static inline int vasprintf (char **strp, const char *fmt, va_list ap)
}
}
#endif
/*
WIN32
*/
#endif
/*
UNDER_CE
*/
}
#endif
...
...
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