1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-30 01:55:30 +00:00

Merge with master

This commit is contained in:
Witold Filipczyk 2007-01-18 16:23:38 +01:00 committed by Witold Filipczyk
commit 0e0cc7100d
14 changed files with 347 additions and 311 deletions

View File

@ -49,7 +49,8 @@ dumbprefixes = {
def goto_url_hook(url): def goto_url_hook(url):
"""Rewrite a URL that was entered in a "Go to URL" dialog box. """Rewrite a URL that was entered in a "Go to URL" dialog box.
This function should return a URL for ELinks to follow, or None if This function should return a string containing a URL for ELinks to
follow, or an empty string if no URL should be followed, or None if
ELinks should follow the original URL. ELinks should follow the original URL.
Arguments: Arguments:
@ -63,7 +64,8 @@ def goto_url_hook(url):
def follow_url_hook(url): def follow_url_hook(url):
"""Rewrite a URL for a link that's about to be followed. """Rewrite a URL for a link that's about to be followed.
This function should return a URL for ELinks to follow, or None if This function should return a string containing a URL for ELinks to
follow, or an empty string if no URL should be followed, or None if
ELinks should follow the original URL. ELinks should follow the original URL.
Arguments: Arguments:

View File

@ -37,7 +37,8 @@ FUNCTIONS
follow_url_hook(url) follow_url_hook(url)
Rewrite a URL for a link that's about to be followed. Rewrite a URL for a link that's about to be followed.
This function should return a URL for ELinks to follow, or None if This function should return a string containing a URL for ELinks to
follow, or an empty string if no URL should be followed, or None if
ELinks should follow the original URL. ELinks should follow the original URL.
Arguments: Arguments:
@ -47,7 +48,8 @@ FUNCTIONS
goto_url_hook(url) goto_url_hook(url)
Rewrite a URL that was entered in a "Go to URL" dialog box. Rewrite a URL that was entered in a "Go to URL" dialog box.
This function should return a URL for ELinks to follow, or None if This function should return a string containing a URL for ELinks to
follow, or an empty string if no URL should be followed, or None if
ELinks should follow the original URL. ELinks should follow the original URL.
Arguments: Arguments:

599
po/fr.po

File diff suppressed because it is too large Load Diff

View File

@ -5102,9 +5102,9 @@ msgstr[2] "%ld sformatowanych"
#, c-format #, c-format
msgid "%ld refreshing" msgid "%ld refreshing"
msgid_plural "%ld refreshing" msgid_plural "%ld refreshing"
msgstr[0] "%ld od¶wie¿anych" msgstr[0] "%ld od¶wie¿any"
msgstr[1] "%ld od¶wie¿any" msgstr[1] "%ld od¶wie¿ane"
msgstr[2] "%ld od¶wie¿ane" msgstr[2] "%ld od¶wie¿anych"
#: src/dialogs/info.c:236 #: src/dialogs/info.c:236
msgid "Interlinking" msgid "Interlinking"

View File

@ -456,9 +456,9 @@ set_cookie(struct uri *uri, unsigned char *str)
#ifdef DEBUG_COOKIES #ifdef DEBUG_COOKIES
{ {
DBG("Got cookie %s = %s from %s, domain %s, " DBG("Got cookie %s = %s from %s, domain %s, "
"expires at %d, secure %d", cookie->name, "expires at %"TIME_PRINT_FORMAT", secure %d", cookie->name,
cookie->value, cookie->server->host, cookie->domain, cookie->value, cookie->server->host, cookie->domain,
cookie->expires, cookie->secure); (time_print_T) cookie->expires, cookie->secure);
} }
#endif #endif
@ -672,8 +672,8 @@ send_cookies(struct uri *uri)
if (c->expires && c->expires <= now) { if (c->expires && c->expires <= now) {
#ifdef DEBUG_COOKIES #ifdef DEBUG_COOKIES
DBG("Cookie %s=%s (exp %d) expired.", DBG("Cookie %s=%s (exp %"TIME_PRINT_FORMAT") expired.",
c->name, c->value, c->expires); c->name, c->value, (time_print_T) c->expires);
#endif #endif
delete_cookie(c); delete_cookie(c);
@ -878,12 +878,12 @@ save_cookies(struct terminal *term) {
now = time(NULL); now = time(NULL);
foreach (c, cookies) { foreach (c, cookies) {
if (!c->expires || c->expires <= now) continue; if (!c->expires || c->expires <= now) continue;
if (secure_fprintf(ssi, "%s\t%s\t%s\t%s\t%s\t%ld\t%d\n", if (secure_fprintf(ssi, "%s\t%s\t%s\t%s\t%s\t%"TIME_PRINT_FORMAT"\t%d\n",
c->name, c->value, c->name, c->value,
c->server->host, c->server->host,
empty_string_or_(c->path), empty_string_or_(c->path),
empty_string_or_(c->domain), empty_string_or_(c->domain),
c->expires, c->secure) < 0) (time_print_T) c->expires, c->secure) < 0)
break; break;
} }

View File

@ -280,6 +280,7 @@ set_cookie_expires(struct dialog_data *dlg_data, struct widget_data *widget_data
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
/* Bug 923: Assumes time_t values fit in long. */
errno = 0; errno = 0;
number = strtol(value, (char **) &end, 10); number = strtol(value, (char **) &end, 10);
if (errno || *end || number < 0) return EVENT_NOT_PROCESSED; if (errno || *end || number < 0) return EVENT_NOT_PROCESSED;
@ -335,6 +336,7 @@ build_edit_dialog(struct terminal *term, struct cookie *cookie)
safe_strncpy(name, cookie->name, MAX_STR_LEN); safe_strncpy(name, cookie->name, MAX_STR_LEN);
safe_strncpy(value, cookie->value, MAX_STR_LEN); safe_strncpy(value, cookie->value, MAX_STR_LEN);
safe_strncpy(domain, cookie->domain, MAX_STR_LEN); safe_strncpy(domain, cookie->domain, MAX_STR_LEN);
/* Bug 923: Assumes time_t values fit in unsigned long. */
ulongcat(expires, &length, cookie->expires, MAX_STR_LEN, 0); ulongcat(expires, &length, cookie->expires, MAX_STR_LEN, 0);
length = 0; length = 0;
ulongcat(secure, &length, cookie->secure, MAX_STR_LEN, 0); ulongcat(secure, &length, cookie->secure, MAX_STR_LEN, 0);

View File

@ -393,10 +393,11 @@ write_global_history(void)
if (!ssi) return; if (!ssi) return;
foreachback (history_item, global_history.entries) { foreachback (history_item, global_history.entries) {
if (secure_fprintf(ssi, "%s\t%s\t%ld\n", if (secure_fprintf(ssi, "%s\t%s\t%"TIME_PRINT_FORMAT"\n",
history_item->title, history_item->title,
history_item->url, history_item->url,
history_item->last_visit) < 0) break; (time_print_T) history_item->last_visit) < 0)
break;
} }
if (!secure_close(ssi)) global_history.dirty = 0; if (!secure_close(ssi)) global_history.dirty = 0;

View File

@ -760,6 +760,7 @@ parse_bittorrent_metafile(struct bittorrent_meta *meta, struct string *metafile)
break; break;
case BENCODING_TOKEN_CREATION_DATE: case BENCODING_TOKEN_CREATION_DATE:
/* Bug 923: Assumes time_t values fit in off_t. */
meta->creation_date = (time_t) parse_bencoding_integer(value); meta->creation_date = (time_t) parse_bencoding_integer(value);
skip_scanner_token(&scanner); skip_scanner_token(&scanner);
break; break;

View File

@ -218,6 +218,8 @@ my_timegm(struct tm *tm)
tm->tm_mon *= 153; tm->tm_mon += 2; tm->tm_mon *= 153; tm->tm_mon += 2;
tm->tm_year -= 68; tm->tm_year -= 68;
/* Bug 924: Assumes all years divisible by 4 are leap years,
* even though e.g. 2100 is not. */
tm->tm_mday += tm->tm_year * 1461 / 4; tm->tm_mday += tm->tm_year * 1461 / 4;
tm->tm_mday += ((tm->tm_mon / 5) - 672); tm->tm_mday += ((tm->tm_mon / 5) - 672);

View File

@ -109,6 +109,7 @@ parse_ftp_eplf_response(struct ftp_file_info *info, unsigned char *src, int len)
case FTP_EPLF_MTIME: case FTP_EPLF_MTIME:
if (src >= pos) break; if (src >= pos) break;
/* Bug 923: Assumes time_t values cannot exceed LONG_MAX. */
info->mtime = (time_t) parse_ftp_number(&src, pos, 0, LONG_MAX); info->mtime = (time_t) parse_ftp_number(&src, pos, 0, LONG_MAX);
break; break;
case FTP_EPLF_ID: case FTP_EPLF_ID:

View File

@ -150,6 +150,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *
case GLOBHIST_LAST_VISIT: { case GLOBHIST_LAST_VISIT: {
uint32 seconds; uint32 seconds;
/* Bug 923: Assumes time_t values fit in uint32. */
JS_ValueToECMAUint32(smjs_ctx, *vp, &seconds); JS_ValueToECMAUint32(smjs_ctx, *vp, &seconds);
history_item->last_visit = seconds; history_item->last_visit = seconds;

View File

@ -134,6 +134,8 @@ timeval_from_milliseconds(timeval_T *t, milliseconds_T milliseconds)
return t; return t;
} }
/* Bug 923: Assumes time_t values fit in long. (This function is used
* for both timestamps and durations.) */
timeval_T * timeval_T *
timeval_from_seconds(timeval_T *t, long seconds) timeval_from_seconds(timeval_T *t, long seconds)
{ {
@ -184,6 +186,8 @@ timeval_to_milliseconds(timeval_T *t)
return add_ms_to_ms(a, b); return add_ms_to_ms(a, b);
} }
/* Bug 923: Assumes time_t values fit in long. (This function is used
* for both timestamps and durations.) */
long long
timeval_to_seconds(timeval_T *t) timeval_to_seconds(timeval_T *t)
{ {

View File

@ -16,13 +16,20 @@ typedef long milliseconds_T;
#define ms_max(a, b) ((a) < (b) ? (b) : (a)) #define ms_max(a, b) ((a) < (b) ? (b) : (a))
#define ms_min(a, b) ((a) < (b) ? (a) : (b)) #define ms_min(a, b) ((a) < (b) ? (a) : (b))
/* Is using atol() in this way acceptable? It seems /* Bug 923: Assumes time_t values fit in long. */
* non-portable to me; time_t might not be a long. -- Miciah */
#define str_to_time_t(s) ((time_t) atol(s)) #define str_to_time_t(s) ((time_t) atol(s))
/* When formatting time_t values to be parsed with str_to_time_t,
* we first cast to time_print_T and then printf the result with
* TIME_PRINT_FORMAT.
* Bug 923: Assumes time_t values fit in long. */
typedef long time_print_T;
#define TIME_PRINT_FORMAT "ld"
/* Redefine a timeval that has all fields signed so calculations /* Redefine a timeval that has all fields signed so calculations
* will be simplified on rare systems that define timeval with * will be simplified on rare systems that define timeval with
* unsigned fields. */ * unsigned fields.
* Bug 923: Assumes time_t values fit in long. (This structure is
* used for both timestamps and durations.) */
typedef struct { long sec; long usec; } timeval_T; typedef struct { long sec; long usec; } timeval_T;
timeval_T *timeval_from_milliseconds(timeval_T *t, milliseconds_T milliseconds); timeval_T *timeval_from_milliseconds(timeval_T *t, milliseconds_T milliseconds);