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
bea54842
Commit
bea54842
authored
May 19, 2011
by
Jakob Pfender
Committed by
Vicent Marti
May 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oid.c: Move to new error handling mechanism
parent
f84d9819
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/oid.c
+6
-6
No files found.
src/oid.c
View file @
bea54842
...
...
@@ -56,7 +56,7 @@ int git_oid_mkstr(git_oid *out, const char *str)
int
v
=
(
from_hex
[(
unsigned
char
)
str
[
0
]]
<<
4
)
|
from_hex
[(
unsigned
char
)
str
[
1
]];
if
(
v
<
0
)
return
GIT_ENOTOID
;
return
git__throw
(
GIT_ENOTOID
,
"Failed to generate sha1. Given string is not a valid sha1 hash"
)
;
out
->
id
[
p
]
=
(
unsigned
char
)
v
;
}
return
GIT_SUCCESS
;
...
...
@@ -127,16 +127,16 @@ int git__parse_oid(git_oid *oid, const char **buffer_out,
const
char
*
buffer
=
*
buffer_out
;
if
(
buffer
+
(
header_len
+
sha_len
+
1
)
>
buffer_end
)
return
GIT_EOBJCORRUPTED
;
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to parse OID. Buffer too small"
)
;
if
(
memcmp
(
buffer
,
header
,
header_len
)
!=
0
)
return
GIT_EOBJCORRUPTED
;
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to parse OID. Buffer and header do not match"
)
;
if
(
buffer
[
header_len
+
sha_len
]
!=
'\n'
)
return
GIT_EOBJCORRUPTED
;
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to parse OID. Buffer not terminated correctly"
)
;
if
(
git_oid_mkstr
(
oid
,
buffer
+
header_len
)
<
GIT_SUCCESS
)
return
GIT_EOBJCORRUPTED
;
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to parse OID. Failed to generate sha1"
)
;
*
buffer_out
=
buffer
+
(
header_len
+
sha_len
+
1
);
...
...
@@ -312,7 +312,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
trie_node
*
node
;
if
(
c
==
-
1
)
return
GIT_ENOTOID
;
return
git__throw
(
GIT_ENOTOID
,
"Failed to shorten OID. Invalid hex value"
)
;
node
=
&
os
->
nodes
[
idx
];
...
...
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