aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-01-10 21:55:28 +0000
committerJason Woodward2005-01-10 21:55:28 +0000
commit0445f3e26d491b0250834f28a7ff97d798de2d3e (patch)
tree1180acaa77243d7c8e0859883edb3e0282a9f8fa /src
parenta024305995ab453105704d109bdcdafd0e6152b6 (diff)
downloadslapt-get-0445f3e26d491b0250834f28a7ff97d798de2d3e.tar.gz
changed int's in typedefs to unsigned where applicable
Diffstat (limited to 'src')
-rw-r--r--src/action.c26
-rw-r--r--src/action.h2
-rw-r--r--src/configuration.c4
-rw-r--r--src/configuration.h28
-rw-r--r--src/package.c30
-rw-r--r--src/package.h10
-rw-r--r--src/transaction.c15
7 files changed, 58 insertions, 57 deletions
diff --git a/src/action.c b/src/action.c
index e9b7a97..6b9b8d3 100644
--- a/src/action.c
+++ b/src/action.c
@@ -20,7 +20,7 @@
/* install pkg */
void pkg_action_install(const rc_config *global_config,const pkg_action_args_t *action_args){
- int i;
+ unsigned int i;
transaction_t tran;
struct pkg_list *installed_pkgs;
struct pkg_list *avail_pkgs;
@@ -145,7 +145,7 @@ void pkg_action_install(const rc_config *global_config,const pkg_action_args_t *
void pkg_action_list(void){
struct pkg_list *pkgs = NULL;
struct pkg_list *installed_pkgs = NULL;
- int i;
+ unsigned int i;
pkgs = get_available_pkgs();
installed_pkgs = get_installed_pkgs();
@@ -153,7 +153,7 @@ void pkg_action_list(void){
for(i = 0; i < pkgs->pkg_count; i++ ){
/* this should eliminate the printing of updates */
if( strstr(pkgs->pkgs[i]->description,"no description") == NULL ){
- int bool_installed = 0;
+ unsigned int bool_installed = 0;
char *short_description = gen_short_pkg_description(pkgs->pkgs[i]);
/* is it installed? */
@@ -181,7 +181,7 @@ void pkg_action_list(void){
/* list installed pkgs */
void pkg_action_list_installed(void){
- int i;
+ unsigned int i;
struct pkg_list *installed_pkgs = NULL;
installed_pkgs = get_installed_pkgs();
@@ -198,7 +198,7 @@ void pkg_action_list_installed(void){
/* remove/uninstall pkg */
void pkg_action_remove(const rc_config *global_config,const pkg_action_args_t *action_args){
- int i;
+ unsigned int i;
struct pkg_list *installed_pkgs;
struct pkg_list *available;
transaction_t tran;
@@ -211,7 +211,7 @@ void pkg_action_remove(const rc_config *global_config,const pkg_action_args_t *a
pkg_info_t *pkg;
if( (pkg = get_newest_pkg(installed_pkgs,action_args->pkgs[i])) != NULL){
- int c;
+ unsigned int c;
struct pkg_list *deps;
deps = is_required_by(global_config,available,pkg);
@@ -246,7 +246,7 @@ void pkg_action_remove(const rc_config *global_config,const pkg_action_args_t *a
/* search for a pkg (support extended POSIX regex) */
void pkg_action_search(const char *pattern){
- int i;
+ unsigned int i;
struct pkg_list *pkgs = NULL;
struct pkg_list *installed_pkgs = NULL;
struct pkg_list *matches = NULL;
@@ -306,7 +306,7 @@ void pkg_action_show(const char *pkg_name){
struct pkg_list *avail_pkgs;
struct pkg_list *installed_pkgs;
sg_regex pkg_regex;
- int bool_installed = 0;
+ unsigned int bool_installed = 0;
pkg_info_t *pkg = NULL;
avail_pkgs = get_available_pkgs();
@@ -388,7 +388,7 @@ void pkg_action_show(const char *pkg_name){
/* upgrade all installed pkgs with available updates */
void pkg_action_upgrade_all(const rc_config *global_config){
- int i;
+ unsigned int i;
struct pkg_list *installed_pkgs;
struct pkg_list *avail_pkgs;
transaction_t tran;
@@ -476,14 +476,14 @@ void pkg_action_upgrade_all(const rc_config *global_config){
/* remove obsolete packages if prompted to */
if( global_config->remove_obsolete == 1 ){
- int r;
+ unsigned int r;
for(r = 0; r < installed_pkgs->pkg_count; r++){
/* if we can't find the installed package in our available pkg list, it must be obsolete */
if( get_newest_pkg(avail_pkgs,installed_pkgs->pkgs[r]->name) == NULL ){
- struct pkg_list *deps;
- int c;
+ struct pkg_list *deps;
+ unsigned int c;
/*
any packages that require this package we are about to remove should be
scheduled to remove as well
@@ -585,7 +585,7 @@ pkg_action_args_t *init_pkg_action_args(int arg_count){
}
void free_pkg_action_args(pkg_action_args_t *paa){
- int i;
+ unsigned int i;
for(i = 0; i < paa->count; i++){
free(paa->pkgs[i]);
diff --git a/src/action.h b/src/action.h
index 5b1736b..ce7395b 100644
--- a/src/action.h
+++ b/src/action.h
@@ -18,7 +18,7 @@
typedef struct {
char **pkgs;
- int count;
+ unsigned int count;
} pkg_action_args_t;
pkg_action_args_t *init_pkg_action_args(int arg_count);
diff --git a/src/configuration.c b/src/configuration.c
index 9423233..1bd0c71 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -160,7 +160,7 @@ void working_dir_init(const rc_config *global_config){
}
void free_rc_config(rc_config *global_config){
- int i;
+ unsigned int i;
for(i = 0; i < global_config->exclude_list->count; i++){
free(global_config->exclude_list->excludes[i]);
@@ -173,7 +173,7 @@ void free_rc_config(rc_config *global_config){
static struct exclude_list *parse_exclude(char *line){
struct exclude_list *list;
- int position = 0, len = 0;
+ unsigned int position = 0, len = 0;
list = malloc( sizeof *list );
if( list == NULL ){
diff --git a/src/configuration.h b/src/configuration.h
index f90063f..cb04fa1 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -25,30 +25,30 @@
struct exclude_list {
char **excludes;
- int count;
+ unsigned int count;
};
struct source_list {
char url[MAX_SOURCES][MAX_SOURCE_URL_LEN];
- int count;
+ unsigned int count;
};
typedef struct {
struct source_list sources;
char working_dir[WORKINGDIR_TOKEN_LEN];
- int download_only;
- int dist_upgrade;
- int simulate;
- int no_prompt;
- int re_install;
+ unsigned int download_only;
+ unsigned int dist_upgrade;
+ unsigned int simulate;
+ unsigned int no_prompt;
+ unsigned int re_install;
struct exclude_list *exclude_list;
- int ignore_excludes;
- int no_md5_check;
- int ignore_dep;
- int disable_dep_check;
- int print_uris;
- int dl_stats;
- int remove_obsolete;
+ unsigned int ignore_excludes;
+ unsigned int no_md5_check;
+ unsigned int ignore_dep;
+ unsigned int disable_dep_check;
+ unsigned int print_uris;
+ unsigned int dl_stats;
+ unsigned int remove_obsolete;
} rc_config;
rc_config *read_rc_config(const char *file_name);
diff --git a/src/package.c b/src/package.c
index 0666256..cec2221 100644
--- a/src/package.c
+++ b/src/package.c
@@ -560,7 +560,7 @@ struct pkg_list *get_installed_pkgs(void){
/* lookup newest package from pkg_list */
pkg_info_t *get_newest_pkg(struct pkg_list *pkg_list,const char *pkg_name){
- int i;
+ unsigned int i;
pkg_info_t *pkg = NULL;
for(i = 0; i < pkg_list->pkg_count; i++ ){
@@ -579,7 +579,7 @@ pkg_info_t *get_newest_pkg(struct pkg_list *pkg_list,const char *pkg_name){
}
pkg_info_t *get_exact_pkg(struct pkg_list *list,const char *name,const char *version){
- int i;
+ unsigned int i;
pkg_info_t *pkg = NULL;
for(i = 0; i < list->pkg_count;i++){
@@ -665,7 +665,7 @@ int remove_pkg(const rc_config *global_config,pkg_info_t *pkg){
}
void free_pkg_list(struct pkg_list *list){
- int i;
+ unsigned int i;
for(i = 0;i < list->pkg_count;i++){
free(list->pkgs[i]);
}
@@ -674,7 +674,7 @@ void free_pkg_list(struct pkg_list *list){
}
int is_excluded(const rc_config *global_config,pkg_info_t *pkg){
- int i,pkg_not_excluded = 0, pkg_is_excluded = 1;
+ unsigned int i,pkg_not_excluded = 0, pkg_is_excluded = 1;
int name_reg_ret = -1,version_reg_ret = -1;
sg_regex exclude_reg;
@@ -794,7 +794,7 @@ void get_md5sum(pkg_info_t *pkg,FILE *checksum_file){
}
static void free_pkg_version_parts(struct pkg_version_parts *parts){
- int i;
+ unsigned int i;
for(i = 0;i < parts->count;i++){
free(parts->parts[i]);
}
@@ -803,7 +803,7 @@ static void free_pkg_version_parts(struct pkg_version_parts *parts){
}
int cmp_pkg_versions(char *a, char *b){
- int position = 0;
+ unsigned int position = 0;
int greater = 1,lesser = -1,equal = 0;
struct pkg_version_parts *a_parts;
struct pkg_version_parts *b_parts;
@@ -966,7 +966,7 @@ static struct pkg_version_parts *break_down_pkg_version(const char *version){
}
void write_pkg_data(const char *source_url,FILE *d_file,struct pkg_list *pkgs){
- int i;
+ unsigned int i;
for(i=0;i < pkgs->pkg_count;i++){
@@ -1006,7 +1006,7 @@ void write_pkg_data(const char *source_url,FILE *d_file,struct pkg_list *pkgs){
}
struct pkg_list *search_pkg_list(struct pkg_list *available,const char *pattern){
- int i;
+ unsigned int i;
int name_r = -1,desc_r = -1,loc_r = -1,version_r = -1;
sg_regex search_regex;
struct pkg_list *matches;
@@ -1218,7 +1218,7 @@ struct pkg_list *get_pkg_conflicts(struct pkg_list *avail_pkgs,struct pkg_list *
}
static pkg_info_t *parse_meta_entry(struct pkg_list *avail_pkgs,struct pkg_list *installed_pkgs,char *dep_entry){
- int i;
+ unsigned int i;
sg_regex parse_dep_regex;
char tmp_pkg_name[NAME_LEN],tmp_pkg_cond[3],tmp_pkg_ver[VERSION_LEN];
pkg_info_t *newest_avail_pkg;
@@ -1380,7 +1380,7 @@ struct pkg_list *is_required_by(const rc_config *global_config,struct pkg_list *
}
static struct pkg_list *required_by(const rc_config *global_config,struct pkg_list *avail, pkg_info_t *pkg,struct pkg_list *parent_required_by){
- int i;
+ unsigned int i;
sg_regex required_by_reg;
struct pkg_list *required_by_list;
char escapedName[NAME_LEN], *escaped_ptr;
@@ -1414,7 +1414,7 @@ static struct pkg_list *required_by(const rc_config *global_config,struct pkg_li
/* only proceed if we don't have the previous required by */
if( (get_newest_pkg(required_by_list,avail->pkgs[i]->name) == NULL) &&
(get_newest_pkg(parent_required_by,avail->pkgs[i]->name) == NULL) ){
- int c;
+ unsigned int c;
struct pkg_list *required_of_required_by;
add_pkg_to_pkg_list(required_by_list,avail->pkgs[i]);
@@ -1437,7 +1437,7 @@ static struct pkg_list *required_by(const rc_config *global_config,struct pkg_li
}
pkg_info_t *get_pkg_by_details(struct pkg_list *list,char *name,char *version,char *location){
- int i;
+ unsigned int i;
for(i = 0; i < list->pkg_count; i++){
if( strcmp(list->pkgs[i]->name,name) == 0 ){
@@ -1570,7 +1570,7 @@ void clear_head_cache(const char *cache_filename){
/* update package data from mirror url */
int update_pkg_cache(const rc_config *global_config){
- int i,source_dl_failed = 0;
+ unsigned int i,source_dl_failed = 0;
FILE *pkg_list_fh_tmp = NULL;
/* open tmp pkg list file */
@@ -1698,7 +1698,7 @@ int update_pkg_cache(const rc_config *global_config){
/* if the download failed don't do this, do it if cached or d/l was good */
if( source_dl_failed != 1 ){
- int a;
+ unsigned int a;
/* now map md5 checksums to packages */
printf(_("Reading Package Lists..."));
@@ -1910,7 +1910,7 @@ int verify_downloaded_pkg(const rc_config *global_config,pkg_info_t *pkg){
on an incomplete file
*/
file_size = get_pkg_file_size(global_config,pkg);
- if( (int)(file_size/1024) != pkg->size_c){
+ if( (unsigned int)(file_size/1024) != pkg->size_c){
return not_verified;
}
/* if not checking the md5 checksum and the sizes match, assume its good */
diff --git a/src/package.h b/src/package.h
index f8c148c..439a03f 100644
--- a/src/package.h
+++ b/src/package.h
@@ -57,8 +57,8 @@ typedef struct {
char version[VERSION_LEN];
char mirror[MIRROR_LEN];
char location[LOCATION_LEN];
- int size_c;
- int size_u;
+ unsigned int size_c;
+ unsigned int size_u;
char description[DESCRIPTION_LEN];
char required[REQUIRED_LEN];
char conflicts[CONFLICTS_LEN];
@@ -68,7 +68,7 @@ typedef struct {
struct pkg_list {
pkg_info_t **pkgs;
- int pkg_count;
+ unsigned int pkg_count;
};
typedef struct {
@@ -78,12 +78,12 @@ typedef struct {
struct pkg_upgrade_list {
pkg_upgrade_t **pkgs;
- int pkg_count;
+ unsigned int pkg_count;
};
struct pkg_version_parts {
char **parts;
- int count;
+ unsigned int count;
};
diff --git a/src/transaction.c b/src/transaction.c
index b716541..283cdf1 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -41,7 +41,7 @@ void init_transaction(transaction_t *tran){
}
int handle_transaction(const rc_config *global_config, transaction_t *tran){
- int i;
+ unsigned int i;
size_t download_size = 0;
size_t already_download_size = 0;
size_t uncompressed_size = 0;
@@ -367,7 +367,7 @@ void add_upgrade_to_transaction(
}
int search_transaction(transaction_t *tran,pkg_info_t *pkg){
- int i,found = 1, not_found = 0;
+ unsigned int i,found = 1, not_found = 0;
for(i = 0; i < tran->install_pkgs->pkg_count;i++){
if( strcmp(pkg->name,tran->install_pkgs->pkgs[i]->name)==0 )
@@ -389,7 +389,7 @@ int search_transaction(transaction_t *tran,pkg_info_t *pkg){
}
static int search_upgrade_transaction(transaction_t *tran,pkg_info_t *pkg){
- int i,found = 1, not_found = 0;
+ unsigned int i,found = 1, not_found = 0;
for(i = 0; i < tran->upgrade_pkgs->pkg_count;i++){
if( strcmp(pkg->name,tran->upgrade_pkgs->pkgs[i]->upgrade->name)==0 )
return found;
@@ -398,7 +398,7 @@ static int search_upgrade_transaction(transaction_t *tran,pkg_info_t *pkg){
}
void free_transaction(transaction_t *tran){
- int i;
+ unsigned int i;
for(i = 0;i < tran->install_pkgs->pkg_count; i++){
free(tran->install_pkgs->pkgs[i]);
@@ -431,7 +431,7 @@ void free_transaction(transaction_t *tran){
}
transaction_t *remove_from_transaction(transaction_t *tran,pkg_info_t *pkg){
- int i;
+ unsigned int i;
transaction_t *new_tran = NULL;
if( search_transaction(tran,pkg) == 0 )
@@ -484,7 +484,8 @@ transaction_t *remove_from_transaction(transaction_t *tran,pkg_info_t *pkg){
/* parse the dependencies for a package, and add them to the transaction as needed */
/* check to see if a package is conflicted */
int add_deps_to_trans(const rc_config *global_config, transaction_t *tran, struct pkg_list *avail_pkgs, struct pkg_list *installed_pkgs, pkg_info_t *pkg){
- int c,dep_return = -1;
+ unsigned int c;
+ int dep_return = -1;
struct pkg_list *deps;
if( global_config->disable_dep_check == 1) return -1;
@@ -545,7 +546,7 @@ int add_deps_to_trans(const rc_config *global_config, transaction_t *tran, struc
/* make sure pkg isn't conflicted with what's already in the transaction */
pkg_info_t *is_conflicted(transaction_t *tran, struct pkg_list *avail_pkgs, struct pkg_list *installed_pkgs, pkg_info_t *pkg){
- int i;
+ unsigned int i;
struct pkg_list *conflicts;
/* if conflicts exist, check to see if they are installed or in the current transaction */