mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Merge branch 'elinks-0.12' into elinks-0.13
Conflicts: src/document/css/stylesheet.c src/document/css/stylesheet.h
This commit is contained in:
commit
4138b401ca
1
NEWS
1
NEWS
@ -328,6 +328,7 @@ To be released as 0.11.4.
|
||||
* minor bug 461: ensure contrast in blank areas, to keep the cursor visible
|
||||
* minor bug 928: properly display no-break spaces in a UTF-8 document
|
||||
if the terminal uses some other charset
|
||||
* minor: don't assume sizeof(int)==4 in bittorrent
|
||||
* trivial bug 947: document.html.wrap_nbsp also affects text in tables
|
||||
* trivial bug 997: fix unlikely stack corruption in active FTP
|
||||
* build bug 950: fix ``config/install-sh: No such file or directory''
|
||||
|
@ -150,7 +150,7 @@ import_css(struct css_stylesheet *css, struct uri *uri)
|
||||
|
||||
static void
|
||||
import_css_file(struct css_stylesheet *css, struct uri *base_uri,
|
||||
unsigned char *url, int urllen)
|
||||
const unsigned char *url, int urllen)
|
||||
{
|
||||
struct string string, filename;
|
||||
|
||||
|
@ -158,7 +158,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
|
||||
type = CSS_TOKEN_NUMBER;
|
||||
|
||||
} else {
|
||||
unsigned char *ident = string;
|
||||
const unsigned char *ident = string;
|
||||
|
||||
scan_css(scanner, string, CSS_CHAR_IDENT);
|
||||
type = map_scanner_string(scanner, ident, string,
|
||||
@ -251,7 +251,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
|
||||
} else if (first_char == '@') {
|
||||
/* Compose token containing @<ident> */
|
||||
if (is_css_ident_start(*string)) {
|
||||
unsigned char *ident = string;
|
||||
const unsigned char *ident = string;
|
||||
|
||||
/* Scan both ident start and ident */
|
||||
scan_css(scanner, string, CSS_CHAR_IDENT);
|
||||
|
@ -50,7 +50,7 @@ struct css_selector *
|
||||
init_css_selector(struct css_selector_set *sels,
|
||||
enum css_selector_type type,
|
||||
enum css_selector_relation relation,
|
||||
unsigned char *name, int namelen)
|
||||
const unsigned char *name, int namelen)
|
||||
{
|
||||
struct css_selector *selector;
|
||||
|
||||
@ -97,7 +97,7 @@ struct css_selector *
|
||||
get_css_selector(struct css_selector_set *sels,
|
||||
enum css_selector_type type,
|
||||
enum css_selector_relation rel,
|
||||
unsigned char *name, int namelen)
|
||||
const unsigned char *name, int namelen)
|
||||
{
|
||||
struct css_selector *selector = NULL;
|
||||
|
||||
|
@ -96,7 +96,7 @@ struct css_selector {
|
||||
|
||||
struct css_stylesheet;
|
||||
typedef void (*css_stylesheet_importer_T)(struct css_stylesheet *, struct uri *,
|
||||
unsigned char *url, int urllen);
|
||||
const unsigned char *url, int urllen);
|
||||
|
||||
/** The struct css_stylesheet describes all the useful data that was extracted
|
||||
* from the CSS source. Currently we don't cache anything but the default user
|
||||
@ -140,7 +140,7 @@ void done_css_stylesheet(struct css_stylesheet *css);
|
||||
struct css_selector *get_css_selector(struct css_selector_set *set,
|
||||
enum css_selector_type type,
|
||||
enum css_selector_relation rel,
|
||||
unsigned char *name, int namelen);
|
||||
const unsigned char *name, int namelen);
|
||||
|
||||
#define get_css_base_selector(stylesheet, type, rel, name, namelen) \
|
||||
get_css_selector((stylesheet) ? &(stylesheet)->selectors : NULL, \
|
||||
@ -161,7 +161,7 @@ struct css_selector *find_css_selector(struct css_selector_set *set,
|
||||
struct css_selector *init_css_selector(struct css_selector_set *set,
|
||||
enum css_selector_type type,
|
||||
enum css_selector_relation relation,
|
||||
unsigned char *name, int namelen);
|
||||
const unsigned char *name, int namelen);
|
||||
|
||||
/** Add all properties from the list to the given @a selector. */
|
||||
void add_selector_properties(struct css_selector *selector,
|
||||
|
@ -40,7 +40,7 @@ css_parse_color_value(struct css_property_info *propinfo,
|
||||
/* The first two args are terminated by ',' and the
|
||||
* last one by ')'. */
|
||||
unsigned char paskynator = shift ? ',' : ')';
|
||||
unsigned char *nstring = token->string;
|
||||
const unsigned char *nstring = token->string;
|
||||
int part;
|
||||
|
||||
/* Are the current and next token valid? */
|
||||
|
@ -143,6 +143,6 @@ unsigned char *get_target(struct document_options *options, unsigned char *a);
|
||||
|
||||
void
|
||||
import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
||||
unsigned char *url, int len);
|
||||
const unsigned char *unterminated_url, int len);
|
||||
|
||||
#endif
|
||||
|
@ -188,9 +188,10 @@ add_fragment_identifier(struct html_context *html_context,
|
||||
#ifdef CONFIG_CSS
|
||||
void
|
||||
import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
||||
unsigned char *url, int len)
|
||||
const unsigned char *unterminated_url, int len)
|
||||
{
|
||||
struct html_context *html_context = css->import_data;
|
||||
unsigned char *url;
|
||||
unsigned char *import_url;
|
||||
struct uri *uri;
|
||||
|
||||
@ -201,7 +202,9 @@ import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
||||
|| !html_context->options->css_import)
|
||||
return;
|
||||
|
||||
url = memacpy(url, len);
|
||||
/* unterminated_url might not end with '\0', but join_urls
|
||||
* requires that, so make a copy. */
|
||||
url = memacpy(unterminated_url, len);
|
||||
if (!url) return;
|
||||
|
||||
/* HTML <head> urls should already be fine but we can.t detect them. */
|
||||
|
@ -327,7 +327,7 @@ check_bencoding_dictionary_entry(struct scanner *scanner,
|
||||
static off_t
|
||||
parse_bencoding_integer(struct scanner_token *token)
|
||||
{
|
||||
unsigned char *string = token->string;
|
||||
const unsigned char *string = token->string;
|
||||
int pos = 0, length = token->length;
|
||||
off_t integer = 0;
|
||||
int sign = 1;
|
||||
@ -340,9 +340,13 @@ parse_bencoding_integer(struct scanner_token *token)
|
||||
}
|
||||
|
||||
for (; pos < length && isdigit(string[pos]); pos++) {
|
||||
if (integer > (off_t) integer * 10)
|
||||
off_t newint = integer * 10 + string[pos] - '0';
|
||||
|
||||
/* Check for overflow. This assumes wraparound,
|
||||
* even though C does not guarantee that. */
|
||||
if (newint / 10 != integer)
|
||||
return 0;
|
||||
integer = (off_t) integer * 10 + string[pos] - '0';
|
||||
integer = newint;
|
||||
}
|
||||
|
||||
if (sign == -1)
|
||||
@ -352,7 +356,8 @@ parse_bencoding_integer(struct scanner_token *token)
|
||||
}
|
||||
|
||||
static unsigned char *
|
||||
normalize_bencoding_path(unsigned char *path, int pathlen, int *malicious)
|
||||
normalize_bencoding_path(const unsigned char *path, int pathlen,
|
||||
int *malicious)
|
||||
{
|
||||
struct string string;
|
||||
|
||||
@ -735,7 +740,7 @@ parse_bittorrent_metafile(struct bittorrent_meta *meta, struct string *metafile)
|
||||
|
||||
case BENCODING_TOKEN_INFO:
|
||||
{
|
||||
unsigned char *start = value->string;
|
||||
const unsigned char *start = value->string;
|
||||
struct scanner_token *token;
|
||||
enum bittorrent_state state;
|
||||
|
||||
@ -881,8 +886,9 @@ parse_bencoding_peers_string(struct bittorrent_connection *bittorrent,
|
||||
struct scanner *scanner)
|
||||
{
|
||||
struct scanner_token *token = get_scanner_token(scanner);
|
||||
unsigned char *pos;
|
||||
unsigned char *last_peer_info_start = token->string + token->length - 6;
|
||||
const unsigned char *pos;
|
||||
const unsigned char *last_peer_info_start
|
||||
= token->string + token->length - 6;
|
||||
enum bittorrent_state state = BITTORRENT_STATE_OK;
|
||||
|
||||
assert(get_scanner_token(scanner)->type == BENCODING_TOKEN_STRING);
|
||||
|
@ -213,7 +213,7 @@ get_peer_from_bittorrent_pool(struct bittorrent_connection *bittorrent,
|
||||
enum bittorrent_state
|
||||
add_peer_to_bittorrent_pool(struct bittorrent_connection *bittorrent,
|
||||
bittorrent_id_T id, int port,
|
||||
unsigned char *ip, int iplen)
|
||||
const unsigned char *ip, int iplen)
|
||||
{
|
||||
struct bittorrent_peer *peer;
|
||||
|
||||
|
@ -368,7 +368,7 @@ bittorrent_id_is_known(struct bittorrent_connection *bittorrent,
|
||||
enum bittorrent_state
|
||||
add_peer_to_bittorrent_pool(struct bittorrent_connection *bittorrent,
|
||||
bittorrent_id_T id, int port,
|
||||
unsigned char *ip, int iplen);
|
||||
const unsigned char *ip, int iplen);
|
||||
|
||||
struct bittorrent_peer *
|
||||
get_peer_from_bittorrent_pool(struct bittorrent_connection *bittorrent,
|
||||
|
@ -1080,7 +1080,7 @@ bittorrent_resume_writer(void *data, int fd)
|
||||
uint32_t piece;
|
||||
|
||||
memcpy(&metafile.length, data, sizeof(metafile.length));
|
||||
metafile.source = (unsigned char *) data + 4;
|
||||
metafile.source = (unsigned char *) data + sizeof(metafile.length);
|
||||
|
||||
if (parse_bittorrent_metafile(&meta, &metafile) != BITTORRENT_STATE_OK) {
|
||||
done_bittorrent_meta(&meta);
|
||||
|
@ -82,7 +82,7 @@ free_colors_lookup(void)
|
||||
}
|
||||
|
||||
int
|
||||
decode_color(unsigned char *str, int slen, color_T *color)
|
||||
decode_color(const unsigned char *str, int slen, color_T *color)
|
||||
{
|
||||
if (*str == '#' && (slen == 7 || slen == 4)) {
|
||||
unsigned char buffer[7];
|
||||
|
@ -13,7 +13,7 @@ struct color_pair {
|
||||
/** Decode the color string.
|
||||
* The color string can either contain '@#FF0044' style declarations or
|
||||
* color names. */
|
||||
int decode_color(unsigned char *str, int slen, color_T *color);
|
||||
int decode_color(const unsigned char *str, int slen, color_T *color);
|
||||
|
||||
/** Returns a string containing the color info. If no 'English' name can be
|
||||
* found the hex color (@#rrggbb) is returned in the given buffer. */
|
||||
|
@ -590,7 +590,8 @@ return_error:
|
||||
} while (0)
|
||||
|
||||
void *
|
||||
fastfind_search(struct fastfind_index *index, unsigned char *key, int key_len)
|
||||
fastfind_search(struct fastfind_index *index,
|
||||
const unsigned char *key, int key_len)
|
||||
{
|
||||
struct ff_node *current;
|
||||
struct fastfind_info *info;
|
||||
|
@ -49,7 +49,8 @@ struct fastfind_index *fastfind_index(struct fastfind_index *index, enum fastfin
|
||||
/** Search the index for @a key with length @a key_len using the
|
||||
* @a index' handle created with fastfind_index().
|
||||
* @relates fastfind_index */
|
||||
void *fastfind_search(struct fastfind_index *index, unsigned char *key, int key_len);
|
||||
void *fastfind_search(struct fastfind_index *index,
|
||||
const unsigned char *key, int key_len);
|
||||
|
||||
/** Fastfind cleanup. It frees the given @a index.
|
||||
* Must be called once per list.
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
int
|
||||
map_scanner_string(struct scanner *scanner,
|
||||
unsigned char *ident, unsigned char *end, int base_type)
|
||||
const unsigned char *ident, const unsigned char *end,
|
||||
int base_type)
|
||||
{
|
||||
const struct scanner_string_mapping *mappings = scanner->info->mappings;
|
||||
int length = end - ident;
|
||||
|
@ -190,7 +190,8 @@ skip_scanner_tokens(struct scanner *scanner, int skipto, int precedence);
|
||||
* @relates scanner */
|
||||
int
|
||||
map_scanner_string(struct scanner *scanner,
|
||||
unsigned char *ident, unsigned char *end, int base_type);
|
||||
const unsigned char *ident, const unsigned char *end,
|
||||
int base_type);
|
||||
|
||||
#ifdef DEBUG_SCANNER
|
||||
/** @relates scanner */
|
||||
|
Loading…
Reference in New Issue
Block a user