summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-08-19 11:43:27 -0400
committerDan McGee <dan@archlinux.org>2011-08-19 19:00:40 -0500
commit43940f591ed77f984c49fe8a3629d66dbf78bfb0 (patch)
treebde0bc07fbffc8b37a1b123324f38edce7efc587
parenteae363c96fb5ffce8e88cb63c780769b1410a1f9 (diff)
downloadpacman-43940f591ed77f984c49fe8a3629d66dbf78bfb0.tar.xz
dload: rename payload->filename to payload->remote_name
This is a far more accurate description of what this is, since it's more than likely not really a filename at all, but the name after a final slash on a URL. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/dload.c24
-rw-r--r--lib/libalpm/dload.h2
-rw-r--r--lib/libalpm/sync.c8
3 files changed, 17 insertions, 17 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index fa7d14c7..c8f52c48 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -101,10 +101,10 @@ static int curl_progress(void *file, double dltotal, double dlnow,
/* initialize the progress bar here to avoid displaying it when
* a repo is up to date and nothing gets downloaded */
if(DOUBLE_EQ(prevprogress, 0)) {
- payload->handle->dlcb(payload->filename, 0, (long)dltotal);
+ payload->handle->dlcb(payload->remote_name, 0, (long)dltotal);
}
- payload->handle->dlcb(payload->filename, (long)current_size, (long)total_size);
+ payload->handle->dlcb(payload->remote_name, (long)current_size, (long)total_size);
prevprogress = current_size;
@@ -196,17 +196,17 @@ static int curl_download_internal(struct dload_payload *payload,
alpm_handle_t *handle = payload->handle;
handle->pm_errno = 0;
- if(!payload->filename) {
- payload->filename = get_filename(payload->fileurl);
+ if(!payload->remote_name) {
+ payload->remote_name = get_filename(payload->fileurl);
}
- if(!payload->filename || curl_gethost(payload->fileurl, hostname) != 0) {
+ if(!payload->remote_name || curl_gethost(payload->fileurl, hostname) != 0) {
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
RET_ERR(handle, ALPM_ERR_SERVER_BAD_URL, -1);
}
- if(strlen(payload->filename) > 0 && strcmp(payload->filename, ".sig") != 0) {
- destfile = get_fullpath(localpath, payload->filename, "");
- tempfile = get_fullpath(localpath, payload->filename, ".part");
+ if(strlen(payload->remote_name) > 0 && strcmp(payload->remote_name, ".sig") != 0) {
+ destfile = get_fullpath(localpath, payload->remote_name, "");
+ tempfile = get_fullpath(localpath, payload->remote_name, ".part");
if(!destfile || !tempfile) {
goto cleanup;
}
@@ -230,7 +230,7 @@ static int curl_download_internal(struct dload_payload *payload,
}
/* localf now points to our alpmtmp.XXXXXX */
STRDUP(tempfile, randpath, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
- payload->filename = strrchr(randpath, '/') + 1;
+ payload->remote_name = strrchr(randpath, '/') + 1;
}
error_buffer[0] = '\0';
@@ -322,10 +322,10 @@ static int curl_download_internal(struct dload_payload *payload,
if(!payload->errors_ok) {
handle->pm_errno = ALPM_ERR_LIBCURL;
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
- payload->filename, hostname, error_buffer);
+ payload->remote_name, hostname, error_buffer);
} else {
_alpm_log(handle, ALPM_LOG_DEBUG, "failed retrieving file '%s' from %s : %s\n",
- payload->filename, hostname, error_buffer);
+ payload->remote_name, hostname, error_buffer);
}
goto cleanup;
}
@@ -352,7 +352,7 @@ static int curl_download_internal(struct dload_payload *payload,
!DOUBLE_EQ(bytes_dl, remote_size)) {
handle->pm_errno = ALPM_ERR_RETRIEVE;
_alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
- payload->filename, (intmax_t)bytes_dl, (intmax_t)remote_size);
+ payload->remote_name, (intmax_t)bytes_dl, (intmax_t)remote_size);
goto cleanup;
}
diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h
index 0c5fcb25..7a8ce048 100644
--- a/lib/libalpm/dload.h
+++ b/lib/libalpm/dload.h
@@ -27,7 +27,7 @@
struct dload_payload {
alpm_handle_t *handle;
- const char *filename;
+ const char *remote_name;
char *cd_filename;
char *fileurl;
double initial_size;
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index e3e7fa90..b048777c 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -810,7 +810,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
struct dload_payload *dpayload;
CALLOC(dpayload, 1, sizeof(*dpayload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
- STRDUP(dpayload->filename, delta->delta, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
+ STRDUP(dpayload->remote_name, delta->delta, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
dpayload->max_size = delta->download_size;
files = alpm_list_add(files, dpayload);
@@ -824,7 +824,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
ASSERT(spkg->filename != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1));
CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
- STRDUP(payload->filename, spkg->filename, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
+ STRDUP(payload->remote_name, spkg->filename, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
payload->max_size = alpm_pkg_get_size(spkg);
files = alpm_list_add(files, payload);
@@ -844,9 +844,9 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
size_t len;
/* print server + filename into a buffer */
- len = strlen(server_url) + strlen(payload->filename) + 2;
+ len = strlen(server_url) + strlen(payload->remote_name) + 2;
CALLOC(payload->fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
- snprintf(payload->fileurl, len, "%s/%s", server_url, payload->filename);
+ snprintf(payload->fileurl, len, "%s/%s", server_url, payload->remote_name);
payload->handle = handle;
payload->allow_resume = 1;