Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
lvzhengyang
git2
Commits
b57c176a
Commit
b57c176a
authored
Jul 05, 2016
by
Edward Thomson
Committed by
GitHub
Jul 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3846 from rkrp/fix_bug_parsing_int64min
Fixed bug while parsing INT64_MIN
parents
d8243465
70b9b841
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
src/util.c
+3
-3
tests/core/strtol.c
+8
-0
No files found.
src/util.c
View file @
b57c176a
...
...
@@ -128,8 +128,8 @@ int git__strntol64(int64_t *result, const char *nptr, size_t nptr_len, const cha
v
=
c
-
'A'
+
10
;
if
(
v
>=
base
)
break
;
nn
=
n
*
base
+
v
;
if
(
nn
<
n
)
nn
=
n
*
base
+
(
neg
?
-
v
:
v
)
;
if
(
(
!
neg
&&
nn
<
n
)
||
(
neg
&&
nn
>
n
)
)
ovfl
=
1
;
n
=
nn
;
}
...
...
@@ -148,7 +148,7 @@ Return:
return
-
1
;
}
*
result
=
n
eg
?
-
n
:
n
;
*
result
=
n
;
return
0
;
}
...
...
tests/core/strtol.c
View file @
b57c176a
...
...
@@ -33,5 +33,13 @@ void test_core_strtol__int64(void)
cl_assert
(
i
==
2147483657LL
);
cl_git_pass
(
git__strtol64
(
&
i
,
" -2147483657 "
,
NULL
,
10
));
cl_assert
(
i
==
-
2147483657LL
);
cl_git_pass
(
git__strtol64
(
&
i
,
" 9223372036854775807 "
,
NULL
,
10
));
cl_assert
(
i
==
INT64_MAX
);
cl_git_pass
(
git__strtol64
(
&
i
,
" -9223372036854775808 "
,
NULL
,
10
));
cl_assert
(
i
==
INT64_MIN
);
cl_git_pass
(
git__strtol64
(
&
i
,
" 0x7fffffffffffffff "
,
NULL
,
16
));
cl_assert
(
i
==
INT64_MAX
);
cl_git_pass
(
git__strtol64
(
&
i
,
" -0x8000000000000000 "
,
NULL
,
16
));
cl_assert
(
i
==
INT64_MIN
);
}
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