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
71e6138b
Commit
71e6138b
authored
Apr 12, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of rev [19271]
parent
86287891
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
8 deletions
+42
-8
src/extras/libc.c
src/extras/libc.c
+42
-8
No files found.
src/extras/libc.c
View file @
71e6138b
...
...
@@ -92,7 +92,6 @@ char *vlc_strndup( const char *string, size_t n )
len
=
__MIN
(
len
,
n
);
psz
=
(
char
*
)
malloc
(
len
+
1
);
if
(
psz
!=
NULL
)
{
memcpy
(
(
void
*
)
psz
,
(
const
void
*
)
string
,
len
);
...
...
@@ -250,10 +249,12 @@ int vlc_asprintf( char **strp, const char *fmt, ... )
double
vlc_atof
(
const
char
*
nptr
)
{
double
f_result
;
wchar_t
*
psz_tmp
;
wchar_t
*
psz_tmp
=
NULL
;
int
i_len
=
strlen
(
nptr
)
+
1
;
psz_tmp
=
malloc
(
i_len
*
sizeof
(
wchar_t
)
);
if
(
!
psz_tmp
)
return
NULL
;
MultiByteToWideChar
(
CP_ACP
,
0
,
nptr
,
-
1
,
psz_tmp
,
i_len
);
f_result
=
wcstod
(
psz_tmp
,
NULL
);
free
(
psz_tmp
);
...
...
@@ -403,14 +404,16 @@ typedef struct vlc_DIR
void
*
vlc_opendir_wrapper
(
const
char
*
psz_path
)
{
vlc_DIR
*
p_dir
;
DIR
*
p_real_dir
;
vlc_DIR
*
p_dir
=
NULL
;
DIR
*
p_real_dir
=
NULL
;
if
(
psz_path
==
NULL
||
psz_path
[
0
]
==
'\0'
||
(
psz_path
[
0
]
==
'\\'
&&
psz_path
[
1
]
==
'\0'
)
)
{
/* Special mode to list drive letters */
p_dir
=
malloc
(
sizeof
(
vlc_DIR
)
);
if
(
!
p_dir
)
return
NULL
;
p_dir
->
p_real_dir
=
NULL
;
p_dir
->
i_drives
=
GetLogicalDrives
();
return
(
void
*
)
p_dir
;
...
...
@@ -421,6 +424,11 @@ void *vlc_opendir_wrapper( const char *psz_path )
return
NULL
;
p_dir
=
malloc
(
sizeof
(
vlc_DIR
)
);
if
(
!
p_dir
)
{
_wclosedir
(
p_real_dir
);
return
NULL
;
}
p_dir
->
p_real_dir
=
p_real_dir
;
p_dir
->
b_insert_back
=
(
psz_path
[
1
]
==
':'
&&
psz_path
[
2
]
==
'\\'
&&
psz_path
[
3
]
==
'\0'
);
...
...
@@ -526,8 +534,19 @@ int vlc_scandir( const char *name, struct dirent ***namelist,
pp_list
=
realloc
(
pp_list
,
(
ret
+
1
)
*
sizeof
(
struct
dirent
*
)
);
size
=
sizeof
(
struct
dirent
)
+
strlen
(
p_content
->
d_name
)
+
1
;
pp_list
[
ret
]
=
malloc
(
size
);
memcpy
(
pp_list
[
ret
],
p_content
,
size
);
ret
++
;
if
(
pp_list
[
ret
]
)
{
memcpy
(
pp_list
[
ret
],
p_content
,
size
);
ret
++
;
}
else
{
/* Continuing is useless when no more memory can be allocted,
* so better return what we have found.
*/
ret
=
-
1
;
break
;
}
}
vlc_closedir_wrapper
(
p_dir
);
...
...
@@ -912,7 +931,12 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
close
(
pi_stdin
[
0
]
);
*
pi_data
=
0
;
if
(
*
pp_data
)
free
(
*
pp_data
);
*
pp_data
=
NULL
;
*
pp_data
=
malloc
(
1025
);
/* +1 for \0 */
if
(
!*
pp_data
)
return
-
1
;
while
(
!
p_object
->
b_die
)
{
...
...
@@ -996,7 +1020,7 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
BOOL
bFuncRetn
=
FALSE
;
HANDLE
hChildStdinRd
,
hChildStdinWr
,
hChildStdoutRd
,
hChildStdoutWr
;
DWORD
i_status
;
char
*
psz_cmd
,
*
p_env
,
*
p
;
char
*
psz_cmd
=
NULL
,
*
p_env
=
NULL
,
*
p
=
NULL
;
char
**
ppsz_parser
;
int
i_size
;
...
...
@@ -1039,6 +1063,8 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
/* Set up the command line. */
psz_cmd
=
malloc
(
32768
);
if
(
!
psz_cmd
)
return
-
1
;
psz_cmd
[
0
]
=
'\0'
;
i_size
=
32768
;
ppsz_parser
=
&
ppsz_argv
[
0
];
...
...
@@ -1066,6 +1092,12 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
/* Set up the environment. */
p
=
p_env
=
malloc
(
32768
);
if
(
!
p
)
{
free
(
psz_cmd
);
return
-
1
;
}
i_size
=
32768
;
ppsz_parser
=
&
ppsz_env
[
0
];
while
(
*
ppsz_parser
!=
NULL
&&
i_size
>
0
)
...
...
@@ -1118,6 +1150,9 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
/* Read output from the child process. */
*
pi_data
=
0
;
if
(
*
pp_data
)
free
(
pp_data
);
*
pp_data
=
NULL
;
*
pp_data
=
malloc
(
1025
);
/* +1 for \0 */
while
(
!
p_object
->
b_die
)
...
...
@@ -1151,6 +1186,5 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char **ppsz_argv,
#endif
(
*
pp_data
)[
*
pi_data
]
=
'\0'
;
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