summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-02-20 14:24:35 +1000
committerDan McGee <dan@archlinux.org>2012-03-08 17:59:13 -0600
commit4773c6b66ef618f4c6345a99d9c246045e9c723b (patch)
tree6e3ccb31e84b8e5e3799a030eb4664c193633b03 /lib
parent5c404268d965d9ca012e4819ac0c2f289a4c768c (diff)
downloadpacman-4773c6b66ef618f4c6345a99d9c246045e9c723b.tar.xz
Remove _alpm_csum
The enum alpm_pkgvalidation_t is essentially a more generic version of _alpm_csum, so use it instead. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_package.c4
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/sync.c2
-rw-r--r--lib/libalpm/util.c6
-rw-r--r--lib/libalpm/util.h7
5 files changed, 8 insertions, 13 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index e4469600..311d673f 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -340,7 +340,7 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
if(syncpkg->md5sum && !syncpkg->sha256sum) {
_alpm_log(handle, ALPM_LOG_DEBUG, "md5sum: %s\n", syncpkg->md5sum);
_alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile);
- if(_alpm_test_checksum(pkgfile, syncpkg->md5sum, ALPM_CSUM_MD5) != 0) {
+ if(_alpm_test_checksum(pkgfile, syncpkg->md5sum, ALPM_PKG_VALIDATION_MD5SUM) != 0) {
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
}
if(validation) {
@@ -351,7 +351,7 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
if(syncpkg->sha256sum) {
_alpm_log(handle, ALPM_LOG_DEBUG, "sha256sum: %s\n", syncpkg->sha256sum);
_alpm_log(handle, ALPM_LOG_DEBUG, "checking sha256sum for %s\n", pkgfile);
- if(_alpm_test_checksum(pkgfile, syncpkg->sha256sum, ALPM_CSUM_SHA256) != 0) {
+ if(_alpm_test_checksum(pkgfile, syncpkg->sha256sum, ALPM_PKG_VALIDATION_SHA256SUM) != 0) {
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
}
if(validation) {
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index dbf0d928..6b648675 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -67,7 +67,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg)
fpath = _alpm_filecache_find(pkg->handle, pkg->filename);
- retval = _alpm_test_checksum(fpath, pkg->md5sum, ALPM_CSUM_MD5);
+ retval = _alpm_test_checksum(fpath, pkg->md5sum, ALPM_PKG_VALIDATION_MD5SUM);
if(retval == 0) {
return 0;
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 5f698008..69d27af9 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -780,7 +780,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas)
alpm_delta_t *d = i->data;
char *filepath = _alpm_filecache_find(handle, d->delta);
- if(_alpm_test_checksum(filepath, d->delta_md5, ALPM_CSUM_MD5)) {
+ if(_alpm_test_checksum(filepath, d->delta_md5, ALPM_PKG_VALIDATION_MD5SUM)) {
errors = alpm_list_add(errors, filepath);
} else {
FREE(filepath);
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index c3212292..22e9e359 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -909,14 +909,14 @@ char SYMEXPORT *alpm_compute_sha256sum(const char *filename)
* error
*/
int _alpm_test_checksum(const char *filepath, const char *expected,
- enum _alpm_csum type)
+ alpm_pkgvalidation_t type)
{
char *computed;
int ret;
- if(type == ALPM_CSUM_MD5) {
+ if(type == ALPM_PKG_VALIDATION_MD5SUM) {
computed = alpm_compute_md5sum(filepath);
- } else if(type == ALPM_CSUM_SHA256) {
+ } else if(type == ALPM_PKG_VALIDATION_SHA256SUM) {
computed = alpm_compute_sha256sum(filepath);
} else {
return -1;
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 0ea4b2a8..e6747827 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -105,11 +105,6 @@ struct archive_read_buffer {
int ret;
};
-enum _alpm_csum {
- ALPM_CSUM_MD5,
- ALPM_CSUM_SHA256,
-};
-
int _alpm_makepath(const char *path);
int _alpm_makepath_mode(const char *path, mode_t mode);
int _alpm_copyfile(const char *src, const char *dest);
@@ -130,7 +125,7 @@ int _alpm_str_cmp(const void *s1, const void *s2);
char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename);
const char *_alpm_filecache_setup(alpm_handle_t *handle);
int _alpm_lstat(const char *path, struct stat *buf);
-int _alpm_test_checksum(const char *filepath, const char *expected, enum _alpm_csum type);
+int _alpm_test_checksum(const char *filepath, const char *expected, alpm_pkgvalidation_t type);
int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b);
int _alpm_splitname(const char *target, char **name, char **version,
unsigned long *name_hash);