diff options
author | Dan McGee <dan@archlinux.org> | 2011-04-15 19:30:11 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-20 20:11:26 -0500 |
commit | 442e1420f95ecc6fd1967677c1be5dfed6584542 (patch) | |
tree | 42c26edf4408acad0580c543262aee51e8e91c95 | |
parent | 3c5661ec3cd5cdf2f1c3101d90789c83786a6897 (diff) | |
download | pacman-442e1420f95ecc6fd1967677c1be5dfed6584542.tar.xz |
Rename gpgsig struct fields for clarity
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | lib/libalpm/be_sync.c | 2 | ||||
-rw-r--r-- | lib/libalpm/db.c | 6 | ||||
-rw-r--r-- | lib/libalpm/package.c | 27 | ||||
-rw-r--r-- | lib/libalpm/signing.c | 12 | ||||
-rw-r--r-- | lib/libalpm/signing.h | 6 |
5 files changed, 27 insertions, 26 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 752ef373..11e28078 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -471,7 +471,7 @@ static int sync_db_read(pmdb_t *db, struct archive *archive, /* we don't do anything with this value right now */ READ_NEXT(line); } else if(strcmp(line, "%PGPSIG%") == 0) { - READ_AND_STORE(pkg->pgpsig.encdata); + READ_AND_STORE(pkg->pgpsig.base64_data); } else if(strcmp(line, "%REPLACES%") == 0) { READ_AND_STORE_ALL(pkg->replaces); } else if(strcmp(line, "%DEPENDS%") == 0) { diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 3808a275..f5e7a25f 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -321,7 +321,7 @@ const pmpgpsig_t *_alpm_db_pgpsig(pmdb_t *db) /* Sanity checks */ ASSERT(db != NULL, return(NULL)); - if(db->pgpsig.rawdata == NULL) { + if(db->pgpsig.data == NULL) { const char *dbfile; int ret; @@ -343,8 +343,8 @@ void _alpm_db_free(pmdb_t *db) _alpm_db_free_pkgcache(db); /* cleanup server list */ FREELIST(db->servers); - /* only need to free rawdata */ - FREE(db->pgpsig.rawdata); + /* only need to free data */ + FREE(db->pgpsig.data); FREE(db->_path); FREE(db->treename); FREE(db); diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 3e787d45..8c927c11 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -198,25 +198,26 @@ const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg) } static int decode_pgpsig(pmpkg_t *pkg) { - int len = strlen(pkg->pgpsig.encdata); - const unsigned char *usline = (const unsigned char *)pkg->pgpsig.encdata; - int destlen = 0; + const int len = strlen(pkg->pgpsig.base64_data); + const unsigned char *usline = (const unsigned char *)pkg->pgpsig.base64_data; + int ret, destlen = 0; /* get the necessary size for the buffer by passing 0 */ - int ret = base64_decode(NULL, &destlen, usline, len); + ret = base64_decode(NULL, &destlen, usline, len); /* alloc our memory and repeat the call to decode */ - MALLOC(pkg->pgpsig.rawdata, (size_t)destlen, goto error); - ret = base64_decode(pkg->pgpsig.rawdata, &destlen, usline, len); - pkg->pgpsig.rawlen = destlen; + MALLOC(pkg->pgpsig.data, (size_t)destlen, goto error); + ret = base64_decode(pkg->pgpsig.data, &destlen, usline, len); + pkg->pgpsig.len = destlen; if(ret != 0) { goto error; } - FREE(pkg->pgpsig.encdata); + /* we no longer have a need for this */ + FREE(pkg->pgpsig.base64_data); return 0; error: - FREE(pkg->pgpsig.rawdata); - pkg->pgpsig.rawlen = 0; + FREE(pkg->pgpsig.data); + pkg->pgpsig.len = 0; return 1; } @@ -227,7 +228,7 @@ const pmpgpsig_t SYMEXPORT *alpm_pkg_get_pgpsig(pmpkg_t *pkg) /* Sanity checks */ ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL)); - if(pkg->pgpsig.rawdata == NULL && pkg->pgpsig.encdata != NULL) { + if(pkg->pgpsig.data == NULL && pkg->pgpsig.base64_data != NULL) { decode_pgpsig(pkg); } return &(pkg->pgpsig); @@ -467,8 +468,8 @@ void _alpm_pkg_free(pmpkg_t *pkg) FREE(pkg->url); FREE(pkg->packager); FREE(pkg->md5sum); - FREE(pkg->pgpsig.encdata); - FREE(pkg->pgpsig.rawdata); + FREE(pkg->pgpsig.base64_data); + FREE(pkg->pgpsig.data); FREE(pkg->arch); FREELIST(pkg->licenses); FREELIST(pkg->replaces); diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 51c4f4ce..9d4fd076 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -109,7 +109,7 @@ int _alpm_gpgme_checksig(const char *path, const pmpgpsig_t *sig) ALPM_LOG_FUNC; - if(!sig || !sig->rawdata) { + if(!sig || !sig->data) { RET_ERR(PM_ERR_SIG_UNKNOWN, -1); } if(!path || access(path, R_OK) != 0) { @@ -140,7 +140,7 @@ int _alpm_gpgme_checksig(const char *path, const pmpgpsig_t *sig) CHECK_ERR(); /* next create data object for the signature */ - err = gpgme_data_new_from_mem(&sigdata, (char *)sig->rawdata, sig->rawlen, 0); + err = gpgme_data_new_from_mem(&sigdata, (char *)sig->data, sig->len, 0); CHECK_ERR(); /* here's where the magic happens */ @@ -227,18 +227,18 @@ int _alpm_load_signature(const char *file, pmpgpsig_t *pgpsig) { free(sigfile); return ret; } - CALLOC(pgpsig->rawdata, st.st_size, sizeof(unsigned char), + CALLOC(pgpsig->data, st.st_size, sizeof(unsigned char), RET_ERR(PM_ERR_MEMORY, -1)); - bytes_read = fread(pgpsig->rawdata, sizeof(char), st.st_size, f); + bytes_read = fread(pgpsig->data, sizeof(char), st.st_size, f); if(bytes_read == (size_t)st.st_size) { - pgpsig->rawlen = bytes_read; + pgpsig->len = bytes_read; _alpm_log(PM_LOG_DEBUG, "loaded gpg signature file, location %s\n", sigfile); ret = 0; } else { _alpm_log(PM_LOG_WARNING, _("Failed reading PGP signature file %s"), sigfile); - FREE(pgpsig->rawdata); + FREE(pgpsig->data); } fclose(f); diff --git a/lib/libalpm/signing.h b/lib/libalpm/signing.h index 42b56508..a378fa50 100644 --- a/lib/libalpm/signing.h +++ b/lib/libalpm/signing.h @@ -26,9 +26,9 @@ struct __pmpgpsig_t { * this way we can decode on an as-needed basis since most * operations won't require the overhead of base64 decodes * on all packages in a sync repository. */ - char *encdata; - size_t rawlen; - unsigned char *rawdata; + char *base64_data; + unsigned char *data; + size_t len; }; int _alpm_gpgme_checksig(const char *path, const pmpgpsig_t *sig); |