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

template -> template_ for C++ compatibility

This commit is contained in:
Witold Filipczyk 2016-04-20 18:05:00 +02:00
parent 13f3da8416
commit 2e721e051a
16 changed files with 134 additions and 134 deletions

View File

@ -206,9 +206,9 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
}
if (tree && tree->flags & OPT_AUTOCREATE && !no_autocreate) {
struct option *template = get_opt_rec(tree, "_template_");
struct option *template_ = get_opt_rec(tree, "_template_");
assertm(template != NULL, "Requested %s should be autocreated but "
assertm(template_ != NULL, "Requested %s should be autocreated but "
"%.*s._template_ is missing!", name_, sep - name_,
name_);
if_assert_failed {
@ -221,7 +221,7 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
* option. By having _template_ OPT_AUTOCREATE and _template_
* inside, you can have even multi-level autocreating. */
option = copy_option(template, 0);
option = copy_option(template_, 0);
if (!option) {
mem_free(aname);
return NULL;
@ -453,10 +453,10 @@ add_opt_rec(struct option *tree, unsigned char *path, struct option *option)
option->box_item->visible = get_opt_bool("config.show_template", NULL);
if (tree->flags & OPT_AUTOCREATE && !option->desc) {
struct option *template = get_opt_rec(tree, "_template_");
struct option *template_ = get_opt_rec(tree, "_template_");
assert(template);
option->desc = template->desc;
assert(template_);
option->desc = template_->desc;
}
option->root = tree;
@ -670,34 +670,34 @@ delete_option(struct option *option)
/*! @relates option */
struct option *
copy_option(struct option *template, int flags)
copy_option(struct option *template_, int flags)
{
struct option *option = mem_calloc(1, sizeof(*option));
if (!option) return NULL;
option->name = null_or_stracpy(template->name);
option->flags = (template->flags | OPT_ALLOC);
option->type = template->type;
option->min = template->min;
option->max = template->max;
option->capt = template->capt;
option->desc = template->desc;
option->change_hook = template->change_hook;
option->name = null_or_stracpy(template_->name);
option->flags = (template_->flags | OPT_ALLOC);
option->type = template_->type;
option->min = template_->min;
option->max = template_->max;
option->capt = template_->capt;
option->desc = template_->desc;
option->change_hook = template_->change_hook;
if (!(flags & CO_NO_LISTBOX_ITEM))
option->box_item = init_option_listbox_item(option);
if (option->box_item) {
if (template->box_item) {
option->box_item->type = template->box_item->type;
option->box_item->depth = template->box_item->depth;
if (template_->box_item) {
option->box_item->type = template_->box_item->type;
option->box_item->depth = template_->box_item->depth;
}
}
if (option_types[template->type].dup) {
option_types[template->type].dup(option, template, flags);
if (option_types[template_->type].dup) {
option_types[template_->type].dup(option, template_, flags);
} else {
option->value = template->value;
option->value = template_->value;
}
return option;

View File

@ -345,11 +345,11 @@ str_wr(struct option *o, struct string *s)
}
static void
str_dup(struct option *opt, struct option *template, int flags)
str_dup(struct option *opt, struct option *template_, int flags)
{
unsigned char *new = mem_alloc(MAX_STR_LEN);
if (new) safe_strncpy(new, template->value.string, MAX_STR_LEN);
if (new) safe_strncpy(new, template_->value.string, MAX_STR_LEN);
opt->value.string = new;
}
@ -441,10 +441,10 @@ color_wr(struct option *opt, struct string *str)
}
static void
tree_dup(struct option *opt, struct option *template, int flags)
tree_dup(struct option *opt, struct option *template_, int flags)
{
LIST_OF(struct option) *new = init_options_tree();
LIST_OF(struct option) *tree = template->value.tree;
LIST_OF(struct option) *tree = template_->value.tree;
struct option *option;
if (!new) return;

View File

@ -197,7 +197,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
/* Initialize styles. */
for (type = 0; type < RSS_STYLES; type++) {
struct screen_char *template = &rss->styles[type];
struct screen_char *template_ = &rss->styles[type];
static const unsigned char *names[RSS_STYLES] =
{ "title", "author", "author-date-sep", "date" };
struct css_selector *selector = NULL;
@ -205,7 +205,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
selector = find_css_selector(&css->selectors,
CST_ELEMENT, CSR_ROOT,
names[type], strlen(names[type]));
init_template_by_style(template, &document->options,
init_template_by_style(template_, &document->options,
selector ? &selector->properties : NULL);
}

View File

@ -63,21 +63,21 @@ static inline void
render_dom_flush(struct dom_renderer *renderer, unsigned char *string)
{
struct source_renderer *data = renderer->data;
struct screen_char *template = &data->styles[DOM_NODE_TEXT];
struct screen_char *template_ = &data->styles[DOM_NODE_TEXT];
int length = string - renderer->position;
assert_source(renderer, renderer->position, 0);
assert_source(renderer, string, 0);
if (length <= 0) return;
render_dom_text(renderer, template, renderer->position, length);
render_dom_text(renderer, template_, renderer->position, length);
renderer->position = string;
assert_source(renderer, renderer->position, 0);
}
static inline void
render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template,
render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template_,
struct dom_node *node)
{
unsigned char *string = node->string.string;
@ -94,7 +94,7 @@ render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template
assert_source(renderer, renderer->position, 0);
}
render_dom_text(renderer, template, string, length);
render_dom_text(renderer, template_, string, length);
}
#ifdef HAVE_REGEX_H
@ -106,7 +106,7 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
regmatch_t regmatch;
unsigned char *string = node->string.string;
int length = node->string.length;
struct screen_char *template = &data->styles[node->type];
struct screen_char *template_ = &data->styles[node->type];
unsigned char *alloc_string;
if (check_dom_node_source(renderer, string, length)) {
@ -127,7 +127,7 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
break;
if (offset > 0)
render_dom_text(renderer, template, string, offset);
render_dom_text(renderer, template_, string, offset);
string += offset;
length -= offset;
@ -139,7 +139,7 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
}
if (length > 0)
render_dom_text(renderer, template, string, length);
render_dom_text(renderer, template_, string, length);
mem_free_if(alloc_string);
}
@ -233,11 +233,11 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
{
struct dom_renderer *renderer = stack->current->data;
struct source_renderer *data = renderer->data;
struct screen_char *template = &data->styles[node->type];
struct screen_char *template_ = &data->styles[node->type];
assert(node && renderer->document);
render_dom_node_text(renderer, template, node);
render_dom_node_text(renderer, template_, node);
if (is_dom_string_set(&node->data.attribute.value)) {
int quoted = node->data.attribute.quoted == 1;
@ -267,7 +267,7 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
}
if (skips > 0) {
render_dom_text(renderer, template, value, skips);
render_dom_text(renderer, template_, value, skips);
value += skips;
valuelen -= skips;
}
@ -294,10 +294,10 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
if (skips > 0) {
value += valuelen - skips;
render_dom_text(renderer, template, value, skips);
render_dom_text(renderer, template_, value, skips);
}
} else {
render_dom_text(renderer, template, value, valuelen);
render_dom_text(renderer, template_, value, valuelen);
}
}
@ -363,7 +363,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void *
/* Initialize styles for all the DOM node types. */
for (type = 0; type < DOM_NODES; type++) {
struct screen_char *template = &data->styles[type];
struct screen_char *template_ = &data->styles[type];
struct dom_string *name = get_dom_node_type_name(type);
struct css_selector *selector = NULL;
@ -371,7 +371,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void *
selector = find_css_selector(&css->selectors,
CST_ELEMENT, CSR_ROOT,
name->string, name->length);
init_template_by_style(template, &document->options,
init_template_by_style(template_, &document->options,
selector ? &selector->properties : NULL);
}

View File

@ -28,16 +28,16 @@
static inline void
init_template(struct screen_char *template, struct document_options *options,
init_template(struct screen_char *template_, struct document_options *options,
enum screen_char_attr attr, color_T foreground, color_T background)
{
struct text_style style = INIT_TEXT_STYLE(attr, foreground, background);
get_screen_char_template(template, options, style);
get_screen_char_template(template_, options, style);
}
void
init_template_by_style(struct screen_char *template, struct document_options *options,
init_template_by_style(struct screen_char *template_, struct document_options *options,
LIST_OF(struct css_property) *properties)
{
struct text_style style = options->default_style;
@ -72,7 +72,7 @@ init_template_by_style(struct screen_char *template, struct document_options *op
}
}
get_screen_char_template(template, options, style);
get_screen_char_template(template_, options, style);
}
@ -115,7 +115,7 @@ add_search_node(struct dom_renderer *renderer, int width)
#define WIDTH(renderer, add) ((renderer)->canvas_x + (add))
static void
render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
render_dom_line(struct dom_renderer *renderer, struct screen_char *template_,
unsigned char *string, int length)
{
struct document *document = renderer->document;
@ -128,7 +128,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
#endif /* CONFIG_UTF8 */
assert(renderer && template && string && length);
assert(renderer && template_ && string && length);
string = convert_string(convert, string, length, document->options.cp,
mode, &length, NULL, NULL);
@ -155,7 +155,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
int tab_width = 7 - (X(renderer) & 7);
int width = WIDTH(renderer, length - x + tab_width);
template->data = ' ';
template_->data = ' ';
if (!realloc_line(document, width, Y(renderer)))
break;
@ -163,7 +163,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
/* Only loop over the expanded tab chars and let the
* ``main loop'' add the actual tab char. */
for (; tab_width-- > 0; renderer->canvas_x++)
copy_screen_chars(POS(renderer), template, 1);
copy_screen_chars(POS(renderer), template_, 1);
charlen = 1;
break;
}
@ -174,22 +174,22 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
charlen = utf8charlen(text);
data = utf8_to_unicode(&text, end);
template->data = (unicode_val_T)data;
template_->data = (unicode_val_T)data;
if (unicode_to_cell(data) == 2) {
copy_screen_chars(POS(renderer),
template, 1);
template_, 1);
X(renderer)++;
template->data = UCS_NO_CHAR;
template_->data = UCS_NO_CHAR;
}
} else
#endif /* CONFIG_UTF8 */
template->data = isscreensafe(*text) ? *text:'.';
template_->data = isscreensafe(*text) ? *text:'.';
}
copy_screen_chars(POS(renderer), template, 1);
copy_screen_chars(POS(renderer), template_, 1);
}
mem_free(string);
}
@ -222,7 +222,7 @@ split_dom_line(unsigned char *line, int length, int *linelen)
}
void
render_dom_text(struct dom_renderer *renderer, struct screen_char *template,
render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
unsigned char *string, int length)
{
int linelen;
@ -231,7 +231,7 @@ render_dom_text(struct dom_renderer *renderer, struct screen_char *template,
unsigned char *newline = split_dom_line(string, length, &linelen);
if (linelen)
render_dom_line(renderer, template, string, linelen);
render_dom_line(renderer, template_, string, linelen);
if (newline) {
renderer->canvas_y++;
@ -254,7 +254,7 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length,
unsigned char *where;
struct link *link;
struct point *point;
struct screen_char template;
struct screen_char template_;
color_T fgcolor;
if (!realloc_document_links(document, document->nlinks + 1))
@ -294,10 +294,10 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length,
link->color.foreground = fgcolor;
link->number = document->nlinks;
init_template(&template, &document->options,
init_template(&template_, &document->options,
0, link->color.foreground, link->color.background);
render_dom_text(renderer, &template, string, length);
render_dom_text(renderer, &template_, string, length);
for (point = link->points; length > 0; length--, point++, x++) {
point->x = x;

View File

@ -42,11 +42,11 @@ struct dom_renderer {
#define Y(renderer) ((renderer)->canvas_y)
void init_template_by_style(struct screen_char *template,
void init_template_by_style(struct screen_char *template_,
struct document_options *options,
LIST_OF(struct css_property) *properties);
void render_dom_text(struct dom_renderer *renderer, struct screen_char *template,
void render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
unsigned char *string, int length);
struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string,
int length, unsigned char *uristring, int urilength);

View File

@ -14,33 +14,33 @@
void
get_screen_char_template(struct screen_char *template,
get_screen_char_template(struct screen_char *template_,
struct document_options *options,
struct text_style style)
{
template->attr = 0;
template->data = ' ';
template_->attr = 0;
template_->data = ' ';
if (style.attr) {
if (style.attr & AT_UNDERLINE) {
template->attr |= SCREEN_ATTR_UNDERLINE;
template_->attr |= SCREEN_ATTR_UNDERLINE;
}
if (style.attr & AT_BOLD) {
template->attr |= SCREEN_ATTR_BOLD;
template_->attr |= SCREEN_ATTR_BOLD;
}
if (style.attr & AT_ITALIC) {
template->attr |= SCREEN_ATTR_ITALIC;
template_->attr |= SCREEN_ATTR_ITALIC;
}
if (style.attr & AT_GRAPHICS) {
template->attr |= SCREEN_ATTR_FRAME;
template_->attr |= SCREEN_ATTR_FRAME;
}
}
{
struct color_pair colors = INIT_COLOR_PAIR(style.color.background, style.color.foreground);
set_term_color(template, &colors, options->color_flags, options->color_mode);
set_term_color(template_, &colors, options->color_flags, options->color_mode);
}
}

View File

@ -33,7 +33,7 @@ struct text_style {
#define INIT_TEXT_STYLE(attr, fg, bg) { attr, {fg, bg}}
void get_screen_char_template(struct screen_char *template, struct document_options *options, struct text_style style);
void get_screen_char_template(struct screen_char *template_, struct document_options *options, struct text_style style);
#endif

View File

@ -275,7 +275,7 @@ get_frame_char(struct html_context *html_context, struct part *part,
int x, int y, unsigned char data,
color_T bgcolor, color_T fgcolor)
{
struct screen_char *template;
struct screen_char *template_;
assert(html_context);
if_assert_failed return NULL;
@ -289,14 +289,14 @@ get_frame_char(struct html_context *html_context, struct part *part,
assert(part->document->data);
if_assert_failed return NULL;
template = &POS(x, y);
template->data = data;
template->attr = SCREEN_ATTR_FRAME;
set_screen_char_color(template, bgcolor, fgcolor,
template_ = &POS(x, y);
template_->data = data;
template_->attr = SCREEN_ATTR_FRAME;
set_screen_char_color(template_, bgcolor, fgcolor,
part->document->options.color_flags,
part->document->options.color_mode);
return template;
return template_;
}
void
@ -304,17 +304,17 @@ draw_frame_hchars(struct part *part, int x, int y, int width,
unsigned char data, color_T bgcolor, color_T fgcolor,
struct html_context *html_context)
{
struct screen_char *template;
struct screen_char *template_;
assert(width > 0);
if_assert_failed return;
template = get_frame_char(html_context, part, x + width - 1, y, data, bgcolor, fgcolor);
if (!template) return;
template_ = get_frame_char(html_context, part, x + width - 1, y, data, bgcolor, fgcolor);
if (!template_) return;
/* The template char is the last we need to draw so only decrease @width. */
for (width -= 1; width; width--, x++) {
copy_screen_chars(&POS(x, y), template, 1);
copy_screen_chars(&POS(x, y), template_, 1);
}
}
@ -323,10 +323,10 @@ draw_frame_vchars(struct part *part, int x, int y, int height,
unsigned char data, color_T bgcolor, color_T fgcolor,
struct html_context *html_context)
{
struct screen_char *template = get_frame_char(html_context, part, x, y,
struct screen_char *template_ = get_frame_char(html_context, part, x, y,
data, bgcolor, fgcolor);
if (!template) return;
if (!template_) return;
/* The template char is the first vertical char to be drawn. So
* copy it to the rest. */
@ -334,7 +334,7 @@ draw_frame_vchars(struct part *part, int x, int y, int height,
if (realloc_line(html_context, part->document, Y(y), X(x)) < 0)
return;
copy_screen_chars(&POS(x, y), template, 1);
copy_screen_chars(&POS(x, y), template_, 1);
}
}

View File

@ -44,7 +44,7 @@ struct plain_renderer {
struct conv_table *convert_table;
/* The default template char data for text */
struct screen_char template;
struct screen_char template_;
/* The maximum width any line can have (used for wrapping text) */
int max_width;
@ -187,7 +187,7 @@ print_document_link(struct plain_renderer *renderer, int lineno,
int link_end = line_pos + len;
unsigned char saved_char;
struct document_options *doc_opts = &document->options;
struct screen_char template = renderer->template;
struct screen_char template_ = renderer->template_;
int i;
if (!len) return 0;
@ -217,12 +217,12 @@ print_document_link(struct plain_renderer *renderer, int lineno,
new_link->color.background = doc_opts->default_style.color.background;
set_term_color(&template, &new_link->color,
set_term_color(&template_, &new_link->color,
doc_opts->color_flags, doc_opts->color_mode);
for (i = len; i; i--) {
template.data = line[line_pos++];
copy_screen_chars(pos++, &template, 1);
template_.data = line[line_pos++];
copy_screen_chars(pos++, &template_, 1);
}
return len;
@ -230,7 +230,7 @@ print_document_link(struct plain_renderer *renderer, int lineno,
static void
decode_esc_color(unsigned char *text, int *line_pos, int width,
struct screen_char *template, enum color_mode mode,
struct screen_char *template_, enum color_mode mode,
int *was_reversed)
{
struct screen_char ch;
@ -252,7 +252,7 @@ decode_esc_color(unsigned char *text, int *line_pos, int width,
end = buf + k;
begin = tail = buf;
get_screen_char_color(template, &color, 0, mode);
get_screen_char_color(template_, &color, 0, mode);
set_term_color(&ch, &color, 0, COLOR_MODE_16);
b1 = background = (ch.c.color[0] >> 4) & 7;
f1 = foreground = ch.c.color[0] & 15;
@ -306,7 +306,7 @@ decode_esc_color(unsigned char *text, int *line_pos, int width,
}
color.background = get_term_color16(background);
color.foreground = get_term_color16(foreground);
set_term_color(template, &color, 0, mode);
set_term_color(template_, &color, 0, mode);
}
static inline int
@ -314,8 +314,8 @@ add_document_line(struct plain_renderer *renderer,
unsigned char *line, int line_width)
{
struct document *document = renderer->document;
struct screen_char *template = &renderer->template;
struct screen_char saved_renderer_template = *template;
struct screen_char *template_ = &renderer->template_;
struct screen_char saved_renderer_template = *template_;
struct screen_char *pos, *startpos;
struct document_options *doc_opts = &document->options;
int was_reversed = 0;
@ -427,12 +427,12 @@ add_document_line(struct plain_renderer *renderer,
expanded += tab_width;
template->data = ' ';
template_->data = ' ';
do
copy_screen_chars(pos++, template, 1);
copy_screen_chars(pos++, template_, 1);
while (tab_width--);
*template = saved_renderer_template;
*template_ = saved_renderer_template;
} else if (line_char == ASCII_BS) {
if (!(expanded + cells)) {
@ -475,32 +475,32 @@ add_document_line(struct plain_renderer *renderer,
&& (pos - 1)->attr) {
/* There is some preceding text,
* and it has an attribute; copy it */
template->attr |= (pos - 1)->attr;
template_->attr |= (pos - 1)->attr;
} else {
/* Default to bold; seems more useful
* than underlining the underscore */
template->attr |= SCREEN_ATTR_BOLD;
template_->attr |= SCREEN_ATTR_BOLD;
}
} else if (pos->data == '_') {
/* Underline _^Hx */
template->attr |= SCREEN_ATTR_UNDERLINE;
template_->attr |= SCREEN_ATTR_UNDERLINE;
} else if (pos->data == next_char) {
/* Embolden x^Hx */
template->attr |= SCREEN_ATTR_BOLD;
template_->attr |= SCREEN_ATTR_BOLD;
}
/* Handle _^Hx^Hx as both bold and underlined */
if (template->attr)
template->attr |= pos->attr;
if (template_->attr)
template_->attr |= pos->attr;
} else if (line_char == 27) {
decode_esc_color(line, &line_pos, width,
&saved_renderer_template,
doc_opts->color_mode, &was_reversed);
*template = saved_renderer_template;
*template_ = saved_renderer_template;
} else {
int added_chars = 0;
@ -531,21 +531,21 @@ add_document_line(struct plain_renderer *renderer,
continue;
}
template->data = (unicode_val_T)data;
copy_screen_chars(pos++, template, 1);
template_->data = (unicode_val_T)data;
copy_screen_chars(pos++, template_, 1);
if (cell == 2) {
template->data = UCS_NO_CHAR;
template_->data = UCS_NO_CHAR;
copy_screen_chars(pos++,
template, 1);
template_, 1);
}
} else
#endif /* CONFIG_UTF8 */
{
if (!isscreensafe(line_char))
line_char = '.';
template->data = line_char;
copy_screen_chars(pos++, template, 1);
template_->data = line_char;
copy_screen_chars(pos++, template_, 1);
/* Detect copy of nul chars to screen,
* this should not occur. --Zas */
@ -553,7 +553,7 @@ add_document_line(struct plain_renderer *renderer,
}
}
*template = saved_renderer_template;
*template_ = saved_renderer_template;
}
next:
line_pos += charlen;
@ -567,9 +567,9 @@ next:
}
static void
init_template(struct screen_char *template, struct document_options *options)
init_template(struct screen_char *template_, struct document_options *options)
{
get_screen_char_template(template, options, options->default_style);
get_screen_char_template(template_, options, options->default_style);
}
static struct node *
@ -734,7 +734,7 @@ render_plain_document(struct cache_entry *cached, struct document *document,
#endif /* CONFIG_UTF8 */
/* Setup the style */
init_template(&renderer.template, &document->options);
init_template(&renderer.template_, &document->options);
add_document_lines(&renderer);
}

View File

@ -224,7 +224,7 @@ gettimeofday(struct timeval* p, void* tz)
int
mkstemp(char *template)
mkstemp(char *template_)
{
char pathname[MAX_PATH];
@ -232,9 +232,9 @@ mkstemp(char *template)
GetTempPath(MAX_PATH, pathname);
/* Create a temporary file. */
GetTempFileName(pathname, "ABC", 0, template);
GetTempFileName(pathname, "ABC", 0, template_);
return open(template, O_WRONLY | O_BINARY | O_EXCL);
return open(template_, O_WRONLY | O_BINARY | O_EXCL);
}
int

View File

@ -19,7 +19,7 @@ unsigned char *user_appdata_directory(void);
/* Stub functions: */
int mkstemp (char *template);
int mkstemp (char *template_);
int gettimeofday (struct timeval *tv, void *tz);
/* fake termios for Win32 (excluding CygWin) */

View File

@ -396,7 +396,7 @@ normalize_bencoding_path(const unsigned char *path, int pathlen,
* checked for sanity. */
static enum bittorrent_state
add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path,
struct bittorrent_file *template)
struct bittorrent_file *template_)
{
struct bittorrent_file *file;
int malicious;
@ -417,7 +417,7 @@ add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path,
return BITTORRENT_STATE_OUT_OF_MEM;
}
copy_struct(file, template);
copy_struct(file, template_);
memcpy(file->name, path, pathlen);
mem_free(path);

View File

@ -271,12 +271,12 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno)
* set appropriately before calling mkstemp.
*/
int
safe_mkstemp(unsigned char *template)
safe_mkstemp(unsigned char *template_)
{
#ifndef CONFIG_OS_WIN32
mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
#endif
int fd = mkstemp(template);
int fd = mkstemp(template_);
#ifndef CONFIG_OS_WIN32
umask(saved_mask);
#endif

View File

@ -56,7 +56,7 @@ unsigned char *file_read_line(unsigned char *line, size_t *linesize,
/** Safe wrapper for mkstemp().
* It enforces permissions by calling umask(0177), call mkstemp(), then
* restore previous umask(). */
int safe_mkstemp(unsigned char *template);
int safe_mkstemp(unsigned char *template_);
/** Recursively create directories in @a path. The last element in the path is
* taken to be a filename, and simply ignored */

View File

@ -169,12 +169,12 @@ static inline struct screen_char *
init_link_drawing(struct document_view *doc_view, struct link *link, int invert)
{
struct document_options *doc_opts;
static struct screen_char template;
static struct screen_char template_;
enum color_flags color_flags;
enum color_mode color_mode;
struct color_pair colors;
template.attr = SCREEN_ATTR_STANDOUT;
template_.attr = SCREEN_ATTR_STANDOUT;
doc_opts = &doc_view->document->options;
@ -182,10 +182,10 @@ init_link_drawing(struct document_view *doc_view, struct link *link, int invert)
color_mode = doc_opts->color_mode;
if (doc_opts->active_link.underline)
template.attr |= SCREEN_ATTR_UNDERLINE;
template_.attr |= SCREEN_ATTR_UNDERLINE;
if (doc_opts->active_link.bold)
template.attr |= SCREEN_ATTR_BOLD;
template_.attr |= SCREEN_ATTR_BOLD;
if (doc_opts->active_link.enable_color) {
colors.foreground = doc_opts->active_link.color.foreground;
@ -218,9 +218,9 @@ init_link_drawing(struct document_view *doc_view, struct link *link, int invert)
}
}
set_term_color(&template, &colors, color_flags, color_mode);
set_term_color(&template_, &colors, color_flags, color_mode);
return &template;
return &template_;
}
/** Give the current link the appropriate colour and attributes. */
@ -228,7 +228,7 @@ void
draw_current_link(struct session *ses, struct document_view *doc_view)
{
struct terminal *term = ses->tab->term;
struct screen_char *template;
struct screen_char *template_;
struct link *link;
int cursor_offset;
int xpos, ypos;
@ -244,8 +244,8 @@ draw_current_link(struct session *ses, struct document_view *doc_view)
if (!link) return;
i = !link_is_textinput(link) || ses->insert_mode == INSERT_MODE_OFF;
template = init_link_drawing(doc_view, link, i);
if (!template) return;
template_ = init_link_drawing(doc_view, link, i);
if (!template_) return;
xpos = doc_view->box.x - doc_view->vs->x;
ypos = doc_view->box.y - doc_view->vs->y;
@ -272,14 +272,14 @@ draw_current_link(struct session *ses, struct document_view *doc_view)
if (i == cursor_offset) {
int blockable = (!link_is_textinput(link)
&& co->c.color != template->c.color);
&& co->c.color != template_->c.color);
set_cursor(term, x, y, blockable);
set_window_ptr(ses->tab, x, y);
}
template->data = co->data;
copy_screen_chars(co, template, 1);
template_->data = co->data;
copy_screen_chars(co, template_, 1);
set_screen_dirty(term->screen, y, y);
}