summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-10-11 20:51:47 +0200
committerDan McGee <dan@archlinux.org>2009-10-11 20:51:47 +0200
commit35dc9b03149dc2f42022fe5fea80a3aed3207489 (patch)
treedbcfa549cf1b8bf30e4d94bad301e6f1f9c12179
parentcf0d619670a4d0c67ad67e22bacbb69c203714f5 (diff)
downloadpacman-35dc9b03149dc2f42022fe5fea80a3aed3207489.tar.gz
pacman-35dc9b03149dc2f42022fe5fea80a3aed3207489.tar.xz
int typing: s/unsigned short/int/ in libalpm
After our recent screwup with size_t and ssize_t in the download code, I found the `-Wsign-conversion` flag to GCC to see if we were doing anything else boneheaded. I didn't find anything quite as bad, but we did have some goofups- most of our public unsigned methods would return -1 on error, which is a bit odd in an unsigned context. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/alpm.h12
-rw-r--r--lib/libalpm/be_package.c5
-rw-r--r--lib/libalpm/db.c2
-rw-r--r--lib/libalpm/db.h6
-rw-r--r--lib/libalpm/handle.c6
-rw-r--r--lib/libalpm/handle.h4
-rw-r--r--lib/libalpm/package.c4
-rw-r--r--lib/libalpm/package.h4
-rw-r--r--lib/libalpm/util.c3
-rw-r--r--lib/libalpm/util.h2
10 files changed, 23 insertions, 25 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index e9fadca2..f2cc123c 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -128,8 +128,8 @@ int alpm_option_set_logfile(const char *logfile);
const char *alpm_option_get_lockfile();
/* no set_lockfile, path is determined from dbpath */
-unsigned short alpm_option_get_usesyslog();
-void alpm_option_set_usesyslog(unsigned short usesyslog);
+int alpm_option_get_usesyslog();
+void alpm_option_set_usesyslog(int usesyslog);
alpm_list_t *alpm_option_get_noupgrades();
void alpm_option_add_noupgrade(const char *pkg);
@@ -154,7 +154,7 @@ int alpm_option_remove_ignoregrp(const char *grp);
const char *alpm_option_get_arch();
void alpm_option_set_arch(const char *arch);
-void alpm_option_set_usedelta(unsigned short usedelta);
+void alpm_option_set_usedelta(int usedelta);
pmdb_t *alpm_option_get_localdb();
alpm_list_t *alpm_option_get_syncdbs();
@@ -195,7 +195,7 @@ typedef enum _pmpkgreason_t {
PM_PKG_REASON_DEPEND = 1 /* installed as a dependency for another package */
} pmpkgreason_t;
-int alpm_pkg_load(const char *filename, unsigned short full, pmpkg_t **pkg);
+int alpm_pkg_load(const char *filename, int full, pmpkg_t **pkg);
int alpm_pkg_free(pmpkg_t *pkg);
int alpm_pkg_checkmd5sum(pmpkg_t *pkg);
char *alpm_fetch_pkgurl(const char *url);
@@ -231,8 +231,8 @@ size_t alpm_pkg_changelog_read(void *ptr, size_t size,
const pmpkg_t *pkg, const void *fp);
/*int alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp);*/
int alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp);
-unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
-unsigned short alpm_pkg_has_force(pmpkg_t *pkg);
+int alpm_pkg_has_scriptlet(pmpkg_t *pkg);
+int alpm_pkg_has_force(pmpkg_t *pkg);
off_t alpm_pkg_download_size(pmpkg_t *newpkg);
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 9c7c1617..1cd30c28 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -132,7 +132,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
* through the full archive
* @return An information filled pmpkg_t struct
*/
-static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
+static pmpkg_t *pkg_load(const char *pkgfile, int full)
{
int ret = ARCHIVE_OK;
int config = 0;
@@ -269,8 +269,7 @@ error:
* @param pkg address of the package pointer
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int SYMEXPORT alpm_pkg_load(const char *filename, unsigned short full,
- pmpkg_t **pkg)
+int SYMEXPORT alpm_pkg_load(const char *filename, int full, pmpkg_t **pkg)
{
ALPM_LOG_FUNC;
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index e57ff935..dca5452a 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -323,7 +323,7 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
/** @} */
-static pmdb_t *_alpm_db_new(const char *treename, unsigned short is_local)
+static pmdb_t *_alpm_db_new(const char *treename, int is_local)
{
pmdb_t *db;
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 29816032..e4e1dcb7 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -43,9 +43,9 @@ struct __pmdb_t {
char *treename;
/* do not access directly, use _alpm_db_path(db) for lazy access */
char *_path;
- unsigned short pkgcache_loaded;
- unsigned short grpcache_loaded;
- unsigned short is_local;
+ int pkgcache_loaded;
+ int grpcache_loaded;
+ int is_local;
alpm_list_t *pkgcache;
alpm_list_t *grpcache;
alpm_list_t *servers;
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 012d4121..a503baea 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -169,7 +169,7 @@ const char SYMEXPORT *alpm_option_get_lockfile()
return handle->lockfile;
}
-unsigned short SYMEXPORT alpm_option_get_usesyslog()
+int SYMEXPORT alpm_option_get_usesyslog()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
@@ -437,7 +437,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
return(0);
}
-void SYMEXPORT alpm_option_set_usesyslog(unsigned short usesyslog)
+void SYMEXPORT alpm_option_set_usesyslog(int usesyslog)
{
handle->usesyslog = usesyslog;
}
@@ -536,7 +536,7 @@ void SYMEXPORT alpm_option_set_arch(const char *arch)
if(arch) handle->arch = strdup(arch);
}
-void SYMEXPORT alpm_option_set_usedelta(unsigned short usedelta)
+void SYMEXPORT alpm_option_set_usedelta(int usedelta)
{
handle->usedelta = usedelta;
}
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index a1eb1cde..a87d0fb2 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -57,9 +57,9 @@ typedef struct _pmhandle_t {
alpm_list_t *ignoregrp; /* List of groups to ignore */
/* options */
- unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
+ int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
char *arch; /* Architecture of packages we should allow */
- unsigned short usedelta; /* Download deltas if possible */
+ int usedelta; /* Download deltas if possible */
} pmhandle_t;
/* global handle variable */
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index de171661..572b863e 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -295,7 +295,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
return pkg->groups;
}
-unsigned short SYMEXPORT alpm_pkg_has_force(pmpkg_t *pkg)
+int SYMEXPORT alpm_pkg_has_force(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -541,7 +541,7 @@ int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
return(ret);
}
-unsigned short SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
+int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index aea3f394..b003b410 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -49,8 +49,8 @@ struct __pmpkg_t {
off_t size;
off_t isize;
off_t download_size;
- unsigned short scriptlet;
- unsigned short force;
+ int scriptlet;
+ int force;
pmpkgreason_t reason;
alpm_list_t *licenses;
alpm_list_t *replaces;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index f78d193a..f608a2c6 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -380,8 +380,7 @@ int _alpm_rmrf(const char *path)
return(0);
}
-int _alpm_logaction(unsigned short usesyslog, FILE *f,
- const char *fmt, va_list args)
+int _alpm_logaction(int usesyslog, FILE *f, const char *fmt, va_list args)
{
int ret = 0;
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index ccf169d3..7c569ece 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -64,7 +64,7 @@ int _alpm_lckmk();
int _alpm_lckrm();
int _alpm_unpack(const char *archive, const char *prefix, const char *fn);
int _alpm_rmrf(const char *path);
-int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *fmt, va_list args);
+int _alpm_logaction(int usesyslog, FILE *f, const char *fmt, va_list args);
int _alpm_run_chroot(const char *root, const char *cmd);
int _alpm_ldconfig(const char *root);
int _alpm_str_cmp(const void *s1, const void *s2);