diff --git a/Makefile.config.in b/Makefile.config.in index e0f61c2d..f6302858 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -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@ diff --git a/Makefile.lib b/Makefile.lib index 364768d0..83651722 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -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) diff --git a/configure.ac b/configure.ac index 946984b5..908d4b0d 100644 --- a/configure.ac +++ b/configure.ac @@ -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)], []) diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index a86fd9e2..fb883c04 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -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; diff --git a/src/bfu/inphist.c b/src/bfu/inphist.c index 0e558bce..0647bc36 100644 --- a/src/bfu/inphist.c +++ b/src/bfu/inphist.c @@ -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 diff --git a/src/bfu/listmenu.c b/src/bfu/listmenu.c index 07350f5c..4139e83c 100644 --- a/src/bfu/listmenu.c +++ b/src/bfu/listmenu.c @@ -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; diff --git a/src/bfu/listmenu.h b/src/bfu/listmenu.h index 3b2b22b2..333d9ab1 100644 --- a/src/bfu/listmenu.h +++ b/src/bfu/listmenu.h @@ -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); diff --git a/src/bfu/menu.c b/src/bfu/menu.c index 3b426788..46c6ddc3 100644 --- a/src/bfu/menu.c +++ b/src/bfu/menu.c @@ -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 */ diff --git a/src/bookmarks/backend/xbel.c b/src/bookmarks/backend/xbel.c index 2422ece5..aa8f8ec6 100644 --- a/src/bookmarks/backend/xbel.c +++ b/src/bookmarks/backend/xbel.c @@ -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))) { diff --git a/src/bookmarks/bookmarks.c b/src/bookmarks/bookmarks.c index 3876fe21..db97f27b 100644 --- a/src/bookmarks/bookmarks.c +++ b/src/bookmarks/bookmarks.c @@ -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; diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index 642505f0..07000d40 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -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; diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 0501e1e4..aab5d395 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -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; diff --git a/src/config/cmdline.c b/src/config/cmdline.c index dae037d1..46bf7e0b 100644 --- a/src/config/cmdline.c +++ b/src/config/cmdline.c @@ -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. */ diff --git a/src/config/conf.c b/src/config/conf.c index 26fbc4c9..c4bbcd91 100644 --- a/src/config/conf.c +++ b/src/config/conf.c @@ -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); diff --git a/src/config/conf.h b/src/config/conf.h index 05f548c8..d13dcc1c 100644 --- a/src/config/conf.h +++ b/src/config/conf.h @@ -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 diff --git a/src/config/dialogs.c b/src/config/dialogs.c index 6a8c7972..427b94c5 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -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; diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index f1736ebf..54d70d9e 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -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; diff --git a/src/config/kbdbind.h b/src/config/kbdbind.h index 8facc190..476002ba 100644 --- a/src/config/kbdbind.h +++ b/src/config/kbdbind.h @@ -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; diff --git a/src/config/options.c b/src/config/options.c index 4bbc2639..d928006d 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -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? */ diff --git a/src/config/options.h b/src/config/options.h index 10b074bb..2c7ba0e8 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -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 { diff --git a/src/config/opttypes.c b/src/config/opttypes.c index 02e7144b..1609549d 100644 --- a/src/config/opttypes.c +++ b/src/config/opttypes.c @@ -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]; diff --git a/src/config/opttypes.h b/src/config/opttypes.h index 65ef11f4..76c78688 100644 --- a/src/config/opttypes.h +++ b/src/config/opttypes.h @@ -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 *); diff --git a/src/cookies/cookies.c b/src/cookies/cookies.c index 993437d1..30926b74 100644 --- a/src/cookies/cookies.c +++ b/src/cookies/cookies.c @@ -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); diff --git a/src/cookies/cookies.h b/src/cookies/cookies.h index c8b8e38c..c4568c94 100644 --- a/src/cookies/cookies.h +++ b/src/cookies/cookies.h @@ -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; diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index 5590f6d0..9441391d 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -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; diff --git a/src/dialogs/document.c b/src/dialogs/document.c index a401f001..c5af46b1 100644 --- a/src/dialogs/document.c +++ b/src/dialogs/document.c @@ -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); diff --git a/src/dialogs/info.c b/src/dialogs/info.c index d4f4f798..06bcc644 100644 --- a/src/dialogs/info.c +++ b/src/dialogs/info.c @@ -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; diff --git a/src/dialogs/menu.c b/src/dialogs/menu.c index 6c8f4f27..c8e6bac2 100644 --- a/src/dialogs/menu.c +++ b/src/dialogs/menu.c @@ -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; diff --git a/src/dialogs/progress.c b/src/dialogs/progress.c index 8c74444a..9ae2755f 100644 --- a/src/dialogs/progress.c +++ b/src/dialogs/progress.c @@ -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; diff --git a/src/dialogs/status.c b/src/dialogs/status.c index 1c90e0bd..c8e80b9b 100644 --- a/src/dialogs/status.c +++ b/src/dialogs/status.c @@ -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; diff --git a/src/document/css/css.c b/src/document/css/css.c index ba6f22e2..2fe7c568 100644 --- a/src/document/css/css.c +++ b/src/document/css/css.c @@ -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 diff --git a/src/document/css/parser.c b/src/document/css/parser.c index ee2bfe72..20fca97a 100644 --- a/src/document/css/parser.c +++ b/src/document/css/parser.c @@ -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) { diff --git a/src/document/dom/renderer.c b/src/document/dom/renderer.c index 97b2854e..7c927e26 100644 --- a/src/document/dom/renderer.c +++ b/src/document/dom/renderer.c @@ -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; diff --git a/src/document/dom/renderer.h b/src/document/dom/renderer.h index ebb95c9c..f1a87fe3 100644 --- a/src/document/dom/renderer.h +++ b/src/document/dom/renderer.h @@ -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 diff --git a/src/document/html/parser.c b/src/document/html/parser.c index b914bb62..6e21dc69 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -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, ...)) diff --git a/src/document/html/parser.h b/src/document/html/parser.h index 7631278a..63e36df4 100644 --- a/src/document/html/parser.h +++ b/src/document/html/parser.h @@ -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, diff --git a/src/document/html/parser/forms.c b/src/document/html/parser/forms.c index b586edd6..6e7642f9 100644 --- a/src/document/html/parser/forms.c +++ b/src/document/html/parser/forms.c @@ -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; diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index 581d1f53..8d334993 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -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; diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c index c80e04db..3725afcc 100644 --- a/src/document/html/parser/link.c +++ b/src/document/html/parser/link.c @@ -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; diff --git a/src/document/html/parser/parse.c b/src/document/html/parser/parse.c index 54e8cca0..def33a9c 100644 --- a/src/document/html/parser/parse.c +++ b/src/document/html/parser/parse.c @@ -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; diff --git a/src/document/html/parser/parse.h b/src/document/html/parser/parse.h index 1e53149e..929ea19c 100644 --- a/src/document/html/parser/parse.h +++ b/src/document/html/parser/parse.h @@ -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); diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index aca4046c..63bb2de5 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -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; diff --git a/src/document/html/renderer.h b/src/document/html/renderer.h index d27a63ce..c7e71cd5 100644 --- a/src/document/html/renderer.h +++ b/src/document/html/renderer.h @@ -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 */ diff --git a/src/document/libdom/renderer.c b/src/document/libdom/renderer.c index 1b885429..1047ff99 100644 --- a/src/document/libdom/renderer.c +++ b/src/document/libdom/renderer.c @@ -35,8 +35,8 @@ #include 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); diff --git a/src/document/libdom/renderer.h b/src/document/libdom/renderer.h index b489b6ba..3b7e630d 100644 --- a/src/document/libdom/renderer.h +++ b/src/document/libdom/renderer.h @@ -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 diff --git a/src/document/plain/renderer.c b/src/document/plain/renderer.c index e00972ed..0ceabc52 100644 --- a/src/document/plain/renderer.c +++ b/src/document/plain/renderer.c @@ -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); diff --git a/src/document/plain/renderer.h b/src/document/plain/renderer.h index 9cb93f60..3cf57660 100644 --- a/src/document/plain/renderer.h +++ b/src/document/plain/renderer.h @@ -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 diff --git a/src/document/renderer.c b/src/document/renderer.c index 234c7ad6..08de2a06 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -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) */ diff --git a/src/dom/stack.c b/src/dom/stack.c index a55548f1..8273c66d 100644 --- a/src/dom/stack.c +++ b/src/dom/stack.c @@ -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; diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index 5b48abb2..311844c9 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -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; diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 8bf25de2..6d0d9788 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -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:. Activated when user * follows a link with this synstax. */ diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 72ea1049..cb02e1e0 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -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 diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 2c8ba385..9e36d1bd 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -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; diff --git a/src/ecmascript/spidermonkey.h b/src/ecmascript/spidermonkey.h index a751b69e..c17aec3a 100644 --- a/src/ecmascript/spidermonkey.h +++ b/src/ecmascript/spidermonkey.h @@ -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 diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 96f583dc..39e2a9fa 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -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) { diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 736f75b4..3c1343d6 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -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 */ diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index bee163ab..baecaa0b 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -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; diff --git a/src/encoding/encoding.c b/src/encoding/encoding.c index d072da7f..4e8308b6 100644 --- a/src/encoding/encoding.c +++ b/src/encoding/encoding.c @@ -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; diff --git a/src/encoding/encoding.h b/src/encoding/encoding.h index f196c2c0..73bf07f1 100644 --- a/src/encoding/encoding.h +++ b/src/encoding/encoding.h @@ -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 diff --git a/src/formhist/dialogs.c b/src/formhist/dialogs.c index c4a65dda..b2b8a737 100644 --- a/src/formhist/dialogs.c +++ b/src/formhist/dialogs.c @@ -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; diff --git a/src/globhist/dialogs.c b/src/globhist/dialogs.c index 3023b4bc..de8b74e4 100644 --- a/src/globhist/dialogs.c +++ b/src/globhist/dialogs.c @@ -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; diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 5b30c855..d121dceb 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -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), diff --git a/src/intl/gettext/loadmsgcat.c b/src/intl/gettext/loadmsgcat.c index 3ad37cff..3e248bd8 100644 --- a/src/intl/gettext/loadmsgcat.c +++ b/src/intl/gettext/loadmsgcat.c @@ -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)) { diff --git a/src/intl/uni_7b.inc b/src/intl/uni_7b.inc index 44f525b4..7a580ed1 100644 --- a/src/intl/uni_7b.inc +++ b/src/intl/uni_7b.inc @@ -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 diff --git a/src/main/interlink.c b/src/main/interlink.c index b535c022..a65cab0b 100644 --- a/src/main/interlink.c +++ b/src/main/interlink.c @@ -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; diff --git a/src/main/main.c b/src/main/main.c index cc0f4f13..43375707 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -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)) { diff --git a/src/main/version.c b/src/main/version.c index 84953f57..8b94fb3a 100644 --- a/src/main/version.c +++ b/src/main/version.c @@ -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; diff --git a/src/mime/backend/default.c b/src/mime/backend/default.c index 923b073b..c9de59df 100644 --- a/src/mime/backend/default.c +++ b/src/mime/backend/default.c @@ -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; diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index c6689da8..a96a217c 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -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; diff --git a/src/mime/dialogs.c b/src/mime/dialogs.c index e52d8c33..238031c0 100644 --- a/src/mime/dialogs.c +++ b/src/mime/dialogs.c @@ -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; diff --git a/src/mime/mime.c b/src/mime/mime.c index d3734246..1ae24056 100644 --- a/src/mime/mime.c +++ b/src/mime/mime.c @@ -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); diff --git a/src/mime/mime.h b/src/mime/mime.h index 01524fdd..6bba299f 100644 --- a/src/mime/mime.h +++ b/src/mime/mime.h @@ -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 diff --git a/src/network/ssl/ssl.c b/src/network/ssl/ssl.c index 0be3da09..4e8dc105 100644 --- a/src/network/ssl/ssl.c +++ b/src/network/ssl/ssl.c @@ -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; diff --git a/src/network/ssl/test/match-hostname-test.c b/src/network/ssl/test/match-hostname-test.c index fbdf6fa6..4a591455 100644 --- a/src/network/ssl/test/match-hostname-test.c +++ b/src/network/ssl/test/match-hostname-test.c @@ -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); diff --git a/src/osdep/generic.h b/src/osdep/generic.h index 1f72d531..bd329488 100644 --- a/src/osdep/generic.h +++ b/src/osdep/generic.h @@ -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 diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index 37a13013..2fae866c 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -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. */ diff --git a/src/protocol/auth/dialogs.c b/src/protocol/auth/dialogs.c index 7c734f13..ead13677 100644 --- a/src/protocol/auth/dialogs.c +++ b/src/protocol/auth/dialogs.c @@ -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; diff --git a/src/protocol/auth/digest.c b/src/protocol/auth/digest.c index 5b3da02d..4aef6ea1 100644 --- a/src/protocol/auth/digest.c +++ b/src/protocol/auth/digest.c @@ -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; diff --git a/src/protocol/bittorrent/bencoding.c b/src/protocol/bittorrent/bencoding.c index ca04adc1..954b0f98 100644 --- a/src/protocol/bittorrent/bencoding.c +++ b/src/protocol/bittorrent/bencoding.c @@ -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; diff --git a/src/protocol/bittorrent/common.h b/src/protocol/bittorrent/common.h index ab6eee2a..83305f52 100644 --- a/src/protocol/bittorrent/common.h +++ b/src/protocol/bittorrent/common.h @@ -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; diff --git a/src/protocol/bittorrent/dialogs.c b/src/protocol/bittorrent/dialogs.c index 4b50a6ae..66b178c8 100644 --- a/src/protocol/bittorrent/dialogs.c +++ b/src/protocol/bittorrent/dialogs.c @@ -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)) diff --git a/src/protocol/bittorrent/peerconnect.c b/src/protocol/bittorrent/peerconnect.c index a836eb7e..7b769e62 100644 --- a/src/protocol/bittorrent/peerconnect.c +++ b/src/protocol/bittorrent/peerconnect.c @@ -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); diff --git a/src/protocol/bittorrent/peerwire.c b/src/protocol/bittorrent/peerwire.c index 698fa533..cd767d2d 100644 --- a/src/protocol/bittorrent/peerwire.c +++ b/src/protocol/bittorrent/peerwire.c @@ -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; diff --git a/src/protocol/bittorrent/piececache.c b/src/protocol/bittorrent/piececache.c index 9cc894a1..6b6af7a3 100644 --- a/src/protocol/bittorrent/piececache.c +++ b/src/protocol/bittorrent/piececache.c @@ -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); diff --git a/src/protocol/bittorrent/tracker.c b/src/protocol/bittorrent/tracker.c index 4e4b6fac..ea78ef2a 100644 --- a/src/protocol/bittorrent/tracker.c +++ b/src/protocol/bittorrent/tracker.c @@ -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; diff --git a/src/protocol/common.c b/src/protocol/common.c index 7db6862b..60004fb5 100644 --- a/src/protocol/common.c +++ b/src/protocol/common.c @@ -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); diff --git a/src/protocol/common.h b/src/protocol/common.h index 7dc259bb..59a5b082 100644 --- a/src/protocol/common.h +++ b/src/protocol/common.h @@ -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 diff --git a/src/protocol/file/cgi.c b/src/protocol/file/cgi.c index 29d69c5b..67d83709 100644 --- a/src/protocol/file/cgi.c +++ b/src/protocol/file/cgi.c @@ -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); diff --git a/src/protocol/file/file.c b/src/protocol/file/file.c index 0adaeff1..c648ee49 100644 --- a/src/protocol/file/file.c +++ b/src/protocol/file/file.c @@ -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; diff --git a/src/protocol/finger/finger.c b/src/protocol/finger/finger.c index c2606921..ca89c508 100644 --- a/src/protocol/finger/finger.c +++ b/src/protocol/finger/finger.c @@ -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"); */ diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c index 8a0dee37..045576b1 100644 --- a/src/protocol/fsp/fsp.c +++ b/src/protocol/fsp/fsp.c @@ -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] = ""; diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 61ecf530..48b76ecc 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -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) { diff --git a/src/protocol/ftp/parse.h b/src/protocol/ftp/parse.h index 18cfacd8..1f955649 100644 --- a/src/protocol/ftp/parse.h +++ b/src/protocol/ftp/parse.h @@ -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 */ diff --git a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c index da76d37f..8c8b10b2 100644 --- a/src/protocol/gopher/gopher.c +++ b/src/protocol/gopher/gopher.c @@ -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, "%s", @@ -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)) diff --git a/src/protocol/http/codes.c b/src/protocol/http/codes.c index c4a260fb..87b40bac 100644 --- a/src/protocol/http/codes.c +++ b/src/protocol/http/codes.c @@ -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"; diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 1df90332..67aeb5e9 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -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: "); diff --git a/src/protocol/http/http_negotiate.c b/src/protocol/http/http_negotiate.c index aa0f7559..13699ec7 100644 --- a/src/protocol/http/http_negotiate.c +++ b/src/protocol/http/http_negotiate.c @@ -253,7 +253,7 @@ http_negotiate_input(struct connection *conn, struct uri *uri, * Fill output token to "Authorization: Negotiate ". */ 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; diff --git a/src/protocol/http/http_negotiate.h b/src/protocol/http/http_negotiate.h index 5b7f3539..459ef907 100644 --- a/src/protocol/http/http_negotiate.h +++ b/src/protocol/http/http_negotiate.h @@ -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 */ diff --git a/src/protocol/nntp/connection.c b/src/protocol/nntp/connection.c index e0f5246d..f966589e 100644 --- a/src/protocol/nntp/connection.c +++ b/src/protocol/nntp/connection.c @@ -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) { diff --git a/src/protocol/nntp/connection.h b/src/protocol/nntp/connection.h index b2564673..02e9d1c7 100644 --- a/src/protocol/nntp/connection.h +++ b/src/protocol/nntp/connection.h @@ -65,13 +65,13 @@ struct nntp_connection_info { * for requesting the target. */ /* The or undefined if target is NNTP_TARGET_GROUPS */ - struct string group; + struct string_ group; /* Can contain either , or * or undefined if target is NTTP_TARGET_{GROUP,GROUPS}. */ /* For it contains start and end numbers as well as the * separating '-'. */ - struct string message; + struct string_ message; /* State for getting articles in a or an */ long current_article, end_article, articles; diff --git a/src/protocol/nntp/response.c b/src/protocol/nntp/response.c index 735374ce..4bb58cd8 100644 --- a/src/protocol/nntp/response.c +++ b/src/protocol/nntp/response.c @@ -148,7 +148,7 @@ static unsigned char * get_nntp_title(struct connection *conn) { struct nntp_connection_info *nntp = conn->info; - struct string title; + struct string_ title; if (!init_string(&title)) return NULL; @@ -201,7 +201,7 @@ get_nntp_title(struct connection *conn) static void -decode_q_segment(struct string *str, unsigned char *in, unsigned char *end) +decode_q_segment(struct string_ *str, unsigned char *in, unsigned char *end) { int c; @@ -223,7 +223,7 @@ decode_q_segment(struct string *str, unsigned char *in, unsigned char *end) } static void -decode_b_segment(struct string *str, unsigned char *in, unsigned char *end) +decode_b_segment(struct string_ *str, unsigned char *in, unsigned char *end) { /* Decode in..ep, possibly in-place to ot */ int c, pos = 0, acc = 0; @@ -270,7 +270,7 @@ decode_b_segment(struct string *str, unsigned char *in, unsigned char *end) } static void -add_header_to_string(struct string *str, unsigned char *header) +add_header_to_string(struct string_ *str, unsigned char *header) { unsigned char *end; @@ -317,7 +317,7 @@ add_header_to_string(struct string *str, unsigned char *header) static void -add_nntp_html_start(struct string *html, struct connection *conn) +add_nntp_html_start(struct string_ *html, struct connection *conn) { struct nntp_connection_info *nntp = conn->info; unsigned char *title = get_nntp_title(conn); @@ -380,7 +380,7 @@ add_nntp_html_start(struct string *html, struct connection *conn) } static void -add_nntp_html_end(struct string *html, struct connection *conn) +add_nntp_html_end(struct string_ *html, struct connection *conn) { struct nntp_connection_info *nntp = conn->info; @@ -405,7 +405,7 @@ add_nntp_html_end(struct string *html, struct connection *conn) } static void -add_nntp_html_line(struct string *html, struct connection *conn, +add_nntp_html_line(struct string_ *html, struct connection *conn, unsigned char *line) { struct nntp_connection_info *nntp = conn->info; @@ -460,7 +460,7 @@ add_nntp_html_line(struct string *html, struct connection *conn, struct connection_state read_nntp_response_data(struct connection *conn, struct read_buffer *rb) { - struct string html; + struct string_ html; unsigned char *end; struct connection_state state = connection_state(S_TRANS); diff --git a/src/protocol/proxy.c b/src/protocol/proxy.c index 96e4f0e7..f9381312 100644 --- a/src/protocol/proxy.c +++ b/src/protocol/proxy.c @@ -57,7 +57,7 @@ static struct uri * proxy_uri(struct uri *uri, unsigned char *proxy, struct connection_state *error_state) { - struct string string; + struct string_ string; if (init_string(&string) && string_concat(&string, "proxy://", proxy, "/", diff --git a/src/protocol/rewrite/rewrite.c b/src/protocol/rewrite/rewrite.c index 3e1f09db..d6ceddb6 100644 --- a/src/protocol/rewrite/rewrite.c +++ b/src/protocol/rewrite/rewrite.c @@ -218,7 +218,7 @@ get_prefix_tree(enum uri_rewrite_option tree) static unsigned char * rewrite_uri(unsigned char *url, struct uri *current_uri, unsigned char *arg) { - struct string n = NULL_STRING; + struct string_ n = NULL_STRING; unsigned char *args[MAX_URI_ARGS]; int argslen[MAX_URI_ARGS]; int argc = 0; diff --git a/src/protocol/smb/smb2.c b/src/protocol/smb/smb2.c index 7381a6d7..e2adc308 100644 --- a/src/protocol/smb/smb2.c +++ b/src/protocol/smb/smb2.c @@ -70,7 +70,7 @@ smb_error(struct connection_state error) /** First information such as permissions is gathered for each directory entry. * All entries are then sorted. */ static struct directory_entry * -get_smb_directory_entries(int dir, struct string *prefix) +get_smb_directory_entries(int dir, struct string_ *prefix) { struct directory_entry *entries = NULL; @@ -80,8 +80,8 @@ get_smb_directory_entries(int dir, struct string *prefix) while ((entry = smbc_readdir(dir))) { struct stat st, *stp; struct directory_entry *new_entries; - struct string attrib; - struct string name; + struct string_ attrib; + struct string_ name; if (!strcmp(entry->name, ".")) continue; @@ -130,12 +130,12 @@ get_smb_directory_entries(int dir, struct string *prefix) } static void -add_smb_dir_entry(struct directory_entry *entry, struct string *page, +add_smb_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)) { @@ -200,7 +200,7 @@ add_smb_dir_entry(struct directory_entry *entry, struct string *page, * Finally the sorted entries are added to the @data->fragment one by one. */ static void add_smb_dir_entries(struct directory_entry *entries, unsigned char *dirpath, - struct string *page) + struct string_ *page) { unsigned char dircolor[8]; int i; @@ -224,9 +224,9 @@ add_smb_dir_entries(struct directory_entry *entries, unsigned char *dirpath, } static void -smb_directory(int dir, struct string *prefix, struct uri *uri) +smb_directory(int dir, struct string_ *prefix, struct uri *uri) { - struct string buf; + struct string_ buf; struct directory_entry *entries; if (!is_in_state(init_directory_listing(&buf, uri), S_OK)) { @@ -259,7 +259,7 @@ do_smb(struct connection *conn) { struct uri *uri = conn->uri; struct auth_entry *auth = find_auth(uri); - struct string string; + struct string_ string; unsigned char *url; int dir; @@ -301,7 +301,7 @@ do_smb(struct connection *conn) dir = smbc_opendir(url); if (dir >= 0) { - struct string prefix; + struct string_ prefix; init_string(&prefix); add_to_string(&prefix, url); diff --git a/src/protocol/uri.c b/src/protocol/uri.c index 05b4c20a..b4a02fdc 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -170,7 +170,7 @@ check_whether_file_exists(unsigned char *name) /* Encodes URIs without encoding stuff like fragments and query separators. */ static void -encode_file_uri_string(struct string *string, unsigned char *uristring) +encode_file_uri_string(struct string_ *string, unsigned char *uristring) { int filenamelen = check_whether_file_exists(uristring); @@ -487,8 +487,8 @@ compare_uri(const struct uri *a, const struct uri *b, /* We might need something more intelligent than this Swiss army knife. */ -struct string * -add_uri_to_string(struct string *string, const struct uri *uri, +struct string_ * +add_uri_to_string(struct string_ *string, const struct uri *uri, enum uri_component components) { /* Custom or unknown keep the URI untouched. */ @@ -661,7 +661,7 @@ add_uri_to_string(struct string *string, const struct uri *uri, unsigned char * get_uri_string(const struct uri *uri, enum uri_component components) { - struct string string; + struct string_ string; if (init_string(&string) && add_uri_to_string(&string, uri, components)) @@ -672,8 +672,8 @@ get_uri_string(const struct uri *uri, enum uri_component components) } -struct string * -add_string_uri_to_string(struct string *string, unsigned char *uristring, +struct string_ * +add_string_uri_to_string(struct string_ *string, unsigned char *uristring, enum uri_component components) { struct uri uri; @@ -831,7 +831,7 @@ transform_file_url(struct uri *uri, const unsigned char *cwd) /* Who would name their file/dir '...' ? */ if (*path == '.' || !*path) { - struct string dir; + struct string_ dir; if (!init_string(&dir)) return NULL; @@ -1113,7 +1113,7 @@ parse_uri: /* Code duplication with the URI_ERRNO_INVALID_PROTOCOL * case. */ if (protocol != PROTOCOL_UNKNOWN) { - struct string str; + struct string_ str; if (!init_string(&str)) return NULL; @@ -1231,7 +1231,7 @@ parse_uri: { /* No protocol name */ enum protocol protocol = find_uri_protocol(newurl); - struct string str; + struct string_ str; if (!init_string(&str)) return NULL; @@ -1348,7 +1348,7 @@ safe_char(unsigned char c) } void -encode_uri_string(struct string *string, const unsigned char *name, int namelen, +encode_uri_string(struct string_ *string, const unsigned char *name, int namelen, int convert_slashes) { unsigned char n[4]; @@ -1377,7 +1377,7 @@ encode_uri_string(struct string *string, const unsigned char *name, int namelen, } void -encode_win32_uri_string(struct string *string, unsigned char *name, int namelen) +encode_win32_uri_string(struct string_ *string, unsigned char *name, int namelen) { unsigned char n[4]; unsigned char *end; @@ -1441,7 +1441,7 @@ decode_uri(unsigned char *src) } void -decode_uri_string(struct string *string) +decode_uri_string(struct string_ *string) { decode_uri(string->source); string->length = strlen(string->source); @@ -1458,7 +1458,7 @@ decode_uri_for_display(unsigned char *src) } void -decode_uri_string_for_display(struct string *string) +decode_uri_string_for_display(struct string_ *string) { decode_uri_for_display(string->source); string->length = strlen(string->source); diff --git a/src/protocol/uri.h b/src/protocol/uri.h index dc70ad21..79d9f5d3 100644 --- a/src/protocol/uri.h +++ b/src/protocol/uri.h @@ -3,7 +3,7 @@ #include "main/object.h" -struct string; +struct string_; #define POST_CHAR 1 #define POST_CHAR_S "\001" @@ -280,12 +280,12 @@ int compare_uri(const struct uri *uri1, const struct uri *uri2, * construction of the URI string. */ /* Adds the components to an already initialized string. */ -struct string *add_uri_to_string(struct string *string, const struct uri *uri, +struct string_ *add_uri_to_string(struct string_ *string, const struct uri *uri, enum uri_component components); /* Takes an uri string, parses it and adds the desired components. Useful if * there is no struct uri around. */ -struct string *add_string_uri_to_string(struct string *string, unsigned char *uristring, enum uri_component components); +struct string_ *add_string_uri_to_string(struct string_ *string, unsigned char *uristring, enum uri_component components); /* Returns the new URI string or NULL upon an error. */ unsigned char *get_uri_string(const struct uri *uri, @@ -306,17 +306,17 @@ int get_uri_port(const struct uri *uri); /* Encode and add @namelen bytes from @name to @string. If @namelen is -1 it is * set to strlen(@name). If the boolean convert_slashes is zero '/'-chars will * not be encoded. */ -void encode_uri_string(struct string *string, const unsigned char *name, int namelen, +void encode_uri_string(struct string_ *string, const unsigned char *name, int namelen, int convert_slashes); /* special version for Windows directory listing */ -void encode_win32_uri_string(struct string *string, unsigned char *name, int namelen); +void encode_win32_uri_string(struct string_ *string, unsigned char *name, int namelen); -void decode_uri_string(struct string *string); +void decode_uri_string(struct string_ *string); void decode_uri(unsigned char *uristring); /* Decodes and replaces illicit screen chars with '*'. */ -void decode_uri_string_for_display(struct string *string); +void decode_uri_string_for_display(struct string_ *string); void decode_uri_for_display(unsigned char *uristring); /* Returns allocated string containing the biggest possible extension. diff --git a/src/protocol/user.c b/src/protocol/user.c index fda52704..68803deb 100644 --- a/src/protocol/user.c +++ b/src/protocol/user.c @@ -97,7 +97,7 @@ get_user_program(struct terminal *term, unsigned char *progid, int progidlen) { struct option *opt; int xwin = term ? term->environment & ENV_XWIN : 0; - struct string name; + struct string_ name; if (!init_string(&name)) return NULL; @@ -121,7 +121,7 @@ static unsigned char * subst_cmd(unsigned char *cmd, struct uri *uri, unsigned char *subj, unsigned char *formfile) { - struct string string; + struct string_ string; if (!init_string(&string)) return NULL; diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 6c7e1379..73eea95f 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -157,7 +157,7 @@ static int l_current_document_formatted(LS) { struct document_view *doc_view; - struct string buffer; + struct string_ buffer; int width, old_width = 0; if (lua_gettop(S) == 0) width = -1; @@ -285,7 +285,7 @@ l_bind_key(LS) int ref; int event_id; unsigned char *err = NULL; - struct string event_name = NULL_STRING; + struct string_ event_name = NULL_STRING; if (!lua_isstring(S, 1) || !lua_isstring(S, 2) || !lua_isfunction(S, 3)) { diff --git a/src/scripting/python/core.c b/src/scripting/python/core.c index 351b5548..2d6c6749 100644 --- a/src/scripting/python/core.c +++ b/src/scripting/python/core.c @@ -96,7 +96,7 @@ end: static int set_python_search_path(void) { - struct string new_python_path; + struct string_ new_python_path; unsigned char *old_python_path; int result = -1; diff --git a/src/scripting/python/keybinding.c b/src/scripting/python/keybinding.c index 983c1847..fbe1dfb5 100644 --- a/src/scripting/python/keybinding.c +++ b/src/scripting/python/keybinding.c @@ -84,7 +84,7 @@ python_bind_key(PyObject *self, PyObject *args, PyObject *kwargs) unsigned char *keymap = "main"; PyObject *key_tuple; PyObject *old_callback; - struct string event_name; + struct string_ event_name; int event_id; unsigned char *error_msg; static char *kwlist[] = {"keystroke", "callback", "keymap", NULL}; diff --git a/src/scripting/ruby/core.c b/src/scripting/ruby/core.c index 82be5cf9..28555312 100644 --- a/src/scripting/ruby/core.c +++ b/src/scripting/ruby/core.c @@ -145,7 +145,7 @@ static VALUE erb_stdout_p(int argc, VALUE *argv, VALUE self) { int i; - struct string string; + struct string_ string; struct terminal *term; if (!init_string(&string)) diff --git a/src/scripting/scripting.c b/src/scripting/scripting.c index 6d0b7f69..7cb0a098 100644 --- a/src/scripting/scripting.c +++ b/src/scripting/scripting.c @@ -37,7 +37,7 @@ report_scripting_error(struct module *module, struct session *ses, unsigned char *msg) { struct terminal *term; - struct string string; + struct string_ string; if (!ses) { term = get_default_terminal(); diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 86e9ed79..f83fbba4 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -23,7 +23,19 @@ struct smjs_action_fn_callback_hop { action_id_T action_id; }; -static const JSClass action_fn_class; /* defined below */ +static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj); +static JSBool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval); + +static const JSClass action_fn_class = { + "action_fn", + JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ + JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + smjs_action_fn_finalize, + NULL, + smjs_action_fn_callback, +}; /* @action_fn_class.finalize */ static void @@ -114,17 +126,6 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) return JS_TRUE; } -static const JSClass action_fn_class = { - "action_fn", - JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, - smjs_action_fn_finalize, - NULL, - smjs_action_fn_callback, -}; - static JSObject * smjs_get_action_fn_object(unsigned char *action_str) { @@ -166,7 +167,7 @@ static JSBool action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); (void)obj; jsval val; diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index 057fbd56..6136f4d0 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -15,11 +15,27 @@ #include "util/memory.h" -static const JSClass bookmark_class, bookmark_folder_class; /* defined below */ - - /*** common code ***/ +static void bookmark_finalize(JSFreeOp *op, JSObject *obj); +static JSBool bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); + +static const JSClass bookmark_class = { + "bookmark", + JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, +}; + +static const JSClass bookmark_folder_class = { + "bookmark_folder", + JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + JS_PropertyStub, JS_PropertyStub, + bookmark_folder_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, +}; + static JSObject * smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp) { @@ -274,13 +290,6 @@ bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId h return JS_TRUE; } -static const JSClass bookmark_class = { - "bookmark", - JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, -}; static JSObject * smjs_get_bookmark_object(struct bookmark *bookmark) @@ -306,7 +315,7 @@ static JSBool bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct bookmark *bookmark; struct bookmark *folder; @@ -339,13 +348,6 @@ bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid return JS_TRUE; } -static const JSClass bookmark_folder_class = { - "bookmark_folder", - JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, - bookmark_folder_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, -}; static JSObject * smjs_get_bookmark_folder_object(struct bookmark *bookmark) diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 9995370d..a35c7c9b 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -15,7 +15,15 @@ #include "util/error.h" #include "util/memory.h" -static const JSClass cache_entry_class; /* defined below */ +static void cache_entry_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass cache_entry_class = { + "cache_entry", + JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ + JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize +}; /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -222,13 +230,6 @@ cache_entry_finalize(JSFreeOp *op, JSObject *obj) cached->jsobject = NULL; } -static const JSClass cache_entry_class = { - "cache_entry", - JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize -}; /** Return an SMJS object through which scripts can access @a cached. * If there already is such an object, return that; otherwise create a diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 11488033..db23327f 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -40,7 +40,7 @@ static void error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) { unsigned char *strict, *exception, *warning, *error; - struct string msg; + struct string_ msg; if (!init_string(&msg)) goto reported; @@ -76,7 +76,7 @@ smjs_do_file(unsigned char *path) { int ret = 1; jsval rval; - struct string script; + struct string_ script; if (!init_string(&script)) return 0; @@ -245,7 +245,7 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) return jsstr; } -/** Convert a jschar array to UTF-8 and append it to struct string. +/** Convert a jschar array to UTF-8 and append it to struct string_. * Replace misused surrogate codepoints with UCS_REPLACEMENT_CHARACTER. * * @param[in,out] utf8 @@ -258,8 +258,8 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) * Number of jschars in the @a utf16 array. * * @return @a utf8 if successful, or NULL if not. */ -static struct string * -add_jschars_to_utf8_string(struct string *utf8, +static struct string_ * +add_jschars_to_utf8_string(struct string_ *utf8, const jschar *utf16, size_t len) { size_t pos; @@ -308,7 +308,7 @@ jsstring_to_utf8(JSContext *ctx, JSString *jsstr, int *length) { size_t utf16_len; const jschar *utf16; - struct string utf8; + struct string_ utf8; utf16_len = JS_GetStringLength(jsstr); utf16 = JS_GetStringCharsZ(ctx, jsstr); /* stays owned by jsstr */ diff --git a/src/scripting/smjs/core.h b/src/scripting/smjs/core.h index ce99b287..63556a02 100644 --- a/src/scripting/smjs/core.h +++ b/src/scripting/smjs/core.h @@ -5,7 +5,7 @@ struct module; struct session; -struct string; +struct string_; extern JSContext *smjs_ctx; extern struct session *smjs_ses; diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 69a71a67..ddd6d714 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -107,14 +107,23 @@ static const JSPropertySpec elinks_props[] = { { NULL } }; -static const JSClass elinks_class; +static JSBool elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); + +static const JSClass elinks_class = { + "elinks", + 0, + JS_PropertyStub, JS_PropertyStub, + elinks_get_property, elinks_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL +}; /* @elinks_class.getProperty */ static JSBool elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -172,7 +181,7 @@ static JSBool elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -211,13 +220,6 @@ elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool return JS_FALSE; } -static const JSClass elinks_class = { - "elinks", - 0, - JS_PropertyStub, JS_PropertyStub, - elinks_get_property, elinks_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL -}; static const spidermonkeyFunctionSpec elinks_funcs[] = { { "alert", elinks_alert, 1 }, diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index fb7064b9..d81f5cf6 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -12,9 +12,26 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" +static JSBool smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool smjs_globhist_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); -static const JSClass smjs_globhist_item_class; /* defined below */ +static const JSClass smjs_globhist_class = { + "global_history", 0, + JS_PropertyStub, JS_PropertyStub, + smjs_globhist_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, +}; +static const JSClass smjs_globhist_item_class = { + "global_history_item", + JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ + JS_PropertyStub, JS_PropertyStub, + smjs_globhist_item_get_property, smjs_globhist_item_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + smjs_globhist_item_finalize, +}; /* @smjs_globhist_item_class.finalize */ static void @@ -61,7 +78,7 @@ smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct global_history_item *history_item; @@ -129,7 +146,7 @@ static JSBool smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct global_history_item *history_item; @@ -183,14 +200,6 @@ smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId } } -static const JSClass smjs_globhist_item_class = { - "global_history_item", - JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ - JS_PropertyStub, JS_PropertyStub, - smjs_globhist_item_get_property, smjs_globhist_item_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, - smjs_globhist_item_finalize, -}; static JSObject * smjs_get_globhist_item_object(struct global_history_item *history_item) @@ -216,7 +225,7 @@ static JSBool smjs_globhist_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); (void)obj; JSObject *jsobj; @@ -246,12 +255,6 @@ ret_null: return JS_TRUE; } -static const JSClass smjs_globhist_class = { - "global_history", 0, - JS_PropertyStub, JS_PropertyStub, - smjs_globhist_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, -}; static JSObject * smjs_get_globhist_object(void) diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 6a4c28a3..0057bb71 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -13,14 +13,24 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" -static const JSClass keymap_class; /* defined below */ +static JSBool keymap_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static void keymap_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass keymap_class = { + "keymap", + JSCLASS_HAS_PRIVATE, /* int * */ + JS_PropertyStub, JS_PropertyStub, + keymap_get_property, keymap_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, +}; /* @keymap_class.getProperty */ static JSBool keymap_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); unsigned char *action_str; const unsigned char *keystroke_str; @@ -80,7 +90,7 @@ static JSBool keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); int *data; unsigned char *keymap_str; @@ -125,7 +135,7 @@ keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool } else if (!JSVAL_IS_PRIMITIVE(*vp) || JSVAL_IS_NULL(*vp)) { unsigned char *err = NULL; int event_id; - struct string event_name = NULL_STRING; + struct string_ event_name = NULL_STRING; JSObject *jsobj = JSVAL_TO_OBJECT(*vp); if (JS_FALSE == JS_ObjectIsFunction(ctx, jsobj)) @@ -179,13 +189,6 @@ keymap_finalize(JSFreeOp *op, JSObject *obj) mem_free(data); } -static const JSClass keymap_class = { - "keymap", - JSCLASS_HAS_PRIVATE, /* int * */ - JS_PropertyStub, JS_PropertyStub, - keymap_get_property, keymap_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, -}; static JSObject * smjs_get_keymap_object(enum keymap_id keymap_id) @@ -219,7 +222,7 @@ static JSObject * smjs_get_keymap_hash_object(void) { jsval val; - enum keymap_id keymap_id; + int keymap_id; JSObject *keymaps_hash; keymaps_hash = JS_NewObject(smjs_ctx, (JSClass *) &keymaps_hash_class, diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 41beda41..5598ca33 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -29,10 +29,29 @@ static JSObject *smjs_session_object; +static JSBool session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static void session_finalize(JSFreeOp *op, JSObject *obj); +static JSBool smjs_location_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static void smjs_location_array_finalize(JSFreeOp *op, JSObject *obj); +static JSBool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); -static const JSClass session_class; /* Defined below. */ +static const JSClass session_class = { + "session", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + JS_PropertyStub, JS_PropertyStub, + session_get_property, session_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, + NULL, NULL, NULL, session_construct +}; -static const JSClass location_array_class; /* Defined below. */ +static const JSClass location_array_class = { + "location_array", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + JS_PropertyStub, JS_PropertyStub, + smjs_location_array_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, +}; /* location_array_class is the class for array object, the elements of which * correspond to the elements of session.history. @@ -45,7 +64,7 @@ static JSBool smjs_location_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct session *ses; int index; @@ -112,14 +131,6 @@ smjs_location_array_finalize(JSFreeOp *op, JSObject *obj) ses->history_jsobject = NULL; } -static const JSClass location_array_class = { - "location_array", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - smjs_location_array_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, -}; - /** Return an SMJS object through which scripts can access @a ses.history. If * there already is such an object, return that; otherwise create a new one. * The SMJS object holds only a weak reference to @a ses. */ @@ -194,7 +205,7 @@ static JSBool session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct session *ses; @@ -303,7 +314,7 @@ static JSBool session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct session *ses; @@ -512,15 +523,6 @@ session_finalize(JSFreeOp *op, JSObject *obj) ses->jsobject = NULL; } -static const JSClass session_class = { - "session", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - session_get_property, session_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, - NULL, NULL, NULL, session_construct -}; - /** Return an SMJS object through which scripts can access @a ses. * If there already is such an object, return that; otherwise create a * new one. The SMJS object holds only a weak reference to @a ses. */ @@ -593,7 +595,7 @@ static JSBool session_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); JSObject *tabobj; struct terminal *term = JS_GetPrivate(obj); @@ -678,15 +680,15 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) JSString *jsstr; unsigned char *url; struct session *ses; - struct JSObject *this; + struct JSObject *this_; if (argc != 1) return JS_FALSE; - this = JS_THIS_OBJECT(ctx, rval); - if (!JS_InstanceOf(ctx, this, (JSClass *) &session_class, NULL)) + this_ = JS_THIS_OBJECT(ctx, rval); + if (!JS_InstanceOf(ctx, this_, (JSClass *) &session_class, NULL)) return JS_FALSE; - ses = JS_GetInstancePrivate(ctx, this, + ses = JS_GetInstancePrivate(ctx, this_, (JSClass *) &session_class, NULL); if (!ses) return JS_FALSE; /* detached */ diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index e47ba87f..2644ba33 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -17,7 +17,16 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static const JSClass terminal_class; /* Defined below. */ +static JSBool terminal_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static void terminal_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass terminal_class = { + "terminal", + JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ + JS_PropertyStub, JS_PropertyStub, + terminal_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize +}; enum terminal_prop { TERMINAL_TAB, @@ -33,7 +42,7 @@ static JSBool terminal_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct terminal *term; @@ -88,13 +97,6 @@ terminal_finalize(JSFreeOp *op, JSObject *obj) term->jsobject = NULL; } -static const JSClass terminal_class = { - "terminal", - JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ - JS_PropertyStub, JS_PropertyStub, - terminal_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize -}; /** Return an SMJS object through which scripts can access @a term. * If there already is such an object, return that; otherwise create a @@ -156,7 +158,7 @@ static JSBool terminal_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); int index; struct terminal *term; diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index 1f23a9b3..70633fa6 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -20,7 +20,18 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static const JSClass view_state_class; /* defined below */ +static JSBool view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool view_state_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static void view_state_finalize(JSFreeOp *op, JSObject *obj); + + +static const JSClass view_state_class = { + "view_state", + JSCLASS_HAS_PRIVATE, /* struct view_state * */ + JS_PropertyStub, JS_PropertyStub, + view_state_get_property, view_state_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize +}; /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -42,7 +53,7 @@ static JSBool view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct view_state *vs; @@ -87,7 +98,7 @@ static JSBool view_state_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = (hid); struct view_state *vs; @@ -144,13 +155,6 @@ view_state_finalize(JSFreeOp *op, JSObject *obj) vs->jsobject = NULL; } -static const JSClass view_state_class = { - "view_state", - JSCLASS_HAS_PRIVATE, /* struct view_state * */ - JS_PropertyStub, JS_PropertyStub, - view_state_get_property, view_state_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize -}; /** Return an SMJS object through which scripts can access @a vs. If there * already is such an object, return that; otherwise create a new one. */ diff --git a/src/session/download.c b/src/session/download.c index 000bbe97..4f36fb1b 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -363,7 +363,7 @@ exec_mailcap_command(void *data) if (exec_mailcap) { if (exec_mailcap->command) { - struct string string; + struct string_ string; if (init_string(&string)) { struct uri *ref = get_uri("mailcap:elmailcap", 0); @@ -999,7 +999,7 @@ create_download_file(struct terminal *term, unsigned char *fi, static unsigned char * get_temp_name(struct uri *uri) { - struct string name; + struct string_ name; unsigned char *extension; /* FIXME * We use tempnam() here, which is unsafe (race condition), for now. @@ -1030,7 +1030,7 @@ get_temp_name(struct uri *uri) static unsigned char * subst_file(unsigned char *prog, unsigned char *file) { - struct string name; + struct string_ name; /* When there is no %s in the mailcap entry, the handler program reads * data from stdin instead of a file. */ int input = 1; @@ -1064,7 +1064,7 @@ subst_file(unsigned char *prog, unsigned char *file) } if (input) { - struct string s; + struct string_ s; if (init_string(&s)) { add_to_string(&s, "/bin/cat "); @@ -1524,7 +1524,7 @@ static void do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_handler *handler) { /* [gettext_accelerator_context(.do_type_query)] */ - struct string filename; + struct string_ filename; unsigned char *description; unsigned char *desc_sep; unsigned char *format, *text, *title; diff --git a/src/session/session.c b/src/session/session.c index 6dd9764b..c5d933ac 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -288,7 +288,7 @@ void print_error_dialog(struct session *ses, struct connection_state state, struct uri *uri, enum connection_priority priority) { - struct string msg; + struct string_ msg; unsigned char *uristring; /* Don't show error dialogs for missing CSS stylesheets */ @@ -1060,8 +1060,8 @@ init_remote_session(struct session *ses, enum remote_session_flags *remote_ptr, -struct string * -encode_session_info(struct string *info, +struct string_ * +encode_session_info(struct string_ *info, LIST_OF(struct string_list_item) *url_list) { struct string_list_item *url; @@ -1069,7 +1069,7 @@ encode_session_info(struct string *info, if (!init_string(info)) return NULL; foreach (url, *url_list) { - struct string *str = &url->string; + struct string_ *str = &url->string; add_bytes_to_string(info, str->source, str->length + 1); } diff --git a/src/session/session.h b/src/session/session.h index b4da2ae8..838de42d 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -257,7 +257,7 @@ print_error_dialog(struct session *ses, struct connection_state state, void process_file_requests(struct session *); -struct string *encode_session_info(struct string *info, +struct string_ *encode_session_info(struct string_ *info, LIST_OF(struct string_list_item) *url_list); /** @returns zero if the info was remote sessions or if it failed to diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c index 83466248..d1e4301d 100644 --- a/src/terminal/kbd.c +++ b/src/terminal/kbd.c @@ -571,8 +571,8 @@ safe_hard_write(int fd, unsigned char *buf, int len) static void in_sock(struct itrm *itrm) { - struct string path; - struct string delete_; + struct string_ path; + struct string_ delete_; char ch; int fg; /* enum term_exec */ ssize_t bytes_read, i, p; diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 5ea0b3ee..5d602837 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -166,13 +166,13 @@ static const unsigned char frame_restrict[48] = { * ECMA-48: CSI Ps... 06/13 = SGR - SELECT GRAPHIC RENDITION * - Ps = 10 = primary (default) font * - Ps = 11 = first alternative font */ -static const struct string m11_hack_frame_seqs[] = { +static const struct string_ m11_hack_frame_seqs[] = { /* end border: */ TERM_STRING("\033[10m"), /* begin border: */ TERM_STRING("\033[11m"), }; /** Frame begin/end sequences for VT100. */ -static const struct string vt100_frame_seqs[] = { +static const struct string_ vt100_frame_seqs[] = { /* end border: */ TERM_STRING("\x0f"), /* begin border: */ TERM_STRING("\x0e"), }; @@ -182,7 +182,7 @@ static const struct string vt100_frame_seqs[] = { * - Ps = 3 = italicized * - Ps = 20 = Fraktur (Gothic) * - Ps = 23 = not italicized, not fraktur */ -static const struct string italic_seqs[] = { +static const struct string_ italic_seqs[] = { /* end italics: */ TERM_STRING("\033[23m"), /* begin italics: */ TERM_STRING("\033[3m"), }; @@ -192,7 +192,7 @@ static const struct string italic_seqs[] = { * - Ps = 4 = singly underlined * - Ps = 21 = doubly underlined * - Ps = 24 = not underlined (neither singly nor doubly) */ -static const struct string underline_seqs[] = { +static const struct string_ underline_seqs[] = { /* end underline: */ TERM_STRING("\033[24m"), /* begin underline: */ TERM_STRING("\033[4m"), }; @@ -200,12 +200,12 @@ static const struct string underline_seqs[] = { /* elinks --dump has a separate implementation of color-changing * sequences and does not use these. */ #if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) -static const struct string color256_seqs[] = { +static const struct string_ color256_seqs[] = { /* foreground: */ TERM_STRING("\033[0;38;5;%dm"), /* background: */ TERM_STRING("\033[48;5;%dm"), }; -static const struct string fbterm_color256_seqs[] = { +static const struct string_ fbterm_color256_seqs[] = { /* foreground: */ TERM_STRING("\033[m\033[1;%d}"), /* background: */ TERM_STRING("\033[2;%d}"), }; @@ -221,19 +221,19 @@ struct screen_driver_opt { const unsigned char *frame; /** The frame mode setup and teardown sequences. May be NULL. */ - const struct string *frame_seqs; + const struct string_ *frame_seqs; /** The italic mode setup and teardown sequences. May be NULL. */ - const struct string *italic; + const struct string_ *italic; /** The underline mode setup and teardown sequences. May be NULL. */ - const struct string *underline; + const struct string_ *underline; /** The color mode */ enum color_mode color_mode; #if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) - const struct string *color256_seqs; + const struct string_ *color256_seqs; #endif /** These are directly derived from the terminal options. */ unsigned int transparent:1; @@ -649,8 +649,8 @@ done_screen_drivers(struct module *xxx) /** Adds the term code for positioning the cursor at @a x and @a y to * @a string. The template term code is: "\033[;H" */ -static inline struct string * -add_cursor_move_to_string(struct string *screen, int y, int x) +static inline struct string_ * +add_cursor_move_to_string(struct string_ *screen, int y, int x) { #ifdef CONFIG_TERMINFO if (get_cmd_opt_bool("terminfo")) { @@ -784,11 +784,11 @@ copy_color_16(unsigned char *a, unsigned char *b) #ifdef CONFIG_UTF8 static inline void -add_char_data(struct string *screen, struct screen_driver *driver, +add_char_data(struct string_ *screen, struct screen_driver *driver, unicode_val_T data, unsigned char border) #else /* !CONFIG_UTF8 */ static inline void -add_char_data(struct string *screen, struct screen_driver *driver, +add_char_data(struct string_ *screen, struct screen_driver *driver, unsigned char data, unsigned char border) #endif /* !CONFIG_UTF8 */ { @@ -855,7 +855,7 @@ add_char_data(struct string *screen, struct screen_driver *driver, /** Time critical section. */ static inline void -add_char16(struct string *screen, struct screen_driver *driver, +add_char16(struct string_ *screen, struct screen_driver *driver, struct screen_char *ch, struct screen_state *state) { unsigned char border = (ch->attr & SCREEN_ATTR_FRAME); @@ -1003,7 +1003,7 @@ add_char16(struct string *screen, struct screen_driver *driver, #if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) static inline void -add_char_color(struct string *screen, const struct string *seq, unsigned char color) +add_char_color(struct string_ *screen, const struct string_ *seq, unsigned char color) { unsigned char color_buf[3]; unsigned char *color_pos = color_buf; @@ -1054,7 +1054,7 @@ add_char_color(struct string *screen, const struct string *seq, unsigned char co /** Time critical section. */ static inline void -add_char256(struct string *screen, struct screen_driver *driver, +add_char256(struct string_ *screen, struct screen_driver *driver, struct screen_char *ch, struct screen_state *state) { unsigned char attr_delta = (ch->attr ^ state->attr); @@ -1163,14 +1163,14 @@ add_char256(struct string *screen, struct screen_driver *driver, #endif #ifdef CONFIG_TRUE_COLOR -static const struct string color_true_seqs[] = { +static const struct string_ color_true_seqs[] = { /* foreground: */ TERM_STRING("\033[0;38;2"), /* background: */ TERM_STRING("\033[48;2"), }; #define add_true_background_color(str, seq, chr) add_char_true_color(str, &(seq)[1], &(chr)->c.color[3]) #define add_true_foreground_color(str, seq, chr) add_char_true_color(str, &(seq)[0], &(chr)->c.color[0]) static inline void -add_char_true_color(struct string *screen, const struct string *seq, unsigned char *colors) +add_char_true_color(struct string_ *screen, const struct string_ *seq, unsigned char *colors) { unsigned char color_buf[3]; int i; @@ -1218,7 +1218,7 @@ add_char_true_color(struct string *screen, const struct string *seq, unsigned ch /** Time critical section. */ static inline void -add_char_true(struct string *screen, struct screen_driver *driver, +add_char_true(struct string_ *screen, struct screen_driver *driver, struct screen_char *ch, struct screen_state *state) { unsigned char attr_delta = (ch->attr ^ state->attr); @@ -1351,7 +1351,7 @@ void redraw_screen(struct terminal *term) { struct screen_driver *driver; - struct string image; + struct string_ image; struct screen_state state = INIT_SCREEN_STATE; struct terminal_screen *screen = term->screen; diff --git a/src/util/conv.c b/src/util/conv.c index b11dbb0d..87e0d560 100644 --- a/src/util/conv.c +++ b/src/util/conv.c @@ -128,8 +128,8 @@ elinks_longcat(unsigned char *s, unsigned int *slen, /** @relates string */ -struct string * -add_long_to_string(struct string *string, long long number) +struct string_ * +add_long_to_string(struct string_ *string, long long number) { unsigned char buffer[64]; int length = 0; @@ -145,8 +145,8 @@ add_long_to_string(struct string *string, long long number) } /** @relates string */ -struct string * -add_knum_to_string(struct string *string, long long num) +struct string_ * +add_knum_to_string(struct string_ *string, long long num) { int ret; unsigned char t[64]; @@ -172,8 +172,8 @@ add_knum_to_string(struct string *string, long long num) } /** @relates string */ -struct string * -add_xnum_to_string(struct string *string, long long xnum) +struct string_ * +add_xnum_to_string(struct string_ *string, long long xnum) { unsigned char suff[3] = "\0i"; off_t d = -1; @@ -205,8 +205,8 @@ add_xnum_to_string(struct string *string, long long xnum) } /** @relates string */ -struct string * -add_duration_to_string(struct string *string, long seconds) +struct string_ * +add_duration_to_string(struct string_ *string, long seconds) { unsigned char q[64]; int qlen = 0; @@ -240,15 +240,15 @@ add_duration_to_string(struct string *string, long seconds) } /** @relates string */ -struct string * -add_timeval_to_string(struct string *string, timeval_T *timeval) +struct string_ * +add_timeval_to_string(struct string_ *string, timeval_T *timeval) { return add_duration_to_string(string, timeval_to_seconds(timeval)); } #ifdef HAVE_STRFTIME -struct string * -add_date_to_string(struct string *string, const unsigned char *fmt, +struct string_ * +add_date_to_string(struct string_ *string, const unsigned char *fmt, const time_t *date) { unsigned char buffer[MAX_STR_LEN]; @@ -267,8 +267,8 @@ add_date_to_string(struct string *string, const unsigned char *fmt, /* Encoders and string changers */ -struct string * -add_string_replace(struct string *string, unsigned char *src, int len, +struct string_ * +add_string_replace(struct string_ *string, unsigned char *src, int len, unsigned char replaceable, unsigned char replacement) { int oldlength = string->length; @@ -283,8 +283,8 @@ add_string_replace(struct string *string, unsigned char *src, int len, return string; } -struct string * -add_html_to_string(struct string *string, const unsigned char *src, int len) +struct string_ * +add_html_to_string(struct string_ *string, const unsigned char *src, int len) { for (; len; len--, src++) { if (*src < 0x20 @@ -308,8 +308,8 @@ add_html_to_string(struct string *string, const unsigned char *src, int len) return string; } -struct string * -add_cp_html_to_string(struct string *string, int src_codepage, +struct string_ * +add_cp_html_to_string(struct string_ *string, int src_codepage, const unsigned char *src, int len) { const unsigned char *const end = src + len; @@ -343,8 +343,8 @@ add_cp_html_to_string(struct string *string, int src_codepage, } /* TODO Optimize later --pasky */ -struct string * -add_quoted_to_string(struct string *string, const unsigned char *src, int len) +struct string_ * +add_quoted_to_string(struct string_ *string, const unsigned char *src, int len) { for (; len; len--, src++) { if (isquote(*src) || *src == '\\') @@ -355,8 +355,8 @@ add_quoted_to_string(struct string *string, const unsigned char *src, int len) return string; } -struct string * -add_shell_quoted_to_string(struct string *string, unsigned char *src, int len) +struct string_ * +add_shell_quoted_to_string(struct string_ *string, unsigned char *src, int len) { add_char_to_string(string, '\''); for (; len; len--, ++src) @@ -369,8 +369,8 @@ add_shell_quoted_to_string(struct string *string, unsigned char *src, int len) return string; } -struct string * -add_shell_safe_to_string(struct string *string, unsigned char *cmd, int cmdlen) +struct string_ * +add_shell_safe_to_string(struct string_ *string, unsigned char *cmd, int cmdlen) { int prev_safe = 0; diff --git a/src/util/conv.h b/src/util/conv.h index 31831463..b286a307 100644 --- a/src/util/conv.h +++ b/src/util/conv.h @@ -44,18 +44,18 @@ unhx(register unsigned char a) } /* These use granular allocation stuff. */ -struct string *add_long_to_string(struct string *string, long long number); -struct string *add_knum_to_string(struct string *string, long long number); -struct string *add_xnum_to_string(struct string *string, long long number); -struct string *add_duration_to_string(struct string *string, long seconds); -struct string *add_timeval_to_string(struct string *string, timeval_T *timeval); +struct string_ *add_long_to_string(struct string_ *string, long long number); +struct string_ *add_knum_to_string(struct string_ *string, long long number); +struct string_ *add_xnum_to_string(struct string_ *string, long long number); +struct string_ *add_duration_to_string(struct string_ *string, long seconds); +struct string_ *add_timeval_to_string(struct string_ *string, timeval_T *timeval); #ifdef HAVE_STRFTIME /** Uses strftime() to format @a time according to @a format and adds * the result to @a string. If @a time is NULL, time(NULL) will be * used. * @relates string */ -struct string *add_date_to_string(struct string *string, +struct string_ *add_date_to_string(struct string_ *string, const unsigned char *format, const time_t *time); #endif @@ -70,8 +70,8 @@ struct string *add_date_to_string(struct string *string, /** A simple generic encoder. Should maybe take @a replaceable as a * string so we could also use it for adding shell safe strings. * @relates string */ -struct string * -add_string_replace(struct string *string, unsigned char *src, int len, +struct string_ * +add_string_replace(struct string_ *string, unsigned char *src, int len, unsigned char replaceable, unsigned char replacement); /** @relates string */ @@ -91,28 +91,28 @@ add_string_replace(struct string *string, unsigned char *src, int len, * because HTML wants Unicode numbers there and this function does not * know the charset of the input data.) * @relates string */ -struct string *add_html_to_string(struct string *string, const unsigned char *html, int htmllen); +struct string_ *add_html_to_string(struct string_ *string, const unsigned char *html, int htmllen); /** Convert reserved or non-ASCII chars to html @&@#xx;. The resulting * string can be correctly parsed in any charset where bytes * 0x20...0x7E match ASCII. * @relates string */ -struct string *add_cp_html_to_string(struct string *string, int src_codepage, +struct string_ *add_cp_html_to_string(struct string_ *string, int src_codepage, const unsigned char *html, int htmllen); /** Escapes @\ and " with a @\ * @relates string */ -struct string *add_quoted_to_string(struct string *string, const unsigned char *q, int qlen); +struct string_ *add_quoted_to_string(struct string_ *string, const unsigned char *q, int qlen); /** Adds ', @a len bytes of @a src with all single-quotes converted to '\'', * and ' to @a string. * @relates string */ -struct string *add_shell_quoted_to_string(struct string *string, +struct string_ *add_shell_quoted_to_string(struct string_ *string, unsigned char *src, int len); /* Escapes non shell safe chars with '_'. * @relates string */ -struct string *add_shell_safe_to_string(struct string *string, unsigned char *cmd, int cmdlen); +struct string_ *add_shell_safe_to_string(struct string_ *string, unsigned char *cmd, int cmdlen); /** @} */ diff --git a/src/util/file.c b/src/util/file.c index 90882eed..c953f8d8 100644 --- a/src/util/file.c +++ b/src/util/file.c @@ -107,7 +107,7 @@ get_filename_position(unsigned char *filename) unsigned char * expand_tilde(unsigned char *filename) { - struct string file; + struct string_ file; if (!init_string(&file)) return NULL; @@ -337,7 +337,7 @@ get_directory_entries(unsigned char *dirname, int get_hidden) struct stat st, *stp; struct directory_entry *new_entries; unsigned char *name; - struct string attrib; + struct string_ attrib; if (!file_visible(entry->d_name, get_hidden, is_root_directory)) continue; diff --git a/src/util/file.h b/src/util/file.h index b8ffa082..1b1a5220 100644 --- a/src/util/file.h +++ b/src/util/file.h @@ -70,7 +70,7 @@ int compare_dir_entries(const void *v1, const void *v2); * @{ */ static inline void -stat_type(struct string *string, struct stat *stp) +stat_type(struct string_ *string, struct stat *stp) { unsigned char c = '?'; @@ -101,7 +101,7 @@ stat_type(struct string *string, struct stat *stp) } static inline void -stat_mode(struct string *string, struct stat *stp) +stat_mode(struct string_ *string, struct stat *stp) { #ifdef FS_UNIX_RIGHTS unsigned char rwx[10] = "---------"; @@ -138,7 +138,7 @@ stat_mode(struct string *string, struct stat *stp) } static inline void -stat_links(struct string *string, struct stat *stp) +stat_links(struct string_ *string, struct stat *stp) { #ifdef FS_UNIX_HARDLINKS if (!stp) { @@ -154,7 +154,7 @@ stat_links(struct string *string, struct stat *stp) } static inline void -stat_user(struct string *string, struct stat *stp) +stat_user(struct string_ *string, struct stat *stp) { #ifdef FS_UNIX_USERS static unsigned char last_user[64]; @@ -183,7 +183,7 @@ stat_user(struct string *string, struct stat *stp) } static inline void -stat_group(struct string *string, struct stat *stp) +stat_group(struct string_ *string, struct stat *stp) { #ifdef FS_UNIX_USERS static unsigned char last_group[64]; @@ -212,7 +212,7 @@ stat_group(struct string *string, struct stat *stp) } static inline void -stat_size(struct string *string, struct stat *stp) +stat_size(struct string_ *string, struct stat *stp) { /* Check if st_size will cause overflow. */ /* FIXME: See bug 497 for info about support for big files. */ @@ -238,7 +238,7 @@ stat_size(struct string *string, struct stat *stp) } static inline void -stat_date(struct string *string, struct stat *stp) +stat_date(struct string_ *string, struct stat *stp) { #ifdef HAVE_STRFTIME if (stp) { diff --git a/src/util/string.c b/src/util/string.c index c8ee7d77..df89befb 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -28,7 +28,7 @@ /* This file looks to be slowly being overloaded by a lot of various stuff, * like memory managment, stubs, tools, granular and non-granular strings, - * struct string object... Perhaps util/memory.* and util/stubs.* (stubs.h + * struct string_ object... Perhaps util/memory.* and util/stubs.* (stubs.h * probably included in elinks.h, it's important enough) would be nice to * have. --pasky */ @@ -318,11 +318,11 @@ char * c_strcasestr(const char *haystack, const char *needle) /* TODO Currently most of the functions use add_bytes_to_string() as a backend * instead we should optimize each function. */ -NONSTATIC_INLINE struct string * +NONSTATIC_INLINE struct string_ * #ifdef DEBUG_MEMLEAK -init_string__(const unsigned char *file, int line, struct string *string) +init_string(const unsigned char *file, int line, struct string_ *string) #else -init_string(struct string *string) +init_string(struct string_ *string) #endif { assertm(string != NULL, "[init_string]"); @@ -344,7 +344,7 @@ init_string(struct string *string) } NONSTATIC_INLINE void -done_string(struct string *string) +done_string(struct string_ *string) { assertm(string != NULL, "[done_string]"); if_assert_failed { return; } @@ -362,8 +362,8 @@ done_string(struct string *string) } /** @relates string */ -NONSTATIC_INLINE struct string * -add_to_string(struct string *string, const unsigned char *source) +NONSTATIC_INLINE struct string_ * +add_to_string(struct string_ *string, const unsigned char *source) { assertm(string && source, "[add_to_string]"); if_assert_failed { return NULL; } @@ -376,8 +376,8 @@ add_to_string(struct string *string, const unsigned char *source) } /** @relates string */ -NONSTATIC_INLINE struct string * -add_crlf_to_string(struct string *string) +NONSTATIC_INLINE struct string_ * +add_crlf_to_string(struct string_ *string) { assertm(string != NULL, "[add_crlf_to_string]"); if_assert_failed { return NULL; } @@ -395,8 +395,8 @@ add_crlf_to_string(struct string *string) } /** @relates string */ -NONSTATIC_INLINE struct string * -add_string_to_string(struct string *string, const struct string *from) +NONSTATIC_INLINE struct string_ * +add_string_to_string(struct string_ *string, const struct string_ *from) { assertm(string && from, "[add_string_to_string]"); if_assert_failed { return NULL; } @@ -410,8 +410,8 @@ add_string_to_string(struct string *string, const struct string *from) } /** @relates string */ -struct string * -add_file_to_string(struct string *string, const unsigned char *filename) +struct string_ * +add_file_to_string(struct string_ *string, const unsigned char *filename) { FILE *file; off_t filelen; @@ -450,8 +450,8 @@ err: return NULL; } -struct string * -string_concat(struct string *string, ...) +struct string_ * +string_concat(struct string_ *string, ...) { va_list ap; const unsigned char *source; @@ -472,8 +472,8 @@ string_concat(struct string *string, ...) } /** @relates string */ -NONSTATIC_INLINE struct string * -add_char_to_string(struct string *string, unsigned char character) +NONSTATIC_INLINE struct string_ * +add_char_to_string(struct string_ *string, unsigned char character) { assertm(string && character, "[add_char_to_string]"); if_assert_failed { return NULL; } @@ -489,8 +489,8 @@ add_char_to_string(struct string *string, unsigned char character) return string; } -NONSTATIC_INLINE struct string * -add_xchar_to_string(struct string *string, unsigned char character, int times) +NONSTATIC_INLINE struct string_ * +add_xchar_to_string(struct string_ *string, unsigned char character, int times) { int newlength; @@ -513,8 +513,8 @@ add_xchar_to_string(struct string *string, unsigned char character, int times) } /** Add printf()-style format string to @a string. */ -struct string * -add_format_to_string(struct string *string, const unsigned char *format, ...) +struct string_ * +add_format_to_string(struct string_ *string, const unsigned char *format, ...) { int newlength; int width; @@ -544,12 +544,12 @@ add_format_to_string(struct string *string, const unsigned char *format, ...) return string; } -struct string * +struct string_ * add_to_string_list(LIST_OF(struct string_list_item) *list, const unsigned char *source, int length) { struct string_list_item *item; - struct string *string; + struct string_ *string; assertm(list && source, "[add_to_string_list]"); if_assert_failed return NULL; diff --git a/src/util/string.h b/src/util/string.h index 509453da..be6cb19f 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -148,7 +148,7 @@ char * c_strcasestr(const char *haystack, const char *needle); #define DEBUG_STRING #endif -struct string { +struct string_ { #ifdef DEBUG_STRING int magic; #endif @@ -157,7 +157,7 @@ struct string { }; -/** The granularity used for the struct string based utilities. */ +/** The granularity used for the struct string_ based utilities. */ #define STRING_GRANULARITY 0xFF #ifdef DEBUG_STRING @@ -179,44 +179,44 @@ struct string { * @post done_string(@a string) is safe, even if this returned NULL. * @relates string */ #ifdef DEBUG_MEMLEAK -struct string *init_string__(const unsigned char *file, int line, struct string *string); +struct string_ *init_string__(const unsigned char *file, int line, struct string_ *string); #define init_string(string) init_string__(__FILE__, __LINE__, string) #else -struct string *init_string(struct string *string); +struct string_ *init_string(struct string_ *string); #endif /** Resets @a string and free()s the string.source member. * @relates string */ -void done_string(struct string *string); +void done_string(struct string_ *string); -struct string *add_to_string(struct string *string, +struct string_ *add_to_string(struct string_ *string, const unsigned char *source); -struct string *add_char_to_string(struct string *string, unsigned char character); -struct string *add_string_to_string(struct string *to, const struct string *from); -struct string *add_file_to_string(struct string *string, const unsigned char *filename); -struct string *add_crlf_to_string(struct string *string); +struct string_ *add_char_to_string(struct string_ *string, unsigned char character); +struct string_ *add_string_to_string(struct string_ *to, const struct string_ *from); +struct string_ *add_file_to_string(struct string_ *string, const unsigned char *filename); +struct string_ *add_crlf_to_string(struct string_ *string); /** Adds each C string to @a string until a terminating * (unsigned char *) NULL is met. * @relates string */ -struct string *string_concat(struct string *string, ...); +struct string_ *string_concat(struct string_ *string, ...); /** Extends the string with @a times number of @a character. * @relates string */ -struct string *add_xchar_to_string(struct string *string, unsigned char character, int times); +struct string_ *add_xchar_to_string(struct string_ *string, unsigned char character, int times); /** Add printf()-style format string to @a string. * @relates string */ -struct string *add_format_to_string(struct string *string, const unsigned char *format, ...); +struct string_ *add_format_to_string(struct string_ *string, const unsigned char *format, ...); /** Get a regular newly allocated stream of bytes from @a string. * @relates string */ -static unsigned char *squeezastring(struct string *string); +static unsigned char *squeezastring(struct string_ *string); static inline unsigned char * -squeezastring(struct string *string) +squeezastring(struct string_ *string) { return memacpy(string->source, string->length); } @@ -246,12 +246,12 @@ squeezastring(struct string *string) #endif -static inline struct string * +static inline struct string_ * add_bytes_to_string__( #ifdef DEBUG_MEMLEAK const unsigned char *file, int line, #endif - struct string *string, const unsigned char *bytes, + struct string_ *string, const unsigned char *bytes, int length) { int newlength; @@ -278,13 +278,13 @@ add_bytes_to_string__( struct string_list_item { LIST_HEAD(struct string_list_item); - struct string string; + struct string_ string; }; /** Adds @a string with @a length chars to the list. If @a length is -1 * it will be set to the return value of strlen(). * @relates string_list_item */ -struct string * +struct string_ * add_to_string_list(LIST_OF(struct string_list_item) *list, const unsigned char *string, int length); diff --git a/src/viewer/dump/dump.c b/src/viewer/dump/dump.c index c3f1fa32..03652397 100644 --- a/src/viewer/dump/dump.c +++ b/src/viewer/dump/dump.c @@ -63,7 +63,7 @@ struct dump_output { /** A string to which the buffer should eventually be flushed, * or NULL. */ - struct string *string; + struct string_ *string; /** A file descriptor to which the buffer should eventually be * flushed, or -1. */ @@ -165,7 +165,7 @@ dump_output_prepare_frame(struct dump_output *out, int to_cp) * * @relates dump_output */ static struct dump_output * -dump_output_alloc(int fd, struct string *string, int cp) +dump_output_alloc(int fd, struct string_ *string, int cp) { struct dump_output *out; @@ -504,9 +504,9 @@ nextfrag: } static unsigned char * -subst_url(unsigned char *str, struct string *url) +subst_url(unsigned char *str, struct string_ *url) { - struct string string; + struct string_ string; if (!init_string(&string)) return NULL; @@ -559,7 +559,7 @@ subst_url(unsigned char *str, struct string *url) } static void -dump_print(unsigned char *option, struct string *url) +dump_print(unsigned char *option, struct string_ *url) { unsigned char *str = get_opt_str(option, NULL); @@ -689,8 +689,8 @@ dump_next(LIST_OF(struct string_list_item) *url_list) } } -struct string * -add_document_to_string(struct string *string, struct document *document) +struct string_ * +add_document_to_string(struct string_ *string, struct document *document) { struct dump_output *out; int error; diff --git a/src/viewer/dump/dump.h b/src/viewer/dump/dump.h index cf60acfe..8bd974ec 100644 --- a/src/viewer/dump/dump.h +++ b/src/viewer/dump/dump.h @@ -4,12 +4,12 @@ #include "util/lists.h" -struct string; +struct string_; struct document; /* Adds the content of the document to the string line by line. */ -struct string * -add_document_to_string(struct string *string, struct document *document); +struct string_ * +add_document_to_string(struct string_ *string, struct document *document); int dump_to_file(struct document *, int); void dump_next(LIST_OF(struct string_list_item) *); diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 07b3f49f..7a6733bb 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -48,7 +48,7 @@ check_document_fragment(struct session *ses, struct document_view *doc_view) struct document *document = doc_view->document; struct uri *uri = doc_view->vs->uri; int vy; - struct string fragment; + struct string_ fragment; assert(uri->fragmentlen); diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c index e55725fe..5cf8c552 100644 --- a/src/viewer/text/form.c +++ b/src/viewer/text/form.c @@ -827,7 +827,7 @@ get_successful_controls(struct document_view *doc_view, unsigned char * encode_crlf(struct submitted_value *sv) { - struct string newtext; + struct string_ newtext; int i; assert(sv && sv->value); @@ -849,7 +849,7 @@ encode_crlf(struct submitted_value *sv) } static void -encode_controls(LIST_OF(struct submitted_value) *l, struct string *data, +encode_controls(LIST_OF(struct submitted_value) *l, struct string_ *data, int cp_from, int cp_to) { struct submitted_value *sv; @@ -944,7 +944,7 @@ init_boundary(struct boundary_info *boundary) /** Add boundary to string and save the offset * @relates boundary_info */ static inline void -add_boundary(struct string *data, struct boundary_info *boundary) +add_boundary(struct string_ *data, struct boundary_info *boundary) { add_to_string(data, "--"); @@ -987,7 +987,7 @@ add_boundary(struct string *data, struct boundary_info *boundary) * @todo FIXME: shouldn't we encode data at send time (in http.c) ? --Zas */ static void encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l, - struct string *data, struct boundary_info *boundary, + struct string_ *data, struct boundary_info *boundary, LIST_OF(struct files_offset) *bfs, int cp_from, int cp_to) { struct conv_table *convert_table = NULL; @@ -1124,7 +1124,7 @@ encode_error: } static void -encode_newlines(struct string *string, unsigned char *data) +encode_newlines(struct string_ *string, unsigned char *data) { for (; *data; data++) { if (*data == '\n' || *data == '\r') { @@ -1142,7 +1142,7 @@ encode_newlines(struct string *string, unsigned char *data) } static void -encode_text_plain(LIST_OF(struct submitted_value) *l, struct string *data, +encode_text_plain(LIST_OF(struct submitted_value) *l, struct string_ *data, int cp_from, int cp_to) { struct submitted_value *sv; @@ -1228,8 +1228,8 @@ get_form_uri(struct session *ses, struct document_view *doc_view, struct boundary_info boundary; INIT_LIST_OF(struct submitted_value, submit); INIT_LIST_OF(struct files_offset, bfs); - struct string data; - struct string go; + struct string_ data; + struct string_ go; int cp_from, cp_to; struct uri *uri; struct form *form; @@ -1944,7 +1944,7 @@ get_form_label(struct el_form_control *fc) } static inline void -add_form_attr_to_string(struct string *string, struct terminal *term, +add_form_attr_to_string(struct string_ *string, struct terminal *term, unsigned char *name, unsigned char *value) { add_to_string(string, ", "); @@ -1962,7 +1962,7 @@ get_form_info(struct session *ses, struct document_view *doc_view) struct link *link = get_current_link(doc_view); struct el_form_control *fc; unsigned char *label, *key; - struct string str; + struct string_ str; assert(link); @@ -2145,7 +2145,7 @@ link_form_menu(struct session *ses) unsigned char *text; unsigned char *rtext; int link_number; - struct string str; + struct string_ str; switch (fc->type) { case FC_HIDDEN: diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index bb606abd..6524689f 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -71,7 +71,7 @@ current_link_evhook(struct document_view *doc_view, enum script_event_hook_type while ((ret = strstr((const char *)ret, "return "))) while (*ret != ' ') *ret++ = ' '; { - struct string src = INIT_STRING(evhook->src, strlen(evhook->src)); + struct string_ src = INIT_STRING(evhook->src, strlen(evhook->src)); /* TODO: Some even handlers return a bool. */ if (!ecmascript_eval_boolback(doc_view->vs->ecmascript, &src)) return 0; @@ -921,7 +921,7 @@ call_onsubmit_and_submit(struct session *ses, struct document_view *doc_view, * pressed. W3C DOM Level 3 doesn't seem to include such a * feature. */ if (fc->type != FC_RESET && fc->form->onsubmit) { - struct string code; + struct string_ code; if (init_string(&code)) { struct view_state *vs = doc_view->vs; @@ -1373,7 +1373,7 @@ link_menu(struct terminal *term, void *xxx, void *ses_) case FC_TEXTAREA: /* [gettext_accelerator_context(link_menu.textarea)] */ if (!form_field_is_readonly(fc)) { - struct string keystroke; + struct string_ keystroke; if (init_string(&keystroke)) add_keystroke_action_to_string( @@ -1495,7 +1495,7 @@ get_current_link_info(struct session *ses, struct document_view *doc_view) if (!link_is_form(link)) { struct terminal *term = ses->tab->term; - struct string str; + struct string_ str; unsigned char *uristring = link->where; if (!init_string(&str)) return NULL; diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index 52d95c1d..f5be7204 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -982,7 +982,9 @@ get_searched_all(struct session *ses, struct document_view *doc_view, struct poi if (*pt == NULL) return FIND_ERROR_NOT_FOUND; - return move_search_do(ses, doc_view, 0); + move_search_do(ses, doc_view, 0); + + return FIND_ERROR_NONE; } static enum find_error diff --git a/src/viewer/text/textarea.c b/src/viewer/text/textarea.c index 3df211fb..b43a9d96 100644 --- a/src/viewer/text/textarea.c +++ b/src/viewer/text/textarea.c @@ -664,7 +664,7 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_, return; } else if (op == 1) { - struct string file; + struct string_ file; td = term_->textarea_data; term_->textarea_data = NULL;