summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/Makefile.am2
-rw-r--r--lib/libalpm/alpm.c2
-rw-r--r--lib/libalpm/be_files.c12
-rw-r--r--lib/libalpm/conflict.c8
-rw-r--r--lib/libalpm/deps.c4
-rw-r--r--lib/libalpm/error.c2
-rw-r--r--lib/libalpm/handle.c1
-rw-r--r--lib/libalpm/list.c3
-rw-r--r--lib/libalpm/md5driver.c1
-rw-r--r--lib/libalpm/package.c1
-rw-r--r--lib/libalpm/server.c2
-rw-r--r--lib/libalpm/sha1.c1
-rw-r--r--lib/libalpm/sha1.h12
-rw-r--r--lib/libalpm/sync.c3
-rw-r--r--lib/libalpm/util.c1
15 files changed, 31 insertions, 24 deletions
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 9f555d22..c5306d1f 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -40,7 +40,7 @@ include_HEADERS = alpm.h
libalpm_la_SOURCES = $(TARGETS)
libalpm_la_LDFLAGS = -no-undefined -version-info $(PM_VERSION_INFO)
-libalpm_la_LIBADD = -ldownload
+libalpm_la_LIBADD = -larchive -ldownload
if HAS_DOXYGEN
all: doxygen.in
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 9cecd0ee..ae5f6686 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -137,7 +137,7 @@ int alpm_release()
/** Register a package database
* @param treename the name of the repository
- * @return 0 on success, -1 on error (pm_errno is set accordingly)
+ * @return a pmdb_t* on success (the value), NULL on error
*/
pmdb_t *alpm_db_register(char *treename)
{
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 62d08dd3..e722f626 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -180,7 +180,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
FILE *fp = NULL;
struct stat buf;
char path[PATH_MAX+1];
- char line[513] = {0};
+ char line[513];
pmlist_t *tmplist;
char *locale;
@@ -205,7 +205,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
_alpm_log(PM_LOG_FUNCTION, _("loading package data for %s : level=%d"), info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
- memset(line, 513, 0);
+ memset(line, 0, 513);
snprintf(path, PATH_MAX, "%s/%s-%s", db->path, info->name, info->version);
if(stat(path, &buf)) {
@@ -528,20 +528,20 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
}
if(info->size) {
fprintf(fp, "%%SIZE%%\n"
- "%ld\n\n", info->size);
+ "%lu\n\n", info->size);
}
if(info->reason) {
fprintf(fp, "%%REASON%%\n"
- "%d\n\n", info->reason);
+ "%u\n\n", info->reason);
}
} else {
if(info->size) {
fprintf(fp, "%%CSIZE%%\n"
- "%ld\n\n", info->size);
+ "%lu\n\n", info->size);
}
if(info->isize) {
fprintf(fp, "%%ISIZE%%\n"
- "%ld\n\n", info->isize);
+ "%lu\n\n", info->isize);
}
if(info->sha1sum) {
fprintf(fp, "%%SHA1SUM%%\n"
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index c9649e40..570520f1 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -206,6 +206,10 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
return(baddeps);
}
+/* Returns a pmlist_t* of file conflicts.
+ *
+ * adds list of files to skip to pmlist_t** skip_list.
+ */
pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmlist_t **skip_list)
{
pmlist_t *i, *j, *k;
@@ -230,10 +234,10 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
for(k = p1->files; k; k = k->next) {
filestr = k->data;
if(filestr[strlen(filestr)-1] == '/') {
- /* this filename has a trailing '/', so it's a directory -- skip it. */
+ /* has a trailing '/', so it's a directory -- skip it. */
continue;
}
- if(!strcmp(filestr, "._install") || !strcmp(filestr, ".INSTALL")) {
+ if(strcmp(filestr, ".INSTALL") == 0) {
continue;
}
if(_alpm_list_is_strin(filestr, p2->files)) {
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 43aa6407..cb53d41b 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -119,6 +119,10 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
while(change) {
pmlist_t *tmptargs = NULL;
change = 0;
+ /* TODO only use of a math.h function in entire libalpm,
+ * can we get rid of it? Former code line:
+ *if(numscans > numtargs) {
+ */
if(numscans > sqrt(numtargs)) {
_alpm_log(PM_LOG_DEBUG, _("possible dependency cycle detected"));
continue;
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 1597f0cb..832d8e78 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -134,7 +134,7 @@ char *alpm_strerror(int err)
case PM_ERR_CONF_DIRECTIVE_OUTSIDE_SECTION:
return _("all directives must belong to a section");
case PM_ERR_INVALID_REGEX:
- return _("valid regular expression");
+ return _("invalid regular expression");
case PM_ERR_CONNECT_FAILED:
return _("connection to remote host failed");
case PM_ERR_FORK_FAILED:
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 4e0ffbec..c6338d59 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -27,7 +27,6 @@
#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
-#include <stdarg.h>
#include <syslog.h>
#include <libintl.h>
#include <time.h>
diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c
index 61a87113..b6797073 100644
--- a/lib/libalpm/list.c
+++ b/lib/libalpm/list.c
@@ -23,7 +23,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <assert.h>
/* pacman */
#include "list.h"
#include "util.h"
@@ -307,8 +306,6 @@ pmlist_t *_alpm_list_last(pmlist_t *list)
return(NULL);
}
- assert(list->last != NULL);
-
return(list->last);
}
diff --git a/lib/libalpm/md5driver.c b/lib/libalpm/md5driver.c
index 5167a6b1..2cd950ef 100644
--- a/lib/libalpm/md5driver.c
+++ b/lib/libalpm/md5driver.c
@@ -21,7 +21,6 @@ documentation and/or software.
#include <stdlib.h>
#include <stdio.h>
-#include <time.h>
#include <string.h>
#include <libintl.h>
#include "util.h"
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 52e939d1..aa72be40 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
-#include <fcntl.h>
#include <string.h>
#include <libintl.h>
#include <locale.h>
diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c
index f2e4afdf..c37d8a12 100644
--- a/lib/libalpm/server.c
+++ b/lib/libalpm/server.c
@@ -27,7 +27,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
-#include <sys/time.h>
+#include <download.h>
/* pacman */
#include "server.h"
diff --git a/lib/libalpm/sha1.c b/lib/libalpm/sha1.c
index c1b03e84..a2caa72b 100644
--- a/lib/libalpm/sha1.c
+++ b/lib/libalpm/sha1.c
@@ -33,7 +33,6 @@
#include <sys/types.h>
#include <stdlib.h>
-#include <time.h>
#include <string.h>
/*
diff --git a/lib/libalpm/sha1.h b/lib/libalpm/sha1.h
index f00b4122..db16d536 100644
--- a/lib/libalpm/sha1.h
+++ b/lib/libalpm/sha1.h
@@ -20,9 +20,14 @@
#include <limits.h>
#define rol(x,n) ( ((x) << (n)) | ((x) >> (32 -(n))) )
+/* TODO check this comment */
/* The code below is from md5.h (from coreutils), little modifications */
#define UINT_MAX_32_BITS 4294967295U
+/* This new ifdef allows splint to not fail on its static code check */
+#ifdef S_SPLINT_S
+ typedef unsigned int sha_uint32;
+#else
#if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int sha_uint32;
#else
@@ -34,9 +39,10 @@
#else
/* The following line is intended to evoke an error. Using #error is not portable enough. */
#error "Cannot determine unsigned 32-bit data type"
-#endif
-#endif
-#endif
+#endif /* ULONG_MAX */
+#endif /* USHRT_MAX */
+#endif /* UINT_MAX */
+#endif /* S_SPLINT_S */
/* We have to make a guess about the integer type equivalent in size
to pointers which should always be correct. */
typedef unsigned long int sha_uintptr;
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 0234861f..453347d7 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -121,7 +121,8 @@ static int istoonew(pmpkg_t *pkg)
/* Find recommended replacements for packages during a sync.
* (refactored from _alpm_sync_prepare)
*/
-static int find_replacements(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync)
+static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
+ pmlist_t *dbs_sync)
{
pmlist_t *i, *j, *k;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index ecdd82c6..074d16f1 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -36,7 +36,6 @@
#ifdef __sun__
#include <alloca.h>
#endif
-#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>