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
04dc2193
Commit
04dc2193
authored
Oct 13, 2012
by
KO Myung-Hun
Committed by
Rémi Denis-Courmont
Oct 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc: Convert command line arguments to
UTF-8
on OS/2
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
af76a67d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
bin/vlc.c
bin/vlc.c
+48
-1
No files found.
bin/vlc.c
View file @
04dc2193
...
...
@@ -42,10 +42,42 @@
#include <unistd.h>
#ifdef __OS2__
# include <iconv.h>
# define pthread_t int
# define pthread_self() _gettid()
#endif
static
char
*
FromSystem
(
const
void
*
str
)
{
iconv_t
handle
=
iconv_open
(
"UTF-8"
,
""
);
if
(
handle
==
(
iconv_t
)(
-
1
))
return
NULL
;
size_t
str_len
=
strlen
(
str
);
char
*
out
=
NULL
;
for
(
unsigned
mul
=
4
;
mul
<
8
;
mul
++
)
{
size_t
in_size
=
str_len
;
const
char
*
in
=
str
;
size_t
out_max
=
mul
*
str_len
;
char
*
tmp
=
out
=
malloc
(
1
+
out_max
);
if
(
!
out
)
break
;
if
(
iconv
(
handle
,
&
in
,
&
in_size
,
&
tmp
,
&
out_max
)
!=
(
size_t
)(
-
1
))
{
*
tmp
=
'\0'
;
break
;
}
free
(
out
);
out
=
NULL
;
if
(
errno
!=
E2BIG
)
break
;
}
iconv_close
(
handle
);
return
out
;
}
#endif
extern
void
vlc_enable_override
(
void
);
...
...
@@ -183,8 +215,18 @@ int main( int i_argc, const char *ppsz_argv[] )
if
(
i_argc
>=
1
&&
!
strncmp
(
*
ppsz_argv
,
"-psn"
,
4
))
ppsz_argv
++
,
i_argc
--
;
#endif
#ifdef __OS2__
for
(
int
i
=
0
;
i
<
i_argc
;
i
++
)
if
((
argv
[
argc
++
]
=
FromSystem
(
ppsz_argv
[
i
]))
==
NULL
)
{
fprintf
(
stderr
,
"Converting '%s' to UTF-8 failed.
\n
"
,
ppsz_argv
[
i
]);
return
1
;
}
#else
memcpy
(
argv
+
argc
,
ppsz_argv
,
i_argc
*
sizeof
(
*
argv
));
argc
+=
i_argc
;
#endif
argv
[
argc
]
=
NULL
;
vlc_enable_override
();
...
...
@@ -237,5 +279,10 @@ out:
if
(
vlc
!=
NULL
)
libvlc_release
(
vlc
);
#ifdef __OS2__
for
(
int
i
=
2
;
i
<
argc
;
i
++
)
free
(
argv
[
i
]);
#endif
return
0
;
}
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