Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
bbde6a4a
Commit
bbde6a4a
authored
May 14, 2020
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time64: Silence compiler warnings about shadowed variable declarations
parent
84b71c90
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
time64.c
src/time64.c
+29
-29
No files found.
src/time64.c
View file @
bbde6a4a
...
...
@@ -346,11 +346,11 @@ static Year cycle_offset(Year year)
*/
static
int
safe_year
(
const
Year
year
)
{
int
safe_year
=
(
int
)
year
;
int
_safe_year
=
(
int
)
year
;
Year
year_cycle
;
if
(
year
>=
MIN_SAFE_YEAR
&&
year
<=
MAX_SAFE_YEAR
)
{
return
safe_year
;
return
_
safe_year
;
}
year_cycle
=
year
+
cycle_offset
(
year
);
...
...
@@ -374,18 +374,18 @@ static int safe_year(const Year year)
assert
(
year_cycle
>=
0
);
assert
(
year_cycle
<
SOLAR_CYCLE_LENGTH
);
if
(
year
<
MIN_SAFE_YEAR
)
safe_year
=
safe_years_low
[
year_cycle
];
_
safe_year
=
safe_years_low
[
year_cycle
];
else
if
(
year
>
MAX_SAFE_YEAR
)
safe_year
=
safe_years_high
[
year_cycle
];
_
safe_year
=
safe_years_high
[
year_cycle
];
else
assert
(
0
);
TIME64_TRACE3
(
"# year: %lld, year_cycle: %lld, safe_year: %d
\n
"
,
year
,
year_cycle
,
safe_year
);
year
,
year_cycle
,
_
safe_year
);
assert
(
safe_year
<=
MAX_SAFE_YEAR
&&
safe_year
>=
MIN_SAFE_YEAR
);
assert
(
_safe_year
<=
MAX_SAFE_YEAR
&&
_
safe_year
>=
MIN_SAFE_YEAR
);
return
safe_year
;
return
_
safe_year
;
}
...
...
@@ -519,17 +519,17 @@ static Time64_T seconds_between_years(Year left_year, Year right_year) {
Time64_T
mktime64
(
struct
TM
*
input_date
)
{
struct
tm
safe_date
;
struct
TM
date
;
Time64_T
time
;
Time64_T
time
v
;
Year
year
=
input_date
->
tm_year
+
1900
;
if
(
date_in_safe_range
(
input_date
,
&
SYSTEM_MKTIME_MIN
,
&
SYSTEM_MKTIME_MAX
)
)
{
copy_TM64_to_tm
(
input_date
,
&
safe_date
);
time
=
(
Time64_T
)
mktime
(
&
safe_date
);
time
v
=
(
Time64_T
)
mktime
(
&
safe_date
);
/* Correct the possibly out of bound input date */
copy_tm_to_TM64
(
&
safe_date
,
input_date
);
return
time
;
return
time
v
;
}
/* Have to make the year safe in date else it won't fit in safe_date */
...
...
@@ -537,14 +537,14 @@ Time64_T mktime64(struct TM *input_date) {
date
.
tm_year
=
safe_year
(
year
)
-
1900
;
copy_TM64_to_tm
(
&
date
,
&
safe_date
);
time
=
(
Time64_T
)
mktime
(
&
safe_date
);
time
v
=
(
Time64_T
)
mktime
(
&
safe_date
);
/* Correct the user's possibly out of bound input date */
copy_tm_to_TM64
(
&
safe_date
,
input_date
);
time
+=
seconds_between_years
(
year
,
(
Year
)(
safe_date
.
tm_year
+
1900
));
time
v
+=
seconds_between_years
(
year
,
(
Year
)(
safe_date
.
tm_year
+
1900
));
return
time
;
return
time
v
;
}
...
...
@@ -560,7 +560,7 @@ struct TM *gmtime64_r (const Time64_T *in_time, struct TM *p)
Time64_T
v_tm_tday
;
int
leap
;
Time64_T
m
;
Time64_T
time
=
*
in_time
;
Time64_T
time
v
=
*
in_time
;
Year
year
=
70
;
int
cycles
=
0
;
...
...
@@ -587,13 +587,13 @@ struct TM *gmtime64_r (const Time64_T *in_time, struct TM *p)
p
->
tm_zone
=
(
char
*
)
"UTC"
;
#endif
v_tm_sec
=
(
int
)(
time
%
60
);
time
/=
60
;
v_tm_min
=
(
int
)(
time
%
60
);
time
/=
60
;
v_tm_hour
=
(
int
)(
time
%
24
);
time
/=
24
;
v_tm_tday
=
time
;
v_tm_sec
=
(
int
)(
time
v
%
60
);
time
v
/=
60
;
v_tm_min
=
(
int
)(
time
v
%
60
);
time
v
/=
60
;
v_tm_hour
=
(
int
)(
time
v
%
24
);
time
v
/=
24
;
v_tm_tday
=
time
v
;
WRAP
(
v_tm_sec
,
v_tm_min
,
60
);
WRAP
(
v_tm_min
,
v_tm_hour
,
60
);
...
...
@@ -681,7 +681,7 @@ struct TM *gmtime64_r (const Time64_T *in_time, struct TM *p)
}
struct
TM
*
localtime64_r
(
const
Time64_T
*
time
,
struct
TM
*
local_tm
)
struct
TM
*
localtime64_r
(
const
Time64_T
*
time
v
,
struct
TM
*
local_tm
)
{
time_t
safe_time
;
struct
tm
safe_date
;
...
...
@@ -692,10 +692,10 @@ struct TM *localtime64_r (const Time64_T *time, struct TM *local_tm)
assert
(
local_tm
!=
NULL
);
/* Use the system localtime() if time_t is small enough */
if
(
SHOULD_USE_SYSTEM_LOCALTIME
(
*
time
)
)
{
safe_time
=
(
time_t
)
*
time
;
if
(
SHOULD_USE_SYSTEM_LOCALTIME
(
*
time
v
)
)
{
safe_time
=
(
time_t
)
*
time
v
;
TIME64_TRACE1
(
"Using system localtime for %lld
\n
"
,
*
time
);
TIME64_TRACE1
(
"Using system localtime for %lld
\n
"
,
*
time
v
);
LOCALTIME_R
(
&
safe_time
,
&
safe_date
);
...
...
@@ -705,8 +705,8 @@ struct TM *localtime64_r (const Time64_T *time, struct TM *local_tm)
return
local_tm
;
}
if
(
gmtime64_r
(
time
,
&
gm_tm
)
==
NULL
)
{
TIME64_TRACE1
(
"gmtime64_r returned null for %lld
\n
"
,
*
time
);
if
(
gmtime64_r
(
time
v
,
&
gm_tm
)
==
NULL
)
{
TIME64_TRACE1
(
"gmtime64_r returned null for %lld
\n
"
,
*
time
v
);
return
NULL
;
}
...
...
@@ -803,10 +803,10 @@ char *asctime64_r( const struct TM* date, char *result ) {
}
char
*
ctime64_r
(
const
Time64_T
*
time
,
char
*
result
)
{
char
*
ctime64_r
(
const
Time64_T
*
time
v
,
char
*
result
)
{
struct
TM
date
;
if
(
!
localtime64_r
(
time
,
&
date
))
if
(
!
localtime64_r
(
time
v
,
&
date
))
return
NULL
;
return
asctime64_r
(
&
date
,
result
);
...
...
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