summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-23 09:20:17 -0700
committerRussell Belfer <rb@github.com>2012-08-23 09:20:17 -0700
commite9ca852e4d77e1b1723a2dceddfa2037677e2fb4 (patch)
treebb1d939d73ce2c2bd9d3001c643bcf28602a8271 /src
parent85bd17462662905dfdf9247b262480280a616ad4 (diff)
downloadlibgit2-e9ca852e4d77e1b1723a2dceddfa2037677e2fb4.tar.gz
Fix warnings and merge issues on Win64
Diffstat (limited to 'src')
-rw-r--r--src/message.c2
-rw-r--r--src/repository.c28
-rw-r--r--src/transports/http.c2
-rw-r--r--src/win32/posix.h8
4 files changed, 10 insertions, 30 deletions
diff --git a/src/message.c b/src/message.c
index e6dedc9fb..791b69455 100644
--- a/src/message.c
+++ b/src/message.c
@@ -82,5 +82,5 @@ int git_message_prettify(char *message_out, size_t buffer_size, const char *mess
done:
git_buf_free(&buf);
- return out_size;
+ return (int)out_size;
}
diff --git a/src/repository.c b/src/repository.c
index 8005797b2..bf19d0706 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1328,39 +1328,27 @@ int git_repository_message(char *buffer, size_t len, git_repository *repo)
{
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
struct stat st;
- ssize_t size;
int error;
if (git_buf_joinpath(&path, repo->path_repository, MERGE_MSG_FILE) < 0)
return -1;
- error = p_stat(git_buf_cstr(&path), &st);
- if (error < 0) {
+ if ((error = p_stat(git_buf_cstr(&path), &st)) < 0) {
if (errno == ENOENT)
error = GIT_ENOTFOUND;
-
- git_buf_free(&path);
- return error;
}
-
- if (buffer == NULL) {
- git_buf_free(&path);
- return (int)st.st_size;
+ else if (buffer != NULL) {
+ error = git_futils_readbuffer(&buf, git_buf_cstr(&path));
+ git_buf_copy_cstr(buffer, len, &buf);
}
- if (git_futils_readbuffer(&buf, git_buf_cstr(&path)) < 0)
- goto on_error;
-
- memcpy(buffer, git_buf_cstr(&buf), len);
- size = git_buf_len(&buf);
-
git_buf_free(&path);
git_buf_free(&buf);
- return size;
-on_error:
- git_buf_free(&path);
- return -1;
+ if (!error)
+ error = (int)st.st_size + 1; /* add 1 for NUL byte */
+
+ return error;
}
int git_repository_message_remove(git_repository *repo)
diff --git a/src/transports/http.c b/src/transports/http.c
index 85fec413a..ce382c3ad 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -233,7 +233,7 @@ static int http_recv_cb(gitno_buffer *buf)
if (t->error < 0)
return t->error;
- return buf->offset - old_len;
+ return (int)(buf->offset - old_len);
}
/* Set up the gitno_buffer so calling gitno_recv() grabs data from the HTTP response */
diff --git a/src/win32/posix.h b/src/win32/posix.h
index def3a766a..14caae418 100644
--- a/src/win32/posix.h
+++ b/src/win32/posix.h
@@ -19,14 +19,6 @@ GIT_INLINE(int) p_link(const char *old, const char *new)
return -1;
}
-GIT_INLINE(int) p_symlink(const char *old, const char *new)
-{
- GIT_UNUSED(old);
- GIT_UNUSED(new);
- errno = ENOSYS;
- return -1;
-}
-
GIT_INLINE(int) p_mkdir(const char *path, mode_t mode)
{
wchar_t* buf = gitwin_to_utf16(path);