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

Compile with C++.

Weak points:
- alignof
- js problems

Todo:
- make js work with C++ and mozjs-17
- then mozjs-24
- then mozjs-52
- then mozjs-60
- decrease number of warnings
This commit is contained in:
Witold Filipczyk 2019-02-17 20:46:16 +01:00
parent 25dd2ecae9
commit 4f4df33638
141 changed files with 649 additions and 620 deletions

View File

@ -55,6 +55,7 @@ ASCIIDOC_FLAGS = --unsafe
AWK = @AWK@
CATALOGS = @CATALOGS@
CC = @CC@
CXX = @CXX@
LD = @LD@
GIT = @GIT@
CONFDIR = @CONFDIR@
@ -180,6 +181,7 @@ CONFIG_GSSAPI = @CONFIG_GSSAPI@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@ -187,7 +189,7 @@ LIBS = @LIBS@
INCLUDES = -I$(top_builddir) -I$(top_srcdir)/src
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
COMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
MAKE_COLOR = @MAKE_COLOR@

View File

@ -62,7 +62,7 @@ quiet_cmd_ld_objs = " [$(LD_COLOR)LD$(END_COLOR)] $(RELPATH)$@"
`test -e $(subdir)/$(LIB_O_NAME) && echo $(subdir)/$(LIB_O_NAME)`)
quiet_cmd_link = ' [$(LINK_COLOR)LINK$(END_COLOR)] $(RELPATH)$@'
cmd_link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
cmd_link = $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
quiet_cmd_sparse = ' [SPARSE] $(RELPATH)$(2)'
cmd_sparse = $(SPARSE) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(SPARSE_FLAGS) $(2)

View File

@ -59,7 +59,8 @@ echo "Feature summary:" > features.log
# Checks for programs.
# ===================================================================
AC_PROG_CC
AC_PROG_CXX
AC_LANG([C++])
AC_CHECK_TOOL([LD], [ld])
AC_PROG_AWK
AC_PATH_PROGS(AWK, "$AWK")
@ -279,7 +280,6 @@ EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
# Checks for library functions.
# ===================================================================
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_STRFTIME
@ -1748,6 +1748,7 @@ if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
CFLAGS="$CFLAGS -Werror"
fi
GETTEXT_CFLAGS="-Wno-uninitialized"
CXXFLAGS="$CXXFLAGS -fpermissive"
case "`$CC -dumpversion`" in
3.0|3.1|3.2)
@ -1850,6 +1851,7 @@ fi
AC_SUBST(GETTEXT_CFLAGS)
EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
EL_LOG_CONFIG(CXXFLAGS, [Compiler flags (CXXFLAGS)], [])
EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])

View File

