Commit 3f3f6225 by Vicent Martí

Merge pull request #391 from sschuberth/development

Warning fixes
parents 564f0f7b bac47f1f
......@@ -61,6 +61,7 @@ ok Pierre Habouzit <madcoder@debian.org>
ok Pieter de Bie <pdebie@ai.rug.nl>
ok René Scharfe <rene.scharfe@lsrfire.ath.cx>
ign Robert Shearman <rob@codeweavers.com> (imap-send)
ok Sebastian Schuberth <sschuberth@gmail.com>
ok Shawn O. Pearce <spearce@spearce.org>
ok Steffen Prohaska <prohaska@zib.de>
ok Sven Verdoolaege <skimo@kotnet.org>
......@@ -106,7 +106,7 @@ GIT_EXTERN(const void *) git_blob_rawcontent(git_blob *blob);
* @param blob pointer to the blob
* @return size on bytes
*/
GIT_EXTERN(int) git_blob_rawsize(git_blob *blob);
GIT_EXTERN(size_t) git_blob_rawsize(git_blob *blob);
/**
* Read a file from the working folder of a repository
......
......@@ -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;
......
......@@ -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;
......@@ -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 */
......
......@@ -116,19 +116,19 @@ 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);
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");
......
......@@ -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];
......
......@@ -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
......
......@@ -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");
......
......@@ -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) {
......
......@@ -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]);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment