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
2fb520f1
Commit
2fb520f1
authored
Jun 28, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #277 from schu/sign-compare
Fix warning: signed and unsigned type in cond expr
parents
d5afc039
7b608b3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
16 deletions
+5
-16
src/blob.c
+5
-16
No files found.
src/blob.c
View file @
2fb520f1
...
...
@@ -99,20 +99,12 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
}
islnk
=
S_ISLNK
(
st
.
st_mode
);
size
=
st
.
st_size
;
if
(
!
islnk
)
{
if
(
!
islnk
)
if
((
fd
=
gitfo_open
(
full_path
,
O_RDONLY
))
<
0
)
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to create blob. Could not open '%s'"
,
full_path
);
if
((
size
=
gitfo_size
(
fd
))
<
0
||
!
git__is_sizet
(
size
))
{
gitfo_close
(
fd
);
return
git__throw
(
GIT_EOSERR
,
"Failed to create blob. '%s' appears to be corrupted"
,
full_path
);
}
}
else
{
size
=
st
.
st_size
;
}
if
((
error
=
git_odb_open_wstream
(
&
stream
,
repo
->
db
,
(
size_t
)
size
,
GIT_OBJ_BLOB
))
<
GIT_SUCCESS
)
{
if
(
!
islnk
)
gitfo_close
(
fd
);
...
...
@@ -123,9 +115,9 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
ssize_t
read_len
;
if
(
!
islnk
)
read_len
=
gitfo_read
(
fd
,
buffer
,
(
size_t
)(
size
<
sizeof
(
buffer
)
?
size
:
sizeof
(
buffer
)
));
read_len
=
gitfo_read
(
fd
,
buffer
,
sizeof
(
buffer
));
else
read_len
=
gitfo_readlink
(
full_path
,
buffer
,
(
size_t
)
size
);
read_len
=
gitfo_readlink
(
full_path
,
buffer
,
sizeof
(
buffer
)
);
if
(
read_len
<
0
)
{
if
(
!
islnk
)
...
...
@@ -143,9 +135,6 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
if
(
!
islnk
)
gitfo_close
(
fd
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to create blob"
);
return
GIT_SUCCESS
;
return
error
==
GIT_SUCCESS
?
GIT_SUCCESS
:
git__rethrow
(
error
,
"Failed to create blob"
);
}
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