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
b2656b12
Commit
b2656b12
authored
Oct 01, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/extras/libc.c: strtoll() replacement when not available.
parent
2ba646a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
8 deletions
+75
-8
configure.ac
configure.ac
+1
-1
include/vlc_common.h
include/vlc_common.h
+7
-0
src/extras/libc.c
src/extras/libc.c
+67
-7
No files found.
configure.ac
View file @
b2656b12
...
@@ -297,7 +297,7 @@ CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcd
...
@@ -297,7 +297,7 @@ CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcd
dnl Check for system libs needed
dnl Check for system libs needed
need_libc=false
need_libc=false
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol strtof isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon)
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol strtof
strtoll
isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon)
dnl Check for usual libc functions
dnl Check for usual libc functions
AC_CHECK_FUNCS(strdup strndup atof lseek)
AC_CHECK_FUNCS(strdup strndup atof lseek)
...
...
include/vlc_common.h
View file @
b2656b12
...
@@ -780,6 +780,13 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
...
@@ -780,6 +780,13 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# define vlc_atoll NULL
# define vlc_atoll NULL
#endif
#endif
#ifndef HAVE_STRTOLL
# define strtoll vlc_strtoll
VLC_EXPORT
(
int64_t
,
vlc_strtoll
,
(
const
char
*
nptr
,
char
**
endptr
,
int
base
)
);
#elif !defined(__PLUGIN__)
# define vlc_strtoll NULL
#endif
#ifndef HAVE_GETENV
#ifndef HAVE_GETENV
# define getenv vlc_getenv
# define getenv vlc_getenv
VLC_EXPORT
(
char
*
,
vlc_getenv
,
(
const
char
*
name
)
);
VLC_EXPORT
(
char
*
,
vlc_getenv
,
(
const
char
*
name
)
);
...
...
src/extras/libc.c
View file @
b2656b12
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
*****************************************************************************/
*****************************************************************************/
#include <string.h>
/* strdup() */
#include <string.h>
/* strdup() */
#include <stdlib.h>
#include <stdlib.h>
#include <ctype.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
...
@@ -250,28 +251,87 @@ double vlc_atof( const char *nptr )
...
@@ -250,28 +251,87 @@ double vlc_atof( const char *nptr )
#endif
#endif
/*****************************************************************************
/*****************************************************************************
*
a
toll: convert a string to a 64 bits int.
*
str
toll: convert a string to a 64 bits int.
*****************************************************************************/
*****************************************************************************/
#if !defined( HAVE_
A
TOLL )
#if !defined( HAVE_
STR
TOLL )
int64_t
vlc_
atoll
(
const
char
*
str
)
int64_t
vlc_
strtoll
(
const
char
*
nptr
,
char
**
endptr
,
int
base
)
{
{
int64_t
i_value
=
0
;
int64_t
i_value
=
0
;
int
sign
=
1
;
int
sign
=
1
,
newbase
=
base
?
base
:
10
;
if
(
*
str
==
'-'
)
while
(
isspace
(
*
nptr
)
)
nptr
++
;
if
(
*
nptr
==
'-'
)
{
{
sign
=
-
1
;
sign
=
-
1
;
nptr
++
;
}
/* Try to detect base */
if
(
*
nptr
==
'0'
)
{
newbase
=
8
;
nptr
++
;
if
(
*
nptr
==
'x'
)
{
newbase
=
16
;
nptr
++
;
}
}
if
(
base
&&
newbase
!=
base
)
{
if
(
endptr
)
*
endptr
=
(
char
*
)
nptr
;
return
i_value
;
}
switch
(
newbase
)
{
case
10
:
while
(
*
nptr
>=
'0'
&&
*
nptr
<=
'9'
)
{
i_value
*=
10
;
i_value
+=
(
*
nptr
++
-
'0'
);
}
}
if
(
endptr
)
*
endptr
=
(
char
*
)
nptr
;
break
;
while
(
*
str
>=
'0'
&&
*
str
<=
'9'
)
case
16
:
while
(
(
*
nptr
>=
'0'
&&
*
nptr
<=
'9'
)
||
(
*
nptr
>=
'a'
&&
*
nptr
<=
'f'
)
||
(
*
nptr
>=
'A'
&&
*
nptr
<=
'F'
)
)
{
{
i_value
=
i_value
*
10
+
(
*
str
++
-
'0'
);
int
i_valc
=
0
;
if
(
*
nptr
>=
'0'
&&
*
nptr
<=
'9'
)
i_valc
=
*
nptr
-
'0'
;
else
if
(
*
nptr
>=
'a'
&&
*
nptr
<=
'f'
)
i_valc
=
*
nptr
-
'a'
+
10
;
else
if
(
*
nptr
>=
'A'
&&
*
nptr
<=
'F'
)
i_valc
=
*
nptr
-
'A'
+
10
;
i_value
*=
16
;
i_value
+=
i_valc
;
nptr
++
;
}
if
(
endptr
)
*
endptr
=
(
char
*
)
nptr
;
break
;
default:
i_value
=
strtol
(
nptr
,
endptr
,
newbase
);
break
;
}
}
return
i_value
*
sign
;
return
i_value
*
sign
;
}
}
#endif
#endif
/*****************************************************************************
* atoll: convert a string to a 64 bits int.
*****************************************************************************/
#if !defined( HAVE_ATOLL )
int64_t
vlc_atoll
(
const
char
*
nptr
)
{
return
strtoll
(
nptr
,
(
char
**
)
NULL
,
10
);
}
#endif
/*****************************************************************************
/*****************************************************************************
* lseek: reposition read/write file offset.
* lseek: reposition read/write file offset.
*****************************************************************************
*****************************************************************************
...
...
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