mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -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
|
static void
|
||||||
import_css_file(struct css_stylesheet *css, struct uri *base_uri,
|
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;
|
struct string string, filename;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
|
|||||||
type = CSS_TOKEN_NUMBER;
|
type = CSS_TOKEN_NUMBER;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
unsigned char *ident = string;
|
const unsigned char *ident = string;
|
||||||
|
|
||||||
scan_css(scanner, string, CSS_CHAR_IDENT);
|
scan_css(scanner, string, CSS_CHAR_IDENT);
|
||||||
type = map_scanner_string(scanner, ident, string,
|
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 == '@') {
|
} else if (first_char == '@') {
|
||||||
/* Compose token containing @<ident> */
|
/* Compose token containing @<ident> */
|
||||||
if (is_css_ident_start(*string)) {
|
if (is_css_ident_start(*string)) {
|
||||||
unsigned char *ident = string;
|
const unsigned char *ident = string;
|
||||||
|
|
||||||
/* Scan both ident start and ident */
|
/* Scan both ident start and ident */
|
||||||
scan_css(scanner, string, CSS_CHAR_IDENT);
|
scan_css(scanner, string, CSS_CHAR_IDENT);
|
||||||
|
@ -49,7 +49,7 @@ find_css_selector(LIST_OF(struct css_selector) *sels,
|
|||||||
struct css_selector *
|
struct css_selector *
|
||||||
init_css_selector(LIST_OF(struct css_selector) *sels,
|
init_css_selector(LIST_OF(struct css_selector) *sels,
|
||||||
enum css_selector_type type,
|
enum css_selector_type type,
|
||||||
unsigned char *name, int namelen)
|
const unsigned char *name, int namelen)
|
||||||
{
|
{
|
||||||
struct css_selector *selector;
|
struct css_selector *selector;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ struct css_selector *
|
|||||||
get_css_selector(LIST_OF(struct css_selector) *sels,
|
get_css_selector(LIST_OF(struct css_selector) *sels,
|
||||||
enum css_selector_type type,
|
enum css_selector_type type,
|
||||||
enum css_selector_relation rel,
|
enum css_selector_relation rel,
|
||||||
unsigned char *name, int namelen)
|
const unsigned char *name, int namelen)
|
||||||
{
|
{
|
||||||
struct css_selector *selector = NULL;
|
struct css_selector *selector = NULL;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ struct css_selector {
|
|||||||
|
|
||||||
struct css_stylesheet;
|
struct css_stylesheet;
|
||||||
typedef void (*css_stylesheet_importer_T)(struct css_stylesheet *, struct uri *,
|
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
|
/** 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
|
* 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,
|
struct css_selector *get_css_selector(LIST_OF(struct css_selector) *selector_list,
|
||||||
enum css_selector_type type,
|
enum css_selector_type type,
|
||||||
enum css_selector_relation rel,
|
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) \
|
#define get_css_base_selector(stylesheet, type, rel, name, namelen) \
|
||||||
get_css_selector((stylesheet) ? &(stylesheet)->selectors : NULL, \
|
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. */
|
* function from your POV. */
|
||||||
struct css_selector *init_css_selector(LIST_OF(struct css_selector) *selector_list,
|
struct css_selector *init_css_selector(LIST_OF(struct css_selector) *selector_list,
|
||||||
enum css_selector_type type,
|
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. */
|
/** Add all properties from the list to the given @a selector. */
|
||||||
void add_selector_properties(struct css_selector *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
|
/* The first two args are terminated by ',' and the
|
||||||
* last one by ')'. */
|
* last one by ')'. */
|
||||||
unsigned char paskynator = shift ? ',' : ')';
|
unsigned char paskynator = shift ? ',' : ')';
|
||||||
unsigned char *nstring = token->string;
|
const unsigned char *nstring = token->string;
|
||||||
int part;
|
int part;
|
||||||
|
|
||||||
/* Are the current and next token valid? */
|
/* Are the current and next token valid? */
|
||||||
|
@ -143,6 +143,6 @@ unsigned char *get_target(struct document_options *options, unsigned char *a);
|
|||||||
|
|
||||||
void
|
void
|
||||||
import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
||||||
unsigned char *url, int len);
|
const unsigned char *unterminated_url, int len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,9 +182,10 @@ add_fragment_identifier(struct html_context *html_context,
|
|||||||
#ifdef CONFIG_CSS
|
#ifdef CONFIG_CSS
|
||||||
void
|
void
|
||||||
import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
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;
|
struct html_context *html_context = css->import_data;
|
||||||
|
unsigned char *url;
|
||||||
unsigned char *import_url;
|
unsigned char *import_url;
|
||||||
struct uri *uri;
|
struct uri *uri;
|
||||||
|
|
||||||
@ -195,7 +196,9 @@ import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
|
|||||||
|| !html_context->options->css_import)
|
|| !html_context->options->css_import)
|
||||||
return;
|
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;
|
if (!url) return;
|
||||||
|
|
||||||
/* HTML <head> urls should already be fine but we can.t detect them. */
|
/* HTML <head> urls should already be fine but we can.t detect them. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user