mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Drop @safe parameter of create_download_file().
Use new flag DOWNLOAD_EXTERNAL instead.
This commit is contained in:
parent
71ccbe0f8d
commit
b3cfede1c1
@ -494,8 +494,6 @@ struct codw_hop {
|
||||
|
||||
struct cdf_hop {
|
||||
unsigned char **real_file;
|
||||
int safe;
|
||||
|
||||
void (*callback)(struct terminal *, int, void *, download_flags_T);
|
||||
void *data;
|
||||
};
|
||||
@ -665,7 +663,7 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
|
||||
#ifdef NO_FILE_SECURITY
|
||||
int sf = 0;
|
||||
#else
|
||||
int sf = cdf_hop->safe;
|
||||
int sf = flags & DOWNLOAD_EXTERNAL;
|
||||
#endif
|
||||
|
||||
if (!file) goto finish;
|
||||
@ -701,7 +699,7 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
|
||||
} else {
|
||||
set_bin(h);
|
||||
|
||||
if (!cdf_hop->safe) {
|
||||
if (!(flags & DOWNLOAD_EXTERNAL)) {
|
||||
unsigned char *download_dir = get_opt_str("document.download.directory", NULL);
|
||||
int i;
|
||||
|
||||
@ -727,7 +725,7 @@ finish:
|
||||
|
||||
void
|
||||
create_download_file(struct terminal *term, unsigned char *fi,
|
||||
unsigned char **real_file, int safe, download_flags_T flags,
|
||||
unsigned char **real_file, download_flags_T flags,
|
||||
void (*callback)(struct terminal *, int, void *, download_flags_T),
|
||||
void *data)
|
||||
{
|
||||
@ -740,7 +738,6 @@ create_download_file(struct terminal *term, unsigned char *fi,
|
||||
}
|
||||
|
||||
cdf_hop->real_file = real_file;
|
||||
cdf_hop->safe = safe;
|
||||
cdf_hop->callback = callback;
|
||||
cdf_hop->data = data;
|
||||
|
||||
@ -880,8 +877,8 @@ common_download(struct session *ses, unsigned char *file, download_flags_T flags
|
||||
|
||||
kill_downloads_to_file(file);
|
||||
|
||||
create_download_file(ses->tab->term, file, &cmdw_hop->real_file, 0,
|
||||
flags, common_download_do, cmdw_hop);
|
||||
create_download_file(ses->tab->term, file, &cmdw_hop->real_file, flags,
|
||||
common_download_do, cmdw_hop);
|
||||
}
|
||||
|
||||
void
|
||||
@ -973,7 +970,9 @@ continue_download(void *data, unsigned char *file)
|
||||
|
||||
create_download_file(type_query->ses->tab->term, file,
|
||||
&codw_hop->real_file,
|
||||
!!type_query->external_handler, 0,
|
||||
type_query->external_handler
|
||||
? DOWNLOAD_START | DOWNLOAD_EXTERNAL
|
||||
: DOWNLOAD_START,
|
||||
continue_download_do, codw_hop);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@ typedef void (download_callback_T)(struct download *, void *);
|
||||
typedef uint32_t download_flags_T;
|
||||
enum download_flag {
|
||||
DOWNLOAD_START = 0,
|
||||
DOWNLOAD_RESUME = 1
|
||||
DOWNLOAD_RESUME = 1,
|
||||
DOWNLOAD_EXTERNAL = 2,
|
||||
};
|
||||
|
||||
struct download {
|
||||
@ -111,7 +112,7 @@ int are_there_downloads(void);
|
||||
void start_download(void *, unsigned char *);
|
||||
void resume_download(void *, unsigned char *);
|
||||
void create_download_file(struct terminal *, unsigned char *, unsigned char **,
|
||||
int, download_flags_T,
|
||||
download_flags_T,
|
||||
void (*)(struct terminal *, int, void *, download_flags_T),
|
||||
void *);
|
||||
|
||||
|
@ -1335,7 +1335,7 @@ save_formatted(void *data, unsigned char *file)
|
||||
assert(doc_view && doc_view->document);
|
||||
if_assert_failed return;
|
||||
|
||||
create_download_file(ses->tab->term, file, NULL, 0, 0,
|
||||
create_download_file(ses->tab->term, file, NULL, DOWNLOAD_START,
|
||||
save_formatted_finish, doc_view->document);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user