index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/conflict.c | 4 | ||||
-rw-r--r-- | lib/libalpm/db.c | 2 | ||||
-rw-r--r-- | lib/libalpm/deps.c | 5 | ||||
-rw-r--r-- | lib/libalpm/diskspace.c | 20 | ||||
-rw-r--r-- | lib/libalpm/dload.c | 2 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 2 | ||||
-rw-r--r-- | lib/libalpm/util.c | 9 | ||||
-rw-r--r-- | src/pacman/package.c | 2 | ||||
-rw-r--r-- | src/pacman/pacman.c | 6 | ||||
-rw-r--r-- | src/pacman/query.c | 8 | ||||
-rw-r--r-- | src/pacman/sync.c | 2 | ||||
-rw-r--r-- | src/pacman/util.c | 15 | ||||
-rw-r--r-- | src/util/pactree.c | 2 |
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 0e4d6df2..0eaf4373 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -425,8 +425,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, continue; } - double percent = (double)current / numtargs; - PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100), + double percent = (double)current / (double)numtargs; + PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (int)(percent * 100), numtargs, current); /* CHECK 1: check every target against every target */ _alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s\n", diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index c1be7ec7..bf9a70d4 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -172,7 +172,7 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url) alpm_list_t *i; int found = 0; char *newurl; - int len = 0; + size_t len = 0; ALPM_LOG_FUNC; diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 1bf2e87f..3d4b1df4 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -350,8 +350,9 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) /* This is a bit tricker than the old code for performance reasons. To * prevent the need to copy and duplicate strings, strncmp only the name * portion if they are the same length, since there is a version and - * operator in play here. */ - size_t namelen = provver - provision; + * operator in play here. Cast is to silence sign conversion warning; + * we know provver >= provision if we are here. */ + size_t namelen = (size_t)(provver - provision); provver += 1; satisfy = (strlen(dep->name) == namelen && strncmp(provision, dep->name, namelen) == 0 diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index 5c9f74e5..87dca84f 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -178,7 +178,7 @@ static int calculate_removed_size(const alpm_list_t *mount_points, } data = mp->data; - data->blocks_needed -= ceil((double)(st.st_size) / + data->blocks_needed -= (long)ceil((double)(st.st_size) / (double)(data->fsp.f_bsize)); data->used = 1; } @@ -229,7 +229,7 @@ static int calculate_installed_size(const alpm_list_t *mount_points, } data = mp->data; - data->blocks_needed += ceil((double)(archive_entry_size(entry)) / + data->blocks_needed += (long)ceil((double)(archive_entry_size(entry)) / (double)(data->fsp.f_bsize)); data->used = 1; } @@ -243,12 +243,12 @@ cleanup: int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) { alpm_list_t *mount_points, *i; - size_t replaces = 0, current = 0; + size_t replaces = 0, current = 0, numtargs; int abort = 0; alpm_list_t *targ; pmpkg_t *pkg; - size_t numtargs = alpm_list_count(trans->add); + numtargs = alpm_list_count(trans->add); mount_points = mount_point_list(); if(mount_points == NULL) { _alpm_log(PM_LOG_ERROR, _("could not determine filesystem mount points")); @@ -259,8 +259,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) if(replaces) { numtargs += replaces; for(targ = trans->remove; targ; targ = targ->next, current++) { - double percent = (double)current / numtargs; - PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (percent * 100), + double percent = (double)current / (double)numtargs; + PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (int)(percent * 100), numtargs, current); pkg = targ->data; @@ -269,8 +269,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) } for(targ = trans->add; targ; targ = targ->next, current++) { - double percent = (double)current / numtargs; - PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (percent * 100), + double percent = (double)current / (double)numtargs; + PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (int)(percent * 100), numtargs, current); pkg = targ->data; @@ -295,8 +295,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local) alpm_mountpoint_t *data = i->data; if(data->used == 1) { /* cushion is roughly min(5% capacity, 20MiB) */ - long fivepc = (data->fsp.f_blocks / 20) + 1; - long twentymb = (20 * 1024 * 1024 / data->fsp.f_bsize) + 1; + long fivepc = ((long)data->fsp.f_blocks / 20) + 1; + long twentymb = (20 * 1024 * 1024 / (long)data->fsp.f_bsize) + 1; long cushion = fivepc < twentymb ? fivepc : twentymb; _alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n", diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index e4b946d3..cb6d000c 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -247,7 +247,7 @@ static int download_internal(const char *url, const char *localpath, while((nread = fetchIO_read(dlf, buffer, PM_DLBUF_LEN)) > 0) { check_stop(); size_t nwritten = 0; - nwritten = fwrite(buffer, 1, nread, localf); + nwritten = fwrite(buffer, 1, (size_t)nread, localf); if((nwritten != (size_t)nread) || ferror(localf)) { pm_errno = PM_ERR_RETRIEVE; _alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"), diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index bcc8dc45..e1249fd6 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -431,7 +431,7 @@ int _alpm_remove_packages(pmtrans_t *trans, pmdb_t *db) /* update progress bar after each file */ percent = (double)position / (double)filenum; PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, - (double)(percent * 100), pkg_count, + (int)(percent * 100), pkg_count, (pkg_count - targcount + 1)); position++; } 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; diff --git a/src/pacman/package.c b/src/pacman/package.c index 19c2daf4..66f21b14 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -242,7 +242,7 @@ void dump_pkg_changelog(pmpkg_t *pkg) } else { /* allocate a buffer to get the changelog back in chunks */ char buf[CLBUF_SIZE]; - int ret = 0; + size_t ret = 0; while((ret = alpm_pkg_changelog_read(buf, CLBUF_SIZE, pkg, fp))) { if(ret < CLBUF_SIZE) { /* if we hit the end of the file, we need to add a null terminator */ diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 12b3810d..c33c5804 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -461,7 +461,7 @@ static int parsearg_global(int opt) case OP_ASK: check_optarg(); config->noask = 1; - config->ask = atoi(optarg); + config->ask = (unsigned int)atoi(optarg); break; case OP_CACHEDIR: check_optarg(); @@ -483,7 +483,7 @@ static int parsearg_global(int opt) * here, error and warning are set in config_new, though perhaps a * --quiet option will remove these later */ if(optarg) { - unsigned short debug = atoi(optarg); + unsigned short debug = (unsigned short)atoi(optarg); switch(debug) { case 2: config->logmask |= PM_LOG_FUNCTION; /* fall through */ @@ -1356,7 +1356,7 @@ int main(int argc, char *argv[]) if(!isatty(fileno(stdin))) { char line[PATH_MAX]; int i = 0; - while(i < PATH_MAX && (line[i] = fgetc(stdin)) != EOF) { + while(i < PATH_MAX && (line[i] = (char)fgetc(stdin)) != EOF) { if(isspace((unsigned char)line[i])) { /* avoid adding zero length arg when multiple spaces separate args */ if(i > 0) { diff --git a/src/pacman/query.c b/src/pacman/query.c index 04ef5e33..dea309a0 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -406,10 +406,10 @@ static int check(pmpkg_t *pkg) } if(!config->quiet) { - printf(_n("%s: %d total file, ", "%s: %d total files, ", allfiles), - pkgname, allfiles); - printf(_n("%d missing file\n", "%d missing files\n", errors), - errors); + printf(_n("%s: %d total file, ", "%s: %d total files, ", + (unsigned long)allfiles), pkgname, allfiles); + printf(_n("%d missing file\n", "%d missing files\n", + (unsigned long)errors), errors); } return(errors != 0 ? 1 : 0); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 3b94437b..278f15e5 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -346,7 +346,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) /* print the package size with the output if ShowSize option set */ if(!config->quiet && config->showsize) { /* Convert byte size to MB */ - double mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); + double mbsize = (double)alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); printf(" [%.2f MB]", mbsize); } diff --git a/src/pacman/util.c b/src/pacman/util.c index 4b53e931..4af639fd 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -275,7 +275,7 @@ char *strtoupper(char *str) char *ptr = str; while(*ptr) { - (*ptr) = toupper((unsigned char)*ptr); + (*ptr) = (char)toupper((unsigned char)*ptr); ptr++; } return str; @@ -355,7 +355,7 @@ char *strreplace(const char *str, const char *needle, const char *replace) q = alpm_list_getdata(i); if(q > p){ /* add chars between this occurence and last occurence, if any */ - strncpy(newp, p, q - p); + strncpy(newp, p, (size_t)(q - p)); newp += q - p; } strncpy(newp, replace, replacesz); @@ -389,7 +389,7 @@ alpm_list_t *strsplit(const char *str, const char splitchar) char *dup = NULL; while((str = strchr(str, splitchar))) { - dup = strndup(prev, str - prev); + dup = strndup(prev, (size_t)(str - prev)); if(dup == NULL) { return(NULL); } @@ -528,8 +528,7 @@ void display_targets(const alpm_list_t *pkgs, int install) /* print the package size with the output if ShowSize option set */ if(config->showsize) { - double mbsize = 0.0; - mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); + double mbsize = (double)alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); pm_asprintf(&str, "%s-%s [%.2f MB]", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg), mbsize); @@ -541,8 +540,8 @@ void display_targets(const alpm_list_t *pkgs, int install) } /* Convert byte sizes to MB */ - mbdlsize = dlsize / (1024.0 * 1024.0); - mbisize = isize / (1024.0 * 1024.0); + mbdlsize = (double)dlsize / (1024.0 * 1024.0); + mbisize = (double)isize / (1024.0 * 1024.0); if(install) { pm_asprintf(&str, _("Targets (%d):"), alpm_list_count(targets)); @@ -646,7 +645,7 @@ void print_packages(const alpm_list_t *packages) if(strstr(temp,"%s")) { char *size; double mbsize = 0.0; - mbsize = pkg_get_size(pkg) / (1024.0 * 1024.0); + mbsize = (double)pkg_get_size(pkg) / (1024.0 * 1024.0); pm_asprintf(&size, "%.2f", mbsize); string = strreplace(temp, "%s", size); free(size); diff --git a/src/util/pactree.c b/src/util/pactree.c index 3267e3d1..0ac3f246 100644 --- a/src/util/pactree.c +++ b/src/util/pactree.c @@ -116,7 +116,7 @@ static int parse_options(int argc, char *argv[]) break; case 'd': /* validate depth */ - max_depth = strtol(optarg, &endptr, 10); + max_depth = (int)strtol(optarg, &endptr, 10); if(*endptr != '\0') { fprintf(stderr, "error: invalid depth -- %s\n", optarg); return 1; |