Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-07 21:06:06 -0600
committerDan McGee <dan@archlinux.org>2011-01-07 21:15:47 -0600
commit62f5da377920c4e7823c4f8b8fb3673c9c2739e9 (patch)
tree3496e43e7161e765680daac4f0f56efe1dae754b /lib/libalpm/util.c
parentf966f3a8344cd96bd675c79a5c470c66920b890c (diff)
Fix some more simple conversion "errors"
None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 5f7512fb..2eee5e4a 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -668,7 +668,7 @@ int _alpm_lstat(const char *path, struct stat *buf)
{
int ret;
char *newpath = strdup(path);
- int len = strlen(newpath);
+ size_t len = strlen(newpath);
/* strip the trailing slash if one exists */
if(len != 0 && newpath[len - 1] == '/') {
@@ -815,7 +815,8 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
b->line_size = b->block_size + 1;
b->line_offset = b->line;
} else {
- size_t needed = (b->line_offset - b->line) + (i - b->block_offset) + 1;
+ size_t needed = (size_t)((b->line_offset - b->line)
+ + (i - b->block_offset) + 1);
if(needed > b->max_line_size) {
RET_ERR(PM_ERR_MEMORY, -1);
}
@@ -832,7 +833,7 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
}
if(done) {
- size_t len = i - b->block_offset;
+ size_t len = (size_t)(i - b->block_offset);
memcpy(b->line_offset, b->block_offset, len);
b->line_offset[len] = '\0';
b->block_offset = ++i;
@@ -840,7 +841,7 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
return(ARCHIVE_OK);
} else {
/* we've looked through the whole block but no newline, copy it */
- size_t len = b->block + b->block_size - b->block_offset;
+ size_t len = (size_t)(b->block + b->block_size - b->block_offset);
memcpy(b->line_offset, b->block_offset, len);
b->line_offset += len;
b->block_offset = i;