Commit 26e74c6a by Sebastian Schuberth

Fix some random size_t vs. int conversion warnings

parent 564f0f7b
...@@ -106,7 +106,7 @@ GIT_EXTERN(const void *) git_blob_rawcontent(git_blob *blob); ...@@ -106,7 +106,7 @@ GIT_EXTERN(const void *) git_blob_rawcontent(git_blob *blob);
* @param blob pointer to the blob * @param blob pointer to the blob
* @return size on bytes * @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 * Read a file from the working folder of a repository
......
...@@ -36,7 +36,7 @@ const void *git_blob_rawcontent(git_blob *blob) ...@@ -36,7 +36,7 @@ const void *git_blob_rawcontent(git_blob *blob)
return blob->odb_object->raw.data; return blob->odb_object->raw.data;
} }
int git_blob_rawsize(git_blob *blob) size_t git_blob_rawsize(git_blob *blob)
{ {
assert(blob); assert(blob);
return blob->odb_object->raw.len; return blob->odb_object->raw.len;
......
...@@ -135,7 +135,7 @@ static int cvar_match_section(const char *local, const char *input) ...@@ -135,7 +135,7 @@ static int cvar_match_section(const char *local, const char *input)
{ {
char *first_dot; char *first_dot;
char *local_sp = strchr(local, ' '); 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 * 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) ...@@ -198,7 +198,8 @@ static int cvar_normalize_name(cvar_t *var, char **output)
{ {
char *section_sp = strchr(var->section, ' '); char *section_sp = strchr(var->section, ' ');
char *quote, *name; char *quote, *name;
int len, ret; size_t len;
int ret;
/* /*
* The final string is going to be at most one char longer than * 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) ...@@ -245,7 +246,7 @@ static int cvar_normalize_name(cvar_t *var, char **output)
static char *interiorize_section(const char *orig) static char *interiorize_section(const char *orig)
{ {
char *dot, *last_dot, *section, *ret; char *dot, *last_dot, *section, *ret;
int len; size_t len;
dot = strchr(orig, '.'); dot = strchr(orig, '.');
last_dot = strrchr(orig, '.'); last_dot = strrchr(orig, '.');
...@@ -530,7 +531,7 @@ static char *cfg_readline(diskfile_backend *cfg) ...@@ -530,7 +531,7 @@ static char *cfg_readline(diskfile_backend *cfg)
{ {
char *line = NULL; char *line = NULL;
char *line_src, *line_end; char *line_src, *line_end;
int line_len; size_t line_len;
line_src = cfg->reader.read_ptr; line_src = cfg->reader.read_ptr;
...@@ -600,7 +601,8 @@ GIT_INLINE(int) config_keychar(int c) ...@@ -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) 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; int c, ret;
char *subsection, *first_quote, *last_quote; char *subsection, *first_quote, *last_quote;
int error = GIT_SUCCESS; int error = GIT_SUCCESS;
...@@ -1100,7 +1102,8 @@ static int is_multiline_var(const char *str) ...@@ -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) static int parse_multiline_variable(diskfile_backend *cfg, const char *first, char **out)
{ {
char *line = NULL, *end; char *line = NULL, *end;
int error = GIT_SUCCESS, len, ret; int error = GIT_SUCCESS, ret;
size_t len;
char *buf; char *buf;
/* Check that the next line exists */ /* Check that the next line exists */
......
...@@ -99,7 +99,7 @@ static int cache_cmp(const void *a, const void *b) ...@@ -99,7 +99,7 @@ static int cache_cmp(const void *a, const void *b)
int git_indexer_new(git_indexer **out, const char *packname) int git_indexer_new(git_indexer **out, const char *packname)
{ {
git_indexer *idx; git_indexer *idx;
unsigned int namelen; size_t namelen;
int ret, error; int ret, error;
assert(out && packname); assert(out && packname);
...@@ -186,7 +186,8 @@ static void index_path(char *path, git_indexer *idx) ...@@ -186,7 +186,8 @@ static void index_path(char *path, git_indexer *idx)
int git_indexer_write(git_indexer *idx) int git_indexer_write(git_indexer *idx)
{ {
git_mwindow *w = NULL; git_mwindow *w = NULL;
int error, namelen; int error;
size_t namelen;
unsigned int i, long_offsets = 0, left; unsigned int i, long_offsets = 0, left;
struct git_pack_idx_header hdr; struct git_pack_idx_header hdr;
char filename[GIT_PATH_MAX]; char filename[GIT_PATH_MAX];
......
...@@ -118,9 +118,9 @@ Return: ...@@ -118,9 +118,9 @@ Return:
return GIT_SUCCESS; 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) { for (i = 0; i < len; ++i) {
str[i] = (char) tolower(str[i]); str[i] = (char) tolower(str[i]);
......
...@@ -90,7 +90,7 @@ GIT_INLINE(int) git__is_sizet(git_off_t p) ...@@ -90,7 +90,7 @@ GIT_INLINE(int) git__is_sizet(git_off_t p)
extern char *git__strtok(char **end, const char *sep); 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 void git__strtolower(char *str);
extern int git__fnmatch(const char *pattern, const char *name, int flags); 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