summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blob.c2
-rw-r--r--src/config_file.c19
-rw-r--r--src/filebuf.c16
-rw-r--r--src/indexer.c5
-rw-r--r--src/mwindow.c2
-rw-r--r--src/odb_loose.c10
-rw-r--r--src/pack.c2
-rw-r--r--src/util.c4
-rw-r--r--src/util.h2
9 files changed, 33 insertions, 29 deletions
diff --git a/src/blob.c b/src/blob.c
index b8282e505..0f4fa1869 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -36,7 +36,7 @@ const void *git_blob_rawcontent(git_blob *blob)
return blob->odb_object->raw.data;
}
-int git_blob_rawsize(git_blob *blob)
+size_t git_blob_rawsize(git_blob *blob)
{
assert(blob);
return blob->odb_object->raw.len;
diff --git a/src/config_file.c b/src/config_file.c
index 520a806b5..7fb54a6c0 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -135,7 +135,7 @@ static int cvar_match_section(const char *local, const char *input)
{
char *first_dot;
char *local_sp = strchr(local, ' ');
- int comparison_len;
+ size_t comparison_len;
/*
* If the local section name doesn't contain a space, then we can
@@ -198,7 +198,8 @@ static int cvar_normalize_name(cvar_t *var, char **output)
{
char *section_sp = strchr(var->section, ' ');
char *quote, *name;
- int len, ret;
+ size_t len;
+ int ret;
/*
* The final string is going to be at most one char longer than
@@ -245,7 +246,7 @@ static int cvar_normalize_name(cvar_t *var, char **output)
static char *interiorize_section(const char *orig)
{
char *dot, *last_dot, *section, *ret;
- int len;
+ size_t len;
dot = strchr(orig, '.');
last_dot = strrchr(orig, '.');
@@ -530,7 +531,7 @@ static char *cfg_readline(diskfile_backend *cfg)
{
char *line = NULL;
char *line_src, *line_end;
- int line_len;
+ size_t line_len;
line_src = cfg->reader.read_ptr;
@@ -538,9 +539,9 @@ static char *cfg_readline(diskfile_backend *cfg)
while (isspace(*line_src))
++line_src;
- line_end = strchr(line_src, '\n');
+ line_end = strchr(line_src, '\n');
- /* no newline at EOF */
+ /* no newline at EOF */
if (line_end == NULL)
line_end = strchr(line_src, 0);
@@ -600,7 +601,8 @@ GIT_INLINE(int) config_keychar(int c)
static int parse_section_header_ext(const char *line, const char *base_name, char **section_name)
{
- int buf_len, total_len, pos, rpos;
+ size_t buf_len, total_len;
+ int pos, rpos;
int c, ret;
char *subsection, *first_quote, *last_quote;
int error = GIT_SUCCESS;
@@ -1100,7 +1102,8 @@ static int is_multiline_var(const char *str)
static int parse_multiline_variable(diskfile_backend *cfg, const char *first, char **out)
{
char *line = NULL, *end;
- int error = GIT_SUCCESS, len, ret;
+ int error = GIT_SUCCESS, ret;
+ size_t len;
char *buf;
/* Check that the next line exists */
diff --git a/src/filebuf.c b/src/filebuf.c
index 6d398a7db..e8c5087b7 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -116,24 +116,24 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
z_stream *zs = &file->zs;
if (len > 0 || file->flush_mode == Z_FINISH) {
- zs->next_in = (void *)source;
- zs->avail_in = len;
+ zs->next_in = source;
+ zs->avail_in = (uInt)len;
do {
- int have;
+ size_t have;
zs->next_out = file->z_buf;
- zs->avail_out = file->buf_size;
+ zs->avail_out = (uInt)file->buf_size;
- result = deflate(zs, file->flush_mode);
- assert(result != Z_STREAM_ERROR);
+ result = deflate(zs, file->flush_mode);
+ assert(result != Z_STREAM_ERROR);
- have = file->buf_size - zs->avail_out;
+ have = file->buf_size - (size_t)zs->avail_out;
if (p_write(file->fd, file->z_buf, have) < GIT_SUCCESS)
return git__throw(GIT_EOSERR, "Failed to write to file");
- } while (zs->avail_out == 0);
+ } while (zs->avail_out == 0);
assert(zs->avail_in == 0);
diff --git a/src/indexer.c b/src/indexer.c
index 3934250e2..eb7d9d4c6 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -99,7 +99,7 @@ static int cache_cmp(const void *a, const void *b)
int git_indexer_new(git_indexer **out, const char *packname)
{
git_indexer *idx;
- unsigned int namelen;
+ size_t namelen;
int ret, error;
assert(out && packname);
@@ -186,7 +186,8 @@ static void index_path(char *path, git_indexer *idx)
int git_indexer_write(git_indexer *idx)
{
git_mwindow *w = NULL;
- int error, namelen;
+ int error;
+ size_t namelen;
unsigned int i, long_offsets = 0, left;
struct git_pack_idx_header hdr;
char filename[GIT_PATH_MAX];
diff --git a/src/mwindow.c b/src/mwindow.c
index 585d75c12..b25921896 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -35,7 +35,7 @@
: 32 * 1024 * 1024)
#define DEFAULT_MAPPED_LIMIT \
- ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256))
+ ((1024 * 1024) * (sizeof(void*) >= 8 ? 8192ULL : 256UL))
/*
* We need this because each process is only allowed a specific amount
diff --git a/src/odb_loose.c b/src/odb_loose.c
index a3a4e5b56..e6aecc668 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -183,19 +183,19 @@ static void init_stream(z_stream *s, void *out, size_t len)
{
memset(s, 0, sizeof(*s));
s->next_out = out;
- s->avail_out = len;
+ s->avail_out = (uInt)len;
}
static void set_stream_input(z_stream *s, void *in, size_t len)
{
s->next_in = in;
- s->avail_in = len;
+ s->avail_in = (uInt)len;
}
static void set_stream_output(z_stream *s, void *out, size_t len)
{
s->next_out = out;
- s->avail_out = len;
+ s->avail_out = (uInt)len;
}
@@ -243,10 +243,10 @@ static int inflate_buffer(void *in, size_t inlen, void *out, size_t outlen)
memset(&zs, 0x0, sizeof(zs));
zs.next_out = out;
- zs.avail_out = outlen;
+ zs.avail_out = (uInt)outlen;
zs.next_in = in;
- zs.avail_in = inlen;
+ zs.avail_in = (uInt)inlen;
if (inflateInit(&zs) < Z_OK)
return git__throw(GIT_ERROR, "Failed to inflate buffer");
diff --git a/src/pack.c b/src/pack.c
index d882516be..d5e069a93 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -404,7 +404,7 @@ int packfile_unpack_compressed(
memset(&stream, 0, sizeof(stream));
stream.next_out = buffer;
- stream.avail_out = size + 1;
+ stream.avail_out = (uInt)size + 1;
st = inflateInit(&stream);
if (st != Z_OK) {
diff --git a/src/util.c b/src/util.c
index 29bf755f8..a171f652c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -118,9 +118,9 @@ Return:
return GIT_SUCCESS;
}
-void git__strntolower(char *str, int len)
+void git__strntolower(char *str, size_t len)
{
- int i;
+ size_t i;
for (i = 0; i < len; ++i) {
str[i] = (char) tolower(str[i]);
diff --git a/src/util.h b/src/util.h
index 78f9f8276..2b009792d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -90,7 +90,7 @@ GIT_INLINE(int) git__is_sizet(git_off_t p)
extern char *git__strtok(char **end, const char *sep);
-extern void git__strntolower(char *str, int len);
+extern void git__strntolower(char *str, size_t len);
extern void git__strtolower(char *str);
extern int git__fnmatch(const char *pattern, const char *name, int flags);