@ -594,7 +594,7 @@ static void
print_delete_error(struct listbox_item *item, struct terminal *term,
const struct listbox_ops *ops, enum delete_error err)
{
struct string msg;
struct string_ msg;
unsigned char *errmsg;
unsigned char *text;

View File

@ -108,7 +108,7 @@ void
do_tab_compl_unambiguous(struct dialog_data *dlg_data,
LIST_OF(struct input_history_entry) *history)
{
struct string completion;
struct string_ completion;
struct widget_data *widget_data = selected_widget(dlg_data);
int base_len = widget_data->info.field.cpos;
/* Maximum number of characters in a match. Characters after this

View File

@ -192,8 +192,8 @@ menu_labels(struct menu_item *items, unsigned char *base, unsigned char **lbls)
}
void
add_select_item(struct list_menu *menu, struct string *string,
struct string *orig_string, unsigned char **value,
add_select_item(struct list_menu *menu, struct string_ *string,
struct string_ *orig_string, unsigned char **value,
int order, int dont_add)
{
int pos = order - 1;

View File

@ -3,7 +3,7 @@
#define EL__BFU_LISTMENU_H
struct session;
struct string;
struct string_;
struct terminal;
struct list_menu {
@ -13,7 +13,7 @@ struct list_menu {
void init_menu(struct list_menu *menu);
void destroy_menu(struct list_menu *menu);
void add_select_item(struct list_menu *menu, struct string *string, struct string *orig_string, unsigned char **value, int order, int dont_add);
void add_select_item(struct list_menu *menu, struct string_ *string, struct string_ *orig_string, unsigned char **value, int order, int dont_add);
void new_menu_item(struct list_menu *menu, unsigned char *name, int data, int fullname);
struct menu_item *detach_menu(struct list_menu *menu);
void menu_labels(struct menu_item *m, unsigned char *base, unsigned char **lbls);

View File

@ -220,7 +220,7 @@ get_menuitem_rtext_width(struct terminal *term, struct menu_item *mi)
rtext_width = L_RTEXT_SPACE + m_submenu_len + R_RTEXT_SPACE;
} else if (mi->action_id != ACT_MAIN_NONE) {
struct string keystroke;
struct string_ keystroke;
if (init_string(&keystroke)) {
add_keystroke_action_to_string(&keystroke, mi->action_id, KEYMAP_MAIN);
@ -634,7 +634,7 @@ display_menu(struct terminal *term, struct menu *menu)
draw_menu_right_text(term, m_submenu, m_submenu_len,
menu->box.x, box.y, box.width, color);
} else if (mi->action_id != ACT_MAIN_NONE) {
struct string keystroke;
struct string_ keystroke;
#ifdef CONFIG_DEBUG
/* Help to detect action + right text. --Zas */

View File

@ -184,7 +184,7 @@ indentation(struct secure_save_info *ssi, int num)
static void
print_xml_entities(struct secure_save_info *ssi, const unsigned char *str)
{
struct string entitized = NULL_STRING;
struct string_ entitized = NULL_STRING;
if (init_string(&entitized)
&& add_html_to_string(&entitized, str, strlen(str))) {

View File

@ -690,7 +690,7 @@ bookmark_auto_save_tabs(struct terminal *term)
static void
bookmark_snapshot(void)
{
struct string folderstring;
struct string_ folderstring;
struct bookmark *folder;
if (!init_string(&folderstring)) return;

View File

@ -75,7 +75,7 @@ get_bookmark_text(struct listbox_item *item, struct terminal *term)
static void
add_converted_bytes_to_string(void *data, unsigned char *buf, int buflen)
{
struct string *string = data;
struct string_ *string = data;
add_bytes_to_string(string, buf, buflen); /* ignore errors */
}
@ -87,7 +87,7 @@ get_bookmark_info(struct listbox_item *item, struct terminal *term)
int utf8_cp = get_cp_index("UTF-8");
int term_cp = get_terminal_codepage(term);
struct conv_table *convert_table;
struct string info;
struct string_ info;
if (item->type == BI_FOLDER) return NULL;
convert_table = get_translation_table(utf8_cp, term_cp);
@ -943,7 +943,7 @@ bookmark_terminal_tabs_ok(void *term_void, unsigned char *foldername)
void
bookmark_terminal_tabs_dialog(struct terminal *term)
{
struct string string;
struct string_ string;
if (!init_string(&string)) return;

2
src/cache/dialogs.c vendored
View File

@ -57,7 +57,7 @@ static unsigned char *
get_cache_entry_info(struct listbox_item *item, struct terminal *term)
{
struct cache_entry *cached = item->udata;
struct string msg;
struct string_ msg;
if (item->type == BI_FOLDER) return NULL;
if (!init_string(&msg)) return NULL;

View File

@ -431,12 +431,12 @@ version_cmd(struct option *o, unsigned char ***argv, int *argc)
static void print_option_desc(const unsigned char *desc)
{
struct string wrapped;
static const struct string indent = INIT_STRING(" ", 12);
struct string_ wrapped;
static const struct string_ indent = INIT_STRING(" ", 12);
if (init_string(&wrapped)
&& wrap_option_desc(&wrapped, desc, &indent, 79 - indent.length)) {
/* struct string could in principle contain null
/* struct string_ could in principle contain null
* characters, so don't use printf() or fputs(). */
fwrite(wrapped.source, 1, wrapped.length, stdout);
} else {
@ -595,8 +595,8 @@ print_short_help(void)
{
#define ALIGN_WIDTH 20
struct option *option;
struct string string = NULL_STRING;
struct string *saved = NULL;
struct string_ string = NULL_STRING;
struct string_ *saved = NULL;
unsigned char align[ALIGN_WIDTH];
/* Initialize @space used to align captions. */

View File

@ -200,7 +200,7 @@ skip_to_unquoted_newline_or_comment(struct conf_parsing_pos *pos)
static enum parse_error
parse_set_common(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf, int want_domain)
struct string_ *mirror, int is_system_conf, int want_domain)
{
const unsigned char *domain_orig = NULL;
size_t domain_len = 0;
@ -386,14 +386,14 @@ parse_set_common(struct option *opt_tree, struct conf_parsing_state *state,
static enum parse_error
parse_set_domain(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf)
struct string_ *mirror, int is_system_conf)
{
return parse_set_common(opt_tree, state, mirror, is_system_conf, 1);
}
static enum parse_error
parse_set(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf)
struct string_ *mirror, int is_system_conf)
{
return parse_set_common(opt_tree, state, mirror, is_system_conf, 0);
}
@ -401,7 +401,7 @@ parse_set(struct option *opt_tree, struct conf_parsing_state *state,
static enum parse_error
parse_unset(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf)
struct string_ *mirror, int is_system_conf)
{
const unsigned char *optname_orig;
size_t optname_len;
@ -478,7 +478,7 @@ parse_unset(struct option *opt_tree, struct conf_parsing_state *state,
static enum parse_error
parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf)
struct string_ *mirror, int is_system_conf)
{
unsigned char *keymap, *keystroke, *action;
enum parse_error err = ERROR_NONE;
@ -567,14 +567,14 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
}
static int load_config_file(unsigned char *, unsigned char *, struct option *,
struct string *, int);
struct string_ *, int);
static enum parse_error
parse_include(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf)
struct string_ *mirror, int is_system_conf)
{
unsigned char *fname;
struct string dumbstring;
struct string_ dumbstring;
struct conf_parsing_pos before_error;
if (!init_string(&dumbstring))
@ -622,7 +622,7 @@ struct parse_handler {
const unsigned char *command;
enum parse_error (*handler)(struct option *opt_tree,
struct conf_parsing_state *state,
struct string *mirror, int is_system_conf);
struct string_ *mirror, int is_system_conf);
};
static const struct parse_handler parse_handlers[] = {
@ -637,7 +637,7 @@ static const struct parse_handler parse_handlers[] = {
static enum parse_error
parse_config_command(struct option *options, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf)
struct string_ *mirror, int is_system_conf)
{
const struct parse_handler *handler;
@ -688,7 +688,7 @@ parse_config_exmode_command(unsigned char *cmd)
void
parse_config_file(struct option *options, unsigned char *name,
unsigned char *file, struct string *mirror,
unsigned char *file, struct string_ *mirror,
int is_system_conf)
{
struct conf_parsing_state state = {{ 0 }};
@ -766,7 +766,7 @@ read_config_file(unsigned char *name)
{
#define FILE_BUF 1024
unsigned char cfg_buffer[FILE_BUF];
struct string string;
struct string_ string;
int fd;
ssize_t r;
@ -797,7 +797,7 @@ read_config_file(unsigned char *name)
/* Return 0 on success. */
static int
load_config_file(unsigned char *prefix, unsigned char *name,
struct option *options, struct string *mirror,
struct option *options, struct string_ *mirror,
int is_system_conf)
{
unsigned char *config_str, *config_file;
@ -856,16 +856,16 @@ conf_i18n(unsigned char *s, int i18n)
}
static void
add_indent_to_string(struct string *string, int depth)
add_indent_to_string(struct string_ *string, int depth)
{
if (!depth) return;
add_xchar_to_string(string, ' ', depth * indentation);
}
struct string *
wrap_option_desc(struct string *out, const unsigned char *src,
const struct string *indent, int maxwidth)
struct string_ *
wrap_option_desc(struct string_ *out, const unsigned char *src,
const struct string_ *indent, int maxwidth)
{
const unsigned char *last_space = NULL;
const unsigned char *uncopied = src;
@ -906,11 +906,11 @@ split:
}
static void
output_option_desc_as_comment(struct string *out, const struct option *option,
output_option_desc_as_comment(struct string_ *out, const struct option *option,
int i18n, int depth)
{
unsigned char *desc_i18n = conf_i18n(option->desc, i18n);
struct string indent;
struct string_ indent;
if (!init_string(&indent)) return;
@ -926,7 +926,7 @@ out_of_memory:
static unsigned char *smart_config_output_fn_domain;
static void
smart_config_output_fn(struct string *string, struct option *option,
smart_config_output_fn(struct string_ *string, struct option *option,
unsigned char *path, int depth, int do_print_comment,
int action, int i18n)
{
@ -999,7 +999,7 @@ smart_config_output_fn(struct string *string, struct option *option,
static void
add_cfg_header_to_string(struct string *string, unsigned char *text)
add_cfg_header_to_string(struct string_ *string, unsigned char *text)
{
int n = strlen(text) + 2;
@ -1016,9 +1016,9 @@ unsigned char *
create_config_string(unsigned char *prefix, unsigned char *name)
{
struct option *options = config_options;
struct string config;
struct string_ config;
/* Don't write headers if nothing will be added anyway. */
struct string tmpstring;
struct string_ tmpstring;
int origlen;
int savestyle = get_opt_int("config.saving_style", NULL);
int i18n = get_opt_bool("config.i18n", NULL);

View File

@ -18,14 +18,14 @@ void load_config(void);
enum parse_error parse_config_exmode_command(unsigned char *cmd);
#endif
void parse_config_file(struct option *options, unsigned char *name,
unsigned char *file, struct string *mirror,
unsigned char *file, struct string_ *mirror,
int is_system_conf);
int write_config(struct terminal *);
unsigned char *
create_config_string(unsigned char *prefix, unsigned char *name);
struct string *wrap_option_desc(struct string *out, const unsigned char *src,
const struct string *indent, int maxwidth);
struct string_ *wrap_option_desc(struct string_ *out, const unsigned char *src,
const struct string_ *indent, int maxwidth);
#endif

View File

@ -102,7 +102,7 @@ is_option_used(struct listbox_item *item)
static unsigned char *
get_range_string(struct option *option)
{
struct string info;
struct string_ info;
if (!init_string(&info)) return NULL;
@ -133,7 +133,7 @@ get_option_info(struct listbox_item *item, struct terminal *term)
{
struct option *option = item->udata;
unsigned char *desc, *type;
struct string info;
struct string_ info;
if (!init_string(&info)) return NULL;
@ -154,7 +154,7 @@ get_option_info(struct listbox_item *item, struct terminal *term)
if (option_types[option->type].write) {
unsigned char *range;
struct string value;
struct string_ value;
if (!init_string(&value)) {
done_string(&info);
@ -302,7 +302,7 @@ build_edit_dialog(struct terminal *term, struct session *ses,
#define EDIT_WIDGETS_COUNT 5
struct dialog *dlg;
unsigned char *value, *name, *desc, *range;
struct string tvalue;
struct string_ tvalue;
if (!init_string(&tvalue)) return;
@ -636,7 +636,7 @@ static unsigned char *
get_keybinding_text(struct listbox_item *item, struct terminal *term)
{
struct keybinding *keybinding = item->udata;
struct string info;
struct string_ info;
if (item->depth == 0) {
struct keymap *keymap = item->udata;
@ -660,7 +660,7 @@ get_keybinding_info(struct listbox_item *item, struct terminal *term)
{
struct keybinding *keybinding = item->udata;
unsigned char *action, *keymap;
struct string info;
struct string_ info;
if (item->depth < 2) return NULL;
if (item->type == BI_FOLDER) return NULL;
@ -793,7 +793,7 @@ really_add_keybinding(void *data, unsigned char *keystroke)
if (keybinding_exists(hop->keymap_id, &hop->kbd, &action_id)
&& action_id != ACT_MAIN_NONE) {
struct kbdbind_add_hop *new_hop;
struct string canonical;
struct string_ canonical;
/* Same keystroke for same action, just return. */
if (action_id == hop->action_id) return;

View File

@ -467,7 +467,7 @@ parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd)
}
void
add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd,
add_keystroke_to_string(struct string_ *str, struct term_event_keyboard *kbd,
int escape)
{
unsigned char key_buffer[3] = "\\x";
@ -503,7 +503,7 @@ add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd,
}
void
add_keystroke_action_to_string(struct string *string, action_id_T action_id,
add_keystroke_action_to_string(struct string_ *string, action_id_T action_id,
enum keymap_id keymap_id)
{
struct keybinding *keybinding = kbd_act_lookup(keymap_id, action_id);
@ -515,7 +515,7 @@ add_keystroke_action_to_string(struct string *string, action_id_T action_id,
unsigned char *
get_keystroke(action_id_T action_id, enum keymap_id keymap_id)
{
struct string keystroke;
struct string_ keystroke;
if (!init_string(&keystroke)) return NULL;
@ -528,7 +528,7 @@ get_keystroke(action_id_T action_id, enum keymap_id keymap_id)
}
void
add_actions_to_string(struct string *string, action_id_T action_ids[],
add_actions_to_string(struct string_ *string, action_id_T action_ids[],
enum keymap_id keymap_id, struct terminal *term)
{
int i;
@ -950,7 +950,7 @@ bind_act(unsigned char *keymap_str, const unsigned char *keystroke_str)
}
static void
single_bind_config_string(struct string *file, enum keymap_id keymap_id,
single_bind_config_string(struct string_ *file, enum keymap_id keymap_id,
struct keybinding *keybinding)
{
unsigned char *keymap_str = get_keymap_name(keymap_id);
@ -976,7 +976,7 @@ single_bind_config_string(struct string *file, enum keymap_id keymap_id,
}
void
bind_config_string(struct string *file)
bind_config_string(struct string_ *file)
{
int keymap_id;

View File

@ -162,9 +162,9 @@ term_event_key_T read_key(const unsigned char *);
unsigned char *get_keymap_name(enum keymap_id);
int parse_keystroke(const unsigned char *, struct term_event_keyboard *);
void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, int escape);
void add_keystroke_to_string(struct string_ *str, struct term_event_keyboard *kbd, int escape);
/* void add_accesskey_to_string(struct string *str, unicode_val_T accesskey); */
/* void add_accesskey_to_string(struct string_ *str, unicode_val_T accesskey); */
#define add_accesskey_to_string(str, accesskey) do { \
struct term_event_keyboard kbd; \
/* FIXME: #ifndef CONFIG_UTF8, kbd.key is encoded in \
@ -184,17 +184,17 @@ struct keybinding *kbd_nm_lookup(enum keymap_id, unsigned char *);
int bind_do(unsigned char *, const unsigned char *, unsigned char *, int);
unsigned char *bind_act(unsigned char *, const unsigned char *);
void bind_config_string(struct string *);
void bind_config_string(struct string_ *);
#ifdef CONFIG_SCRIPTING
int bind_key_to_event_name(unsigned char *, const unsigned char *, unsigned char *,
unsigned char **);
#endif
void add_keystroke_action_to_string(struct string *string, action_id_T action_id, enum keymap_id keymap_id);
void add_keystroke_action_to_string(struct string_ *string, action_id_T action_id, enum keymap_id keymap_id);
unsigned char *get_keystroke(action_id_T action_id, enum keymap_id keymap_id);
void add_actions_to_string(struct string *string, action_id_T actions[],
void add_actions_to_string(struct string_ *string, action_id_T actions[],
enum keymap_id keymap_id, struct terminal *term);
extern struct module kbdbind_module;

View File

@ -1044,10 +1044,10 @@ check_nonempty_tree(LIST_OF(struct option) *options)
/*! @relates option */
void
smart_config_string(struct string *str, int print_comment, int i18n,
smart_config_string(struct string_ *str, int print_comment, int i18n,
LIST_OF(struct option) *options,
unsigned char *path, int depth,
void (*fn)(struct string *, struct option *,
void (*fn)(struct string_ *, struct option *,
unsigned char *, int, int, int, int))
{
struct option *option;
@ -1106,7 +1106,7 @@ smart_config_string(struct string *str, int print_comment, int i18n,
do_print_comment, 2, i18n);
} else if (option->type == OPT_TREE) {
struct string newpath;
struct string_ newpath;
int pc = print_comment;
if (!init_string(&newpath)) continue; /* OK? */

View File

@ -231,9 +231,9 @@ extern LIST_OF(struct option) *init_options_tree(void);
extern void prepare_mustsave_flags(LIST_OF(struct option) *, int set_all);
extern void untouch_options(LIST_OF(struct option) *);
extern void smart_config_string(struct string *, int, int,
extern void smart_config_string(struct string_ *, int, int,
LIST_OF(struct option) *, unsigned char *, int,
void (*)(struct string *, struct option *,
void (*)(struct string_ *, struct option *,
unsigned char *, int, int, int, int));
enum copy_option_flags {

View File

@ -129,7 +129,7 @@ redir_rd(struct option *opt, unsigned char **file, int *line)
}
static void
redir_wr(struct option *opt, struct string *string)
redir_wr(struct option *opt, struct string_ *string)
{
struct option *real = get_opt_rec(config_options, opt->value.string);
@ -189,7 +189,7 @@ redir_eq(struct option *opt, const unsigned char *str)
/* Support functions for config file parsing. */
static void
add_optstring_to_string(struct string *s, const unsigned char *q, int qlen)
add_optstring_to_string(struct string_ *s, const unsigned char *q, int qlen)
{
if (!commandline) add_char_to_string(s, '"');
add_quoted_to_string(s, q, qlen);
@ -241,7 +241,7 @@ num_eq(struct option *opt, const unsigned char *str)
}
static void
num_wr(struct option *option, struct string *string)
num_wr(struct option *option, struct string_ *string)
{
add_knum_to_string(string, option->value.number);
}
@ -261,7 +261,7 @@ long_eq(struct option *opt, const unsigned char *str)
}
static void
long_wr(struct option *option, struct string *string)
long_wr(struct option *option, struct string_ *string)
{
add_knum_to_string(string, option->value.big_number);
}
@ -270,7 +270,7 @@ static unsigned char *
str_rd(struct option *opt, unsigned char **file, int *line)
{
unsigned char *str = *file;
struct string str2;
struct string_ str2;
if (!init_string(&str2)) return NULL;
@ -336,7 +336,7 @@ str_eq(struct option *opt, const unsigned char *str)
}
static void
str_wr(struct option *o, struct string *s)
str_wr(struct option *o, struct string_ *s)
{
int len = strlen(o->value.string);
@ -372,7 +372,7 @@ cp_eq(struct option *opt, const unsigned char *str)
}
static void
cp_wr(struct option *o, struct string *s)
cp_wr(struct option *o, struct string_ *s)
{
unsigned char *mime_name = get_cp_config_name(o->value.number);
@ -401,7 +401,7 @@ lang_eq(struct option *opt, const unsigned char *str)
}
static void
lang_wr(struct option *o, struct string *s)
lang_wr(struct option *o, struct string_ *s)
{
unsigned char *lang;
@ -431,7 +431,7 @@ color_eq(struct option *opt, const unsigned char *str)
}
static void
color_wr(struct option *opt, struct string *str)
color_wr(struct option *opt, struct string_ *str)
{
color_T color = opt->value.color;
unsigned char hexcolor[8];

View File

@ -8,7 +8,7 @@ struct option_type_info {
unsigned char *name;
unsigned char *(*cmdline)(struct option *, unsigned char ***, int *);
unsigned char *(*read)(struct option *, unsigned char **, int *);
void (*write)(struct option *, struct string *);
void (*write)(struct option *, struct string_ *);
void (*dup)(struct option *, struct option *, int);
int (*set)(struct option *, unsigned char *);
int (*equals)(struct option *, const unsigned char *);

View File

@ -619,13 +619,13 @@ is_path_prefix(unsigned char *d, unsigned char *s)
}
static struct string *
static struct string_ *
send_cookies_common(struct uri *uri, unsigned int httponly)
{
struct c_domain *cd;
struct cookie *c, *next;
unsigned char *path = NULL;
static struct string header;
static struct string_ header;
time_t now;
if (!uri->host || !uri->data)
@ -686,13 +686,13 @@ send_cookies_common(struct uri *uri, unsigned int httponly)
return &header;
}
struct string *
struct string_ *
send_cookies(struct uri *uri)
{
return send_cookies_common(uri, 0);
}
struct string *
struct string_ *
send_cookies_js(struct uri *uri)
{
return send_cookies_common(uri, 1);

View File

@ -61,8 +61,8 @@ void set_cookies_dirty(void);
/* Note that the returned value points to a static structure and thus the
* string will be overwritten at the next call time. The string source
* itself is dynamically allocated, though. */
struct string *send_cookies(struct uri *uri);
struct string *send_cookies_js(struct uri *uri);
struct string_ *send_cookies(struct uri *uri);
struct string_ *send_cookies_js(struct uri *uri);
extern struct module cookies_module;

View File

@ -32,7 +32,7 @@
INIT_LIST_OF(struct cookie, cookie_queries);
static void
add_cookie_info_to_string(struct string *string, struct cookie *cookie,
add_cookie_info_to_string(struct string_ *string, struct cookie *cookie,
struct terminal *term)
{
add_format_to_string(string, "\n%s: %s", _("Name", term), cookie->name);
@ -74,7 +74,7 @@ accept_cookie_dialog(struct session *ses, void *data)
{
/* [gettext_accelerator_context(accept_cookie_dialog)] */
struct cookie *cookie = cookie_queries.next;
struct string string;
struct string_ string;
assert(ses);
@ -156,7 +156,7 @@ get_cookie_info(struct listbox_item *item, struct terminal *term)
{
struct cookie *cookie = item->udata;
struct cookie_server *server;
struct string string;
struct string_ string;
if (item->type == BI_FOLDER) return NULL;

View File

@ -46,7 +46,7 @@ nowhere_box(struct terminal *term, unsigned char *title)
}
static void
add_link_info_to_string(struct string *msg, struct session *ses)
add_link_info_to_string(struct string_ *msg, struct session *ses)
{
struct document_view *doc_view = current_frame(ses);
struct terminal *term = ses->tab->term;
@ -73,7 +73,7 @@ add_link_info_to_string(struct string *msg, struct session *ses)
link = get_current_link_in_view(doc_view);
if (link) {
struct string img;
struct string_ img;
#ifdef CONFIG_GLOBHIST
struct global_history_item *historyitem;
#endif
@ -119,7 +119,7 @@ link_info_dialog(struct session *ses)
{
struct terminal *term = ses->tab->term;
struct location *location = cur_loc(ses);
struct string msg;
struct string_ msg;
if (!location) {
nowhere_box(term, NULL);
@ -142,7 +142,7 @@ document_info_dialog(struct session *ses)
struct terminal *term = ses->tab->term;
struct location *location = cur_loc(ses);
struct document_view *doc_view;
struct string msg;
struct string_ msg;
if (!location) {
nowhere_box(term, NULL);

View File

@ -87,7 +87,7 @@ menu_keys(struct terminal *term, void *d_, void *xxx)
ACT_MAIN_NONE,
};
struct string keys;
struct string_ keys;
struct keys_toggle_info *info;
info = mem_calloc(1, sizeof(*info));
@ -157,7 +157,7 @@ menu_copying(struct terminal *term, void *xxx, void *xxxx)
static unsigned char *
get_resource_info(struct terminal *term, void *data)
{
struct string info;
struct string_ info;
long val;
unsigned longlong bigval;

View File

@ -555,7 +555,7 @@ query_file(struct session *ses, struct uri *uri, void *data,
void (*std)(void *, unsigned char *),
void (*cancel)(void *), int interactive)
{
struct string def;
struct string_ def;
assert(ses && uri);
if_assert_failed return;
@ -621,7 +621,7 @@ free_history_lists(void)
static void
add_cmdline_bool_option(struct string *string, unsigned char *name)
add_cmdline_bool_option(struct string_ *string, unsigned char *name)
{
if (!get_cmd_opt_bool(name)) return;
add_to_string(string, " -");
@ -634,7 +634,7 @@ open_uri_in_new_window(struct session *ses, struct uri *uri, struct uri *referre
enum task_type task)
{
int ring = get_cmd_opt_int("session-ring");
struct string parameters;
struct string_ parameters;
int id;
assert(env && ses);
@ -774,7 +774,7 @@ do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx)
static unsigned char *
format_command(unsigned char *format, struct uri *uri)
{
struct string string;
struct string_ string;
if (!init_string(&string)) return NULL;

View File

@ -19,7 +19,7 @@ static unsigned char *
get_progress_msg_2(struct progress *progress, struct terminal *term,
int wide, int full, unsigned char *separator, unsigned char *type)
{
struct string msg;
struct string_ msg;
int newlines = separator[strlen(separator) - 1] == '\n';
if (!init_string(&msg)) return NULL;

View File

@ -397,7 +397,7 @@ display_title_bar(struct session *ses, struct terminal *term)
{
struct document_view *doc_view;
struct document *document;
struct string title;
struct string_ title;
unsigned char buf[40];
int buflen = 0;
int height;

View File

@ -155,7 +155,7 @@ static void
import_css_file(struct css_stylesheet *css, struct uri *base_uri,
const unsigned char *url, int urllen)
{
struct string string, filename;
struct string_ string, filename;
if (!*url
|| css->import_level >= MAX_REDIRECTS

View File

@ -175,7 +175,7 @@ css_parse_atrule(struct css_stylesheet *css, struct scanner *scanner,
struct uri *base_uri)
{
struct scanner_token *token = get_scanner_token(scanner);
struct string import_uri;
struct string_ import_uri;
/* Skip skip skip that code */
switch (token->type) {

View File

@ -31,7 +31,7 @@
static inline void
init_dom_renderer(struct dom_renderer *renderer, struct document *document,
struct string *buffer, struct conv_table *convert_table)
struct string_ *buffer, struct conv_table *convert_table)
{
memset(renderer, 0, sizeof(*renderer));
@ -79,7 +79,7 @@ get_doctype(struct dom_renderer *renderer, struct cache_entry *cached)
/* Shared multiplexor between renderers */
void
render_dom_document(struct cache_entry *cached, struct document *document,
struct string *buffer)
struct string_ *buffer)
{
unsigned char *head = empty_string_or_(cached->head);
struct dom_renderer renderer;

View File

@ -4,8 +4,8 @@
struct cache_entry;
struct document;
struct string;
struct string_;
void render_dom_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void render_dom_document(struct cache_entry *cached, struct document *document, struct string_ *buffer);
#endif

View File

@ -445,7 +445,7 @@ look_for_tag(unsigned char **pos, unsigned char *eof,
unsigned char *name, int namelen, unsigned char **label)
{
unsigned char *pos2;
struct string str;
struct string_ str;
if (!init_string(&str)) {
/* Is this the right way to bail out? --jonas */
@ -643,7 +643,7 @@ get_image_map(unsigned char *head, unsigned char *pos, unsigned char *eof,
int to, int def, int hdef)
{
struct conv_table *ct;
struct string hd;
struct string_ hd;
int look_result;
if (!init_string(&hd)) return -1;
@ -744,7 +744,7 @@ done_html_parser_state(struct html_context *html_context,
struct html_context *
init_html_parser(struct uri *uri, struct document_options *options,
unsigned char *start, unsigned char *end,
struct string *head, struct string *title,
struct string_ *head, struct string_ *title,
void (*put_chars)(struct html_context *, unsigned char *, int),
void (*line_break)(struct html_context *),
void *(*special)(struct html_context *, enum html_special_type, ...))

View File

@ -17,7 +17,7 @@ struct html_context;
struct memory_list;
struct menu_item;
struct part;
struct string;
struct string_;
struct uri;
/* XXX: This is just terible - this interface is from 75% only for other HTML
@ -165,7 +165,7 @@ struct html_element {
struct html_context *
init_html_parser(struct uri *uri, struct document_options *options,
unsigned char *start, unsigned char *end,
struct string *head, struct string *title,
struct string_ *head, struct string_ *title,
void (*put_chars)(struct html_context *, unsigned char *, int),
void (*line_break)(struct html_context *),
void *(*special)(struct html_context *, enum html_special_type,

View File

@ -341,7 +341,7 @@ do_html_select(unsigned char *attr, unsigned char *html,
{
struct conv_table *ct = html_context->special_f(html_context, SP_TABLE, NULL);
struct el_form_control *fc;
struct string lbl = NULL_STRING, orig_lbl = NULL_STRING;
struct string_ lbl = NULL_STRING, orig_lbl = NULL_STRING;
unsigned char **values = NULL;
unsigned char **labels;
unsigned char *name, *t_attr, *en;
@ -558,7 +558,7 @@ html_option(struct html_context *html_context, unsigned char *a,
val = get_attr_val(a, "value", html_context->doc_cp);
if (!val) {
struct string str;
struct string_ str;
unsigned char *p, *r;
unsigned char *name;
int namelen;

View File

@ -450,7 +450,7 @@ void
html_handle_body_meta(struct html_context *html_context, unsigned char *meta,
unsigned char *eof)
{
struct string head;
struct string_ head;
if (!init_string(&head)) return;
@ -826,7 +826,7 @@ static struct {
};
static void
roman(struct string *p, unsigned n)
roman(struct string_ *p, unsigned n)
{
int i = 0;
@ -884,7 +884,7 @@ html_li(struct html_context *html_context, unsigned char *a,
int nlen;
int t = par_format.flags & P_LISTMASK;
int s = get_num(a, "value", html_context->doc_cp);
struct string n;
struct string_ n;
if (!init_string(&n)) return;

View File

@ -865,7 +865,7 @@ html_link(struct html_context *html_context, unsigned char *a,
int link_display = html_context->options->meta_link_display;
unsigned char *name;
struct hlink link;
struct string text;
struct string_ text;
int name_neq_title = 0;
int first = 1;

View File

@ -1165,8 +1165,8 @@ process_element(unsigned char *name, int namelen, int endingtag,
}
void
scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head,
struct string *title, int cp)
scan_http_equiv(unsigned char *s, unsigned char *eof, struct string_ *head,
struct string_ *title, int cp)
{
unsigned char *name, *attr, *he, *c;
int namelen;

View File

@ -5,7 +5,7 @@
struct html_context;
struct document_options;
struct part;
struct string;
struct string_;
/* Flags for get_attr_value(). */
enum html_attr_flags {
@ -66,7 +66,7 @@ int get_width(unsigned char *, unsigned char *, int, struct html_context *);
unsigned char *skip_comment(unsigned char *, unsigned char *);
void scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head, struct string *title, int cp);
void scan_http_equiv(unsigned char *s, unsigned char *eof, struct string_ *head, struct string_ *title, int cp);
int supports_html_media_attr(const unsigned char *media);

View File

@ -2509,14 +2509,14 @@ ret:
void
render_html_document(struct cache_entry *cached, struct document *document,
struct string *buffer)
struct string_ *buffer)
{
struct html_context *html_context;
struct part *part;
unsigned char *start;
unsigned char *end;
struct string title;
struct string head;
struct string_ title;
struct string_ head;
assert(cached && document);
if_assert_failed return;

View File

@ -7,10 +7,10 @@
struct el_box;
struct cache_entry;
struct html_context;
struct string;
struct string_;
void render_html_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void render_html_document(struct cache_entry *cached, struct document *document, struct string_ *buffer);
/* Interface with parser.c */

View File

@ -35,8 +35,8 @@
#include <dom/bindings/hubbub/parser.h>
struct source_renderer {
struct string tmp_buffer;
struct string *source;
struct string_ tmp_buffer;
struct string_ *source;
char *enc;
};
@ -378,7 +378,7 @@ libdom_main(struct source_renderer *renderer)
void
render_source_document(struct cache_entry *cached, struct document *document,
struct string *buffer)
struct string_ *buffer)
{
struct source_renderer renderer;
unsigned char *head = empty_string_or_(cached->head);

View File

@ -4,8 +4,8 @@
struct cache_entry;
struct document;
struct string;
struct string_;
void render_source_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void render_source_document(struct cache_entry *cached, struct document *document, struct string_ *buffer);
#endif

View File

@ -705,7 +705,7 @@ add_document_lines(struct plain_renderer *renderer)
void
render_plain_document(struct cache_entry *cached, struct document *document,
struct string *buffer)
struct string_ *buffer)
{
struct conv_table *convert_table;
unsigned char *head = empty_string_or_(cached->head);

View File

@ -4,8 +4,8 @@
struct cache_entry;
struct document;
struct string;
struct string_;
void render_plain_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void render_plain_document(struct cache_entry *cached, struct document *document, struct string_ *buffer);
#endif

View File

@ -122,7 +122,7 @@ process_snippets(struct ecmascript_interpreter *interpreter,
*current = snippets->next;
for (; *current != (struct string_list_item *) snippets;
(*current) = (*current)->next) {
struct string *string = &(*current)->string;
struct string_ *string = &(*current)->string;
unsigned char *uristring;
struct uri *uri;
struct cache_entry *cached;
@ -196,7 +196,7 @@ process_snippets(struct ecmascript_interpreter *interpreter,
fragment = get_cache_fragment(cached);
if (fragment) {
struct string code = INIT_STRING(fragment->data, fragment->length);
struct string_ code = INIT_STRING(fragment->data, fragment->length);
ecmascript_eval(interpreter, &code, NULL);
}
@ -210,7 +210,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
struct uri *uri = cached->uri;
enum stream_encoding encoding = ENCODING_NONE;
struct fragment *fragment = get_cache_fragment(cached);
struct string buffer = INIT_STRING("", 0);
struct string_ buffer = INIT_STRING("", 0);
/* Even empty documents have to be rendered so that info in the protocol
* header, such as refresh info, get processed. (bug 625) */

View File

@ -451,7 +451,7 @@ walk_dom_nodes(struct dom_stack *stack, struct dom_node *root)
static inline unsigned char *
compress_string(unsigned char *string, unsigned int length)
{
struct string buffer;
struct string_ buffer;
unsigned char escape[2] = "\\";
if (!init_string(&buffer)) return NULL;

View File

@ -127,7 +127,7 @@ ecmascript_get_interpreter_count(void)
void
ecmascript_eval(struct ecmascript_interpreter *interpreter,
struct string *code, struct string *ret)
struct string_ *code, struct string_ *ret)
{
if (!get_ecmascript_enable())
return;
@ -139,7 +139,7 @@ ecmascript_eval(struct ecmascript_interpreter *interpreter,
unsigned char *
ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter,
struct string *code)
struct string_ *code)
{
unsigned char *result;
@ -154,7 +154,7 @@ ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter,
int
ecmascript_eval_boolback(struct ecmascript_interpreter *interpreter,
struct string *code)
struct string_ *code)
{
int result;
@ -211,7 +211,7 @@ void
ecmascript_protocol_handler(struct session *ses, struct uri *uri)
{
struct document_view *doc_view = current_frame(ses);
struct string current_url = INIT_STRING(struri(uri), strlen(struri(uri)));
struct string_ current_url = INIT_STRING(struri(uri), strlen(struri(uri)));
unsigned char *redirect_url, *redirect_abs_url;
struct uri *redirect_uri;

View File

@ -10,7 +10,7 @@
struct form_state;
struct form_view;
struct string;
struct string_;
struct terminal;
struct uri;
struct view_state;
@ -27,10 +27,10 @@ struct ecmascript_interpreter {
int backend_nesting;
/* Used by document.write() */
struct string *ret;
struct string_ *ret;
/* The code evaluated by setTimeout() */
struct string code;
struct string_ code;
#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
struct heartbeat *heartbeat;
@ -83,10 +83,10 @@ void ecmascript_moved_form_state(struct form_state *fs);
void ecmascript_reset_state(struct view_state *vs);
void ecmascript_eval(struct ecmascript_interpreter *interpreter, struct string *code, struct string *ret);
unsigned char *ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code);
void ecmascript_eval(struct ecmascript_interpreter *interpreter, struct string_ *code, struct string_ *ret);
unsigned char *ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter, struct string_ *code);
/* Returns -1 if undefined. */
int ecmascript_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code);
int ecmascript_eval_boolback(struct ecmascript_interpreter *interpreter, struct string_ *code);
/* Takes line with the syntax javascript:<ecmascript code>. Activated when user
* follows a link with this synstax. */

View File

@ -87,7 +87,8 @@ jsid_to_string(JSContext *ctx, jsid *id)
return jsval_to_string(ctx, &v);
}
#define ELINKS_CAST_PROP_PARAMS JSObject *obj = *(hobj._); \
jsval *vp = (hvp._);
#define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj); \
jsval vp2 = (hvp); \
jsval *vp = &vp2;
#endif

View File

@ -66,7 +66,7 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
struct session *ses = interpreter->vs->doc_view->session;
struct terminal *term;
unsigned char *strict, *exception, *warning, *error;
struct string msg;
struct string_ msg;
assert(interpreter && interpreter->vs && interpreter->vs->doc_view
&& ses && ses->tab);
@ -277,7 +277,7 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter)
void
spidermonkey_eval(struct ecmascript_interpreter *interpreter,
struct string *code, struct string *ret)
struct string_ *code, struct string_ *ret)
{
JSContext *ctx;
jsval rval;
@ -305,7 +305,7 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
unsigned char *
spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
struct string *code)
struct string_ *code)
{
JSBool ret;
JSContext *ctx;
@ -340,7 +340,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
int
spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
struct string *code)
struct string_ *code)
{
JSContext *ctx;
JSFunction *fun;

View File

@ -4,7 +4,7 @@
struct ecmascript_interpreter;
struct form_view;
struct form_state;
struct string;
struct string_;
void *spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter);
void spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter);
@ -13,9 +13,9 @@ void spidermonkey_detach_form_view(struct form_view *fv);
void spidermonkey_detach_form_state(struct form_state *fs);
void spidermonkey_moved_form_state(struct form_state *fs);
void spidermonkey_eval(struct ecmascript_interpreter *interpreter, struct string *code, struct string *ret);
unsigned char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code);
int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code);
void spidermonkey_eval(struct ecmascript_interpreter *interpreter, struct string_ *code, struct string_ *ret);
unsigned char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string_ *code);
int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string_ *code);
extern struct module spidermonkey_module;
#endif

View File

@ -66,7 +66,7 @@ document_get_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid
JSObject *parent_win; /* instance of @window_class */
struct view_state *vs;
struct string *cookies;
struct string_ *cookies;
JSClass* classPtr = JS_GetClass(obj);
if (classPtr != &document_class)
@ -350,7 +350,7 @@ static JSBool
document_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
JSObject *parent_win; /* instance of @window_class */
struct view_state *vs;
@ -399,7 +399,7 @@ document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline)
{
jsval val;
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
struct string *ret = interpreter->ret;
struct string_ *ret = interpreter->ret;
jsval *argv = JS_ARGV(ctx, rval);
if (argc >= 1 && ret) {

View File

@ -46,10 +46,6 @@
#include "viewer/text/link.h"
#include "viewer/text/vs.h"
static JSClass form_class; /* defined below */
/* Accordingly to the JS specs, each input type should own object. That'd be a
* huge PITA though, however DOM comes to the rescue and defines just a single
* HTMLInputElement. The difference could be spotted only by some clever tricky
@ -1393,7 +1389,7 @@ static JSBool
input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
JSObject *parent_form; /* instance of @form_class */
JSObject *parent_doc; /* instance of @document_class */
@ -1550,7 +1546,7 @@ static JSBool
input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
JSObject *parent_form; /* instance of @form_class */
JSObject *parent_doc; /* instance of @document_class */
@ -1957,7 +1953,7 @@ static JSBool
form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
jsval idval;
JSObject *parent_form; /* instance of @form_class */
@ -2285,7 +2281,7 @@ static JSBool
form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
/* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */
JSObject *parent_doc; /* instance of @document_class */
JSObject *parent_win; /* instance of @window_class */
@ -3124,7 +3120,7 @@ static JSBool
forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
jsval idval;
JSObject *parent_doc; /* instance of @document_class */

View File

@ -131,7 +131,7 @@ static JSBool
window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp)
{
ELINKS_CAST_PROP_PARAMS
jsid id = *(hid._);
jsid id = (hid);
struct view_state *vs;

View File

@ -190,7 +190,7 @@ get_encoding_name(enum stream_encoding encoding)
/* Tries to open @prefixname with each of the supported encoding extensions
* appended. */
static inline enum stream_encoding
try_encoding_extensions(struct string *filename, int *fd)
try_encoding_extensions(struct string_ *filename, int *fd)
{
int length = filename->length;
int encoding;
@ -226,7 +226,7 @@ try_encoding_extensions(struct string *filename, int *fd)
*
* @return a connection state. S_OK if all is well. */
struct connection_state
read_file(struct stream_encoded *stream, int readsize, struct string *page)
read_file(struct stream_encoded *stream, int readsize, struct string_ *page)
{
if (!init_string(page)) return connection_state(S_OUT_OF_MEM);
@ -282,7 +282,7 @@ read_file(struct stream_encoded *stream, int readsize, struct string *page)
}
static inline int
is_stdin_pipe(struct stat *stt, struct string *filename)
is_stdin_pipe(struct stat *stt, struct string_ *filename)
{
/* On Mac OS X, /dev/stdin has type S_IFSOCK. (bug 616) */
return !strlcmp(filename->source, filename->length, "/dev/stdin", 10)
@ -294,7 +294,7 @@ is_stdin_pipe(struct stat *stt, struct string *filename)
}
struct connection_state
read_encoded_file(struct string *filename, struct string *page)
read_encoded_file(struct string_ *filename, struct string_ *page)
{
struct stream_encoded *stream;
struct stat stt;

View File

@ -41,9 +41,9 @@ const unsigned char *get_encoding_name(enum stream_encoding encoding);
/* Read from open @stream into the @page string */
struct connection_state
read_file(struct stream_encoded *stream, int readsize, struct string *page);
read_file(struct stream_encoded *stream, int readsize, struct string_ *page);
/* Reads the file with the given @filename into the string @source. */
struct connection_state read_encoded_file(struct string *filename, struct string *source);
struct connection_state read_encoded_file(struct string_ *filename, struct string_ *source);
#endif

View File

@ -54,7 +54,7 @@ static unsigned char *
get_formhist_data_info(struct listbox_item *item, struct terminal *term)
{
struct formhist_data *formhist_data = item->udata;
struct string info;
struct string_ info;
struct submitted_value *sv;
if (item->type == BI_FOLDER) return NULL;

View File

@ -45,7 +45,7 @@ static unsigned char *
get_globhist_item_text(struct listbox_item *box_item, struct terminal *term)
{
struct global_history_item *item = box_item->udata;
struct string info;
struct string_ info;
if (get_opt_int("document.history.global.display_type", NULL)
&& *item->title)
@ -60,7 +60,7 @@ static unsigned char *
get_globhist_item_info(struct listbox_item *box_item, struct terminal *term)
{
struct global_history_item *item = box_item->udata;
struct string info;
struct string_ info;
if (box_item->type == BI_FOLDER) return NULL;
if (!init_string(&info)) return NULL;

View File

@ -1085,7 +1085,7 @@ hits_cmp(const void *v1, const void *v2)
static int
compare_entities(const void *key_, const void *element_)
{
struct string *key = (struct string *) key_;
struct string_ *key = (struct string_ *) key_;
struct entity *element = (struct entity *) element_;
int length = key->length;
unsigned char *first = key->source;
@ -1210,7 +1210,7 @@ skip:
fprintf(stderr, "%lu %016x %s\n", (unsigned long) n , n, result);
#endif
} else { /* Text entity. */
struct string key = INIT_STRING((unsigned char *) str, strlen);
struct string_ key = INIT_STRING((unsigned char *) str, strlen);
struct entity *element = bsearch((void *) &key, entities,
N_ENTITIES,
sizeof(*element),

View File

@ -213,8 +213,8 @@ _nl_free_domain_conv(struct loaded_domain *domain)
/* This is hacked for ELinks - we want to look up for the translations at the
* correct place even if we are being ran from the source/build tree. */
static struct string *
add_filename_to_string(struct string *str, struct loaded_l10nfile *domain_file)
static struct string_ *
add_filename_to_string(struct string_ *str, struct loaded_l10nfile *domain_file)
{
unsigned char *slash = strrchr((const char *)program.path, '/');
size_t dirnamelen = (slash ? slash - program.path + 1 : 0);
@ -257,7 +257,7 @@ _nl_load_domain(struct loaded_l10nfile *domain_file,
a call to bind_textdomain_codeset). */
{
struct string filename;
struct string_ filename;
if (init_string(&filename)
&& add_filename_to_string(&filename, domain_file)) {

View File

@ -2454,7 +2454,7 @@ static const struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = {
{0x0000ff62, "\""},
{0x0000ff63, "\""},
{0x0000ff64, ","},
{-1, NULL}
{0xffffffff, NULL}
};
#define N_UNICODE_7B 2452

View File

@ -111,7 +111,7 @@ enum addr_type {
* to free anything).
* It returns 1 on success. */
static int
get_sun_path(struct string *sun_path)
get_sun_path(struct string_ *sun_path)
{
assert(sun_path);
if_assert_failed return 0;
@ -134,7 +134,7 @@ get_address(struct socket_info *info, enum addr_type type)
{
struct sockaddr_un *addr = NULL;
int sun_path_freespace;
struct string path;
struct string_ path;
assert(info);
if_assert_failed return -1;

View File

@ -219,7 +219,7 @@ init(void)
program.retval = RET_REMOTE;
} else {
struct string info;
struct string_ info;
struct terminal *term = NULL;
if (!encode_session_info(&info, &url_list)) {

View File

@ -27,7 +27,7 @@ extern int event_enabled;
#endif
static void
add_module_to_string(struct string *string, struct module *module,
add_module_to_string(struct string_ *string, struct module *module,
struct terminal *term)
{
struct module *submodule;
@ -48,7 +48,7 @@ add_module_to_string(struct string *string, struct module *module,
}
static void
add_modules_to_string(struct string *string, struct terminal *term)
add_modules_to_string(struct string_ *string, struct terminal *term)
{
struct module *module;
int i;
@ -62,7 +62,7 @@ add_modules_to_string(struct string *string, struct terminal *term)
/* Wrap string on spaces starting at position @start_at, trying
* to keep lines undex @maxlen length */
static void
wrap_string(struct string *string, int start_at, int maxlen)
wrap_string(struct string_ *string, int start_at, int maxlen)
{
unsigned char *pos, *start_pos;
unsigned char *last_pos = NULL;
@ -92,7 +92,7 @@ unsigned char *
get_dyn_full_version(struct terminal *term, int more)
{
static const unsigned char comma[] = ", ";
struct string string;
struct string_ string;
if (!init_string(&string)) return NULL;

View File

@ -151,7 +151,7 @@ static struct option *
get_mime_type_option(unsigned char *type)
{
struct option *opt;
struct string name;
struct string_ name;
opt = get_opt_rec_real(config_options, "mime.type");
if (!opt) return NULL;

View File

@ -499,7 +499,7 @@ init_mailcap(struct module *module)
static unsigned char *
format_command(unsigned char *command, unsigned char *type, int copiousoutput)
{
struct string cmd;
struct string_ cmd;
if (!init_string(&cmd)) return NULL;

View File

@ -24,7 +24,7 @@ static struct option *
get_real_opt(unsigned char *base, unsigned char *id)
{
struct option *opt = get_opt_rec_real(config_options, base);
struct string translated;
struct string_ translated;
assert(opt);
@ -82,7 +82,7 @@ static void
add_mime_extension(void *data)
{
struct extension *ext = data;
struct string name;
struct string_ name;
if (!ext || !init_string(&name)) return;
@ -152,7 +152,7 @@ menu_list_ext(struct terminal *term, void *fn_, void *xxx)
struct menu_item *mi = NULL;
foreachback (opt, *opt_tree) {
struct string translated;
struct string_ translated;
unsigned char *translated2;
unsigned char *optptr2;

View File

@ -328,8 +328,8 @@ get_mime_type_handler(unsigned char *content_type, int xwin)
return get_mime_handler_backends(content_type, xwin);
}
struct string *
add_mime_filename_to_string(struct string *string, struct uri *uri)
struct string_ *
add_mime_filename_to_string(struct string_ *string, struct uri *uri)
{
unsigned char *filename = get_content_filename(uri, NULL);

View File

@ -31,6 +31,6 @@ get_mime_type_handler(unsigned char *content_type, int xwin);
/* Extracts strictly the filename part (the crap between path and query) and
* adds it to the @string. Note that there are cases where the string will be
* empty ("") (ie. http://example.com/?crash=elinks). */
struct string *add_mime_filename_to_string(struct string *string, struct uri *uri);
struct string_ *add_mime_filename_to_string(struct string_ *string, struct uri *uri);
#endif

View File

@ -442,7 +442,7 @@ unsigned char *
get_ssl_connection_cipher(struct socket *socket)
{
ssl_t *ssl = socket->ssl;
struct string str;
struct string_ str;
if (!init_string(&str)) return NULL;

View File

@ -48,8 +48,8 @@ main(void)
const struct match_hostname_pattern_test_case *test;
int count_ok = 0;
int count_fail = 0;
struct string hostname_str = NULL_STRING;
struct string pattern_str = NULL_STRING;
struct string_ hostname_str = NULL_STRING;
struct string_ pattern_str = NULL_STRING;
if (!init_string(&hostname_str) || !init_string(&pattern_str)) {
fputs("Out of memory.\n", stderr);

View File

@ -93,8 +93,12 @@ safe_write(int fd, const void *buf, size_t count) {
#endif
/* Alignment of types. */
#define alignof(TYPE) \
#define alignof(TYPE) 1
#if 0
offsetof(struct { unsigned char dummy1; TYPE dummy2; }, dummy2)
#endif
/* Using this macro to copy structs is both faster and safer than
* memcpy(destination, source, sizeof(source)). Please, use this macro instead

View File

@ -368,7 +368,7 @@ get_clipboard_text(void)
#if 0
/* GNU Screen's clipboard */
if (is_gnuscreen()) {
struct string str;
struct string_ str;
if (!init_string(&str)) return NULL;
@ -386,7 +386,7 @@ set_clipboard_text(unsigned char *data)
{
/* GNU Screen's clipboard */
if (is_gnuscreen()) {
struct string str;
struct string_ str;
if (!init_string(&str)) return;
@ -406,7 +406,7 @@ set_clipboard_text(unsigned char *data)
void
set_window_title(unsigned char *title, int codepage)
{
struct string filtered;
struct string_ filtered;
#ifndef HAVE_SYS_CYGWIN_H
/* Check if we're in a xterm-like terminal. */

View File

@ -199,7 +199,7 @@ static unsigned char *
get_auth_entry_info(struct listbox_item *item, struct terminal *term)
{
struct auth_entry *auth_entry = item->udata;
struct string info;
struct string_ info;
if (item->type == BI_FOLDER) return NULL;
if (!init_string(&info)) return NULL;

View File

@ -136,7 +136,7 @@ init_response_digest(md5_digest_hex_T response, struct auth_entry *entry,
unsigned char *
get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri)
{
struct string string;
struct string_ string;
md5_digest_hex_T cnonce;
md5_digest_hex_T response;

View File

@ -359,7 +359,7 @@ static unsigned char *
normalize_bencoding_path(const unsigned char *path, int pathlen,
int *malicious)
{
struct string string;
struct string_ string;
/* Normalize and check for malicious paths in the the file list. */
@ -431,7 +431,7 @@ add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path,
/* Parses a list of path elements and adds them each to the path string
* separated by the platform specific directory separater. */
static enum bittorrent_state
parse_bencoding_file_path(struct scanner *scanner, struct string *path)
parse_bencoding_file_path(struct scanner *scanner, struct string_ *path)
{
assert(get_scanner_token(scanner)->type == BENCODING_TOKEN_LIST);
@ -468,7 +468,7 @@ parse_bencoding_file_path(struct scanner *scanner, struct string *path)
/* Parse a dictionary of file information used for multi-file torrents. */
static enum bittorrent_state
parse_bencoding_file_dictionary(struct bittorrent_meta *meta,
struct scanner *scanner, struct string *path)
struct scanner *scanner, struct string_ *path)
{
struct bittorrent_file file;
@ -529,7 +529,7 @@ parse_bencoding_files_list(struct bittorrent_meta *meta, struct scanner *scanner
while (scanner_has_tokens(scanner)) {
struct scanner_token *token = get_scanner_token(scanner);
struct string path;
struct string_ path;
enum bittorrent_state state;
if (!token) break;

View File

@ -231,6 +231,8 @@ struct bittorrent_file {
unsigned char name[1]; /**< Filename converted from path list. */
};
enum type_ { BITTORRENT_SINGLE_FILE, BITTORRENT_MULTI_FILE };
/** Static information from the .torrent metafile. */
struct bittorrent_meta {
/** The SHA1 info hash of the value of the info key from the metainfo
@ -260,7 +262,7 @@ struct bittorrent_meta {
unsigned char *piece_hash;
/** The type of the torrent. */
enum { BITTORRENT_SINGLE_FILE, BITTORRENT_MULTI_FILE } type;
enum type_ type;
/** Potential bad file path detected. */
unsigned int malicious_paths:1;

View File

@ -60,7 +60,7 @@ init_bittorrent_download_info(struct bittorrent_meta *meta)
}
foreach (file, meta->files) {
struct string string;
struct string_ string;
int spaces;
if (!init_string(&string))
@ -114,7 +114,7 @@ init_bittorrent_download_info(struct bittorrent_meta *meta)
/* Add information from the meta file struct to a string. */
static void
add_bittorrent_meta_to_string(struct string *msg, struct bittorrent_meta *meta,
add_bittorrent_meta_to_string(struct string_ *msg, struct bittorrent_meta *meta,
struct terminal *term, int add_files)
{
if (meta->malicious_paths) {
@ -236,7 +236,7 @@ dlg_show_bittorrent_info(struct dialog_data *dlg_data, struct widget_data *widge
{
struct file_download *file_download = dlg_data->dlg->udata;
struct download *download = &file_download->download;
struct string msg;
struct string_ msg;
if (download->conn
&& download->conn->info
@ -280,7 +280,7 @@ get_bittorrent_message(struct download *download, struct terminal *term,
};
struct bittorrent_connection *bittorrent;
struct bittorrent_peer_connection *peer;
struct string string;
struct string_ string;
unsigned char *msg;
uint32_t value;
@ -565,7 +565,7 @@ void
bittorrent_message_dialog(struct session *ses, void *data)
{
struct bittorrent_message *message = data;
struct string string;
struct string_ string;
unsigned char *uristring;
/* Don't show error dialogs for missing CSS stylesheets */
@ -628,7 +628,7 @@ bittorrent_download(struct dialog_data *dlg_data, struct widget_data *widget_dat
struct bittorrent_download_info *info = dlg_data->dlg->udata;
struct file_download *file_download;
struct session *ses = type_query->ses;
struct string redirect;
struct string_ redirect;
struct uri *uri;
struct connection conn;
@ -698,7 +698,7 @@ bittorrent_query_callback(void *data, struct connection_state state,
{
/* [gettext_accelerator_context(.bittorrent_query_callback)] */
struct type_query *type_query = data;
struct string filename;
struct string_ filename;
unsigned char *text;
struct dialog *dlg;
#define BITTORRENT_QUERY_WIDGETS_COUNT 6
@ -709,7 +709,7 @@ bittorrent_query_callback(void *data, struct connection_state state,
struct dialog_data *dlg_data;
int selected_widget;
struct memory_list *ml;
struct string msg;
struct string_ msg;
int files;
if (!is_in_state(state, S_OK))

View File

@ -273,7 +273,7 @@ make_bittorrent_peer_connection(struct bittorrent_connection *bittorrent,
{
enum bittorrent_state result = BITTORRENT_STATE_OUT_OF_MEM;
struct uri *uri = NULL;
struct string uri_string = NULL_STRING;
struct string_ uri_string = NULL_STRING;
struct bittorrent_peer_connection *peer;
peer = init_bittorrent_peer_connection(-1);

View File

@ -228,7 +228,7 @@ sent_bittorrent_peer_message(struct socket *socket)
}
static inline void
add_bittorrent_peer_integer(struct string *string, uint32_t integer)
add_bittorrent_peer_integer(struct string_ *string, uint32_t integer)
{
uint32_t data = htonl(integer);
@ -242,7 +242,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer,
struct bittorrent_peer_request *message)
{
struct bittorrent_connection *bittorrent = peer->bittorrent;
struct string string;
struct string_ string;
unsigned char msgid_str[1] = { (unsigned char) message->id };
uint32_t msglen = 0;

View File

@ -1175,7 +1175,7 @@ start_bittorrent_resume(struct bittorrent_connection *bittorrent,
struct bittorrent_const_string *meta)
{
struct bittorrent_piece_cache *cache = bittorrent->cache;
struct string info;
struct string_ info;
assert(cache && cache->resume_fd == -1);

View File

@ -145,7 +145,7 @@ do_send_bittorrent_tracker_request(struct connection *conn)
struct bittorrent_connection *bittorrent = conn->info;
int stopped = (bittorrent->tracker.event == BITTORRENT_EVENT_STOPPED);
unsigned char *ip, *key;
struct string request;
struct string_ request;
struct uri *uri = NULL;
int numwant, index, min_size;

View File

@ -44,11 +44,11 @@ close_all_non_term_fd(void)
}
struct connection_state
init_directory_listing(struct string *page, struct uri *uri)
init_directory_listing(struct string_ *page, struct uri *uri)
{
struct string dirpath = NULL_STRING;
struct string decoded = NULL_STRING;
struct string location = NULL_STRING;
struct string_ dirpath = NULL_STRING;
struct string_ decoded = NULL_STRING;
struct string_ location = NULL_STRING;
unsigned char *info;
int local = (uri->protocol == PROTOCOL_FILE);

View File

@ -3,13 +3,13 @@
#include "network/state.h"
struct string;
struct string_;
struct uri;
/* Close all non-terminal file descriptors. */
void close_all_non_term_fd(void);
struct connection_state
init_directory_listing(struct string *page, struct uri *uri);
init_directory_listing(struct string_ *page, struct uri *uri);
#endif

View File

@ -260,7 +260,7 @@ set_vars(struct connection *conn, unsigned char *script)
#ifdef CONFIG_COOKIES
{
struct string *cookies = send_cookies(conn->uri);
struct string_ *cookies = send_cookies(conn->uri);
if (cookies) {
env_set("HTTP_COOKIE", cookies->source, -1);

View File

@ -80,12 +80,12 @@ struct module file_protocol_module = struct_module(
/* Based on the @entry attributes and file-/dir-/linkname is added to the @data
* fragment. All the strings are in the system charset. */
static inline void
add_dir_entry(struct directory_entry *entry, struct string *page,
add_dir_entry(struct directory_entry *entry, struct string_ *page,
int pathlen, unsigned char *dircolor)
{
unsigned char *lnk = NULL;
struct string html_encoded_name;
struct string uri_encoded_name;
struct string_ html_encoded_name;
struct string_ uri_encoded_name;
if (!init_string(&html_encoded_name)) return;
if (!init_string(&uri_encoded_name)) {
@ -150,7 +150,7 @@ add_dir_entry(struct directory_entry *entry, struct string *page,
* Finally the sorted entries are added to the @data->fragment one by one. */
static inline void
add_dir_entries(struct directory_entry *entries, unsigned char *dirpath,
struct string *page)
struct string_ *page)
{
unsigned char dircolor[8];
int dirpathlen = strlen(dirpath);
@ -179,7 +179,7 @@ add_dir_entries(struct directory_entry *entries, unsigned char *dirpath,
/* Returns a connection state. S_OK if all is well. */
static inline struct connection_state
list_directory(struct connection *conn, unsigned char *dirpath,
struct string *page)
struct string_ *page)
{
int show_hidden_files = get_opt_bool("protocol.file.show_hidden_files",
NULL);
@ -245,7 +245,7 @@ void
file_protocol_handler(struct connection *connection)
{
unsigned char *redirect_location = NULL;
struct string page, name;
struct string_ page, name;
struct connection_state state;
int set_dir_content_type = 0;

View File

@ -61,7 +61,7 @@ static void
finger_send_request(struct socket *socket)
{
struct connection *conn = socket->conn;
struct string req;
struct string_ req;
if (!init_string(&req)) return;
/* add_to_string(&req, &rl, "/W"); */

View File

@ -121,7 +121,7 @@ compare(const void *av, const void *bv)
static void
display_entry(const FSP_RDENTRY *fentry, const unsigned char dircolor[])
{
struct string string;
struct string_ string;
/* fentry->name is a fixed-size array and is followed by other
* members; thus, if the name reported by the server does not
@ -199,7 +199,7 @@ sort_and_display_entries(FSP_DIR *dir, const unsigned char dircolor[])
static void
fsp_directory(FSP_SESSION *ses, struct uri *uri)
{
struct string buf;
struct string_ buf;
FSP_DIR *dir;
unsigned char *data = get_uri_string(uri, URI_DATA);
unsigned char dircolor[8] = "";

View File

@ -293,7 +293,7 @@ ftp_protocol_handler(struct connection *conn)
/* Send command, set connection state and free cmd string. */
static void
send_cmd(struct connection *conn, struct string *cmd, void *callback,
send_cmd(struct connection *conn, struct string_ *cmd, void *callback,
struct connection_state state)
{
request_from_socket(conn->socket, cmd->source, cmd->length, state,
@ -341,7 +341,7 @@ static void
ftp_login(struct socket *socket)
{
struct connection *conn = socket->conn;
struct string cmd;
struct string_ cmd;
struct auth_entry* auth;
auth = find_auth(conn->uri);
@ -454,7 +454,7 @@ ftp_got_user_info(struct socket *socket, struct read_buffer *rb)
static void
ftp_pass(struct connection *conn)
{
struct string cmd;
struct string_ cmd;
struct auth_entry *auth;
auth = find_auth(conn->uri);
@ -531,7 +531,7 @@ ftp_pass_info(struct socket *socket, struct read_buffer *rb)
/* Construct PORT command. */
static void
add_portcmd_to_string(struct string *string, unsigned char *pc)
add_portcmd_to_string(struct string_ *string, unsigned char *pc)
{
/* From RFC 959: DATA PORT (PORT)
*
@ -567,7 +567,7 @@ add_portcmd_to_string(struct string *string, unsigned char *pc)
#ifdef CONFIG_IPV6
/* Construct EPRT command. */
static void
add_eprtcmd_to_string(struct string *string, struct sockaddr_in6 *addr)
add_eprtcmd_to_string(struct string_ *string, struct sockaddr_in6 *addr)
{
unsigned char addr_str[INET6_ADDRSTRLEN];
@ -598,7 +598,7 @@ add_eprtcmd_to_string(struct string *string, struct sockaddr_in6 *addr)
* When PORT or EPRT are used, related sockets are created.
* It returns 0 on error (data socket creation failure). */
static int
get_ftp_data_socket(struct connection *conn, struct string *command)
get_ftp_data_socket(struct connection *conn, struct string_ *command)
{
struct ftp_connection_info *ftp = conn->info;
@ -656,7 +656,7 @@ get_ftp_data_socket(struct connection *conn, struct string *command)
* FTP server. To prevent command injection attacks, this function
* must reject CR LF sequences. */
static int
is_ftp_pathname_safe(const struct string *s)
is_ftp_pathname_safe(const struct string_ *s)
{
int i;
@ -681,9 +681,9 @@ add_file_cmd_to_str(struct connection *conn)
{
int ok = 0;
struct ftp_connection_info *ftp = NULL;
struct string command = NULL_STRING;
struct string ftp_data_command = NULL_STRING;
struct string pathname = NULL_STRING;
struct string_ command = NULL_STRING;
struct string_ ftp_data_command = NULL_STRING;
struct string_ pathname = NULL_STRING;
if (!conn->uri->data) {
INTERNAL("conn->uri->data empty");
@ -828,7 +828,7 @@ ret:
}
static void
send_it_line_by_line(struct connection *conn, struct string *cmd)
send_it_line_by_line(struct connection *conn, struct string_ *cmd)
{
struct ftp_connection_info *ftp = conn->info;
unsigned char *nl = strchr((const char *)ftp->cmd_buffer, '\n');
@ -847,7 +847,7 @@ send_it_line_by_line(struct connection *conn, struct string *cmd)
static void
ftp_send_retr_req(struct connection *conn, struct connection_state state)
{
struct string cmd;
struct string_ cmd;
if (!init_string(&cmd)) {
abort_connection(conn, connection_state(S_OUT_OF_MEM));
@ -1184,7 +1184,7 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries,
const struct ftp_dir_html_format *format,
struct ftp_file_info *ftp_info)
{
struct string string;
struct string_ string;
unsigned char permissions[10] = "---------";
if (!init_string(&string)) return -1;
@ -1347,7 +1347,7 @@ ftp_add_unparsed_line(struct cache_entry *cached, off_t *pos, int *tries,
const unsigned char *line, int line_length)
{
int our_ret;
struct string string;
struct string_ string;
int frag_ret;
our_ret = -1; /* assume out of memory if returning early */
@ -1501,7 +1501,7 @@ out_of_mem:
}
if (ftp->dir && !conn->from) {
struct string string;
struct string_ string;
struct connection_state state;
if (!conn->uri->data) {

View File

@ -17,8 +17,8 @@ enum ftp_file_type {
/* Information about one file in a directory listing. */
struct ftp_file_info {
enum ftp_file_type type; /* File type */
struct string name; /* File name */
struct string symlink; /* Link to which file points */
struct string_ name; /* File name */
struct string_ symlink; /* Link to which file points */
off_t size; /* File size. -1 if unknown. */
time_t mtime; /* Modification time */
unsigned int local_time_zone:1; /* What format the mtime is in */

View File

@ -169,7 +169,7 @@ struct gopher_connection_info {
/* De-escape a selector into a command. */
/* The % hex escapes are converted. Otherwise, the string is copied. */
static void
add_uri_decoded(struct string *command, unsigned char *string, int length,
add_uri_decoded(struct string_ *command, unsigned char *string, int length,
int replace_plus)
{
int oldlen = command->length;
@ -200,7 +200,7 @@ add_uri_decoded(struct string *command, unsigned char *string, int length,
static struct connection_state init_gopher_index_cache_entry(struct connection *conn);
static struct connection_state
add_gopher_command(struct connection *conn, struct string *command,
add_gopher_command(struct connection *conn, struct string_ *command,
enum gopher_entity entity,
unsigned char *selector, int selectorlen)
{
@ -274,7 +274,7 @@ init_gopher_connection_info(struct connection *conn)
{
struct gopher_connection_info *gopher;
struct connection_state state;
struct string command;
struct string_ command;
enum gopher_entity entity = DEFAULT_GOPHER_ENTITY;
unsigned char *selector = conn->uri->data;
int selectorlen = conn->uri->datalen;
@ -344,7 +344,7 @@ init_gopher_connection_info(struct connection *conn)
*/
static void
add_gopher_link(struct string *buffer, const unsigned char *text,
add_gopher_link(struct string_ *buffer, const unsigned char *text,
const unsigned char *addr)
{
add_format_to_string(buffer, "<a href=\"%s\">%s</a>",
@ -352,7 +352,7 @@ add_gopher_link(struct string *buffer, const unsigned char *text,
}
static void
add_gopher_search_field(struct string *buffer, const unsigned char *text,
add_gopher_search_field(struct string_ *buffer, const unsigned char *text,
const unsigned char *addr)
{
add_format_to_string(buffer,
@ -368,7 +368,7 @@ add_gopher_search_field(struct string *buffer, const unsigned char *text,
}
static void
add_gopher_description(struct string *buffer, enum gopher_entity entity)
add_gopher_description(struct string_ *buffer, enum gopher_entity entity)
{
unsigned char *description = get_gopher_entity_description(entity);
@ -381,7 +381,7 @@ add_gopher_description(struct string *buffer, enum gopher_entity entity)
}
static void
encode_selector_string(struct string *buffer, unsigned char *selector)
encode_selector_string(struct string_ *buffer, unsigned char *selector)
{
unsigned char *slashes;
@ -399,7 +399,7 @@ encode_selector_string(struct string *buffer, unsigned char *selector)
}
static void
add_gopher_menu_line(struct string *buffer, unsigned char *line)
add_gopher_menu_line(struct string_ *buffer, unsigned char *line)
{
/* Gopher menu fields */
unsigned char *name = line;
@ -501,7 +501,7 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line)
default:
{
struct string address;
struct string_ address;
unsigned char *format = selector && *selector
? "%s://%s@%s/" : "%s://%s%s/";
@ -584,7 +584,7 @@ static struct connection_state
read_gopher_directory_data(struct connection *conn, struct read_buffer *rb)
{
struct connection_state state = connection_state(S_TRANS);
struct string buffer;
struct string_ buffer;
unsigned char *end;
if (conn->from == 0) {
@ -654,7 +654,7 @@ static struct connection_state
init_gopher_index_cache_entry(struct connection *conn)
{
unsigned char *where;
struct string buffer;
struct string_ buffer;
if (!init_gopher_cache_entry(conn)
|| !init_string(&buffer))

View File

@ -103,7 +103,7 @@ get_http_error_document(struct terminal *term, struct uri *uri, int code)
{
const unsigned char *codestr = http_code_to_string(code);
unsigned char *title = asprintfa(_("HTTP error %03d", term), code);
struct string string;
struct string_ string;
if (!codestr) codestr = "Unknown error";

View File

@ -258,7 +258,7 @@ done_http(void)
static void
init_accept_charset(void)
{
struct string ac;
struct string_ ac;
unsigned char *cs;
int i;
@ -287,7 +287,7 @@ unsigned char *
subst_user_agent(unsigned char *fmt, unsigned char *version,
unsigned char *sysname, unsigned char *termsize)
{
struct string agent;
struct string_ agent;
if (!init_string(&agent)) return NULL;
@ -337,7 +337,7 @@ subst_user_agent(unsigned char *fmt, unsigned char *version,
}
static void
add_url_to_http_string(struct string *header, struct uri *uri, int components)
add_url_to_http_string(struct string_ *header, struct uri *uri, int components)
{
/* This block substitues spaces in URL by %20s. This is
* certainly not the right place where to do it, but now the
@ -586,7 +586,7 @@ init_http_connection_info(struct connection *conn, int major, int minor, int clo
}
static void
accept_encoding_header(struct string *header)
accept_encoding_header(struct string_ *header)
{
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || defined(CONFIG_LZMA) || defined(CONFIG_BROTLI)
int comma = 0;
@ -658,7 +658,7 @@ http_send_header(struct socket *socket)
struct connection *conn = socket->conn;
struct http_connection_info *http;
int trace = get_opt_bool("protocol.http.trace", NULL);
struct string header;
struct string_ header;
unsigned char *post_data = NULL;
struct auth_entry *entry = NULL;
struct uri *uri = conn->proxied_uri; /* Set to the real uri */
@ -1022,7 +1022,7 @@ http_send_header(struct socket *socket)
#ifdef CONFIG_COOKIES
/* CONNECT: Cookies are for the origin server only. */
if (!use_connect) {
struct string *cookies = send_cookies(uri);
struct string_ *cookies = send_cookies(uri);
if (cookies) {
add_to_string(&header, "Cookie: ");

View File

@ -253,7 +253,7 @@ http_negotiate_input(struct connection *conn, struct uri *uri,
* Fill output token to "Authorization: Negotiate <token>".
*/
int
http_negotiate_output(struct uri *uri, struct string *header)
http_negotiate_output(struct uri *uri, struct string_ *header)
{
struct negotiate *neg;
char *encoded = NULL;

View File

@ -14,7 +14,7 @@
int http_negotiate_input(struct connection *conn, struct uri *uri,
int type, unsigned char *data);
int http_negotiate_output(struct uri *uri, struct string *header);
int http_negotiate_output(struct uri *uri, struct string_ *header);
#endif /* EL_PROTOCOL_HTTP_HTTP_NEGOTIATE_H */

View File

@ -467,7 +467,7 @@ get_nntp_command(struct nntp_connection_info *nntp)
/* FIXME: For the beauty maybe %.*s could be used. --jonas */
static void
add_nntp_command_to_string(struct string *req, struct nntp_connection_info *nntp)
add_nntp_command_to_string(struct string_ *req, struct nntp_connection_info *nntp)
{
switch (nntp->command) {
case NNTP_COMMAND_GROUP:
@ -520,7 +520,7 @@ static void
nntp_send_command(struct connection *conn)
{
struct nntp_connection_info *nntp = conn->info;
struct string req;
struct string_ req;
nntp->command = get_nntp_command(nntp);
@ -580,7 +580,7 @@ news_protocol_handler(struct connection *conn)
{
unsigned char *protocol;
unsigned char *server = get_nntp_server();
struct string location;
struct string_ location;
if (!*server) server = getenv("NNTPSERVER");
if (!server || !*server) {

View File

@ -65,13 +65,13 @@ struct nntp_connection_info {
* for requesting the target. */
/* The <group> or undefined if target is NNTP_TARGET_GROUPS */
struct string group;
struct string_ group;
/* Can contain either <message-id>, <article-number> or <article-range>
* or undefined if target is NTTP_TARGET_{GROUP,GROUPS}. */
/* For <article-range> it contains start and end numbers as well as the
* separating '-'. */
struct string message;
struct string_ message;
/* State for getting articles in a <group> or an <article-range> */
long current_article, end_article, articles;

Some files were not shown because too many files have changed in this diff Show More