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
274260e4
Commit
274260e4
authored
Aug 24, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: (restore) support for Unicode command line...
...and use Windows built-in function for command line parsing.
parent
a06aeb0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
70 deletions
+27
-70
bin/winvlc.c
bin/winvlc.c
+27
-70
No files found.
bin/winvlc.c
View file @
274260e4
...
@@ -35,73 +35,36 @@
...
@@ -35,73 +35,36 @@
#include <stdlib.h>
#include <stdlib.h>
#include <windows.h>
#include <windows.h>
static
int
parse_cmdline
(
char
*
line
,
char
***
argvp
)
static
char
*
FromWide
(
const
wchar_t
*
wide
)
{
{
char
**
argv
=
malloc
(
sizeof
(
char
*
))
;
size_t
len
;
int
argc
=
0
;
len
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
wide
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
;
while
(
*
line
!=
'\0'
)
char
*
out
=
(
char
*
)
malloc
(
len
);
{
if
(
out
)
char
quote
=
0
;
WideCharToMultiByte
(
CP_UTF8
,
0
,
wide
,
-
1
,
out
,
len
,
NULL
,
NULL
);
return
out
;
/* Skips white spaces */
while
(
strchr
(
"
\t
"
,
*
line
))
line
++
;
if
(
!*
line
)
break
;
/* Starts a new parameter */
argv
=
realloc
(
argv
,
(
argc
+
2
)
*
sizeof
(
char
*
));
if
(
*
line
==
'"'
)
{
quote
=
'"'
;
line
++
;
}
argv
[
argc
++
]
=
line
;
more:
while
(
*
line
&&
!
strchr
(
"
\t
"
,
*
line
))
line
++
;
if
(
line
>
argv
[
argc
-
1
]
&&
line
[
-
1
]
==
quote
)
/* End of quoted parameter */
line
[
-
1
]
=
0
;
else
if
(
*
line
&&
quote
)
{
/* Space within a quote */
line
++
;
goto
more
;
}
else
/* End of unquoted parameter */
if
(
*
line
)
*
line
++
=
0
;
}
argv
[
argc
]
=
NULL
;
*
argvp
=
argv
;
return
argc
;
}
}
#ifdef UNDER_CE
# define wWinMain WinMain
#endif
/*****************************************************************************
int
WINAPI
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance
,
* wWinMain: parse command line, start interface and spawn threads.
#ifndef UNDER_CE
*****************************************************************************/
LPSTR
lpCmdLine
,
int
WINAPI
wWinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance
,
#else
LPWSTR
lpCmdLine
,
int
nCmdShow
)
LPWSTR
lpCmdLine
,
#endif
int
nCmdShow
)
{
{
char
**
argv
,
psz_cmdline
[
wcslen
(
lpCmdLine
)
*
4
+
1
];
int
argc
,
ret
;
int
argc
,
ret
;
wchar_t
**
wargv
=
CommandLineToArgvW
(
GetCommandLine
(),
&
argc
);
if
(
wargv
==
NULL
)
return
1
;
(
void
)
hInstance
;
(
void
)
hPrevInstance
;
(
void
)
nCmdShow
;
char
*
argv
[
argc
+
1
];
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
WideCharToMultiByte
(
CP_UTF8
,
0
,
lpCmdLine
,
-
1
,
argv
[
i
]
=
FromWide
(
wargv
[
i
]);
psz_cmdline
,
sizeof
(
psz_cmdline
),
NULL
,
NULL
);
argv
[
argc
]
=
NULL
;
LocalFree
(
wargv
);
argc
=
parse_cmdline
(
psz_cmdline
,
&
argv
);
libvlc_exception_t
ex
,
dummy
;
libvlc_exception_t
ex
,
dummy
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
...
@@ -121,16 +84,10 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
...
@@ -121,16 +84,10 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
ret
=
libvlc_exception_raised
(
&
ex
);
ret
=
libvlc_exception_raised
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
dummy
);
libvlc_exception_clear
(
&
dummy
);
return
ret
;
}
#ifndef IF_MINGW_SUPPORTED_UNICODE
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
int
WINAPI
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance
,
free
(
argv
[
i
]);
LPSTR
args
,
int
nCmdShow
)
{
(
void
)
hInstance
;
(
void
)
hPrevInstance
;
(
void
)
lpCmdLine
;
(
void
)
nCmdShow
;
/* This makes little sense, but at least it links properly */
return
ret
;
wchar_t
lpCmdLine
[(
strlen
(
args
)
+
1
)
*
3
];
MultiByteToWideChar
(
CP_ACP
,
0
,
args
,
-
1
,
lpCmdLine
,
sizeof
(
lpCmdLine
));
return
wWinMain
(
hInstance
,
hPrevInstance
,
lpCmdLine
,
nCmdShow
);
}
}
#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