Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
83d33207
Commit
83d33207
authored
Apr 29, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenBSDish strlcpy()
parent
0a930be2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
8 deletions
+45
-8
configure.ac
configure.ac
+1
-1
include/vlc_common.h
include/vlc_common.h
+7
-0
include/vlc_symbols.h
include/vlc_symbols.h
+3
-0
modules/access/smb.c
modules/access/smb.c
+2
-6
src/extras/libc.c
src/extras/libc.c
+32
-1
No files found.
configure.ac
View file @
83d33207
...
...
@@ -404,7 +404,7 @@ CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcd
dnl Check for system libs needed
need_libc=false
AC_CHECK_FUNCS(gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat)
AC_CHECK_FUNCS(gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat
strlcpy
)
dnl Check for usual libc functions
AC_CHECK_FUNCS(strdup strndup atof)
...
...
include/vlc_common.h
View file @
83d33207
...
...
@@ -846,6 +846,13 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# define vlc_strndup NULL
#endif
#ifndef HAVE_STRLCPY
# define strlcpy vlc_strlcpy
VLC_EXPORT
(
size_t
,
vlc_strlcpy
,
(
char
*
,
const
char
*
,
size_t
)
);
#elif !defined(__PLUGIN__)
# define vlc_strlcpy NULL
#endif
#ifndef HAVE_ATOF
# define atof vlc_atof
VLC_EXPORT
(
double
,
vlc_atof
,
(
const
char
*
nptr
)
);
...
...
include/vlc_symbols.h
View file @
83d33207
...
...
@@ -491,6 +491,7 @@ struct module_symbols_t
char
*
(
*
decode_URI_duplicate_inner
)
(
const
char
*
psz
);
void
(
*
decode_URI_inner
)
(
char
*
psz
);
char
*
(
*
encode_URI_component_inner
)
(
const
char
*
psz
);
size_t
(
*
vlc_strlcpy_inner
)
(
char
*
,
const
char
*
,
size_t
);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...
...
@@ -962,6 +963,7 @@ struct module_symbols_t
# define decode_URI_duplicate (p_symbols)->decode_URI_duplicate_inner
# define decode_URI (p_symbols)->decode_URI_inner
# define encode_URI_component (p_symbols)->encode_URI_component_inner
# define vlc_strlcpy (p_symbols)->vlc_strlcpy_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...
...
@@ -1436,6 +1438,7 @@ struct module_symbols_t
((p_symbols)->decode_URI_duplicate_inner) = decode_URI_duplicate; \
((p_symbols)->decode_URI_inner) = decode_URI; \
((p_symbols)->encode_URI_component_inner) = encode_URI_component; \
((p_symbols)->vlc_strlcpy_inner) = vlc_strlcpy; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__stats_CounterGet_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
...
...
modules/access/smb.c
View file @
83d33207
...
...
@@ -457,18 +457,14 @@ static void Win32AddConnection( access_t *p_access, char *psz_path,
net_resource
.
dwType
=
RESOURCETYPE_DISK
;
/* Find out server and share names */
strncpy
(
psz_server
,
psz_path
,
sizeof
(
psz_server
)
);
psz_server
[
sizeof
(
psz_server
)
-
1
]
=
'\0'
;
strlcpy
(
psz_server
,
psz_path
,
sizeof
(
psz_server
)
);
psz_share
[
0
]
=
0
;
psz_parser
=
strchr
(
psz_path
,
'/'
);
if
(
psz_parser
)
{
char
*
psz_parser2
=
strchr
(
++
psz_parser
,
'/'
);
if
(
psz_parser2
)
{
strncpy
(
psz_share
,
psz_parser
,
sizeof
(
psz_share
)
);
psz_parse
[
sizeof
(
psz_parse
)
-
1
]
=
'\0'
;
}
strlcpy
(
psz_share
,
psz_parser
,
sizeof
(
psz_share
)
);
}
sprintf
(
psz_remote
,
"
\\\\
%s
\\
%s"
,
psz_server
,
psz_share
);
...
...
src/extras/libc.c
View file @
83d33207
/*****************************************************************************
* libc.c: Extra libc function for some systems.
*****************************************************************************
* Copyright (C) 2002 the VideoLAN team
* Copyright (C) 2002
-2006
the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
...
...
@@ -9,6 +9,7 @@
* Gildas Bazin <gbazin@videolan.org>
* Derk-Jan Hartman <hartman at videolan dot org>
* Christophe Massiot <massiot@via.ecp.fr>
* Rémi Denis-Courmont <rem à videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -356,6 +357,36 @@ lldiv_t vlc_lldiv( long long numer, long long denom )
}
#endif
/**
* Copy a string to a sized buffer. The result is always nul-terminated
* (contrary to strncpy()).
*
* @param dest destination buffer
* @param src string to be copied
* @param len maximum number of characters to be copied plus one for the
* terminating nul.
*
* @return strlen(src)
*/
#ifndef HAVE_STRLCPY
extern
size_t
vlc_strlcpy
(
char
*
tgt
,
const
char
*
src
,
size_t
bufsize
)
{
size_t
length
;
for
(
length
=
1
;
(
length
<
bufsize
)
&&
*
src
;
length
++
)
*
tgt
++
=
*
src
++
;
if
(
bufsize
)
*
tgt
=
'\0'
;
while
(
*
src
++
)
length
++
;
return
length
-
1
;
}
#endif
/*****************************************************************************
* vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\'
...
...
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