mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
const in CSS
This commit is contained in:
parent
0689443ad2
commit
cab0b3fbd5
@ -79,7 +79,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);
|
||||
|
@ -49,7 +49,7 @@ find_css_selector(LIST_OF(struct css_selector) *sels,
|
||||
struct css_selector *
|
||||
init_css_selector(LIST_OF(struct css_selector) *sels,
|
||||
enum css_selector_type type,
|
||||
unsigned char *name, int namelen)
|
||||
const unsigned char *name, int namelen)
|
||||
{
|
||||
struct css_selector *selector;
|
||||
|
||||
@ -84,7 +84,7 @@ struct css_selector *
|
||||
get_css_selector(LIST_OF(struct css_selector) *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;
|
||||
|
||||
|
@ -74,7 +74,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
|
||||
@ -117,7 +117,7 @@ void done_css_stylesheet(struct css_stylesheet *css);
|
||||
struct css_selector *get_css_selector(LIST_OF(struct css_selector) *selector_list,
|
||||
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, \
|
||||
@ -137,7 +137,7 @@ struct css_selector *find_css_selector(LIST_OF(struct css_selector) *selector_li
|
||||
* function from your POV. */
|
||||
struct css_selector *init_css_selector(LIST_OF(struct css_selector) *selector_list,
|
||||
enum css_selector_type type,
|
||||
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,
|
||||
|
@ -41,7 +41,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
|
||||
|
@ -182,9 +182,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;
|
||||
|
||||
@ -195,7 +196,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. */
|
||||
|
Loading…
Reference in New Issue
Block a user