1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[renderer] const

This commit is contained in:
Witold Filipczyk 2022-02-12 22:03:19 +01:00
parent 6575f71dd4
commit 6d5913b55f
5 changed files with 19 additions and 19 deletions

View File

@ -16,7 +16,7 @@ struct uri;
/* For parser/parse.c: */ /* For parser/parse.c: */
void process_head(struct html_context *html_context, char *head); void process_head(struct html_context *html_context, char *head);
void put_chrs(struct html_context *html_context, char *start, int len); void put_chrs(struct html_context *html_context, const char *start, int len);
enum html_whitespace_state { enum html_whitespace_state {
/* Either we are starting a new "block" or the last segment of the /* Either we are starting a new "block" or the last segment of the
@ -120,7 +120,7 @@ struct html_context {
* html/parser.c */ * html/parser.c */
/* Note that this is for usage by put_chrs only; anywhere else in /* Note that this is for usage by put_chrs only; anywhere else in
* the parser, one should use put_chrs. */ * the parser, one should use put_chrs. */
void (*put_chars_f)(struct html_context *, char *, int); void (*put_chars_f)(struct html_context *, const char *, int);
/* For: /* For:
* html/parser/forms.c * html/parser/forms.c

View File

@ -129,7 +129,7 @@ ln_break(struct html_context *html_context, int n)
} }
void void
put_chrs(struct html_context *html_context, char *start, int len) put_chrs(struct html_context *html_context, const char *start, int len)
{ {
if (html_is_preformatted()) if (html_is_preformatted())
html_context->putsp = HTML_SPACE_NORMAL; html_context->putsp = HTML_SPACE_NORMAL;
@ -759,7 +759,7 @@ struct html_context *
init_html_parser(struct uri *uri, struct document_options *options, init_html_parser(struct uri *uri, struct document_options *options,
char *start, char *end, char *start, char *end,
struct string *head, struct string *title, struct string *head, struct string *title,
void (*put_chars)(struct html_context *, char *, int), void (*put_chars)(struct html_context *, const char *, int),
void (*line_break)(struct html_context *), void (*line_break)(struct html_context *),
void *(*special)(struct html_context *, enum html_special_type, ...)) void *(*special)(struct html_context *, enum html_special_type, ...))
{ {

View File

@ -177,7 +177,7 @@ struct html_context *
init_html_parser(struct uri *uri, struct document_options *options, init_html_parser(struct uri *uri, struct document_options *options,
char *start, char *end, char *start, char *end,
struct string *head, struct string *title, struct string *head, struct string *title,
void (*put_chars)(struct html_context *, char *, int), void (*put_chars)(struct html_context *, const char *, int),
void (*line_break)(struct html_context *), void (*line_break)(struct html_context *),
void *(*special)(struct html_context *, enum html_special_type, void *(*special)(struct html_context *, enum html_special_type,
...)); ...));

View File

@ -92,7 +92,7 @@ static struct hash *table_cache;
struct renderer_context renderer_context; struct renderer_context renderer_context;
/* Prototypes */ /* Prototypes */
static void put_chars(struct html_context *, char *, int); static void put_chars(struct html_context *, const char *, int);
#define X(x_) (part->box.x + (x_)) #define X(x_) (part->box.x + (x_))
#define Y(y_) (part->box.y + (y_)) #define Y(y_) (part->box.y + (y_))
@ -470,7 +470,7 @@ put_combined(struct part *part, int x)
/* First possibly do the format change and then find out what coordinates /* First possibly do the format change and then find out what coordinates
* to use since sub- or superscript might change them */ * to use since sub- or superscript might change them */
static inline int static inline int
set_hline(struct html_context *html_context, char *chars, int charslen, set_hline(struct html_context *html_context, const char *chars, int charslen,
link_state_T link_state) link_state_T link_state)
{ {
struct part *const part = html_context->part; struct part *const part = html_context->part;
@ -537,7 +537,7 @@ set_hline(struct html_context *html_context, char *chars, int charslen,
} }
if (utf8) { if (utf8) {
char *const end = chars + charslen; const char *const end = chars + charslen;
unicode_val_T data; unicode_val_T data;
if (document->buf_length) { if (document->buf_length) {
@ -578,7 +578,7 @@ set_hline(struct html_context *html_context, char *chars, int charslen,
while (chars < end) { while (chars < end) {
/* ELinks does not use NBSP_CHAR in UTF-8. */ /* ELinks does not use NBSP_CHAR in UTF-8. */
data = utf8_to_unicode(&chars, end); data = utf8_to_unicode((char **)&chars, end);
if (data == UCS_NO_CHAR) { if (data == UCS_NO_CHAR) {
part->spaces[x] = 0; part->spaces[x] = 0;
if (charslen == 1) { if (charslen == 1) {
@ -700,12 +700,12 @@ good_char:
len = x - x2; len = x - x2;
} else { /* part->document == NULL */ } else { /* part->document == NULL */
if (utf8) { if (utf8) {
char *const end = chars + charslen; const char *const end = chars + charslen;
while (chars < end) { while (chars < end) {
unicode_val_T data; unicode_val_T data;
data = utf8_to_unicode(&chars, end); data = utf8_to_unicode((char **)&chars, end);
#ifdef CONFIG_COMBINE #ifdef CONFIG_COMBINE
if (data == UCS_SOFT_HYPHEN if (data == UCS_SOFT_HYPHEN
|| (data != UCS_NO_CHAR && wcwidth((wchar_t)data) == 0)) || (data != UCS_NO_CHAR && wcwidth((wchar_t)data) == 0))
@ -750,7 +750,7 @@ good_char:
/* First possibly do the format change and then find out what coordinates /* First possibly do the format change and then find out what coordinates
* to use since sub- or superscript might change them */ * to use since sub- or superscript might change them */
static inline void static inline void
set_hline(struct html_context *html_context, char *chars, int charslen, set_hline(struct html_context *html_context, const char *chars, int charslen,
link_state_T link_state) link_state_T link_state)
{ {
struct part *part = html_context->part; struct part *part = html_context->part;
@ -1429,7 +1429,7 @@ init_link_event_hooks(struct html_context *html_context, struct link *link)
} }
static struct link * static struct link *
new_link(struct html_context *html_context, char *name, int namelen) new_link(struct html_context *html_context, const char *name, int namelen)
{ {
struct document *document; struct document *document;
struct part *part; struct part *part;
@ -1556,7 +1556,7 @@ html_special_tag(struct document *document, char *t, int x, int y)
void void
put_chars_conv(struct html_context *html_context, put_chars_conv(struct html_context *html_context,
char *chars, int charslen) const char *chars, int charslen)
{ {
assert(html_context); assert(html_context);
if_assert_failed return; if_assert_failed return;
@ -1693,11 +1693,11 @@ done_link_state_info(void)
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
static inline void static inline void
process_link(struct html_context *html_context, link_state_T link_state, process_link(struct html_context *html_context, link_state_T link_state,
char *chars, int charslen, int cells) const char *chars, int charslen, int cells)
#else #else
static inline void static inline void
process_link(struct html_context *html_context, link_state_T link_state, process_link(struct html_context *html_context, link_state_T link_state,
char *chars, int charslen) const char *chars, int charslen)
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
{ {
struct part *part = html_context->part; struct part *part = html_context->part;
@ -1822,7 +1822,7 @@ get_link_state(struct html_context *html_context)
} }
static inline int static inline int
html_has_non_space_chars(char *chars, int charslen) html_has_non_space_chars(const char *chars, int charslen)
{ {
int pos = 0; int pos = 0;
@ -1834,7 +1834,7 @@ html_has_non_space_chars(char *chars, int charslen)
} }
static void static void
put_chars(struct html_context *html_context, char *chars, int charslen) put_chars(struct html_context *html_context, const char *chars, int charslen)
{ {
link_state_T link_state; link_state_T link_state;
struct part *part; struct part *part;

View File

@ -116,7 +116,7 @@ struct part *format_html_part(struct html_context *html_context, char *, char *,
int dec2qwerty(int num, char *link_sym, const char *key, int base); int dec2qwerty(int num, char *link_sym, const char *key, int base);
int qwerty2dec(const char *link_sym, const char *key, int base); int qwerty2dec(const char *link_sym, const char *key, int base);
void put_chars_conv(struct html_context *html_context, char *chars, int charslen); void put_chars_conv(struct html_context *html_context, const char *chars, int charslen);
void line_break(struct html_context *html_context); void line_break(struct html_context *html_context);
void *html_special(struct html_context *html_context, enum html_special_type c, ...); void *html_special(struct html_context *html_context, enum html_special_type c, ...);