Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
d212ab72
Commit
d212ab72
authored
Sep 17, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GNU libc-like support for "%m" expanded as strerror(errno) in Msg_*.
strerror() is mostly called in that case anyway.
parent
f6911cc8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
src/misc/messages.c
src/misc/messages.c
+43
-0
No files found.
src/misc/messages.c
View file @
d212ab72
...
...
@@ -301,6 +301,49 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
return
;
}
#ifndef __GLIBC__
/* Expand %m to strerror(errno) - only once */
char
buf
[
strlen
(
psz_format
)
+
2001
],
*
ptr
;
strcpy
(
buf
,
psz_format
);
ptr
=
psz_format
=
buf
;
for
(
;;
)
{
ptr
=
strchr
(
ptr
,
'%'
);
if
(
ptr
==
NULL
)
break
;
if
(
ptr
[
1
]
==
'm'
)
{
char
errbuf
[
2001
];
size_t
errlen
;
strerror_r
(
errno
,
errbuf
,
1001
);
errbuf
[
1000
]
=
0
;
/* Escape '%' from the error string */
for
(
char
*
percent
=
strchr
(
errbuf
,
'%'
);
percent
!=
NULL
;
percent
=
strchr
(
percent
+
2
,
'%'
)
)
{
memmove
(
percent
+
1
,
percent
,
strlen
(
percent
)
+
1
);
}
errlen
=
strlen
(
errbuf
);
memmove
(
ptr
+
errlen
,
ptr
+
2
,
strlen
(
ptr
+
2
)
+
1
);
memcpy
(
ptr
,
errbuf
,
errlen
);
break
;
/* Only once, so we don't overflow */
}
/* Looks for conversion specifier... */
do
ptr
++
;
while
(
*
ptr
&&
(
strchr
(
"diouxXeEfFgGaAcspn%"
,
*
ptr
)
==
NULL
)
);
if
(
*
ptr
)
ptr
++
;
/* ...and skip it */
}
#endif
/* Convert message to string */
#if defined(HAVE_VASPRINTF) && !defined(__APPLE__) && !defined( SYS_BEOS )
vlc_va_copy
(
args
,
_args
);
...
...
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