diff --git a/configure.ac b/configure.ac index 41700e05..e02162a6 100644 --- a/configure.ac +++ b/configure.ac @@ -1798,16 +1798,16 @@ if test "x$ac_cv_c_compiler_gnu" = "xyes"; then CFLAGS="$CFLAGS -fno-strict-aliasing" ;; 4.5*) - CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign -Wno-enum-compare" + CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-enum-compare" ;; 4.*|5.*|6.*|7.*|8|8.*|9|9.*) # Do not show warnings related to (char * | unsigned char *) type # difference. - CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign" + CFLAGS="$CFLAGS -fno-strict-aliasing" ;; 10|10.*) # gettext - CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign -Wno-builtin-declaration-mismatch" + CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-builtin-declaration-mismatch" ;; *) # These should be ok using -Werror diff --git a/src/bfu/button.c b/src/bfu/button.c index eb1e1aa0..3ffb98e3 100644 --- a/src/bfu/button.c +++ b/src/bfu/button.c @@ -36,13 +36,13 @@ #ifdef DEBUG_BUTTON_HOTKEY void -add_dlg_button_do(const unsigned char *file, int line, - struct dialog *dlg, unsigned char *text, int flags, +add_dlg_button_do(const char *file, int line, + struct dialog *dlg, char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data) #else void -add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, +add_dlg_button_do(struct dialog *dlg, char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data) #endif @@ -63,7 +63,7 @@ add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widget->info.button.truetextlen = textlen; if (textlen > 1) { - unsigned char *pos = memchr(text, '~', textlen - 1); + char *pos = memchr(text, '~', textlen - 1); if (pos) { widget->info.button.hotkey_pos = pos - text; @@ -217,7 +217,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data) draw_dlg_text(dlg_data, pos->x, pos->y, BUTTON_LEFT, BUTTON_LEFT_LEN, 0, color); if (len > 0) { - unsigned char *text = widget_data->widget->text; + char *text = widget_data->widget->text; int hk_pos = widget_data->widget->info.button.hotkey_pos; int attr; diff --git a/src/bfu/button.h b/src/bfu/button.h index 74f7dbe4..80241c7b 100644 --- a/src/bfu/button.h +++ b/src/bfu/button.h @@ -36,7 +36,7 @@ struct widget_info_button { /** @def add_dlg_ok_button * Add a button that will close the dialog if pressed. * - * void add_dlg_ok_button(struct dialog *dlg, unsigned char *text, int flags, + * void add_dlg_ok_button(struct dialog *dlg, char *text, int flags, * ::done_handler_T *done, void *data); * * @param dlg @@ -61,7 +61,7 @@ struct widget_info_button { /** @def add_dlg_button * Add a button that need not close the dialog if pressed. * - * void add_dlg_button(struct dialog *dlg, unsigned char *text, int flags, + * void add_dlg_button(struct dialog *dlg, char *text, int flags, * ::widget_handler_T *handler, void *data); * * @param handler @@ -76,7 +76,7 @@ struct widget_info_button { * The other parameters are as in ::add_dlg_ok_button. */ #ifdef DEBUG_BUTTON_HOTKEY -void add_dlg_button_do(const unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); +void add_dlg_button_do(const char *file, int line, struct dialog *dlg, char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); #define add_dlg_ok_button(dlg, text, flags, done, data) \ add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, done, data) @@ -84,7 +84,7 @@ void add_dlg_button_do(const unsigned char *file, int line, struct dialog *dlg, add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, handler, data, NULL, NULL) #else -void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); +void add_dlg_button_do(struct dialog *dlg, char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); #define add_dlg_ok_button(dlg, text, flags, done, data) \ add_dlg_button_do(dlg, text, flags, ok_dialog, NULL, done, data) diff --git a/src/bfu/checkbox.c b/src/bfu/checkbox.c index 3c6a4122..212fc023 100644 --- a/src/bfu/checkbox.c +++ b/src/bfu/checkbox.c @@ -21,7 +21,7 @@ #define CHECKBOX_LS (CHECKBOX_LEN + CHECKBOX_SPACING) /* "[X] " */ void -add_dlg_radio_do(struct dialog *dlg, unsigned char *text, +add_dlg_radio_do(struct dialog *dlg, char *text, int groupid, int groupnum, int *data) { struct widget *widget = &dlg->widgets[dlg->number_of_widgets++]; @@ -42,7 +42,7 @@ dlg_format_checkbox(struct dialog_data *dlg_data, enum format_align align, int format_only) { struct terminal *term = dlg_data->win->term; - unsigned char *text = widget_data->widget->text; + char *text = widget_data->widget->text; set_box(&widget_data->box, x, *y, CHECKBOX_LEN, CHECKBOX_HEIGHT); @@ -63,7 +63,7 @@ display_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct terminal *term = dlg_data->win->term; struct color_pair *color; - unsigned char *text; + char *text; struct el_box *pos = &widget_data->box; int selected = is_selected_widget(dlg_data, widget_data); diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h index b91c833b..382d0bc9 100644 --- a/src/bfu/checkbox.h +++ b/src/bfu/checkbox.h @@ -24,7 +24,7 @@ struct widget_data_info_checkbox { }; -void add_dlg_radio_do(struct dialog *dlg, unsigned char *text, int groupid, int groupnum, int *data); +void add_dlg_radio_do(struct dialog *dlg, char *text, int groupid, int groupnum, int *data); #define add_dlg_radio(dlg, text, groupid, groupnum, data) \ add_dlg_radio_do(dlg, text, groupid, groupnum, data) diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c index 6afe6049..6868ccf2 100644 --- a/src/bfu/dialog.c +++ b/src/bfu/dialog.c @@ -97,7 +97,7 @@ redraw_dialog(struct dialog_data *dlg_data, int layout) title_color = get_bfu_color(term, "dialog.title"); if (title_color && dlg_data->real_box.width > 2) { - unsigned char *title = dlg_data->dlg->title; + char *title = dlg_data->dlg->title; int titlelen = strlen(title); int titlecells = titlelen; int x, y; @@ -333,7 +333,7 @@ select_button_by_key(struct dialog_data *dlg_data) foreach_widget(dlg_data, widget_data) { int hk_pos; - unsigned char *hk_ptr; + char *hk_ptr; term_event_char_T hk_char; if (widget_data->widget->type != WIDGET_BUTTON) diff --git a/src/bfu/dialog.h b/src/bfu/dialog.h index 7ede125a..e6a277bd 100644 --- a/src/bfu/dialog.h +++ b/src/bfu/dialog.h @@ -49,7 +49,7 @@ struct dialog_refresh { }; struct dialog { - unsigned char *title; + char *title; void *udata; void *udata2; struct dialog_refresh *refresh; @@ -123,7 +123,7 @@ struct dialog { * @return * The address of the additional data. */ #define get_dialog_offset(dlg, n) \ - (((unsigned char *) dlg) + sizeof_dialog(n, 0)) + (((char *) dlg) + sizeof_dialog(n, 0)) #define dialog_has_refresh(dlg_data) \ ((dlg_data)->dlg->refresh && (dlg_data)->dlg->refresh->timer != TIMER_ID_UNDEF) diff --git a/src/bfu/group.c b/src/bfu/group.c index 09b3212b..c3c214be 100644 --- a/src/bfu/group.c +++ b/src/bfu/group.c @@ -36,7 +36,7 @@ dlg_format_group(struct dialog_data *dlg_data, while (n--) { int widget_width; int width; - unsigned char *text = widget_data->widget->text; + char *text = widget_data->widget->text; int label_length; int label_padding; diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index a86fd9e2..1a5f716c 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -413,7 +413,7 @@ push_hierbox_info_button(struct dialog_data *dlg_data, struct widget_data *butto struct listbox_item *item = box->sel; struct terminal *term = dlg_data->win->term; struct listbox_context *context; - unsigned char *msg; + char *msg; if (!item) return EVENT_PROCESSED; @@ -595,8 +595,8 @@ print_delete_error(struct listbox_item *item, struct terminal *term, const struct listbox_ops *ops, enum delete_error err) { struct string msg; - unsigned char *errmsg; - unsigned char *text; + char *errmsg; + char *text; switch (err) { case DELETE_IMPOSSIBLE: @@ -631,7 +631,7 @@ print_delete_error(struct listbox_item *item, struct terminal *term, mem_free(text); if (item->type == BI_LEAF) { - unsigned char *info = ops->get_info(item, term); + char *info = ops->get_info(item, term); if (info) { add_format_to_string(&msg, "\n\n%s", info); @@ -722,7 +722,7 @@ query_delete_selected_item(void *context_) struct listbox_data *box = oldcontext->box; const struct listbox_ops *ops = box->ops; struct listbox_item *item = box->sel; - unsigned char *text; + char *text; enum delete_error delete_; assert(item); @@ -754,7 +754,7 @@ query_delete_selected_item(void *context_) MSG_BOX_BUTTON(N_("~Yes"), push_ok_delete_button, B_ENTER), MSG_BOX_BUTTON(N_("~No"), done_listbox_context, B_ESC)); } else { - unsigned char *msg = ops->get_info(item, term); + char *msg = ops->get_info(item, term); ops->lock(item); @@ -888,7 +888,7 @@ static int scan_for_matches(struct listbox_item *item, void *info_, int *offset) { struct listbox_context *context = info_; - unsigned char *text = (unsigned char *) context->widget_data; + char *text = (char *) context->widget_data; if (!*text) { item->visible = 1; @@ -922,7 +922,7 @@ mark_visible(struct listbox_item *item, void *xxx, int *offset) static void -search_hierbox_browser(void *data, unsigned char *text) +search_hierbox_browser(void *data, char *text) { struct dialog_data *dlg_data = data; struct listbox_data *box = get_dlg_listbox_data(dlg_data); diff --git a/src/bfu/hierbox.h b/src/bfu/hierbox.h index 56fbd841..3a567ccc 100644 --- a/src/bfu/hierbox.h +++ b/src/bfu/hierbox.h @@ -15,7 +15,7 @@ struct session; struct hierbox_browser_button { /** The button label text * It is automatically localized. */ - unsigned char *label; + char *label; /** The button handler * The handler gets called when the button is activated */ @@ -39,7 +39,7 @@ struct hierbox_browser_button { struct hierbox_browser { /** The title of the browser * Note, it is automatically localized. */ - unsigned char *title; + char *title; /** Callback for (un)expansion of the listboxes * Can be used by subsystems to install a handler to be called diff --git a/src/bfu/hotkey.c b/src/bfu/hotkey.c index 5bab6be6..046fd5f8 100644 --- a/src/bfu/hotkey.c +++ b/src/bfu/hotkey.c @@ -22,10 +22,10 @@ /* Return position (starting at 1) of the first tilde in text, * or 0 if not found. */ static inline int -find_hotkey_pos(unsigned char *text) +find_hotkey_pos(char *text) { if (text && *text) { - unsigned char *p = strchr((const char *)text, '~'); + char *p = strchr((const char *)text, '~'); if (p) return (int) (p - text) + 1; } @@ -46,7 +46,7 @@ init_hotkeys(struct terminal *term, struct menu *menu) memset(used_hotkeys, 0, sizeof(used_hotkeys)); foreach_menu_item(mi, menu->items) { - unsigned char *text = mi->text; + char *text = mi->text; if (!mi_has_left_text(mi)) continue; if (mi_text_translate(mi)) text = _(text, term); @@ -80,7 +80,7 @@ init_hotkeys(struct terminal *term, struct menu *menu) mi->hotkey_state = HKS_IGNORE; } else if (mi->hotkey_state != HKS_CACHED && !mi->hotkey_pos) { - unsigned char *text = mi->text; + char *text = mi->text; if (!mi_has_left_text(mi)) continue; if (mi_text_translate(mi)) text = _(text, term); @@ -142,7 +142,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina start = i; do { struct menu_item *item; - unsigned char *text; + char *text; #ifdef CONFIG_UTF8 unicode_val_T items_hotkey; #endif diff --git a/src/bfu/hotkey.h b/src/bfu/hotkey.h index 6e1a6079..02981c2f 100644 --- a/src/bfu/hotkey.h +++ b/src/bfu/hotkey.h @@ -12,7 +12,7 @@ extern "C" { struct menu; struct terminal; -/* int find_hotkey_pos(unsigned char *text); */ +/* int find_hotkey_pos(char *text); */ void init_hotkeys(struct terminal *term, struct menu *menu); #ifdef CONFIG_NLS void clear_hotkeys_cache(struct menu *menu); diff --git a/src/bfu/inpfield.c b/src/bfu/inpfield.c index 19d1c029..f02a9397 100644 --- a/src/bfu/inpfield.c +++ b/src/bfu/inpfield.c @@ -38,7 +38,7 @@ #define INPUTFIELD_FLOAT_SEPARATOR_LEN 1 void -add_dlg_field_do(struct dialog *dlg, enum widget_type type, unsigned char *label, +add_dlg_field_do(struct dialog *dlg, enum widget_type type, char *label, int min, int max, widget_handler_T *handler, int datalen, void *data, struct input_history *history, enum inpfield_flags flags) @@ -89,7 +89,7 @@ check_number(struct dialog_data *dlg_data, struct widget_data *widget_data) widget_handler_status_T check_nonempty(struct dialog_data *dlg_data, struct widget_data *widget_data) { - unsigned char *p; + char *p; for (p = widget_data->cdata; *p; p++) if (*p > ' ') @@ -110,7 +110,7 @@ dlg_format_field(struct dialog_data *dlg_data, struct terminal *term = dlg_data->win->term; static int max_label_width; static int *prev_y; /* Assert the uniqueness of y */ /* TODO: get rid of this !! --Zas */ - unsigned char *label = widget_data->widget->text; + char *label = widget_data->widget->text; struct color_pair *text_color = NULL; int label_width = 0; int float_label = widget_data->widget->info.field.flags & (INPFIELD_FLOAT|INPFIELD_FLOAT2); @@ -177,9 +177,9 @@ input_field_cancel(struct dialog_data *dlg_data, struct widget_data *widget_data static widget_handler_status_T input_field_ok(struct dialog_data *dlg_data, struct widget_data *widget_data) { - void (*fn)(void *, unsigned char *) = widget_data->widget->data; + void (*fn)(void *, char *) = widget_data->widget->data; void *data = dlg_data->dlg->udata2; - unsigned char *text = dlg_data->widgets_data->cdata; + char *text = dlg_data->widgets_data->cdata; if (check_dialog(dlg_data)) return EVENT_NOT_PROCESSED; @@ -194,18 +194,18 @@ input_field_ok(struct dialog_data *dlg_data, struct widget_data *widget_data) void input_field(struct terminal *term, struct memory_list *ml, int intl, - unsigned char *title, - unsigned char *text, - unsigned char *okbutton, - unsigned char *cancelbutton, + char *title, + char *text, + char *okbutton, + char *cancelbutton, void *data, struct input_history *history, int l, - unsigned char *def, int min, int max, + char *def, int min, int max, widget_handler_T *check, - void (*fn)(void *, unsigned char *), + void (*fn)(void *, char *), void (*cancelfn)(void *)) { struct dialog *dlg; - unsigned char *field; + char *field; if (intl) { title = _(title, term); @@ -245,12 +245,12 @@ input_field(struct terminal *term, struct memory_list *ml, int intl, void input_dialog(struct terminal *term, struct memory_list *ml, - unsigned char *title, - unsigned char *text, + char *title, + char *text, void *data, struct input_history *history, int l, - unsigned char *def, int min, int max, + char *def, int min, int max, widget_handler_T *check, - void (*fn)(void *, unsigned char *), + void (*fn)(void *, char *), void (*cancelfn)(void *)) { /* [gettext_accelerator_context(input_dialog)] */ @@ -273,7 +273,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data, #ifdef CONFIG_UTF8 if (term->utf8_cp) { - unsigned char *t = widget_data->cdata; + char *t = widget_data->cdata; int p = widget_data->info.field.cpos; len = utf8_ptr2cells(t, &t[p]); @@ -295,7 +295,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data, color = get_bfu_color(term, "dialog.field-text"); if (color) { - unsigned char *text = widget_data->cdata + widget_data->info.field.vpos; + char *text = widget_data->cdata + widget_data->info.field.vpos; int len, w; #ifdef CONFIG_UTF8 @@ -476,8 +476,8 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data) if (widget_data->info.field.cpos < strlen(widget_data->cdata)) { #ifdef CONFIG_UTF8 if (term->utf8_cp) { - unsigned char *next = widget_data->cdata + widget_data->info.field.cpos; - unsigned char *end = strchr((const char *)next, '\0'); + char *next = widget_data->cdata + widget_data->info.field.cpos; + char *end = strchr((const char *)next, '\0'); utf8_to_unicode(&next, end); widget_data->info.field.cpos = (int)(next - widget_data->cdata); @@ -494,8 +494,8 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data) widget_data->info.field.cpos--; #ifdef CONFIG_UTF8 if (widget_data->info.field.cpos && term->utf8_cp) { - unsigned char *t = widget_data->cdata; - unsigned char *t2 = t; + char *t = widget_data->cdata; + char *t2 = t; int p = widget_data->info.field.cpos; unsigned char tmp = t[p]; @@ -523,8 +523,8 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data) /* FIXME: This isn't nice. We remove last byte * from UTF-8 character to detect * character before it. */ - unsigned char *text = widget_data->cdata; - unsigned char *end = widget_data->cdata + widget_data->info.field.cpos - 1; + char *text = widget_data->cdata; + char *end = widget_data->cdata + widget_data->info.field.cpos - 1; unicode_val_T data; int old = widget_data->info.field.cpos; @@ -561,9 +561,9 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data) #ifdef CONFIG_UTF8 if (term->utf8_cp) { - unsigned char *end = widget_data->cdata + cdata_len; - unsigned char *text = widget_data->cdata + widget_data->info.field.cpos; - unsigned char *old = text; + char *end = widget_data->cdata + cdata_len; + char *text = widget_data->cdata + widget_data->info.field.cpos; + char *old = text; utf8_to_unicode(&text, end); if (old != text) { @@ -642,7 +642,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data) case ACT_EDIT_PASTE_CLIPBOARD: { /* Paste from clipboard */ - unsigned char *clipboard = get_clipboard_text(); + char *clipboard = get_clipboard_text(); if (!clipboard) goto display_field; @@ -679,14 +679,14 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data) default: if (check_kbd_textinput_key(ev)) { - unsigned char *text = widget_data->cdata; + char *text = widget_data->cdata; int textlen = strlen(text); #ifndef CONFIG_UTF8 /* Both get_kbd_key(ev) and @text * are in the terminal's charset. */ const int inslen = 1; #else /* CONFIG_UTF8 */ - const unsigned char *ins; + const char *ins; int inslen; /* get_kbd_key(ev) is UCS-4, and @text @@ -874,11 +874,11 @@ cancel_input_line: } void -input_field_line(struct session *ses, unsigned char *prompt, void *data, +input_field_line(struct session *ses, char *prompt, void *data, struct input_history *history, input_line_handler_T handler) { struct dialog *dlg; - unsigned char *buffer; + char *buffer; struct input_line *input_line; assert(ses); diff --git a/src/bfu/inpfield.h b/src/bfu/inpfield.h index 668b218f..0b54ac86 100644 --- a/src/bfu/inpfield.h +++ b/src/bfu/inpfield.h @@ -38,7 +38,7 @@ struct widget_data_info_field { }; void -add_dlg_field_do(struct dialog *dlg, enum widget_type type, unsigned char *label, +add_dlg_field_do(struct dialog *dlg, enum widget_type type, char *label, int min, int max, widget_handler_T *handler, int data_len, void *data, struct input_history *history, enum inpfield_flags flags); @@ -67,21 +67,21 @@ widget_handler_status_T check_nonempty(struct dialog_data *, struct widget_data void dlg_format_field(struct dialog_data *, struct widget_data *, int, int *, int, int *, enum format_align, int format_only); -void input_field(struct terminal *, struct memory_list *, int, unsigned char *, - unsigned char *, unsigned char *, unsigned char *, void *, - struct input_history *, int, unsigned char *, int, int, +void input_field(struct terminal *, struct memory_list *, int, char *, + char *, char *, char *, void *, + struct input_history *, int, char *, int, int, widget_handler_T *check, - void (*)(void *, unsigned char *), + void (*)(void *, char *), void (*)(void *)); void input_dialog(struct terminal *term, struct memory_list *ml, - unsigned char *title, - unsigned char *text, + char *title, + char *text, void *data, struct input_history *history, int l, - unsigned char *def, int min, int max, + char *def, int min, int max, widget_handler_T *check, - void (*fn)(void *, unsigned char *), + void (*fn)(void *, char *), void (*cancelfn)(void *)); @@ -105,11 +105,11 @@ struct input_line { struct session *ses; input_line_handler_T handler; void *data; - unsigned char buffer[INPUT_LINE_BUFFER_SIZE]; + char buffer[INPUT_LINE_BUFFER_SIZE]; }; void -input_field_line(struct session *ses, unsigned char *prompt, void *data, +input_field_line(struct session *ses, char *prompt, void *data, struct input_history *history, input_line_handler_T handler); #define widget_has_history(widget_data) ((widget_data)->widget->type == WIDGET_FIELD \ diff --git a/src/bfu/inphist.c b/src/bfu/inphist.c index 0e558bce..66c4ba9a 100644 --- a/src/bfu/inphist.c +++ b/src/bfu/inphist.c @@ -24,7 +24,7 @@ static void -tab_compl_n(struct dialog_data *dlg_data, unsigned char *item, int len) +tab_compl_n(struct dialog_data *dlg_data, char *item, int len) { struct widget_data *widget_data = selected_widget(dlg_data); @@ -40,7 +40,7 @@ tab_compl_n(struct dialog_data *dlg_data, unsigned char *item, int len) } static void -tab_compl(struct dialog_data *dlg_data, unsigned char *item) +tab_compl(struct dialog_data *dlg_data, char *item) { tab_compl_n(dlg_data, item, strlen(item)); } @@ -49,7 +49,7 @@ tab_compl(struct dialog_data *dlg_data, unsigned char *item) static void menu_tab_compl(struct terminal *term, void *item_, void *dlg_data_) { - unsigned char *item = item_; + char *item = item_; struct dialog_data *dlg_data = dlg_data_; tab_compl_n(dlg_data, item, strlen(item)); @@ -90,9 +90,9 @@ do_tab_compl(struct dialog_data *dlg_data, /* Return the length of the common substring from the starts * of the two strings a and b. */ static inline int -strcommonlen(unsigned char *a, unsigned char *b) +strcommonlen(char *a, char *b) { - unsigned char *start = a; + char *start = a; while (*a && *a == *b) ++a, ++b; @@ -114,11 +114,11 @@ do_tab_compl_unambiguous(struct dialog_data *dlg_data, /* Maximum number of characters in a match. Characters after this * position are varying in other matches. */ int longest_common_match = 0; - unsigned char *match = NULL; + char *match = NULL; struct input_history_entry *entry; foreach (entry, *history) { - unsigned char *cur = entry->data; + char *cur = entry->data; int cur_len = strcommonlen(cur, match ? match : widget_data->cdata); @@ -160,7 +160,7 @@ set_complete_file_menu(struct terminal *term, void *filename_, void *dlg_data_) { struct dialog_data *dlg_data = dlg_data_; struct widget_data *widget_data = selected_widget(dlg_data); - unsigned char *filename = filename_; + char *filename = filename_; int filenamelen; assert(widget_is_textfield(widget_data)); @@ -182,7 +182,7 @@ static void tab_complete_file_menu(struct terminal *term, void *path_, void *dlg_data_) { struct dialog_data *dlg_data = dlg_data_; - unsigned char *path = path_; + char *path = path_; auto_complete_file(term, 0 /* no_elevator */, path, set_complete_file_menu, tab_complete_file_menu, @@ -205,7 +205,7 @@ do_tab_compl_file(struct dialog_data *dlg_data, /* Search for duplicate entries in history list, save first one and remove * older ones. */ static struct input_history_entry * -check_duplicate_entries(struct input_history *history, unsigned char *data) +check_duplicate_entries(struct input_history *history, char *data) { struct input_history_entry *entry, *first_duplicate = NULL; @@ -237,7 +237,7 @@ check_duplicate_entries(struct input_history *history, unsigned char *data) /* Add a new entry in inputbox history list, take care of duplicate if * check_duplicate and respect history size limit. */ void -add_to_input_history(struct input_history *history, unsigned char *data, +add_to_input_history(struct input_history *history, char *data, int check_duplicate) { struct input_history_entry *entry; @@ -284,16 +284,16 @@ add_to_input_history(struct input_history *history, unsigned char *data, /* Load history file */ int -load_input_history(struct input_history *history, unsigned char *filename) +load_input_history(struct input_history *history, char *filename) { - unsigned char *history_file = filename; - unsigned char line[MAX_STR_LEN]; + char *history_file = filename; + char line[MAX_STR_LEN]; FILE *file; if (get_cmd_opt_bool("anonymous")) return 0; if (elinks_home) { history_file = straconcat(elinks_home, filename, - (unsigned char *) NULL); + (char *) NULL); if (!history_file) return 0; } @@ -319,11 +319,11 @@ load_input_history(struct input_history *history, unsigned char *filename) /* Write history list to file. It returns a value different from 0 in case of * failure, 0 on success. */ int -save_input_history(struct input_history *history, unsigned char *filename) +save_input_history(struct input_history *history, char *filename) { struct input_history_entry *entry; struct secure_save_info *ssi; - unsigned char *history_file; + char *history_file; int i = 0; if (!history->dirty @@ -332,7 +332,7 @@ save_input_history(struct input_history *history, unsigned char *filename) return 0; history_file = straconcat(elinks_home, filename, - (unsigned char *) NULL); + (char *) NULL); if (!history_file) return -1; ssi = secure_open(history_file); @@ -358,7 +358,7 @@ dlg_set_history(struct widget_data *widget_data) assert(widget_data->widget->datalen > 0); if ((void *) widget_data->info.field.cur_hist != &widget_data->info.field.history) { - unsigned char *s = widget_data->info.field.cur_hist->data; + char *s = widget_data->info.field.cur_hist->data; widget_data->info.field.cpos = int_min(strlen(s), widget_data->widget->datalen - 1); if (widget_data->info.field.cpos) diff --git a/src/bfu/inphist.h b/src/bfu/inphist.h index 8e6acd5b..2f71e84e 100644 --- a/src/bfu/inphist.h +++ b/src/bfu/inphist.h @@ -12,7 +12,7 @@ struct dialog_data; struct input_history_entry { LIST_HEAD(struct input_history_entry); - unsigned char data[1]; /* Must be last. */ + char data[1]; /* Must be last. */ }; struct input_history { @@ -44,7 +44,7 @@ struct input_history { if (!(history)->nosave) (history)->dirty = 1; \ } while (0) -void add_to_input_history(struct input_history *, unsigned char *, int); +void add_to_input_history(struct input_history *, char *, int); void do_tab_compl(struct dialog_data *, LIST_OF(struct input_history_entry) *); @@ -54,11 +54,11 @@ void do_tab_compl_unambiguous(struct dialog_data *, LIST_OF(struct input_history_entry) *); /* Load history file from elinks home. */ -int load_input_history(struct input_history *history, unsigned char *filename); +int load_input_history(struct input_history *history, char *filename); /* Write history list to @filebane in elinks home. It returns a value different * from 0 in case of failure, 0 on success. */ -int save_input_history(struct input_history *history, unsigned char *filename); +int save_input_history(struct input_history *history, char *filename); void dlg_set_history(struct widget_data *); diff --git a/src/bfu/leds.c b/src/bfu/leds.c index 693abbab..7aee8e17 100644 --- a/src/bfu/leds.c +++ b/src/bfu/leds.c @@ -165,7 +165,7 @@ init_led_panel(struct led_panel *leds) static int draw_timer(struct terminal *term, int xpos, int ypos, struct color_pair *color) { - unsigned char s[64]; + char s[64]; int i, length; snprintf(s, sizeof(s), "[%d]", get_timer_duration()); @@ -183,7 +183,7 @@ draw_show_ip(struct session *ses, int xpos, int ypos, struct color_pair *color) if (ses->doc_view && ses->doc_view->document && ses->doc_view->document->ip) { struct terminal *term = ses->tab->term; - unsigned char *s = ses->doc_view->document->ip; + char *s = ses->doc_view->document->ip; int length = strlen(s); int i; @@ -200,7 +200,7 @@ draw_show_ip(struct session *ses, int xpos, int ypos, struct color_pair *color) static int draw_clock(struct terminal *term, int xpos, int ypos, struct color_pair *color) { - unsigned char s[64]; + char s[64]; time_t curtime = time(NULL); struct tm *loctime = localtime(&curtime); int i, length; diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c index 5d44720c..09932936 100644 --- a/src/bfu/listbox.c +++ b/src/bfu/listbox.c @@ -460,7 +460,7 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset) data->box->ops->draw(item, data, x, y, width); } else { - unsigned char *text; + char *text; const struct listbox_ops *ops = data->box->ops; int len_bytes; diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index c43d753c..3884113c 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -49,18 +49,18 @@ struct listbox_context { }; struct listbox_ops_messages { - unsigned char *cant_delete_item; /* %s = text of item */ - unsigned char *cant_delete_used_item; /* %s = text of item */ - unsigned char *cant_delete_folder; /* %s = text of item */ - unsigned char *cant_delete_used_folder; /* %s = text of item */ - unsigned char *delete_marked_items_title; /* not a format string */ - unsigned char *delete_marked_items; /* not a format string */ - unsigned char *delete_folder_title; /* not a format string */ - unsigned char *delete_folder; /* %s = text of item */ - unsigned char *delete_item_title; /* not a format string */ - unsigned char *delete_item; /* %s = text of item */ - unsigned char *clear_all_items_title; /* not a format string */ - unsigned char *clear_all_items; /* not a format string */ + char *cant_delete_item; /* %s = text of item */ + char *cant_delete_used_item; /* %s = text of item */ + char *cant_delete_folder; /* %s = text of item */ + char *cant_delete_used_folder; /* %s = text of item */ + char *delete_marked_items_title; /* not a format string */ + char *delete_marked_items; /* not a format string */ + char *delete_folder_title; /* not a format string */ + char *delete_folder; /* %s = text of item */ + char *delete_item_title; /* not a format string */ + char *delete_item; /* %s = text of item */ + char *clear_all_items_title; /* not a format string */ + char *clear_all_items; /* not a format string */ }; /* TODO: We can maybe find a better way of figuring out whether a user of a @@ -72,8 +72,8 @@ struct listbox_ops { void (*unlock)(struct listbox_item *); int (*is_used)(struct listbox_item *); - unsigned char *(*get_text)(struct listbox_item *, struct terminal *); - unsigned char *(*get_info)(struct listbox_item *, struct terminal *); + char *(*get_text)(struct listbox_item *, struct terminal *); + char *(*get_info)(struct listbox_item *, struct terminal *); struct uri *(*get_uri)(struct listbox_item *); @@ -81,7 +81,7 @@ struct listbox_ops { /* Do a search on the item. */ enum listbox_match (*match)(struct listbox_item *, struct terminal *, - unsigned char *text); + char *text); /* Before calling delete() thou shall call can_delete(). */ int (*can_delete)(struct listbox_item *); diff --git a/src/bfu/listmenu.c b/src/bfu/listmenu.c index 07350f5c..a6db75a7 100644 --- a/src/bfu/listmenu.c +++ b/src/bfu/listmenu.c @@ -57,7 +57,7 @@ do_select_submenu(struct terminal *term, void *menu_, void *ses_) } void -new_menu_item(struct list_menu *menu, unsigned char *name, int data, int fullname) +new_menu_item(struct list_menu *menu, char *name, int data, int fullname) /* name == NULL - up; data == -1 - down */ { struct menu_item *new_menu_item = NULL; /* no uninitialized warnings */ @@ -169,15 +169,15 @@ destroy_menu(struct list_menu *menu) } void -menu_labels(struct menu_item *items, unsigned char *base, unsigned char **lbls) +menu_labels(struct menu_item *items, char *base, char **lbls) { struct menu_item *item; - unsigned char *bs; + char *bs; foreach_menu_item (item, items) { - bs = (item->flags & MENU_FULLNAME) ? (unsigned char *) "" + bs = (item->flags & MENU_FULLNAME) ? (char *) "" : base; - bs = straconcat(bs, item->text, (unsigned char *) NULL); + bs = straconcat(bs, item->text, (char *) NULL); if (!bs) continue; if (item->func == do_select_submenu) { @@ -193,7 +193,7 @@ 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, + struct string *orig_string, char **value, int order, int dont_add) { int pos = order - 1; diff --git a/src/bfu/listmenu.h b/src/bfu/listmenu.h index d738ecf0..0fc1d9ea 100644 --- a/src/bfu/listmenu.h +++ b/src/bfu/listmenu.h @@ -17,10 +17,10 @@ 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 new_menu_item(struct list_menu *menu, unsigned char *name, int data, int fullname); +void add_select_item(struct list_menu *menu, struct string *string, struct string *orig_string, char **value, int order, int dont_add); +void new_menu_item(struct list_menu *menu, 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); +void menu_labels(struct menu_item *m, char *base, char **lbls); void do_select_submenu(struct terminal *term, void *menu_, void *ses_); void free_menu(struct menu_item *m); diff --git a/src/bfu/menu.c b/src/bfu/menu.c index 3b426788..ff1b5706 100644 --- a/src/bfu/menu.c +++ b/src/bfu/menu.c @@ -54,7 +54,7 @@ /* Types and structures */ /* Submenu indicator, displayed at right. */ -static unsigned char m_submenu[] = ">>"; +static char m_submenu[] = ">>"; static int m_submenu_len = sizeof(m_submenu) - 1; /* Prototypes */ @@ -190,7 +190,7 @@ select_menu(struct terminal *term, struct menu *menu) static int get_menuitem_text_width(struct terminal *term, struct menu_item *mi) { - unsigned char *text; + char *text; if (!mi_has_left_text(mi)) return 0; @@ -229,7 +229,7 @@ get_menuitem_rtext_width(struct terminal *term, struct menu_item *mi) } } else if (mi_has_right_text(mi)) { - unsigned char *rtext = mi->rtext; + char *rtext = mi->rtext; if (mi_rtext_translate(mi)) rtext = _(rtext, term); @@ -371,7 +371,7 @@ set_menu_selection(struct menu *menu, int pos) * separators). For double-width glyph width == 2. * len - length of text in bytes */ static inline void -draw_menu_left_text(struct terminal *term, unsigned char *text, int len, +draw_menu_left_text(struct terminal *term, char *text, int len, int x, int y, int width, struct color_pair *color) { int w = width - (L_TEXT_SPACE + R_TEXT_SPACE); @@ -398,7 +398,7 @@ draw_menu_left_text(struct terminal *term, unsigned char *text, int len, static inline void -draw_menu_left_text_hk(struct terminal *term, unsigned char *text, +draw_menu_left_text_hk(struct terminal *term, char *text, int hotkey_pos, int x, int y, int width, struct color_pair *color, int selected) { @@ -411,7 +411,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text, int w = width - (L_TEXT_SPACE + R_TEXT_SPACE); int hk_state = 0; #ifdef CONFIG_UTF8 - unsigned char *text2, *end; + char *text2, *end; #endif #ifdef CONFIG_DEBUG @@ -521,7 +521,7 @@ utf8: } static inline void -draw_menu_right_text(struct terminal *term, unsigned char *text, int len, +draw_menu_right_text(struct terminal *term, char *text, int len, int x, int y, int width, struct color_pair *color) { int w = width - (L_RTEXT_SPACE + R_RTEXT_SPACE); @@ -611,7 +611,7 @@ display_menu(struct terminal *term, struct menu *menu) if (mi_has_left_text(mi)) { int l = mi->hotkey_pos; - unsigned char *text = mi->text; + char *text = mi->text; if (mi_text_translate(mi)) text = _(text, term); @@ -658,7 +658,7 @@ display_menu(struct terminal *term, struct menu *menu) } } else if (mi_has_right_text(mi)) { - unsigned char *rtext = mi->rtext; + char *rtext = mi->rtext; if (mi_rtext_translate(mi)) rtext = _(rtext, term); @@ -781,10 +781,10 @@ menu_page_down(struct menu *menu) #undef DIST static inline int -search_menu_item(struct menu_item *item, unsigned char *buffer, +search_menu_item(struct menu_item *item, char *buffer, struct terminal *term) { - unsigned char *text, *match; + char *text, *match; /* set_menu_selection asserts selectability. */ if (!mi_has_left_text(item) || !mi_is_selectable(item)) return 0; @@ -810,7 +810,7 @@ menu_search_handler(struct input_line *line, int action_id) { struct menu *menu = line->data; struct terminal *term = menu->win->term; - unsigned char *buffer = line->buffer; + char *buffer = line->buffer; struct window *win; int pos = menu->selected; int start; @@ -871,7 +871,7 @@ search_menu(struct menu *menu) struct terminal *term = menu->win->term; struct window *current_tab = get_current_tab(term); struct session *ses = current_tab ? current_tab->data : NULL; - unsigned char *prompt = _("Search menu/", term); + char *prompt = _("Search menu/", term); if (menu->size < 1 || !ses) return; @@ -1127,7 +1127,7 @@ display_mainmenu(struct terminal *term, struct menu *menu) for (i = menu->first; i < menu->size; i++) { struct menu_item *mi = &menu->items[i]; struct color_pair *color = normal_color; - unsigned char *text = mi->text; + char *text = mi->text; int l = mi->hotkey_pos; int textlen; int selected = (i == menu->selected); @@ -1248,7 +1248,7 @@ mainmenu_mouse_handler(struct menu *menu, struct term_event *ev) /* We don't initialize to menu->first here, since it breaks * horizontal scrolling using mouse in some cases. --Zas */ foreach_menu_item (item, menu->items) { - unsigned char *text = item->text; + char *text = item->text; if (!mi_has_left_text(item)) continue; @@ -1386,7 +1386,7 @@ new_menu(enum menu_item_flags flags) } void -add_to_menu(struct menu_item **mi, unsigned char *text, unsigned char *rtext, +add_to_menu(struct menu_item **mi, char *text, char *rtext, enum main_action action_id, menu_func_T func, void *data, enum menu_item_flags flags) { diff --git a/src/bfu/menu.h b/src/bfu/menu.h index 39025772..1cadcb0b 100644 --- a/src/bfu/menu.h +++ b/src/bfu/menu.h @@ -80,7 +80,7 @@ enum hotkey_state { /* XXX: keep order of fields, there's some hard initializations for it. --Zas */ struct menu_item { - unsigned char *text; /* The item label */ + char *text; /* The item label */ /* The following three members are tightly coupled: * @@ -91,7 +91,7 @@ struct menu_item { * - A few places however there is no associated keybinding and no * ``default'' handler defined in which case @rtext (if non NULL) * will be drawn and @func will be called when selecting the item. */ - unsigned char *rtext; /* Right aligned guiding text */ + char *rtext; /* Right aligned guiding text */ enum main_action action_id; /* Default item handlers */ menu_func_T func; /* Called when selecting the item */ @@ -106,8 +106,8 @@ struct menu_item { #define INIT_MENU_ITEM(text, rtext, action_id, func, data, flags) \ { \ - (unsigned char *) (text), \ - (unsigned char *) (rtext), \ + (char *) (text), \ + (char *) (rtext), \ (action_id), \ (func), \ (void *) (data), \ @@ -128,8 +128,8 @@ struct menu_item { #define SET_MENU_ITEM(e_, text_, rtext_, action_id_, func_, data_, \ flags_, hotkey_state_, hotkey_pos_) \ do { \ - (e_)->text = (unsigned char *) (text_); \ - (e_)->rtext = (unsigned char *) (rtext_); \ + (e_)->text = (char *) (text_); \ + (e_)->rtext = (char *) (rtext_); \ (e_)->action_id = (action_id_); \ (e_)->func = (func_); \ (e_)->data = (void *) (data_); \ @@ -165,7 +165,7 @@ struct menu { struct menu_item *new_menu(enum menu_item_flags); void -add_to_menu(struct menu_item **mi, unsigned char *text, unsigned char *rtext, +add_to_menu(struct menu_item **mi, char *text, char *rtext, enum main_action action_id, menu_func_T func, void *data, enum menu_item_flags flags); diff --git a/src/bfu/msgbox.c b/src/bfu/msgbox.c index aa126087..bc320023 100644 --- a/src/bfu/msgbox.c +++ b/src/bfu/msgbox.c @@ -23,8 +23,8 @@ struct dialog_data * msg_box(struct terminal *term, struct memory_list *ml, enum msgbox_flags flags, - unsigned char *title, enum format_align align, - unsigned char *text, void *udata, int buttons, ...) + char *title, enum format_align align, + char *text, void *udata, int buttons, ...) { struct dialog *dlg; va_list ap; @@ -66,11 +66,11 @@ msg_box(struct terminal *term, struct memory_list *ml, enum msgbox_flags flags, va_start(ap, buttons); while (dlg->number_of_widgets < buttons + 1) { - unsigned char *label; + char *label; done_handler_T *done; int bflags; - label = va_arg(ap, unsigned char *); + label = va_arg(ap, char *); done = va_arg(ap, done_handler_T *); bflags = va_arg(ap, int); @@ -93,10 +93,10 @@ msg_box(struct terminal *term, struct memory_list *ml, enum msgbox_flags flags, return do_dialog(term, dlg, ml); } -static inline unsigned char * -msg_text_do(unsigned char *format, va_list ap) +static inline char * +msg_text_do(char *format, va_list ap) { - unsigned char *info; + char *info; int infolen, len; va_list ap2; @@ -117,10 +117,10 @@ msg_text_do(unsigned char *format, va_list ap) return info; } -unsigned char * -msg_text(struct terminal *term, unsigned char *format, ...) +char * +msg_text(struct terminal *term, char *format, ...) { - unsigned char *info; + char *info; va_list ap; va_start(ap, format); @@ -142,9 +142,9 @@ abort_refreshed_msg_box_handler(struct dialog_data *dlg_data) static enum dlg_refresh_code refresh_msg_box(struct dialog_data *dlg_data, void *data) { - unsigned char *(*get_info)(struct terminal *, void *) = data; + char *(*get_info)(struct terminal *, void *) = data; void *msg_data = dlg_data->dlg->udata2; - unsigned char *info = get_info(dlg_data->win->term, msg_data); + char *info = get_info(dlg_data->win->term, msg_data); if (!info) return REFRESH_CANCEL; @@ -156,13 +156,13 @@ refresh_msg_box(struct dialog_data *dlg_data, void *data) void refreshed_msg_box(struct terminal *term, enum msgbox_flags flags, - unsigned char *title, enum format_align align, - unsigned char *(get_info)(struct terminal *, void *), + char *title, enum format_align align, + char *(get_info)(struct terminal *, void *), void *data) { /* [gettext_accelerator_context(refreshed_msg_box)] */ struct dialog_data *dlg_data; - unsigned char *info = get_info(term, data); + char *info = get_info(term, data); if (!info) return; @@ -183,8 +183,8 @@ refreshed_msg_box(struct terminal *term, enum msgbox_flags flags, struct dialog_data * info_box(struct terminal *term, enum msgbox_flags flags, - unsigned char *title, enum format_align align, - unsigned char *text) + char *title, enum format_align align, + char *text) { /* [gettext_accelerator_context(info_box)] */ return msg_box(term, NULL, flags, diff --git a/src/bfu/msgbox.h b/src/bfu/msgbox.h index 1df93772..bb72c753 100644 --- a/src/bfu/msgbox.h +++ b/src/bfu/msgbox.h @@ -94,8 +94,8 @@ enum msgbox_flags { * ...no matter that it could fit on one line in case of a tiny message box. */ struct dialog_data * msg_box(struct terminal *term, struct memory_list *mem_list, - enum msgbox_flags flags, unsigned char *title, enum format_align align, - unsigned char *text, void *udata, int buttons, ...); + enum msgbox_flags flags, char *title, enum format_align align, + char *text, void *udata, int buttons, ...); /* Cast @value to @type and warn if the conversion is suspicious. * If @value has side effects, this does them only once. @@ -108,7 +108,7 @@ msg_box(struct terminal *term, struct memory_list *mem_list, /* A button in the variadic arguments of msg_box(). * This macro expands into three arguments. */ #define MSG_BOX_BUTTON(label, handler, flags) \ - MSG_BOX_CAST(const unsigned char *, label), \ + MSG_BOX_CAST(const char *, label), \ MSG_BOX_CAST(done_handler_T *, handler), \ MSG_BOX_CAST(int, flags) @@ -121,21 +121,21 @@ msg_box(struct terminal *term, struct memory_list *mem_list, * This one automagically localizes the format string. The possible * additional parameters still need to be localized manually at the user's * side. */ -unsigned char *msg_text(struct terminal *term, unsigned char *format, ...); +char *msg_text(struct terminal *term, char *format, ...); /* A periodically refreshed message box with one OK button. The text in the * message box is updated using the get_info() function. If get_info() returns * NULL the message box is closed. */ void refreshed_msg_box(struct terminal *term, enum msgbox_flags flags, - unsigned char *title, enum format_align align, - unsigned char *(get_info)(struct terminal *, void *), + char *title, enum format_align align, + char *(get_info)(struct terminal *, void *), void *data); struct dialog_data * info_box(struct terminal *term, enum msgbox_flags flags, - unsigned char *title, enum format_align align, - unsigned char *text); + char *title, enum format_align align, + char *text); #ifdef __cplusplus } diff --git a/src/bfu/style.c b/src/bfu/style.c index 54d7a4dd..a2668400 100644 --- a/src/bfu/style.c +++ b/src/bfu/style.c @@ -28,7 +28,7 @@ struct bfu_color_entry { static struct hash *bfu_colors = NULL; struct color_pair * -get_bfu_color(struct terminal *term, unsigned char *stylename) +get_bfu_color(struct terminal *term, char *stylename) { static enum color_mode last_color_mode; struct bfu_color_entry *entry; diff --git a/src/bfu/style.h b/src/bfu/style.h index 7dce1173..aeb03610 100644 --- a/src/bfu/style.h +++ b/src/bfu/style.h @@ -23,7 +23,7 @@ struct terminal; * @return A color pair matching the stylename or NULL. */ struct color_pair * -get_bfu_color(struct terminal *term, unsigned char *stylename); +get_bfu_color(struct terminal *term, char *stylename); /** Cleanup after the BFU style cache * diff --git a/src/bfu/text.c b/src/bfu/text.c index 52818893..3755b763 100644 --- a/src/bfu/text.c +++ b/src/bfu/text.c @@ -23,7 +23,7 @@ #define is_unsplitable(pos) (*(pos) && *(pos) != '\n' && !isspace(*(pos))) void -add_dlg_text(struct dialog *dlg, unsigned char *text, +add_dlg_text(struct dialog *dlg, char *text, enum format_align align, int bottom_pad) { struct widget *widget = &dlg->widgets[dlg->number_of_widgets++]; @@ -38,26 +38,26 @@ add_dlg_text(struct dialog *dlg, unsigned char *text, /* Returns length of substring (from start of @text) before a split. */ #ifdef CONFIG_UTF8 static inline int -split_line(unsigned char *text, int max_width, int *cells, int utf8) +split_line(char *text, int max_width, int *cells, int utf8) #else static inline int -split_line(unsigned char *text, int max_width, int *cells) +split_line(char *text, int max_width, int *cells) #endif /* CONFIG_UTF8 */ { - unsigned char *split = text; + char *split = text; #ifdef CONFIG_UTF8 - unsigned char *text_end = split + strlen(split); + char *text_end = split + strlen(split); #endif /* CONFIG_UTF8 */ int cells_save = *cells; if (max_width <= 0) return 0; while (*split && *split != '\n') { - unsigned char *next_split; + char *next_split; #ifdef CONFIG_UTF8 if (utf8) { - unsigned char *next_char_begin = split + char *next_char_begin = split + utf8charlen(split); next_split = split; @@ -153,15 +153,15 @@ split_line(unsigned char *text, int max_width, int *cells) /* Find the start of each line with the current max width */ #ifdef CONFIG_UTF8 -static unsigned char ** +static char ** split_lines(struct widget_data *widget_data, int max_width, int utf8) #else -static unsigned char ** +static char ** split_lines(struct widget_data *widget_data, int max_width) #endif /* CONFIG_UTF8 */ { - unsigned char *text = widget_data->widget->text; - unsigned char **lines = (unsigned char **) widget_data->cdata; + char *text = widget_data->widget->text; + char **lines = (char **) widget_data->cdata; int line = 0; if (widget_data->info.text.max_width == max_width) return lines; @@ -202,7 +202,7 @@ split_lines(struct widget_data *widget_data, int max_width) /* Yes it might be a bit ugly on the other hand it will be autofreed * for us. */ - widget_data->cdata = (unsigned char *) lines; + widget_data->cdata = (char *) lines; widget_data->info.text.lines = line; widget_data->info.text.max_width = max_width; @@ -212,7 +212,7 @@ split_lines(struct widget_data *widget_data, int max_width) /* Format text according to dialog box and alignment. */ void dlg_format_text_do(struct dialog_data *dlg_data, - unsigned char *text, + char *text, int x, int *y, int width, int *real_width, struct color_pair *color, enum format_align align, int format_only) @@ -270,9 +270,9 @@ dlg_format_text(struct dialog_data *dlg_data, int format_only) { struct terminal *term = dlg_data->win->term; - unsigned char *text = widget_data->widget->text; + char *text = widget_data->widget->text; unsigned char saved = 0; - unsigned char *saved_pos = NULL; + char *saved_pos = NULL; int height; height = int_max(0, max_height - 3); @@ -288,7 +288,7 @@ dlg_format_text(struct dialog_data *dlg_data, && (widget_data->info.text.max_width != width || height < widget_data->info.text.lines)) { - unsigned char **lines; + char **lines; int current; int visible; @@ -304,7 +304,7 @@ dlg_format_text(struct dialog_data *dlg_data, return; #endif - lines = (unsigned char **) widget_data->cdata; + lines = (char **) widget_data->cdata; /* Make maximum number of lines available */ visible = int_max(widget_data->info.text.lines - height, diff --git a/src/bfu/text.h b/src/bfu/text.h index ddb520de..7470d8fb 100644 --- a/src/bfu/text.h +++ b/src/bfu/text.h @@ -46,12 +46,12 @@ struct widget_data_info_text { #endif }; -void add_dlg_text(struct dialog *dlg, unsigned char *text, +void add_dlg_text(struct dialog *dlg, char *text, enum format_align align, int bottom_pad); extern const struct widget_ops text_ops; void dlg_format_text_do(struct dialog_data *dlg_data, - unsigned char *text, int x, int *y, int w, int *rw, + char *text, int x, int *y, int w, int *rw, struct color_pair *scolor, enum format_align align, int format_only); void diff --git a/src/bfu/widget.h b/src/bfu/widget.h index 7a9c7df8..6666e23a 100644 --- a/src/bfu/widget.h +++ b/src/bfu/widget.h @@ -36,7 +36,7 @@ struct widget_ops { struct widget { const struct widget_ops *ops; - unsigned char *text; + char *text; widget_handler_T *handler; @@ -61,14 +61,14 @@ struct widget_data { * and is assumed to be unibyte otherwise.) The UTF-8 I/O * option has no effect here. * - * For WIDGET_TEXT: @cdata is cast from/to an unsigned char ** + * For WIDGET_TEXT: @cdata is cast from/to an char ** * that points to the first element of an array. Each element * in this array corresponds to one line of text, and is an - * unsigned char * that points to the first character of that + * char * that points to the first character of that * line. The array has @widget_data.info.text.lines elements. * * For WIDGET_LISTBOX: @cdata points to struct listbox_data. */ - unsigned char *cdata; + char *cdata; struct el_box box; diff --git a/src/bookmarks/backend/common.c b/src/bookmarks/backend/common.c index 174b9145..a779dd16 100644 --- a/src/bookmarks/backend/common.c +++ b/src/bookmarks/backend/common.c @@ -47,7 +47,7 @@ bookmarks_read(void) { int backend_num = get_opt_int("bookmarks.file_format", NULL); struct bookmarks_backend *backend = bookmarks_backends[backend_num]; - unsigned char *file_name; + char *file_name; FILE *f; if (!backend @@ -58,7 +58,7 @@ bookmarks_read(void) if (!file_name) return; if (elinks_home) { file_name = straconcat(elinks_home, file_name, - (unsigned char *) NULL); + (char *) NULL); if (!file_name) return; } @@ -79,7 +79,7 @@ bookmarks_write(LIST_OF(struct bookmark) *bookmarks_list) int backend_num = get_opt_int("bookmarks.file_format", NULL); struct bookmarks_backend *backend = bookmarks_backends[backend_num]; struct secure_save_info *ssi; - unsigned char *file_name; + char *file_name; if (!bookmarks_are_dirty() && backend_num == loaded_backend_num) return; if (!backend @@ -92,7 +92,7 @@ bookmarks_write(LIST_OF(struct bookmark) *bookmarks_list) * they would be just truncated to zero by secure_open()). */ file_name = backend->filename(1); if (!file_name) return; - file_name = straconcat(elinks_home, file_name, (unsigned char *) NULL); + file_name = straconcat(elinks_home, file_name, (char *) NULL); if (!file_name) return; ssi = secure_open(file_name); diff --git a/src/bookmarks/backend/common.h b/src/bookmarks/backend/common.h index 5abdef24..68f500d4 100644 --- a/src/bookmarks/backend/common.h +++ b/src/bookmarks/backend/common.h @@ -12,7 +12,7 @@ extern "C" { struct bookmarks_backend { /* Order matters here. --Zas. */ - unsigned char *(*filename)(int); + char *(*filename)(int); void (*read)(FILE *); void (*write)(struct secure_save_info *, LIST_OF(struct bookmark) *); }; diff --git a/src/bookmarks/backend/default.c b/src/bookmarks/backend/default.c index 2787e5a9..54e4e43d 100644 --- a/src/bookmarks/backend/default.c +++ b/src/bookmarks/backend/default.c @@ -31,19 +31,19 @@ read_bookmarks_default(FILE *f) * + 1 byte for end of line + 1 byte for null char + reserve */ #define INBUF_SIZE ((MAX_STR_LEN - 1) + 1 + (MAX_STR_LEN - 1) + 1 + 5 + 1 + 1 \ + MAX_STR_LEN) - unsigned char in_buffer[INBUF_SIZE]; /* read buffer */ + char in_buffer[INBUF_SIZE]; /* read buffer */ struct bookmark *last_bm = NULL; int last_depth = 0; const int file_cp = get_cp_index("System"); /* TODO: Ignore lines with bad chars in title or url (?). -- Zas */ while (fgets(in_buffer, INBUF_SIZE, f)) { - unsigned char *title = in_buffer; - unsigned char *url; - unsigned char *depth_str; + char *title = in_buffer; + char *url; + char *depth_str; int depth = 0; - unsigned char *flags = NULL; - unsigned char *line_end; + char *flags = NULL; + char *line_end; /* Load URL. */ @@ -143,7 +143,7 @@ write_bookmarks_default_inner(const struct write_bookmarks_default *out, struct bookmark *bm; foreach (bm, *bookmarks_list) { - unsigned char *title, *url; + char *title, *url; title = convert_string(out->conv_table, bm->title, strlen(bm->title), out->codepage, @@ -189,7 +189,7 @@ write_bookmarks_default(struct secure_save_info *ssi, write_bookmarks_default_inner(&out, bookmarks_list); } -static unsigned char * +static char * filename_bookmarks_default(int writing) { return BOOKMARKS_FILENAME; diff --git a/src/bookmarks/backend/xbel.c b/src/bookmarks/backend/xbel.c index 2422ece5..51ea2961 100644 --- a/src/bookmarks/backend/xbel.c +++ b/src/bookmarks/backend/xbel.c @@ -38,8 +38,8 @@ struct attributes { LIST_HEAD(struct attributes); - unsigned char *name; - unsigned char *value; + char *name; + char *value; }; /* Prototypes */ @@ -50,9 +50,9 @@ static void on_text(void *data, const XML_Char *text, int len); static struct tree_node *new_node(struct tree_node *parent); static void free_node(struct tree_node *node); static void free_xbeltree(struct tree_node *node); -static struct tree_node *get_child(struct tree_node *node, unsigned char *name); -static unsigned char *get_attribute_value(struct tree_node *node, - unsigned char *name); +static struct tree_node *get_child(struct tree_node *node, char *name); +static char *get_attribute_value(struct tree_node *node, + char *name); struct read_bookmarks_xbel { @@ -60,7 +60,7 @@ struct read_bookmarks_xbel { }; static void read_bookmarks_xbel(FILE *f); -static unsigned char * filename_bookmarks_xbel(int writing); +static char * filename_bookmarks_xbel(int writing); static int xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload, struct tree_node *root, struct bookmark *current_parent); @@ -72,8 +72,8 @@ static void write_bookmarks_xbel(struct secure_save_info *ssi, /* Element */ struct tree_node { - unsigned char *name; /* Name of the element */ - unsigned char *text; /* Text inside the element */ + char *name; /* Name of the element */ + char *text; /* Text inside the element */ LIST_OF(struct attributes) attrs; struct tree_node *parent; struct tree_node *children; @@ -92,7 +92,7 @@ static int readok = 1; static void read_bookmarks_xbel(FILE *f) { - unsigned char in_buffer[BUFSIZ]; + char in_buffer[BUFSIZ]; XML_Parser p; int done = 0; int err = 0; @@ -165,7 +165,7 @@ write_bookmarks_xbel(struct secure_save_info *ssi, secure_fputs(ssi, "\n\n"); } -static unsigned char * +static char * filename_bookmarks_xbel(int writing) { if (writing && !readok) return NULL; @@ -182,7 +182,7 @@ indentation(struct secure_save_info *ssi, int num) } static void -print_xml_entities(struct secure_save_info *ssi, const unsigned char *str) +print_xml_entities(struct secure_save_info *ssi, const char *str) { struct string entitized = NULL_STRING; @@ -268,7 +268,7 @@ on_element_open(void *data, const char *name, const char **attr) current_node = node; - current_node->name = stracpy((unsigned char *) name); + current_node->name = stracpy((char *) name); if (!current_node->name) { mem_free(current_node); return; @@ -276,8 +276,8 @@ on_element_open(void *data, const char *name, const char **attr) for (; *attr; attr += 2) { struct attributes *attribute = mem_calloc(1, sizeof(*attribute)); - unsigned char *name = stracpy((unsigned char *) attr[0]); - unsigned char *value = stracpy((unsigned char *) attr[1]); + char *name = stracpy((char *) attr[0]); + char *value = stracpy((char *) attr[1]); if (!attribute || !name || !value) { mem_free_if(attribute); @@ -301,10 +301,10 @@ on_element_close(void *data, const char *name) current_node = current_node->parent; } -static unsigned char * -delete_whites(const unsigned char *s) +static char * +delete_whites(const char *s) { - unsigned char *r; + char *r; int last_was_space = 0, c = 0, i; int len = strlen(s); @@ -376,7 +376,7 @@ xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload, while (node) { if (!strcmp(node->name, "bookmark")) { - unsigned char *href; + char *href; title = get_child(node, "title"); href = get_attribute_value(node, "href"); @@ -385,13 +385,13 @@ xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload, tmp = add_bookmark(current_parent, 0, /* The element is optional */ title && title->text ? title->text - : (unsigned char *) gettext("No title"), + : (char *) gettext("No title"), /* XXX: The href attribute isn't optional but * we don't validate the source XML yet, so * we can't always assume a non NULL value for * get_attribute_value() */ href ? href - : (unsigned char *) gettext("No URL")); + : (char *) gettext("No URL")); /* Out of memory */ if (!tmp) return 0; @@ -400,14 +400,14 @@ xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload, lastbm = tmp; } else if (!strcmp(node->name, "folder")) { - unsigned char *folded; + char *folded; title = get_child(node, "title"); intl_set_charset_by_index(preload->utf8_cp); tmp = add_bookmark(current_parent, 0, title && title->text ? title->text - : (unsigned char *) gettext("No title"), + : (char *) gettext("No title"), NULL); /* Out of memory */ @@ -471,7 +471,7 @@ free_xbeltree(struct tree_node *node) } static struct tree_node * -get_child(struct tree_node *node, unsigned char *name) +get_child(struct tree_node *node, char *name) { struct tree_node *ret; @@ -489,8 +489,8 @@ get_child(struct tree_node *node, unsigned char *name) return NULL; } -static unsigned char * -get_attribute_value(struct tree_node *node, unsigned char *name) +static char * +get_attribute_value(struct tree_node *node, char *name) { struct attributes *attribute; diff --git a/src/bookmarks/bookmarks.c b/src/bookmarks/bookmarks.c index 3876fe21..bb619ff9 100644 --- a/src/bookmarks/bookmarks.c +++ b/src/bookmarks/bookmarks.c @@ -276,7 +276,7 @@ delete_bookmark(struct bookmark *bm) * @param foldername * The title of the folder, in UTF-8. */ static void -delete_folder_by_name(const unsigned char *foldername) +delete_folder_by_name(const char *foldername) { struct bookmark *bookmark, *next; @@ -305,7 +305,7 @@ delete_folder_by_name(const unsigned char *foldername) * * @return the new bookmark, or NULL on error. */ static struct bookmark * -init_bookmark(struct bookmark *root, unsigned char *title, unsigned char *url) +init_bookmark(struct bookmark *root, char *title, char *url) { struct bookmark *bm; @@ -379,8 +379,8 @@ add_bookmark_item_to_bookmarks(struct bookmark *bm, struct bookmark *root, int p * * @see add_bookmark_cp() */ struct bookmark * -add_bookmark(struct bookmark *root, int place, unsigned char *title, - unsigned char *url) +add_bookmark(struct bookmark *root, int place, char *title, + char *url) { enum listbox_item_type type; struct bookmark *bm; @@ -435,12 +435,12 @@ add_bookmark(struct bookmark *root, int place, unsigned char *title, * @see add_bookmark() */ struct bookmark * add_bookmark_cp(struct bookmark *root, int place, int codepage, - unsigned char *title, unsigned char *url) + char *title, char *url) { const int utf8_cp = get_cp_index("UTF-8"); struct conv_table *table; - unsigned char *utf8_title = NULL; - unsigned char *utf8_url = NULL; + char *utf8_title = NULL; + char *utf8_url = NULL; struct bookmark *bookmark = NULL; if (!url) @@ -471,13 +471,13 @@ add_bookmark_cp(struct bookmark *root, int place, int codepage, * If any of the fields are NULL, the value is left unchanged. */ int update_bookmark(struct bookmark *bm, int codepage, - unsigned char *title, unsigned char *url) + char *title, char *url) { static int update_bookmark_event_id = EVENT_NONE; const int utf8_cp = get_cp_index("UTF-8"); struct conv_table *table; - unsigned char *title2 = NULL; - unsigned char *url2 = NULL; + char *title2 = NULL; + char *url2 = NULL; table = get_translation_table(codepage, utf8_cp); if (!table) @@ -541,7 +541,7 @@ update_bookmark(struct bookmark *bm, int codepage, * * @return The bookmark, or NULL if not found. */ struct bookmark * -get_bookmark_by_name(struct bookmark *folder, unsigned char *title) +get_bookmark_by_name(struct bookmark *folder, char *title) { struct bookmark *bookmark; LIST_OF(struct bookmark) *lh; @@ -556,7 +556,7 @@ get_bookmark_by_name(struct bookmark *folder, unsigned char *title) /* Search bookmark cache for item matching url. */ struct bookmark * -get_bookmark(unsigned char *url) +get_bookmark(char *url) { struct hash_item *item; @@ -574,7 +574,7 @@ get_bookmark(unsigned char *url) static void bookmark_terminal(struct terminal *term, struct bookmark *folder) { - unsigned char title[MAX_STR_LEN], url[MAX_STR_LEN]; + char title[MAX_STR_LEN], url[MAX_STR_LEN]; struct window *tab; int term_cp = get_terminal_codepage(term); @@ -600,7 +600,7 @@ bookmark_terminal(struct terminal *term, struct bookmark *folder) * @param foldername * The name of the new bookmark folder, in UTF-8. */ void -bookmark_terminal_tabs(struct terminal *term, unsigned char *foldername) +bookmark_terminal_tabs(struct terminal *term, char *foldername) { struct bookmark *folder = add_bookmark(NULL, 1, foldername, NULL); @@ -624,7 +624,7 @@ bookmark_all_terminals(struct bookmark *folder) } foreach (term, terminals) { - unsigned char subfoldername[4]; + char subfoldername[4]; struct bookmark *subfolder; if (ulongcat(subfoldername, NULL, n, sizeof(subfoldername), 0) @@ -643,10 +643,10 @@ bookmark_all_terminals(struct bookmark *folder) } -unsigned char * +char * get_auto_save_bookmark_foldername_utf8(void) { - unsigned char *foldername; + char *foldername; int from_cp, to_cp; struct conv_table *convert_table; @@ -670,7 +670,7 @@ get_auto_save_bookmark_foldername_utf8(void) void bookmark_auto_save_tabs(struct terminal *term) { - unsigned char *foldername; /* UTF-8 */ + char *foldername; /* UTF-8 */ if (get_cmd_opt_bool("anonymous") || !get_opt_bool("ui.sessions.auto_save", NULL)) @@ -726,7 +726,7 @@ bookmark_snapshot(void) * @param foldername * The name of the bookmark folder, in UTF-8. */ void -open_bookmark_folder(struct session *ses, unsigned char *foldername) +open_bookmark_folder(struct session *ses, char *foldername) { struct bookmark *bookmark; struct bookmark *folder = NULL; diff --git a/src/bookmarks/bookmarks.h b/src/bookmarks/bookmarks.h index ea30370b..5cacfd79 100644 --- a/src/bookmarks/bookmarks.h +++ b/src/bookmarks/bookmarks.h @@ -23,8 +23,8 @@ struct bookmark { /** @todo Bug 1066: The bookmark::url string should be in UTF-8 too, * but this has not yet been fully implemented. */ - unsigned char *title; /* UTF-8 title of bookmark */ - unsigned char *url; /* Location of bookmarked item */ + char *title; /* UTF-8 title of bookmark */ + char *url; /* Location of bookmarked item */ LIST_OF(struct bookmark) child; }; @@ -48,18 +48,18 @@ void bookmarks_unset_dirty(void); int bookmarks_are_dirty(void); void delete_bookmark(struct bookmark *); -struct bookmark *add_bookmark(struct bookmark *, int, unsigned char *, unsigned char *); +struct bookmark *add_bookmark(struct bookmark *, int, char *, char *); struct bookmark *add_bookmark_cp(struct bookmark *, int, int, - unsigned char *, unsigned char *); + char *, char *); struct bookmark *get_bookmark_by_name(struct bookmark *folder, - unsigned char *title); -struct bookmark *get_bookmark(unsigned char *url); -void bookmark_terminal_tabs(struct terminal *term, unsigned char *foldername); -unsigned char *get_auto_save_bookmark_foldername_utf8(void); + char *title); +struct bookmark *get_bookmark(char *url); +void bookmark_terminal_tabs(struct terminal *term, char *foldername); +char *get_auto_save_bookmark_foldername_utf8(void); void bookmark_auto_save_tabs(struct terminal *term); int update_bookmark(struct bookmark *, int, - unsigned char *, unsigned char *); -void open_bookmark_folder(struct session *ses, unsigned char *foldername); + char *, char *); +void open_bookmark_folder(struct session *ses, char *foldername); #ifdef __cplusplus } diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index 642505f0..920fdcd3 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -52,7 +52,7 @@ is_bookmark_used(struct listbox_item *item) return is_object_used((struct bookmark *) item->udata); } -static unsigned char * +static char * get_bookmark_text(struct listbox_item *item, struct terminal *term) { struct bookmark *bookmark = item->udata; @@ -73,14 +73,14 @@ get_bookmark_text(struct listbox_item *item, struct terminal *term) * resulting string may be displayed in the UI but should not be saved * to a file or given to another program. */ static void -add_converted_bytes_to_string(void *data, unsigned char *buf, int buflen) +add_converted_bytes_to_string(void *data, char *buf, int buflen) { struct string *string = data; add_bytes_to_string(string, buf, buflen); /* ignore errors */ } -static unsigned char * +static char * get_bookmark_info(struct listbox_item *item, struct terminal *term) { struct bookmark *bookmark = item->udata; @@ -255,7 +255,7 @@ move_bookmark_after_selected(struct bookmark *bookmark, struct bookmark *selecte * or "" means add a bookmark folder, unless @a title is "-". */ static void do_add_bookmark(struct terminal *term, struct dialog_data *dlg_data, - unsigned char *title, unsigned char *url) + char *title, char *url) { int term_cp = get_terminal_codepage(term); struct bookmark *bm = NULL; @@ -307,7 +307,7 @@ do_add_bookmark(struct terminal *term, struct dialog_data *dlg_data, * The folder name that the user typed in the input dialog. * This is in the charset of the terminal. */ static void -do_add_folder(struct dialog_data *dlg_data, unsigned char *foldername) +do_add_folder(struct dialog_data *dlg_data, char *foldername) { do_add_bookmark(dlg_data->win->term, dlg_data, foldername, NULL); } @@ -327,7 +327,7 @@ push_add_folder_button(struct dialog_data *dlg_data, struct widget_data *widget_ N_("Add folder"), N_("Folder name"), dlg_data, NULL, MAX_STR_LEN, NULL, 0, 0, NULL, - (void (*)(void *, unsigned char *)) do_add_folder, + (void (*)(void *, char *)) do_add_folder, NULL); return EVENT_PROCESSED; } @@ -393,8 +393,8 @@ push_edit_button(struct dialog_data *dlg_data, struct widget_data *edit_btn) convert_table = get_translation_table(utf8_cp, term_cp); if (convert_table) { - unsigned char *title; - unsigned char *url; + char *title; + char *url; title = convert_string(convert_table, bm->title, strlen(bm->title), @@ -641,8 +641,8 @@ bookmark_manager(struct session *ses) * rapid search of an already existing bookmark. --Zas */ struct bookmark_search_ctx { - unsigned char *url; /* UTF-8 */ - unsigned char *title; /* system charset */ + char *url; /* UTF-8 */ + char *title; /* system charset */ int found; int offset; int utf8_cp; @@ -673,7 +673,7 @@ test_search(struct listbox_item *item, void *data_, int *offset) * charset. So convert bm->title to that. * (ctx->title has already been converted.) */ struct conv_table *convert_table; - unsigned char *title = NULL; + char *title = NULL; convert_table = get_translation_table(ctx->utf8_cp, ctx->system_cp); @@ -705,8 +705,8 @@ test_search(struct listbox_item *item, void *data_, int *offset) /* Last searched values. Both are in UTF-8. (The title could be kept * in the system charset, but that would be a bit risky, because * setlocale calls from Lua scripts can change the system charset.) */ -static unsigned char *bm_last_searched_title = NULL; -static unsigned char *bm_last_searched_url = NULL; +static char *bm_last_searched_title = NULL; +static char *bm_last_searched_url = NULL; void free_last_searched_bookmark(void) @@ -716,8 +716,8 @@ free_last_searched_bookmark(void) } static int -memorize_last_searched_bookmark(const unsigned char *title, - const unsigned char *url) +memorize_last_searched_bookmark(const char *title, + const char *url) { /* Memorize last searched title */ mem_free_set(&bm_last_searched_title, stracpy(title)); @@ -743,9 +743,9 @@ bookmark_search_do(void *data) struct dialog_data *dlg_data; struct conv_table *convert_table; int term_cp; - unsigned char *url_term; - unsigned char *title_term; - unsigned char *title_utf8 = NULL; + char *url_term; + char *title_term; + char *title_utf8 = NULL; assertm(dlg->udata != NULL, "Bookmark search with NULL udata in dialog"); if_assert_failed return; @@ -797,8 +797,8 @@ launch_bm_search_doc_dialog(struct terminal *term, struct dialog_data *parent, struct session *ses) { - unsigned char *title = NULL; - unsigned char *url = NULL; + char *title = NULL; + char *url = NULL; if (bm_last_searched_title && bm_last_searched_url) { int utf8_cp, term_cp; @@ -872,8 +872,8 @@ void launch_bm_add_dialog(struct terminal *term, struct dialog_data *parent, struct session *ses, - unsigned char *title, - unsigned char *url) + char *title, + char *url) { /* When the user eventually pushes the OK button, BFU calls * bookmark_add_add() and gives it the struct dialog * as the @@ -906,7 +906,7 @@ launch_bm_add_link_dialog(struct terminal *term, struct dialog_data *parent, struct session *ses) { - unsigned char title[MAX_STR_LEN], url[MAX_STR_LEN]; + char title[MAX_STR_LEN], url[MAX_STR_LEN]; launch_bm_add_dialog(term, parent, ses, get_current_link_name(ses, title, MAX_STR_LEN), @@ -919,13 +919,13 @@ launch_bm_add_link_dialog(struct terminal *term, \****************************************************************************/ static void -bookmark_terminal_tabs_ok(void *term_void, unsigned char *foldername) +bookmark_terminal_tabs_ok(void *term_void, char *foldername) { struct terminal *const term = term_void; int from_cp = get_terminal_codepage(term); int to_cp = get_cp_index("UTF-8"); struct conv_table *convert_table; - unsigned char *converted; + char *converted; convert_table = get_translation_table(from_cp, to_cp); if (convert_table == NULL) return; /** @todo Report the error */ diff --git a/src/bookmarks/dialogs.h b/src/bookmarks/dialogs.h index 7b987d74..db81a620 100644 --- a/src/bookmarks/dialogs.h +++ b/src/bookmarks/dialogs.h @@ -21,8 +21,8 @@ void bookmark_manager(struct session *ses); void launch_bm_add_dialog(struct terminal *term, struct dialog_data *parent, struct session *ses, - unsigned char *title, - unsigned char *url); + char *title, + char *url); /* ...with the current document's title and URL */ void launch_bm_add_doc_dialog(struct terminal *term, diff --git a/src/cache/cache.c b/src/cache/cache.c index 4bc8eed6..d50a310b 100644 --- a/src/cache/cache.c +++ b/src/cache/cache.c @@ -374,7 +374,7 @@ remove_overlaps(struct cache_entry *cached, struct fragment *f, int *trunc) * unhappy from that. */ int add_fragment(struct cache_entry *cached, off_t offset, - const unsigned char *data, ssize_t length) + const char *data, ssize_t length) { struct fragment *f, *nf; int trunc = 0; @@ -700,10 +700,10 @@ normalize_cache_entry(struct cache_entry *cached, off_t truncate_length) struct uri * -redirect_cache(struct cache_entry *cached, unsigned char *location, +redirect_cache(struct cache_entry *cached, char *location, int get, int incomplete) { - unsigned char *uristring; + char *uristring; /* XXX: I am a little puzzled whether we should only use the cache * entry's URI if it is valid. Hopefully always using it won't hurt. diff --git a/src/cache/cache.h b/src/cache/cache.h index 7ff59adb..032f1f85 100644 --- a/src/cache/cache.h +++ b/src/cache/cache.h @@ -39,12 +39,12 @@ struct cache_entry { struct uri *proxy_uri; /* Proxy identifier or same as @uri */ struct uri *redirect; /* Location we were redirected to */ - unsigned char *head; /* The protocol header */ - unsigned char *content_type; /* MIME type: <type> "/" <subtype> */ - unsigned char *last_modified; /* Latest modification date */ - unsigned char *etag; /* ETag value from the HTTP header */ - unsigned char *ssl_info; /* SSL ciphers used during transfer */ - unsigned char *encoding_info; /* Encoding used during transfer */ + char *head; /* The protocol header */ + char *content_type; /* MIME type: <type> "/" <subtype> */ + char *last_modified; /* Latest modification date */ + char *etag; /* ETag value from the HTTP header */ + char *ssl_info; /* SSL ciphers used during transfer */ + char *encoding_info; /* Encoding used during transfer */ unsigned int cache_id; /* Change each time entry is modified. */ @@ -81,7 +81,7 @@ struct fragment { off_t offset; off_t length; off_t real_length; - unsigned char data[1]; /* Must be last */ + char data[1]; /* Must be last */ }; @@ -114,7 +114,7 @@ struct cache_entry *get_redirected_cache_entry(struct uri *uri); * 1 if cache entry was enlarged, * 0 if only old data were overwritten. */ int add_fragment(struct cache_entry *cached, off_t offset, - const unsigned char *data, ssize_t length); + const char *data, ssize_t length); /* Defragments the cache entry and returns the resulting fragment containing the * complete source of all currently downloaded fragments. Returns NULL if @@ -138,7 +138,7 @@ void delete_cache_entry(struct cache_entry *cached); * Returns the URI being redirected to or NULL if allocation failed. */ struct uri * -redirect_cache(struct cache_entry *cached, unsigned char *location, +redirect_cache(struct cache_entry *cached, char *location, int get, int incomplete); /* The garbage collector trigger. If @whole is zero, remove unused cache diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 0501e1e4..51a7b612 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -45,7 +45,7 @@ is_cache_entry_used(struct listbox_item *item) return is_object_used((struct cache_entry *) item->udata); } -static unsigned char * +static char * get_cache_entry_text(struct listbox_item *item, struct terminal *term) { struct cache_entry *cached = item->udata; @@ -53,7 +53,7 @@ get_cache_entry_text(struct listbox_item *item, struct terminal *term) return get_uri_string(cached->uri, URI_PUBLIC); } -static unsigned char * +static char * get_cache_entry_info(struct listbox_item *item, struct terminal *term) { struct cache_entry *cached = item->udata; @@ -189,7 +189,7 @@ delete_cache_entry_item(struct listbox_item *item, int last) static enum listbox_match match_cache_entry(struct listbox_item *item, struct terminal *term, - unsigned char *text) + char *text) { struct cache_entry *cached = item->udata; @@ -202,7 +202,7 @@ match_cache_entry(struct listbox_item *item, struct terminal *term, static enum listbox_match match_cache_entry_contents(struct listbox_item *item, struct terminal *term, - unsigned char *text) + char *text) { struct cache_entry *cached = item->udata; struct fragment *fragment = get_cache_fragment(cached); diff --git a/src/config/cmdline.c b/src/config/cmdline.c index 51aaf74d..3a11d161 100644 --- a/src/config/cmdline.c +++ b/src/config/cmdline.c @@ -41,10 +41,10 @@ /* Hack to handle URL extraction for -remote commands */ -static unsigned char *remote_url; +static char *remote_url; static enum retval -parse_options_(int argc, unsigned char *argv[], struct option *opt, +parse_options_(int argc, char *argv[], struct option *opt, LIST_OF(struct string_list_item) *url_list) { while (argc) { @@ -52,9 +52,9 @@ parse_options_(int argc, unsigned char *argv[], struct option *opt, if (argv[-1][0] == '-' && argv[-1][1]) { struct option *option; - unsigned char *argname = &argv[-1][1]; - unsigned char *oname = stracpy(argname); - unsigned char *err; + char *argname = &argv[-1][1]; + char *oname = stracpy(argname); + char *err; if (!oname) continue; @@ -64,7 +64,7 @@ parse_options_(int argc, unsigned char *argv[], struct option *opt, option = get_opt_rec(opt, argname); if (!option) option = get_opt_rec(opt, oname); if (!option) { - unsigned char *pos; + char *pos; oname++; /* the '-' */ /* Substitute '-' by '_'. This helps @@ -116,7 +116,7 @@ unknown_option: } enum retval -parse_options(int argc, unsigned char *argv[], +parse_options(int argc, char *argv[], LIST_OF(struct string_list_item) *url_list) { return parse_options_(argc, argv, cmdline_options, url_list); @@ -127,8 +127,8 @@ parse_options(int argc, unsigned char *argv[], Options handlers **********************************************************************/ -static unsigned char * -eval_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +eval_cmd(struct option *o, char ***argv, int *argc) { if (*argc < 1) return gettext("Parameter expected"); @@ -141,15 +141,15 @@ eval_cmd(struct option *o, unsigned char ***argv, int *argc) return NULL; } -static unsigned char * -forcehtml_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +forcehtml_cmd(struct option *o, char ***argv, int *argc) { safe_strncpy(get_opt_str("mime.default_type", NULL), "text/html", MAX_STR_LEN); return NULL; } -static unsigned char * -lookup_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +lookup_cmd(struct option *o, char ***argv, int *argc) { struct sockaddr_storage *addrs = NULL; int addrno, i; @@ -170,7 +170,7 @@ lookup_cmd(struct option *o, unsigned char ***argv, int *argc) for (i = 0; i < addrno; i++) { #ifdef CONFIG_IPV6 struct sockaddr_in6 addr = *((struct sockaddr_in6 *) &(addrs)[i]); - unsigned char p[INET6_ADDRSTRLEN]; + char p[INET6_ADDRSTRLEN]; if (! inet_ntop(addr.sin6_family, (addr.sin6_family == AF_INET6 ? (void *) &addr.sin6_addr @@ -181,7 +181,7 @@ lookup_cmd(struct option *o, unsigned char ***argv, int *argc) printf("%s\n", p); #else struct sockaddr_in addr = *((struct sockaddr_in *) &(addrs)[i]); - unsigned char *p = (unsigned char *) &addr.sin_addr.s_addr; + char *p = (char *) &addr.sin_addr.s_addr; printf("%d.%d.%d.%d\n", (int) p[0], (int) p[1], (int) p[2], (int) p[3]); @@ -210,12 +210,12 @@ enum remote_method_enum { }; struct remote_method { - unsigned char *name; + char *name; enum remote_method_enum type; }; -static unsigned char * -remote_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +remote_cmd(struct option *o, char ***argv, int *argc) { struct remote_method remote_methods[] = { { "openURL", REMOTE_METHOD_OPENURL }, @@ -227,9 +227,9 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc) { "search", REMOTE_METHOD_SEARCH }, { NULL, REMOTE_METHOD_NOT_SUPPORTED }, }; - unsigned char *command, *arg, *argend, *argstring; + char *command, *arg, *argend, *argstring; int method, len = 0; - unsigned char *remote_argv[10]; + char *remote_argv[10]; int remote_argc; if (*argc < 1) return gettext("Parameter expected"); @@ -265,7 +265,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc) remote_argc = 0; do { - unsigned char *start, *end; + char *start, *end; if (remote_argc > sizeof_array(remote_argv)) { mem_free(argstring); @@ -325,7 +325,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc) } while (*arg); for (method = 0; remote_methods[method].name; method++) { - unsigned char *name = remote_methods[method].name; + char *name = remote_methods[method].name; if (!c_strlcasecmp(command, len, name, -1)) break; @@ -340,7 +340,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc) } if (remote_argc == 2) { - unsigned char *where = remote_argv[1]; + char *where = remote_argv[1]; if (strstr((const char *)where, "new-window")) { remote_session_flags |= SES_REMOTE_NEW_WINDOW; @@ -423,8 +423,8 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc) return NULL; } -static unsigned char * -version_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +version_cmd(struct option *o, char ***argv, int *argc) { printf("%s\n", full_static_version); fflush(stdout); @@ -444,7 +444,7 @@ version_cmd(struct option *o, unsigned char ***argv, int *argc) #define gettext_nonempty(x) (*(x) ? gettext(x) : (x)) -static void print_option_desc(const unsigned char *desc) +static void print_option_desc(const char *desc) { struct string wrapped; static const struct string indent = INIT_STRING(" ", 12); @@ -466,25 +466,25 @@ static void print_option_desc(const unsigned char *desc) done_string(&wrapped); } -static void print_full_help_outer(struct option *tree, unsigned char *path); +static void print_full_help_outer(struct option *tree, char *path); static void -print_full_help_inner(struct option *tree, unsigned char *path, +print_full_help_inner(struct option *tree, char *path, int trees) { struct option *option; - unsigned char saved[MAX_STR_LEN]; - unsigned char *savedpos = saved; + char saved[MAX_STR_LEN]; + char *savedpos = saved; *savedpos = 0; foreach (option, *tree->value.tree) { enum option_type type = option->type; - unsigned char *help; - unsigned char *capt = option->capt; - unsigned char *desc = (option->desc && *option->desc) - ? (unsigned char *) gettext(option->desc) - : (unsigned char *) "N/A"; + char *help; + char *capt = option->capt; + char *desc = (option->desc && *option->desc) + ? (char *) gettext(option->desc) + : (char *) "N/A"; if (trees != (type == OPT_TREE)) continue; @@ -496,7 +496,7 @@ print_full_help_inner(struct option *tree, unsigned char *path, continue; if (!capt && !c_strncasecmp(option->name, "_template_", 10)) - capt = (unsigned char *) N_("Template option folder"); + capt = (char *) N_("Template option folder"); if (!capt) { int len = strlen(option->name); @@ -543,7 +543,7 @@ print_full_help_inner(struct option *tree, unsigned char *path, case OPT_COLOR: { color_T color = option->value.color; - unsigned char hexcolor[8]; + char hexcolor[8]; printf(gettext("(default: %s)"), get_color_string(color, hexcolor)); @@ -599,7 +599,7 @@ print_full_help_inner(struct option *tree, unsigned char *path, } static void -print_full_help_outer(struct option *tree, unsigned char *path) +print_full_help_outer(struct option *tree, char *path) { print_full_help_inner(tree, path, 0); print_full_help_inner(tree, path, 1); @@ -612,17 +612,17 @@ print_short_help(void) struct option *option; struct string string = NULL_STRING; struct string *saved = NULL; - unsigned char align[ALIGN_WIDTH]; + char align[ALIGN_WIDTH]; /* Initialize @space used to align captions. */ memset(align, ' ', sizeof(align) - 1); align[sizeof(align) - 1] = 0; foreach (option, *cmdline_options->value.tree) { - unsigned char *capt; - unsigned char *help; - unsigned char *info = saved ? saved->source - : (unsigned char *) ""; + char *capt; + char *help; + char *info = saved ? saved->source + : (char *) ""; int len = strlen(option->name); /* Avoid printing compatibility options */ @@ -666,10 +666,10 @@ print_short_help(void) #undef gettext_nonempty -static unsigned char * -printhelp_cmd(struct option *option, unsigned char ***argv, int *argc) +static char * +printhelp_cmd(struct option *option, char ***argv, int *argc) { - unsigned char *lineend = strchr((const char *)full_static_version, '\n'); + char *lineend = strchr((const char *)full_static_version, '\n'); if (lineend) *lineend = '\0'; @@ -693,10 +693,10 @@ printhelp_cmd(struct option *option, unsigned char ***argv, int *argc) return ""; } -static unsigned char * -redir_cmd(struct option *option, unsigned char ***argv, int *argc) +static char * +redir_cmd(struct option *option, char ***argv, int *argc) { - unsigned char *target; + char *target; /* I can't get any dirtier. --pasky */ @@ -732,10 +732,10 @@ redir_cmd(struct option *option, unsigned char ***argv, int *argc) return NULL; } -static unsigned char * -printconfigdump_cmd(struct option *option, unsigned char ***argv, int *argc) +static char * +printconfigdump_cmd(struct option *option, char ***argv, int *argc) { - unsigned char *config_string; + char *config_string; /* Print all. */ get_opt_int("config.saving_style", NULL) = 2; diff --git a/src/config/cmdline.h b/src/config/cmdline.h index 5d96c648..f06c2223 100644 --- a/src/config/cmdline.h +++ b/src/config/cmdline.h @@ -8,7 +8,7 @@ extern "C" { #endif -enum retval parse_options(int, unsigned char *[], +enum retval parse_options(int, char *[], LIST_OF(struct string_list_item) *); #ifdef __cplusplus diff --git a/src/config/conf.c b/src/config/conf.c index 26fbc4c9..b5b593a6 100644 --- a/src/config/conf.c +++ b/src/config/conf.c @@ -60,7 +60,7 @@ struct conf_parsing_pos { /** Points to the next character to be parsed from the * configuration file. */ - unsigned char *look; + char *look; /** The line number corresponding to #look. This is * shown in error messages. */ @@ -78,11 +78,11 @@ struct conf_parsing_state { * to the mirror string. Otherwise, @c mirrored is not used. * * @invariant @c mirrored @<= @c pos.look */ - unsigned char *mirrored; + char *mirrored; /** File name for error messages. If NULL then do not display * error messages. */ - const unsigned char *filename; + const char *filename; }; /** Tell the user about an error in the configuration file. @@ -90,7 +90,7 @@ struct conf_parsing_state { static enum parse_error show_parse_error(const struct conf_parsing_state *state, enum parse_error err) { - static const unsigned char error_msg[][40] = { + static const char error_msg[][40] = { "no error", /* ERROR_NONE */ "unknown command", /* ERROR_COMMAND */ "parse error", /* ERROR_PARSE */ @@ -110,7 +110,7 @@ show_parse_error(const struct conf_parsing_state *state, enum parse_error err) static void skip_white(struct conf_parsing_pos *pos) { - unsigned char *start = pos->look; + char *start = pos->look; while (*start) { while (isspace(*start)) { @@ -202,12 +202,12 @@ 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) { - const unsigned char *domain_orig = NULL; + const char *domain_orig = NULL; size_t domain_len = 0; - unsigned char *domain_copy = NULL; - const unsigned char *optname_orig; + char *domain_copy = NULL; + const char *optname_orig; size_t optname_len; - unsigned char *optname_copy; + char *optname_copy; skip_white(&state->pos); if (!*state->pos.look) return show_parse_error(state, ERROR_PARSE); @@ -252,7 +252,7 @@ parse_set_common(struct option *opt_tree, struct conf_parsing_state *state, /* Option value */ { struct option *opt; - unsigned char *val; + char *val; const struct conf_parsing_pos pos_before_value = state->pos; if (want_domain && *domain_copy) { @@ -403,9 +403,9 @@ static enum parse_error parse_unset(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf) { - const unsigned char *optname_orig; + const char *optname_orig; size_t optname_len; - unsigned char *optname_copy; + char *optname_copy; skip_white(&state->pos); if (!*state->pos.look) return show_parse_error(state, ERROR_PARSE); @@ -480,7 +480,7 @@ static enum parse_error parse_bind(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf) { - unsigned char *keymap, *keystroke, *action; + char *keymap, *keystroke, *action; enum parse_error err = ERROR_NONE; struct conf_parsing_pos before_error; @@ -550,7 +550,7 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state, /* Mirror what we already have. If the keystroke has * been unbound, then act_str is simply "none" and * this does not require special handling. */ - unsigned char *act_str = bind_act(keymap, keystroke); + char *act_str = bind_act(keymap, keystroke); if (act_str) { add_bytes_to_string(mirror, state->mirrored, @@ -566,14 +566,14 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state, return err; } -static int load_config_file(unsigned char *, unsigned char *, struct option *, +static int load_config_file(char *, char *, struct option *, 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) { - unsigned char *fname; + char *fname; struct string dumbstring; struct conf_parsing_pos before_error; @@ -603,7 +603,7 @@ parse_include(struct option *opt_tree, struct conf_parsing_state *state, * rarely-used option ;). */ /* XXX: We should try CONFDIR/<file> when proceeding * CONFDIR/<otherfile> ;). --pasky */ - if (load_config_file(fname[0] == '/' ? (unsigned char *) "" + if (load_config_file(fname[0] == '/' ? (char *) "" : elinks_home, fname, opt_tree, mirror ? &dumbstring : NULL, 1)) { @@ -619,7 +619,7 @@ parse_include(struct option *opt_tree, struct conf_parsing_state *state, struct parse_handler { - const unsigned char *command; + const char *command; enum parse_error (*handler)(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf); @@ -673,7 +673,7 @@ parse_config_command(struct option *options, struct conf_parsing_state *state, #ifdef CONFIG_EXMODE enum parse_error -parse_config_exmode_command(unsigned char *cmd) +parse_config_exmode_command(char *cmd) { struct conf_parsing_state state = {{ 0 }}; @@ -687,8 +687,8 @@ parse_config_exmode_command(unsigned char *cmd) #endif /* CONFIG_EXMODE */ void -parse_config_file(struct option *options, unsigned char *name, - unsigned char *file, struct string *mirror, +parse_config_file(struct option *options, char *name, + char *file, struct string *mirror, int is_system_conf) { struct conf_parsing_state state = {{ 0 }}; @@ -761,11 +761,11 @@ parse_config_file(struct option *options, unsigned char *name, -static unsigned char * -read_config_file(unsigned char *name) +static char * +read_config_file(char *name) { #define FILE_BUF 1024 - unsigned char cfg_buffer[FILE_BUF]; + char cfg_buffer[FILE_BUF]; struct string string; int fd; ssize_t r; @@ -796,21 +796,21 @@ read_config_file(unsigned char *name) /* Return 0 on success. */ static int -load_config_file(unsigned char *prefix, unsigned char *name, +load_config_file(char *prefix, char *name, struct option *options, struct string *mirror, int is_system_conf) { - unsigned char *config_str, *config_file; + char *config_str, *config_file; config_file = straconcat(prefix, STRING_DIR_SEP, name, - (unsigned char *) NULL); + (char *) NULL); if (!config_file) return 1; config_str = read_config_file(config_file); if (!config_str) { mem_free(config_file); config_file = straconcat(prefix, STRING_DIR_SEP, ".", name, - (unsigned char *) NULL); + (char *) NULL); if (!config_file) return 2; config_str = read_config_file(config_file); @@ -830,7 +830,7 @@ load_config_file(unsigned char *prefix, unsigned char *name, } static void -load_config_from(unsigned char *file, struct option *tree) +load_config_from(char *file, struct option *tree) { load_config_file(CONFDIR, file, tree, NULL, 1); load_config_file(empty_string_or_(elinks_home), file, tree, NULL, 0); @@ -848,8 +848,8 @@ static int indentation = 2; /* 0 -> none, 1 -> only option full name+type, 2 -> only desc, 3 -> both */ static int comments = 3; -static inline unsigned char * -conf_i18n(unsigned char *s, int i18n) +static inline char * +conf_i18n(char *s, int i18n) { if (i18n) return gettext(s); return s; @@ -864,11 +864,11 @@ add_indent_to_string(struct string *string, int depth) } struct string * -wrap_option_desc(struct string *out, const unsigned char *src, +wrap_option_desc(struct string *out, const char *src, const struct string *indent, int maxwidth) { - const unsigned char *last_space = NULL; - const unsigned char *uncopied = src; + const char *last_space = NULL; + const char *uncopied = src; int width = 0; /* TODO: multibyte or fullwidth characters */ @@ -909,7 +909,7 @@ static void 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); + char *desc_i18n = conf_i18n(option->desc, i18n); struct string indent; if (!init_string(&indent)) return; @@ -923,11 +923,11 @@ out_of_memory: done_string(&indent); } -static unsigned char *smart_config_output_fn_domain; +static char *smart_config_output_fn_domain; static void smart_config_output_fn(struct string *string, struct option *option, - unsigned char *path, int depth, int do_print_comment, + char *path, int depth, int do_print_comment, int action, int i18n) { if (option->type == OPT_ALIAS) @@ -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, char *text) { int n = strlen(text) + 2; @@ -1012,8 +1012,8 @@ add_cfg_header_to_string(struct string *string, unsigned char *text) add_to_string(string, "#\n\n"); } -unsigned char * -create_config_string(unsigned char *prefix, unsigned char *name) +char * +create_config_string(char *prefix, char *name) { struct option *options = config_options; struct string config; @@ -1130,23 +1130,23 @@ get_me_out: } static int -write_config_file(unsigned char *prefix, unsigned char *name, +write_config_file(char *prefix, char *name, struct terminal *term) { int ret = -1; struct secure_save_info *ssi; - unsigned char *config_file = NULL; - unsigned char *cfg_str = create_config_string(prefix, name); + char *config_file = NULL; + char *cfg_str = create_config_string(prefix, name); int prefixlen = strlen(prefix); int prefix_has_slash = (prefixlen && dir_sep(prefix[prefixlen - 1])); int name_has_slash = dir_sep(name[0]); - unsigned char *slash = name_has_slash || prefix_has_slash ? "" : STRING_DIR_SEP; + char *slash = name_has_slash || prefix_has_slash ? "" : STRING_DIR_SEP; if (!cfg_str) return -1; if (name_has_slash && prefix_has_slash) name++; - config_file = straconcat(prefix, slash, name, (unsigned char *) NULL); + config_file = straconcat(prefix, slash, name, (char *) NULL); if (!config_file) goto free_cfg_str; ssi = secure_open(config_file); diff --git a/src/config/conf.h b/src/config/conf.h index 173a5d20..c770c655 100644 --- a/src/config/conf.h +++ b/src/config/conf.h @@ -19,17 +19,17 @@ enum parse_error { void load_config(void); #ifdef CONFIG_EXMODE -enum parse_error parse_config_exmode_command(unsigned char *cmd); +enum parse_error parse_config_exmode_command(char *cmd); #endif -void parse_config_file(struct option *options, unsigned char *name, - unsigned char *file, struct string *mirror, +void parse_config_file(struct option *options, char *name, + 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); +char * +create_config_string(char *prefix, char *name); -struct string *wrap_option_desc(struct string *out, const unsigned char *src, +struct string *wrap_option_desc(struct string *out, const char *src, const struct string *indent, int maxwidth); #ifdef __cplusplus diff --git a/src/config/dialogs.c b/src/config/dialogs.c index 6a8c7972..273b8829 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -39,12 +39,12 @@ disable_success_msgbox(void *dummy) } void -write_config_dialog(struct terminal *term, unsigned char *config_file, +write_config_dialog(struct terminal *term, char *config_file, int secsave_error, int stdio_error) { /* [gettext_accelerator_context(write_config_dialog)] */ - unsigned char *errmsg = NULL; - unsigned char *strerr; + char *errmsg = NULL; + char *strerr; if (secsave_error == SS_ERR_NONE && !stdio_error) { if (!get_opt_bool("ui.success_msgbox", NULL)) return; @@ -63,7 +63,7 @@ write_config_dialog(struct terminal *term, unsigned char *config_file, if (stdio_error > 0) errmsg = straconcat(strerr, " (", strerror(stdio_error), ")", - (unsigned char *) NULL); + (char *) NULL); info_box(term, MSGBOX_FREE_TEXT, N_("Write config error"), ALIGN_CENTER, @@ -99,7 +99,7 @@ is_option_used(struct listbox_item *item) return is_object_used((struct option *) item->udata); } -static unsigned char * +static char * get_range_string(struct option *option) { struct string info; @@ -114,25 +114,25 @@ get_range_string(struct option *option) return info.source; } -static unsigned char * +static char * get_option_text(struct listbox_item *item, struct terminal *term) { struct option *option = item->udata; - unsigned char *desc = option->capt ? option->capt : option->name; + char *desc = option->capt ? option->capt : option->name; if (option->flags & OPT_TOUCHED) return straconcat(_(desc, term), " (", _("modified", term), ")", - (unsigned char *) NULL); + (char *) NULL); return stracpy(_(desc, term)); } -static unsigned char * +static char * get_option_info(struct listbox_item *item, struct terminal *term) { struct option *option = item->udata; - unsigned char *desc, *type; + char *desc, *type; struct string info; if (!init_string(&info)) return NULL; @@ -143,7 +143,7 @@ get_option_info(struct listbox_item *item, struct terminal *term) if (option->type == OPT_TREE) { type = straconcat(type, " ", _("(expand by pressing space)", term), - (unsigned char *) NULL); + (char *) NULL); } add_format_to_string(&info, "\n%s: %s", _("Type", term), type); @@ -153,7 +153,7 @@ get_option_info(struct listbox_item *item, struct terminal *term) } if (option_types[option->type].write) { - unsigned char *range; + char *range; struct string value; if (!init_string(&value)) { @@ -181,7 +181,7 @@ get_option_info(struct listbox_item *item, struct terminal *term) } - desc = _(option->desc ? option->desc : (unsigned char *) "N/A", term); + desc = _(option->desc ? option->desc : (char *) "N/A", term); if (*desc) add_format_to_string(&info, "\n\n%s:\n%s", _("Description", term), desc); @@ -202,7 +202,7 @@ get_option_root(struct listbox_item *item) static enum listbox_match match_option(struct listbox_item *item, struct terminal *term, - unsigned char *text) + char *text) { struct option *option = item->udata; @@ -268,8 +268,8 @@ check_valid_option(struct dialog_data *dlg_data, struct widget_data *widget_data struct terminal *term = dlg_data->win->term; struct option *option = dlg_data->dlg->udata; struct session *ses = dlg_data->dlg->udata2; - unsigned char *value = widget_data->cdata; - unsigned char *chinon; + char *value = widget_data->cdata; + char *chinon; int dummy_line = 0; commandline = 1; @@ -301,7 +301,7 @@ build_edit_dialog(struct terminal *term, struct session *ses, /* [gettext_accelerator_context(.build_edit_dialog)] */ #define EDIT_WIDGETS_COUNT 5 struct dialog *dlg; - unsigned char *value, *name, *desc, *range; + char *value, *name, *desc, *range; struct string tvalue; if (!init_string(&tvalue)) return; @@ -329,18 +329,18 @@ build_edit_dialog(struct terminal *term, struct session *ses, name = straconcat(_("Name", term), ": ", option->name, "\n", _("Type", term), ": ", _(option_types[option->type].name, term), - (unsigned char *) NULL); + (char *) NULL); desc = straconcat(_("Description", term), ": \n", _(option->desc ? option->desc - : (unsigned char *) "N/A", term), - (unsigned char *) NULL); + : (char *) "N/A", term), + (char *) NULL); range = get_range_string(option); if (range) { if (*range) { - unsigned char *tmp; + char *tmp; tmp = straconcat(name, " ", range, - (unsigned char *) NULL); + (char *) NULL); if (tmp) { mem_free(name); name = tmp; @@ -406,7 +406,7 @@ struct add_option_to_tree_ctx { }; static void -add_option_to_tree(void *data, unsigned char *name) +add_option_to_tree(void *data, char *name) { struct add_option_to_tree_ctx *ctx = data; struct option *old = get_opt_rec_real(ctx->option, name); @@ -422,7 +422,7 @@ add_option_to_tree(void *data, unsigned char *name) static widget_handler_status_T check_option_name(struct dialog_data *dlg_data, struct widget_data *widget_data) { - unsigned char *p; + char *p; for (p = widget_data->cdata; *p; p++) if (!is_option_name_char(*p)) { @@ -632,7 +632,7 @@ is_keybinding_used(struct listbox_item *item) return is_object_used((struct keybinding *) item->udata); } -static unsigned char * +static char * get_keybinding_text(struct listbox_item *item, struct terminal *term) { struct keybinding *keybinding = item->udata; @@ -655,11 +655,11 @@ get_keybinding_text(struct listbox_item *item, struct terminal *term) return info.source; } -static unsigned char * +static char * get_keybinding_info(struct listbox_item *item, struct terminal *term) { struct keybinding *keybinding = item->udata; - unsigned char *action, *keymap; + char *action, *keymap; struct string info; if (item->depth < 2) return NULL; @@ -698,10 +698,10 @@ get_keybinding_root(struct listbox_item *item) static enum listbox_match match_keybinding(struct listbox_item *item, struct terminal *term, - unsigned char *text) + char *text) { const struct action *action = item->udata; - unsigned char *desc; + char *desc; if (item->depth != 1) return LISTBOX_MATCH_IMPOSSIBLE; @@ -783,7 +783,7 @@ really_really_add_keybinding(void *data) } static void -really_add_keybinding(void *data, unsigned char *keystroke) +really_add_keybinding(void *data, char *keystroke) { /* [gettext_accelerator_context(.really_add_keybinding.yn)] */ struct kbdbind_add_hop *hop = data; @@ -834,7 +834,7 @@ static widget_handler_status_T check_keystroke(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct kbdbind_add_hop *hop = dlg_data->dlg->udata2; - unsigned char *keystroke = widget_data->cdata; + char *keystroke = widget_data->cdata; if (parse_keystroke(keystroke, &hop->kbd) >= 0) return EVENT_PROCESSED; @@ -853,7 +853,7 @@ push_kbdbind_add_button(struct dialog_data *dlg_data, struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct listbox_item *item = box->sel; struct kbdbind_add_hop *hop; - unsigned char *text; + char *text; if (!item || !item->depth) { info_box(term, 0, N_("Add keybinding"), ALIGN_CENTER, diff --git a/src/config/dialogs.h b/src/config/dialogs.h index fd361478..60fe3b5b 100644 --- a/src/config/dialogs.h +++ b/src/config/dialogs.h @@ -14,7 +14,7 @@ extern "C" { extern struct hierbox_browser option_browser; extern struct hierbox_browser keybinding_browser; -void write_config_dialog(struct terminal *term, unsigned char *config_file, +void write_config_dialog(struct terminal *term, char *config_file, int secsave_error, int stdio_error); void options_manager(struct session *); void keybinding_manager(struct session *); diff --git a/src/config/domain.c b/src/config/domain.c index 897cc5f1..6dabb5b0 100644 --- a/src/config/domain.c +++ b/src/config/domain.c @@ -24,8 +24,8 @@ INIT_LIST_OF(struct domain_tree, domain_trees); * match the given domain-name. Return the option from the the shadow tree * that best matches the given domain name. */ static struct option * -get_domain_option(unsigned char *domain_name, int domain_len, - unsigned char *name) +get_domain_option(char *domain_name, int domain_len, + char *name) { struct option *opt, *longest_match_opt = NULL; struct domain_tree *longest_match = NULL; @@ -46,7 +46,7 @@ get_domain_option(unsigned char *domain_name, int domain_len, } struct option * -get_domain_option_from_session(unsigned char *name, struct session *ses) +get_domain_option_from_session(char *name, struct session *ses) { struct uri *uri; @@ -66,7 +66,7 @@ get_domain_option_from_session(unsigned char *name, struct session *ses) /* Return the shadow shadow tree for the given domain name, and * if the domain does not yet have a shadow tree, create it. */ struct option * -get_domain_tree(unsigned char *domain_name) +get_domain_tree(char *domain_name) { struct domain_tree *domain; int domain_len; diff --git a/src/config/domain.h b/src/config/domain.h index 09b20a88..33f7d86e 100644 --- a/src/config/domain.h +++ b/src/config/domain.h @@ -18,14 +18,14 @@ struct domain_tree { int len; - unsigned char name[1]; /* Must be at end of struct. */ + char name[1]; /* Must be at end of struct. */ }; extern LIST_OF(struct domain_tree) domain_trees; -struct option *get_domain_tree(unsigned char *); +struct option *get_domain_tree(char *); -struct option *get_domain_option_from_session(unsigned char *, +struct option *get_domain_option_from_session(char *, struct session *); void done_domain_trees(void); diff --git a/src/config/home.c b/src/config/home.c index 2af61a63..7b5cc228 100644 --- a/src/config/home.c +++ b/src/config/home.c @@ -24,11 +24,11 @@ #include "util/string.h" -unsigned char *elinks_home = NULL; +char *elinks_home = NULL; int first_use = 0; static inline void -strip_trailing_dir_sep(unsigned char *path) +strip_trailing_dir_sep(char *path) { int i; @@ -39,18 +39,18 @@ strip_trailing_dir_sep(unsigned char *path) path[i + 1] = 0; } -static unsigned char * -test_confdir(unsigned char *home, unsigned char *path, - unsigned char *error_message) +static char * +test_confdir(char *home, char *path, + char *error_message) { struct stat st; - unsigned char *confdir; + char *confdir; if (!path || !*path) return NULL; if (home && *home && !dir_sep(*path)) confdir = straconcat(home, STRING_DIR_SEP, path, - (unsigned char *) NULL); + (char *) NULL); else confdir = stracpy(path); @@ -86,11 +86,11 @@ test_confdir(unsigned char *home, unsigned char *path, } /* TODO: Check possibility to use <libgen.h> dirname. */ -static unsigned char * -elinks_dirname(unsigned char *path) +static char * +elinks_dirname(char *path) { int i; - unsigned char *dir; + char *dir; if (!path) return NULL; @@ -106,12 +106,12 @@ elinks_dirname(unsigned char *path) return dir; } -static unsigned char * +static char * get_home(void) { - unsigned char *home_elinks; - unsigned char *envhome = getenv("HOME"); - unsigned char *home = NULL; + char *home_elinks; + char *envhome = getenv("HOME"); + char *home = NULL; if (!home && envhome) home = stracpy(envhome); diff --git a/src/config/home.h b/src/config/home.h index a59b499f..7b7c2c15 100644 --- a/src/config/home.h +++ b/src/config/home.h @@ -5,7 +5,7 @@ extern "C" { #endif -extern unsigned char *elinks_home; +extern char *elinks_home; extern int first_use; void init_home(void); diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index f1736ebf..6be28459 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -231,7 +231,7 @@ kbd_act_lookup(enum keymap_id keymap_id, action_id_T action_id) } struct keybinding * -kbd_nm_lookup(enum keymap_id keymap_id, unsigned char *name) +kbd_nm_lookup(enum keymap_id keymap_id, char *name) { action_id_T action_id = get_action_from_string(keymap_id, name); @@ -241,7 +241,7 @@ kbd_nm_lookup(enum keymap_id keymap_id, unsigned char *name) } static struct keybinding * -kbd_stroke_lookup(enum keymap_id keymap_id, const unsigned char *keystroke_str) +kbd_stroke_lookup(enum keymap_id keymap_id, const char *keystroke_str) { struct term_event_keyboard kbd; @@ -260,7 +260,7 @@ kbd_stroke_lookup(enum keymap_id keymap_id, const unsigned char *keystroke_str) static const struct action * get_action_from_keystroke(enum keymap_id keymap_id, - const unsigned char *keystroke_str) + const char *keystroke_str) { struct keybinding *keybinding = kbd_stroke_lookup(keymap_id, keystroke_str); @@ -268,9 +268,9 @@ get_action_from_keystroke(enum keymap_id keymap_id, return keybinding ? get_action(keymap_id, keybinding->action_id) : NULL; } -unsigned char * +char * get_action_name_from_keystroke(enum keymap_id keymap_id, - const unsigned char *keystroke_str) + const char *keystroke_str) { const struct action *action = get_action_from_keystroke(keymap_id, keystroke_str); @@ -279,7 +279,7 @@ get_action_name_from_keystroke(enum keymap_id keymap_id, } action_id_T -get_action_from_string(enum keymap_id keymap_id, unsigned char *str) +get_action_from_string(enum keymap_id keymap_id, char *str) { const struct action *action; @@ -303,7 +303,7 @@ get_action(enum keymap_id keymap_id, action_id_T action_id) return NULL; } -unsigned char * +char * get_action_name(enum keymap_id keymap_id, action_id_T action_id) { const struct action *action = get_action(keymap_id, action_id); @@ -311,7 +311,7 @@ get_action_name(enum keymap_id keymap_id, action_id_T action_id) return action ? action->str : NULL; } -static unsigned char * +static char * get_action_desc(enum keymap_id keymap_id, action_id_T action_id) { const struct action *action = get_action(keymap_id, action_id); @@ -330,7 +330,7 @@ get_keymap(enum keymap_id keymap_id) } static enum keymap_id -get_keymap_id(unsigned char *keymap_str) +get_keymap_id(char *keymap_str) { int keymap_id; @@ -341,7 +341,7 @@ get_keymap_id(unsigned char *keymap_str) return KEYMAP_INVALID; } -unsigned char * +char * get_keymap_name(enum keymap_id keymap_id) { return get_keymap(keymap_id)->str; @@ -349,7 +349,7 @@ get_keymap_name(enum keymap_id keymap_id) struct named_key { - const unsigned char *str; + const char *str; term_event_key_T num; }; @@ -385,7 +385,7 @@ static const struct named_key key_table[] = { }; term_event_key_T -read_key(const unsigned char *key_str) +read_key(const char *key_str) { const struct named_key *key; @@ -406,7 +406,7 @@ read_key(const unsigned char *key_str) * This function does not support ::KBD_MOD_PASTE, because keystrokes * that include it should never be bound to actions. */ int -parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd) +parse_keystroke(const char *s, struct term_event_keyboard *kbd) { kbd->modifier = KBD_MOD_NONE; while (1) { @@ -470,8 +470,8 @@ void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, int escape) { - unsigned char key_buffer[3] = "\\x"; - const unsigned char *key_string = NULL; + char key_buffer[3] = "\\x"; + const char *key_string = NULL; const struct named_key *key; if (kbd->key == KBD_UNDEF) return; @@ -512,7 +512,7 @@ add_keystroke_action_to_string(struct string *string, action_id_T action_id, add_keystroke_to_string(string, &keybinding->kbd, 0); } -unsigned char * +char * get_keystroke(action_id_T action_id, enum keymap_id keymap_id) { struct string keystroke; @@ -540,7 +540,7 @@ add_actions_to_string(struct string *string, action_id_T action_ids[], for (i = 0; action_ids[i] != ACT_MAIN_NONE; i++) { struct keybinding *keybinding = kbd_act_lookup(keymap_id, action_ids[i]); int keystrokelen = string->length; - unsigned char *desc = get_action_desc(keymap_id, action_ids[i]); + char *desc = get_action_desc(keymap_id, action_ids[i]); if (!keybinding) continue; @@ -582,8 +582,8 @@ free_keymaps(struct module *xxx) */ #ifdef CONFIG_SCRIPTING -static unsigned char * -bind_key_to_event(unsigned char *ckmap, const unsigned char *ckey, int event) +static char * +bind_key_to_event(char *ckmap, const char *ckey, int event) { struct term_event_keyboard kbd; action_id_T action_id; @@ -605,8 +605,8 @@ bind_key_to_event(unsigned char *ckmap, const unsigned char *ckey, int event) } int -bind_key_to_event_name(unsigned char *ckmap, const unsigned char *ckey, - unsigned char *event_name, unsigned char **err) +bind_key_to_event_name(char *ckmap, const char *ckey, + char *event_name, char **err) { int event_id; @@ -849,7 +849,7 @@ add_default_keybindings(void) */ struct action_alias { - const unsigned char *str; + const char *str; action_id_T action_id; }; @@ -887,7 +887,7 @@ static const struct action_alias *action_aliases[KEYMAP_MAX] = { }; static action_id_T -get_aliased_action(enum keymap_id keymap_id, unsigned char *action_str) +get_aliased_action(enum keymap_id keymap_id, char *action_str) { assert(keymap_id >= 0 && keymap_id < KEYMAP_MAX); @@ -904,8 +904,8 @@ get_aliased_action(enum keymap_id keymap_id, unsigned char *action_str) /* Return 0 when ok, something strange otherwise. */ int -bind_do(unsigned char *keymap_str, const unsigned char *keystroke_str, - unsigned char *action_str, int is_system_conf) +bind_do(char *keymap_str, const char *keystroke_str, + char *action_str, int is_system_conf) { enum keymap_id keymap_id; action_id_T action_id; @@ -927,11 +927,11 @@ bind_do(unsigned char *keymap_str, const unsigned char *keystroke_str, return 0; } -unsigned char * -bind_act(unsigned char *keymap_str, const unsigned char *keystroke_str) +char * +bind_act(char *keymap_str, const char *keystroke_str) { enum keymap_id keymap_id; - unsigned char *action; + char *action; struct keybinding *keybinding; keymap_id = get_keymap_id(keymap_str); @@ -946,15 +946,15 @@ bind_act(unsigned char *keymap_str, const unsigned char *keystroke_str) return NULL; keybinding->flags |= KBDB_WATERMARK; - return straconcat("\"", action, "\"", (unsigned char *) NULL); + return straconcat("\"", action, "\"", (char *) NULL); } static void single_bind_config_string(struct string *file, enum keymap_id keymap_id, struct keybinding *keybinding) { - unsigned char *keymap_str = get_keymap_name(keymap_id); - unsigned char *action_str = get_action_name(keymap_id, keybinding->action_id); + char *keymap_str = get_keymap_name(keymap_id); + char *action_str = get_action_name(keymap_id, keybinding->action_id); if (!keymap_str || !action_str || action_str[0] == ' ') return; diff --git a/src/config/kbdbind.h b/src/config/kbdbind.h index f46ce9d2..14178110 100644 --- a/src/config/kbdbind.h +++ b/src/config/kbdbind.h @@ -26,10 +26,10 @@ enum keymap_id { }; struct action { - unsigned char *str; + char *str; action_id_T num; enum keymap_id keymap_id; - unsigned char *desc; + char *desc; unsigned int flags; }; @@ -38,9 +38,9 @@ struct action_list { int num_actions; }; struct keymap { - unsigned char *str; + char *str; enum keymap_id keymap_id; - unsigned char *desc; + char *desc; }; enum action_flags { @@ -109,10 +109,10 @@ int keybinding_exists(enum keymap_id keymap_id, struct term_event_keyboard *kbd, void free_keybinding(struct keybinding *); const struct action *get_action(enum keymap_id keymap_id, action_id_T action_id); -unsigned char *get_action_name(enum keymap_id keymap_id, action_id_T action_id); -action_id_T get_action_from_string(enum keymap_id keymap_id, unsigned char *str); -unsigned char *get_action_name_from_keystroke(enum keymap_id keymap_id, - const unsigned char *keystroke_str); +char *get_action_name(enum keymap_id keymap_id, action_id_T action_id); +action_id_T get_action_from_string(enum keymap_id keymap_id, char *str); +char *get_action_name_from_keystroke(enum keymap_id keymap_id, + const char *keystroke_str); static inline unsigned int action_is_anonymous_safe(enum keymap_id keymap_id, action_id_T action_id) @@ -162,10 +162,10 @@ action_requires_form(enum keymap_id keymap_id, action_id_T action_id) return action && (action->flags & ACTION_REQUIRE_FORM); } -term_event_key_T read_key(const unsigned char *); -unsigned char *get_keymap_name(enum keymap_id); +term_event_key_T read_key(const char *); +char *get_keymap_name(enum keymap_id); -int parse_keystroke(const unsigned char *, struct term_event_keyboard *); +int parse_keystroke(const char *, struct term_event_keyboard *); 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); */ @@ -184,19 +184,19 @@ void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd action_id_T kbd_action(enum keymap_id, struct term_event *, int *); struct keybinding *kbd_ev_lookup(enum keymap_id, struct term_event_keyboard *kbd, int *); -struct keybinding *kbd_nm_lookup(enum keymap_id, unsigned char *); +struct keybinding *kbd_nm_lookup(enum keymap_id, char *); -int bind_do(unsigned char *, const unsigned char *, unsigned char *, int); -unsigned char *bind_act(unsigned char *, const unsigned char *); +int bind_do(char *, const char *, char *, int); +char *bind_act(char *, const char *); void bind_config_string(struct string *); #ifdef CONFIG_SCRIPTING -int bind_key_to_event_name(unsigned char *, const unsigned char *, unsigned char *, - unsigned char **); +int bind_key_to_event_name(char *, const char *, char *, + char **); #endif 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); +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[], enum keymap_id keymap_id, struct terminal *term); diff --git a/src/config/options.c b/src/config/options.c index e4f4ed9f..b3abdac5 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -68,7 +68,7 @@ static struct option options_root = INIT_OPTION( struct option *config_options; struct option *cmdline_options; -static void add_opt_rec(struct option *, unsigned char *, struct option *); +static void add_opt_rec(struct option *, char *, struct option *); static void free_options_tree(LIST_OF(struct option) *, int recursive); #ifdef CONFIG_DEBUG @@ -78,7 +78,7 @@ static void free_options_tree(LIST_OF(struct option) *, int recursive); #define bad_punct(c) (c != ')' && c != '>' && !isquote(c) && ispunct(c)) static void -check_caption(unsigned char *caption) +check_caption(char *caption) { int len; unsigned char c; @@ -106,7 +106,7 @@ check_caption(unsigned char *caption) #undef bad_punct static void -check_description(unsigned char *desc) +check_description(char *desc) { int len; unsigned char c; @@ -170,12 +170,12 @@ static int no_autocreate = 0; * * @relates option */ struct option * -get_opt_rec(struct option *tree, const unsigned char *name_) +get_opt_rec(struct option *tree, const char *name_) { struct option *option; - unsigned char *aname = stracpy(name_); - unsigned char *name = aname; - unsigned char *sep; + char *aname = stracpy(name_); + char *name = aname; + char *sep; if (!aname) return NULL; @@ -243,7 +243,7 @@ get_opt_rec(struct option *tree, const unsigned char *name_) * enabled. * @relates option */ struct option * -get_opt_rec_real(struct option *tree, const unsigned char *name) +get_opt_rec_real(struct option *tree, const char *name) { struct option *opt; @@ -282,9 +282,9 @@ indirect_option(struct option *alias) union option_value * get_opt_( #ifdef CONFIG_DEBUG - unsigned char *file, int line, enum option_type option_type, + char *file, int line, enum option_type option_type, #endif - struct option *tree, unsigned char *name, struct session *ses) + struct option *tree, char *name, struct session *ses) { struct option *opt = NULL; @@ -437,7 +437,7 @@ append: /** Add option to tree. * @relates option */ static void -add_opt_rec(struct option *tree, unsigned char *path, struct option *option) +add_opt_rec(struct option *tree, char *path, struct option *option) { int abi = 0; @@ -502,9 +502,9 @@ init_option_listbox_item(struct option *option) /*! @relates option */ struct option * -add_opt(struct option *tree, unsigned char *path, unsigned char *capt, - unsigned char *name, enum option_flags flags, enum option_type type, - long min, long max, longptr_T value, unsigned char *desc) +add_opt(struct option *tree, char *path, char *capt, + char *name, enum option_flags flags, enum option_type type, + long min, long max, longptr_T value, char *desc) { struct option *option = mem_calloc(1, sizeof(*option)); @@ -539,10 +539,10 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt, mem_free(option); return NULL; } - option->value.string = (unsigned char *) value; + option->value.string = (char *) value; break; case OPT_ALIAS: - option->value.string = (unsigned char *) value; + option->value.string = (char *) value; break; case OPT_BOOL: case OPT_INT: @@ -553,7 +553,7 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt, option->value.big_number = (long) value; /* FIXME: cast from void * */ break; case OPT_COLOR: - decode_color((unsigned char *) value, strlen((unsigned char *) value), + decode_color((char *) value, strlen((char *) value), &option->value.color); break; case OPT_COMMAND: @@ -1059,9 +1059,9 @@ check_nonempty_tree(LIST_OF(struct option) *options) void smart_config_string(struct string *str, int print_comment, int i18n, LIST_OF(struct option) *options, - unsigned char *path, int depth, + char *path, int depth, void (*fn)(struct string *, struct option *, - unsigned char *, int, int, int, int)) + char *, int, int, int, int)) { struct option *option; @@ -1202,7 +1202,7 @@ commit_option_values(struct option_resolver *resolvers, assert(resolvers && root && values && size); for (i = 0; i < size; i++) { - unsigned char *name = resolvers[i].name; + char *name = resolvers[i].name; struct option *option = get_opt_rec(root, name); int id = resolvers[i].id; @@ -1239,7 +1239,7 @@ checkout_option_values(struct option_resolver *resolvers, int i; for (i = 0; i < size; i++) { - unsigned char *name = resolvers[i].name; + char *name = resolvers[i].name; struct option *option = get_opt_rec(root, name); int id = resolvers[i].id; @@ -1273,7 +1273,7 @@ register_options(union option_info info[], struct option *tree) const struct option_init init = info[i].init; struct option *option = &info[i].option; - unsigned char *string; + char *string; *option = zero; option->name = init.name; diff --git a/src/config/options.h b/src/config/options.h index 234f7cb4..859ebb95 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -136,8 +136,8 @@ struct session; /* session/session.h */ * * @return NULL if successful, or a localized error string that the * caller will not free. */ -typedef unsigned char *option_command_fn_T(struct option *option, - unsigned char ***argv, int *argc); +typedef char *option_command_fn_T(struct option *option, + char ***argv, int *argc); union option_value { /** The ::OPT_TREE list_head is allocated. @@ -161,7 +161,7 @@ union option_value { * The ::OPT_ALIAS string is NOT allocated, has variable length * (option.max) and should remain untouched! It contains the full path to * the "real" / aliased option. */ - unsigned char *string; + char *string; }; @@ -190,13 +190,13 @@ typedef int (*change_hook_T)(struct session *session, struct option *current, struct option { OBJECT_HEAD(struct option); - unsigned char *name; + char *name; enum option_flags flags; enum option_type type; long min, max; union option_value value; - unsigned char *desc; - unsigned char *capt; + char *desc; + char *capt; struct option *root; @@ -224,7 +224,7 @@ extern void done_options(void); struct change_hook_info { - unsigned char *name; + char *name; change_hook_T change_hook; }; @@ -236,9 +236,9 @@ 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, - LIST_OF(struct option) *, unsigned char *, int, + LIST_OF(struct option) *, char *, int, void (*)(struct string *, struct option *, - unsigned char *, int, int, int, int)); + char *, int, int, int, int)); enum copy_option_flags { /* Do not create a listbox option for the new option. */ @@ -259,7 +259,7 @@ void mark_option_as_deleted(struct option *); /** Some minimal option cache */ struct option_resolver { int id; - unsigned char *name; + char *name; }; /** Update the visibility of the box item of each option @@ -295,14 +295,14 @@ extern void checkout_option_values(struct option_resolver *resolvers, * use get_opt_type() and add_opt_type(). For command line options, you want to * use get_opt_type_tree(cmdline_options, "option", NULL). */ -extern struct option *get_opt_rec(struct option *, const unsigned char *); -extern struct option *get_opt_rec_real(struct option *, const unsigned char *); +extern struct option *get_opt_rec(struct option *, const char *); +extern struct option *get_opt_rec_real(struct option *, const char *); struct option *indirect_option(struct option *); #ifdef CONFIG_DEBUG -extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *, struct session *); +extern union option_value *get_opt_(char *, int, enum option_type, struct option *, char *, struct session *); #define get_opt(tree, name, ses, type) get_opt_(__FILE__, __LINE__, type, tree, name, ses) #else -extern union option_value *get_opt_(struct option *, unsigned char *, struct session *); +extern union option_value *get_opt_(struct option *, char *, struct session *); #define get_opt(tree, name, ses, type) get_opt_(tree, name, ses) #endif @@ -330,9 +330,9 @@ extern union option_value *get_opt_(struct option *, unsigned char *, struct ses #define get_cmd_opt_color(name) get_opt_color_tree(cmdline_options, name, NULL) #define get_cmd_opt_tree(name) get_opt_tree_tree(cmdline_options, name, NULL) -extern struct option *add_opt(struct option *, unsigned char *, unsigned char *, - unsigned char *, enum option_flags, enum option_type, - long, long, longptr_T, unsigned char *); +extern struct option *add_opt(struct option *, char *, char *, + char *, enum option_flags, enum option_type, + long, long, longptr_T, char *); /** Check whether the character @a c may be used in the name of an * option. This does not allow the '.' used in multi-part names like @@ -350,7 +350,7 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *, #ifndef CONFIG_SMALL #define DESC(x) (x) #else -#define DESC(x) ((unsigned char *) "") +#define DESC(x) ((char *) "") #endif @@ -369,7 +369,7 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *, /*! @relates option */ #define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \ do { \ - unsigned char *ptr = mem_alloc(MAX_STR_LEN); \ + char *ptr = mem_alloc(MAX_STR_LEN); \ safe_strncpy(ptr, def, MAX_STR_LEN); \ add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \ } while (0) @@ -409,18 +409,18 @@ do { \ struct option_init { /** The name of the option tree where the option should be * registered. option.root is computed from this. */ - unsigned char *path; + char *path; /** The name of the option. This goes to option.name. */ - unsigned char *name; + char *name; /** The caption shown in the option manager. This goes to * option.capt. */ - unsigned char *capt; + char *capt; /** The long description shown when the user edits the option, * or NULL if not available. This goes to option.desc. */ - unsigned char *desc; + char *desc; /** Flags for the option. These go to option.flags. */ enum option_flags flags; diff --git a/src/config/opttypes.c b/src/config/opttypes.c index 02e7144b..54546ea9 100644 --- a/src/config/opttypes.c +++ b/src/config/opttypes.c @@ -29,10 +29,10 @@ * since you will parse the commandline _TWO TIMES_! Remember! :-) */ int commandline = 0; -static unsigned char * -gen_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +gen_cmd(struct option *o, char ***argv, int *argc) { - unsigned char *str; + char *str; int dummy_line = 0; if (!*argc) return gettext("Parameter expected"); @@ -56,8 +56,8 @@ gen_cmd(struct option *o, unsigned char ***argv, int *argc) /* If 0 follows, disable option and eat 0. If 1 follows, enable option and * eat 1. If anything else follow, enable option and don't eat anything. */ -static unsigned char * -bool_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +bool_cmd(struct option *o, char ***argv, int *argc) { o->value.number = 1; @@ -77,8 +77,8 @@ bool_cmd(struct option *o, unsigned char ***argv, int *argc) return NULL; } -static unsigned char * -exec_cmd(struct option *o, unsigned char ***argv, int *argc) +static char * +exec_cmd(struct option *o, char ***argv, int *argc) { return o->value.command(o, argv, argc); } @@ -90,11 +90,11 @@ exec_cmd(struct option *o, unsigned char ***argv, int *argc) * possibly changing ptr to structure containing target name and pointer to * options list? --pasky */ -static unsigned char * -redir_cmd(struct option *opt, unsigned char ***argv, int *argc) +static char * +redir_cmd(struct option *opt, char ***argv, int *argc) { struct option *real = get_opt_rec(config_options, opt->value.string); - unsigned char * ret = NULL; + char * ret = NULL; assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string); if_assert_failed { return ret; } @@ -109,11 +109,11 @@ redir_cmd(struct option *opt, unsigned char ***argv, int *argc) return ret; } -static unsigned char * -redir_rd(struct option *opt, unsigned char **file, int *line) +static char * +redir_rd(struct option *opt, char **file, int *line) { struct option *real = get_opt_rec(config_options, opt->value.string); - unsigned char *ret = NULL; + char *ret = NULL; assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string); if_assert_failed { return ret; } @@ -141,7 +141,7 @@ redir_wr(struct option *opt, struct string *string) } static int -redir_set(struct option *opt, unsigned char *str) +redir_set(struct option *opt, char *str) { struct option *real = get_opt_rec(config_options, opt->value.string); int ret = 0; @@ -154,7 +154,7 @@ redir_set(struct option *opt, unsigned char *str) if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) { negated = !*(long *) str; - str = (unsigned char *) &negated; + str = (char *) &negated; } ret = option_types[real->type].set(real, str); } @@ -163,7 +163,7 @@ redir_set(struct option *opt, unsigned char *str) } static int -redir_eq(struct option *opt, const unsigned char *str) +redir_eq(struct option *opt, const char *str) { struct option *real = get_opt_rec(config_options, opt->value.string); int ret = 0; @@ -176,7 +176,7 @@ redir_eq(struct option *opt, const unsigned char *str) if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) { negated = !*(const long *) str; - str = (unsigned char *) &negated; + str = (char *) &negated; } ret = option_types[real->type].equals(real, str); } @@ -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 char *q, int qlen) { if (!commandline) add_char_to_string(s, '"'); add_quoted_to_string(s, q, qlen); @@ -198,10 +198,10 @@ add_optstring_to_string(struct string *s, const unsigned char *q, int qlen) /* Config file handlers. */ -static unsigned char * -num_rd(struct option *opt, unsigned char **file, int *line) +static char * +num_rd(struct option *opt, char **file, int *line) { - unsigned char *end = *file; + char *end = *file; long *value = mem_alloc(sizeof(*value)); if (!value) return NULL; @@ -219,11 +219,11 @@ num_rd(struct option *opt, unsigned char **file, int *line) return NULL; } - return (unsigned char *) value; + return (char *) value; } static int -num_set(struct option *opt, unsigned char *str) +num_set(struct option *opt, char *str) { /* In num_rd(), num_set(), and num_eq(), str always points * to a long, even though these functions are only used for @@ -235,7 +235,7 @@ num_set(struct option *opt, unsigned char *str) } static int -num_eq(struct option *opt, const unsigned char *str) +num_eq(struct option *opt, const char *str) { return str && opt->value.number == *(const long *) str; } @@ -248,14 +248,14 @@ num_wr(struct option *option, struct string *string) static int -long_set(struct option *opt, unsigned char *str) +long_set(struct option *opt, char *str) { opt->value.big_number = *((long *) str); return 1; } static int -long_eq(struct option *opt, const unsigned char *str) +long_eq(struct option *opt, const char *str) { return str && opt->value.big_number == *(const long *) str; } @@ -266,10 +266,10 @@ long_wr(struct option *option, struct string *string) add_knum_to_string(string, option->value.big_number); } -static unsigned char * -str_rd(struct option *opt, unsigned char **file, int *line) +static char * +str_rd(struct option *opt, char **file, int *line) { - unsigned char *str = *file; + char *str = *file; struct string str2; if (!init_string(&str2)) return NULL; @@ -321,7 +321,7 @@ str_rd(struct option *opt, unsigned char **file, int *line) } static int -str_set(struct option *opt, unsigned char *str) +str_set(struct option *opt, char *str) { assert(opt->value.string); @@ -330,7 +330,7 @@ str_set(struct option *opt, unsigned char *str) } static int -str_eq(struct option *opt, const unsigned char *str) +str_eq(struct option *opt, const char *str) { return str && strcmp(opt->value.string, str) == 0; } @@ -347,7 +347,7 @@ str_wr(struct option *o, struct string *s) static void str_dup(struct option *opt, struct option *template_, int flags) { - unsigned char *new_ = mem_alloc(MAX_STR_LEN); + char *new_ = mem_alloc(MAX_STR_LEN); if (new_) safe_strncpy(new_, template_->value.string, MAX_STR_LEN); opt->value.string = new_; @@ -355,7 +355,7 @@ str_dup(struct option *opt, struct option *template_, int flags) static int -cp_set(struct option *opt, unsigned char *str) +cp_set(struct option *opt, char *str) { int ret = get_cp_index(str); @@ -366,7 +366,7 @@ cp_set(struct option *opt, unsigned char *str) } static int -cp_eq(struct option *opt, const unsigned char *str) +cp_eq(struct option *opt, const char *str) { return str && get_cp_index(str) == opt->value.number; } @@ -374,14 +374,14 @@ cp_eq(struct option *opt, const unsigned char *str) static void cp_wr(struct option *o, struct string *s) { - unsigned char *mime_name = get_cp_config_name(o->value.number); + char *mime_name = get_cp_config_name(o->value.number); add_optstring_to_string(s, mime_name, strlen(mime_name)); } static int -lang_set(struct option *opt, unsigned char *str) +lang_set(struct option *opt, char *str) { #ifdef CONFIG_NLS opt->value.number = name_to_language(str); @@ -391,7 +391,7 @@ lang_set(struct option *opt, unsigned char *str) } static int -lang_eq(struct option *opt, const unsigned char *str) +lang_eq(struct option *opt, const char *str) { #ifdef CONFIG_NLS return str && name_to_language(str) == opt->value.number; @@ -403,7 +403,7 @@ lang_eq(struct option *opt, const unsigned char *str) static void lang_wr(struct option *o, struct string *s) { - unsigned char *lang; + char *lang; #ifdef CONFIG_NLS lang = language_to_name(current_language); @@ -416,13 +416,13 @@ lang_wr(struct option *o, struct string *s) static int -color_set(struct option *opt, unsigned char *str) +color_set(struct option *opt, char *str) { return !decode_color(str, strlen(str), &opt->value.color); } static int -color_eq(struct option *opt, const unsigned char *str) +color_eq(struct option *opt, const char *str) { color_T color; @@ -434,8 +434,8 @@ static void color_wr(struct option *opt, struct string *str) { color_T color = opt->value.color; - unsigned char hexcolor[8]; - const unsigned char *strcolor = get_color_string(color, hexcolor); + char hexcolor[8]; + const char *strcolor = get_color_string(color, hexcolor); add_optstring_to_string(str, strcolor, strlen(strcolor)); } @@ -502,7 +502,7 @@ const struct option_type_info option_types[] = { { N_("Folder"), NULL, NULL, NULL, tree_dup, NULL, NULL, "" }, }; -unsigned char * +char * get_option_type_name(enum option_type type) { assert(type >= 0 && type < sizeof(option_types)/sizeof(struct option_type_info)); diff --git a/src/config/opttypes.h b/src/config/opttypes.h index fa377034..95413275 100644 --- a/src/config/opttypes.h +++ b/src/config/opttypes.h @@ -9,14 +9,14 @@ extern "C" { #endif struct option_type_info { - unsigned char *name; - unsigned char *(*cmdline)(struct option *, unsigned char ***, int *); - unsigned char *(*read)(struct option *, unsigned char **, int *); + char *name; + char *(*cmdline)(struct option *, char ***, int *); + char *(*read)(struct option *, char **, int *); 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 *); - unsigned char *help_str; + int (*set)(struct option *, char *); + int (*equals)(struct option *, const char *); + char *help_str; }; /* enum option_type is index in this array */ @@ -24,7 +24,7 @@ extern const struct option_type_info option_types[]; extern int commandline; -unsigned char *get_option_type_name(enum option_type type); +char *get_option_type_name(enum option_type type); #ifdef __cplusplus } diff --git a/src/cookies/cookies.c b/src/cookies/cookies.c index a01135b1..4a298105 100644 --- a/src/cookies/cookies.c +++ b/src/cookies/cookies.c @@ -57,7 +57,7 @@ static INIT_LIST_OF(struct cookie, cookies); struct c_domain { LIST_HEAD(struct c_domain); - unsigned char domain[1]; /* Must be at end of struct. */ + char domain[1]; /* Must be at end of struct. */ }; /* List of domains for which there may be cookies. This supposedly @@ -137,7 +137,7 @@ static union option_info cookies_options[] = { #define get_cookies_resave() get_opt_cookies(COOKIES_RESAVE).number struct cookie_server * -get_cookie_server(unsigned char *host, int hostlen) +get_cookie_server(char *host, int hostlen) { struct cookie_server *sort_spot = NULL; struct cookie_server *cs; @@ -226,7 +226,7 @@ delete_cookie(struct cookie *c) /* Check whether cookie's domain matches server. * It returns 1 if ok, 0 else. */ static int -is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_len) +is_domain_security_ok(char *domain, char *server, int server_len) { int i; int domain_len; @@ -301,7 +301,7 @@ is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_l * although you may also want to set the remaining members and check * @get_cookies_accept_policy and @is_domain_security_ok. * - * The unsigned char * arguments must be allocated with @mem_alloc or + * The char * arguments must be allocated with @mem_alloc or * equivalent, because @done_cookie will @mem_free them. Likewise, * the caller must already have locked @server. If @init_cookie * fails, then it frees the strings itself, and unlocks @server. @@ -310,8 +310,8 @@ is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_l * consider that a bug. This means callers can use e.g. @stracpy * and let @init_cookie check whether the call ran out of memory. */ struct cookie * -init_cookie(unsigned char *name, unsigned char *value, - unsigned char *path, unsigned char *domain, +init_cookie(char *name, char *value, + char *path, char *domain, struct cookie_server *server) { struct cookie *cookie = mem_calloc(1, sizeof(*cookie)); @@ -337,9 +337,9 @@ init_cookie(unsigned char *name, unsigned char *value, } void -set_cookie(struct uri *uri, unsigned char *str) +set_cookie(struct uri *uri, char *str) { - unsigned char *path, *domain; + char *path, *domain; struct cookie *cookie; struct cookie_str cstr; int max_age; @@ -354,7 +354,7 @@ set_cookie(struct uri *uri, unsigned char *str) if (!parse_cookie_str(&cstr, str)) return; switch (parse_header_param(str, "path", &path, 0)) { - unsigned char *path_end; + char *path_end; case HEADER_PARAM_FOUND: if (!path[0]) @@ -421,7 +421,7 @@ set_cookie(struct uri *uri, unsigned char *str) max_age = get_cookies_max_age(); if (max_age) { - unsigned char *date; + char *date; time_t expires; switch (parse_header_param(str, "expires", &date, 0)) { @@ -611,7 +611,7 @@ send_cookies_common(struct uri *uri, unsigned int httponly) { struct c_domain *cd; struct cookie *c, *next; - unsigned char *path = NULL; + char *path = NULL; static struct string header; time_t now; @@ -693,14 +693,14 @@ load_cookies(void) { /* Buffer size is set to be enough to read long lines that * save_cookies may write. 6 is choosen after the fprintf(..) call * in save_cookies(). --Zas */ - unsigned char in_buffer[6 * MAX_STR_LEN]; - unsigned char *cookfile = COOKIES_FILENAME; + char in_buffer[6 * MAX_STR_LEN]; + char *cookfile = COOKIES_FILENAME; FILE *fp; time_t now; if (elinks_home) { cookfile = straconcat(elinks_home, cookfile, - (unsigned char *) NULL); + (char *) NULL); if (!cookfile) return; } @@ -721,11 +721,11 @@ load_cookies(void) { now = time(NULL); while (fgets(in_buffer, 6 * MAX_STR_LEN, fp)) { struct cookie *cookie; - unsigned char *p, *q = in_buffer; + char *p, *q = in_buffer; enum { NAME = 0, VALUE, SERVER, PATH, DOMAIN, EXPIRES, SECURE, HTTPONLY, MEMBERS }; int member; struct { - unsigned char *pos; + char *pos; int len; } members[MEMBERS]; time_t expires; @@ -812,7 +812,7 @@ set_cookies_dirty(void) void save_cookies(struct terminal *term) { struct cookie *c; - unsigned char *cookfile; + char *cookfile; struct secure_save_info *ssi; time_t now; @@ -844,7 +844,7 @@ save_cookies(struct terminal *term) { } cookfile = straconcat(elinks_home, COOKIES_FILENAME, - (unsigned char *) NULL); + (char *) NULL); if (!cookfile) { CANNOT_SAVE_COOKIES(0, N_("Out of memory")); return; diff --git a/src/cookies/cookies.h b/src/cookies/cookies.h index 7bbcc180..9d55eeee 100644 --- a/src/cookies/cookies.h +++ b/src/cookies/cookies.h @@ -33,14 +33,14 @@ struct cookie_server { OBJECT_HEAD(struct cookie_server); struct listbox_item *box_item; - unsigned char host[1]; /* Must be at end of struct. */ + char host[1]; /* Must be at end of struct. */ }; struct cookie { OBJECT_HEAD(struct cookie); - unsigned char *name, *value; - unsigned char *path, *domain; + char *name, *value; + char *path, *domain; struct cookie_server *server; /* The host the cookie originated from */ time_t expires; /* Expiration time. Zero means undefined */ @@ -50,14 +50,14 @@ struct cookie { struct listbox_item *box_item; }; -struct cookie_server *get_cookie_server(unsigned char *host, int hostlen); -struct cookie *init_cookie(unsigned char *name, unsigned char *value, - unsigned char *path, unsigned char *domain, +struct cookie_server *get_cookie_server(char *host, int hostlen); +struct cookie *init_cookie(char *name, char *value, + char *path, char *domain, struct cookie_server *server); void accept_cookie(struct cookie *); void done_cookie(struct cookie *); void delete_cookie(struct cookie *); -void set_cookie(struct uri *, unsigned char *); +void set_cookie(struct uri *, char *); void load_cookies(void); void save_cookies(struct terminal *); void set_cookies_dirty(void); diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index 093ac044..05961c0d 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -138,7 +138,7 @@ is_cookie_used(struct listbox_item *item) return is_object_used((struct cookie *) item->udata); } -static unsigned char * +static char * get_cookie_text(struct listbox_item *item, struct terminal *term) { /* Are we dealing with a folder? */ @@ -154,7 +154,7 @@ get_cookie_text(struct listbox_item *item, struct terminal *term) } } -static unsigned char * +static char * get_cookie_info(struct listbox_item *item, struct terminal *term) { struct cookie *cookie = item->udata; @@ -259,7 +259,7 @@ static widget_handler_status_T set_cookie_name(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct cookie *cookie = dlg_data->dlg->udata; - unsigned char *value = widget_data->cdata; + char *value = widget_data->cdata; if (!value || !cookie) return EVENT_NOT_PROCESSED; mem_free_set(&cookie->name, stracpy(value)); @@ -271,7 +271,7 @@ static widget_handler_status_T set_cookie_value(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct cookie *cookie = dlg_data->dlg->udata; - unsigned char *value = widget_data->cdata; + char *value = widget_data->cdata; if (!value || !cookie) return EVENT_NOT_PROCESSED; mem_free_set(&cookie->value, stracpy(value)); @@ -283,7 +283,7 @@ static widget_handler_status_T set_cookie_domain(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct cookie *cookie = dlg_data->dlg->udata; - unsigned char *value = widget_data->cdata; + char *value = widget_data->cdata; if (!value || !cookie) return EVENT_NOT_PROCESSED; mem_free_set(&cookie->domain, stracpy(value)); @@ -295,8 +295,8 @@ static widget_handler_status_T set_cookie_expires(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct cookie *cookie = dlg_data->dlg->udata; - unsigned char *value = widget_data->cdata; - unsigned char *end; + char *value = widget_data->cdata; + char *end; if (!value || !cookie) return EVENT_NOT_PROCESSED; #ifdef HAVE_STRPTIME @@ -324,8 +324,8 @@ static widget_handler_status_T set_cookie_secure(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct cookie *cookie = dlg_data->dlg->udata; - unsigned char *value = widget_data->cdata; - unsigned char *end; + char *value = widget_data->cdata; + char *end; long number; if (!value || !cookie) return EVENT_NOT_PROCESSED; @@ -343,8 +343,8 @@ static widget_handler_status_T set_cookie_httponly(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct cookie *cookie = dlg_data->dlg->udata; - unsigned char *value = widget_data->cdata; - unsigned char *end; + char *value = widget_data->cdata; + char *end; long number; if (!value || !cookie) return EVENT_NOT_PROCESSED; @@ -365,8 +365,8 @@ build_edit_dialog(struct terminal *term, struct cookie *cookie) #define EDIT_WIDGETS_COUNT 9 /* [gettext_accelerator_context(.build_edit_dialog)] */ struct dialog *dlg; - unsigned char *name, *value, *domain, *expires, *secure, *httponly; - unsigned char *dlg_server; + char *name, *value, *domain, *expires, *secure, *httponly; + char *dlg_server; int length = 0; dlg = calloc_dialog(EDIT_WIDGETS_COUNT, MAX_STR_LEN * 6); @@ -405,7 +405,7 @@ build_edit_dialog(struct terminal *term, struct cookie *cookie) dlg_server = cookie->server->host; dlg_server = straconcat(_("Server", term), ": ", dlg_server, "\n", - (unsigned char *) NULL); + (char *) NULL); if (!dlg_server) { mem_free(dlg); @@ -483,7 +483,7 @@ push_add_button(struct dialog_data *dlg_data, struct widget_data *button) static void add_server_do(void *data) { - unsigned char *value = data; + char *value = data; struct cookie *dummy_cookie; if (!value) return; @@ -505,8 +505,8 @@ push_add_server_button(struct dialog_data *dlg_data, struct widget_data *button) #define SERVER_WIDGETS_COUNT 3 struct terminal *term = dlg_data->win->term; struct dialog *dlg; - unsigned char *name; - unsigned char *text; + char *name; + char *text; dlg = calloc_dialog(SERVER_WIDGETS_COUNT, MAX_STR_LEN); if (!dlg) return EVENT_NOT_PROCESSED; diff --git a/src/cookies/parser.c b/src/cookies/parser.c index 16a6b961..fe075deb 100644 --- a/src/cookies/parser.c +++ b/src/cookies/parser.c @@ -17,7 +17,7 @@ #if 0 static inline void -debug_cookie_parser(struct cookie_str *cstr, unsigned char *pos, int ws, int eq) +debug_cookie_parser(struct cookie_str *cstr, char *pos, int ws, int eq) { int namelen = int_max(cstr->nam_end - cstr->str, 0); int valuelen = int_max(cstr->val_end - cstr->val_start, 0); @@ -39,7 +39,7 @@ debug_cookie_parser(struct cookie_str *cstr, unsigned char *pos, int ws, int eq) /* Defined in RFC 2965. */ /* Return cstr on success, NULL on failure. */ struct cookie_str * -parse_cookie_str(struct cookie_str *cstr, unsigned char *str) +parse_cookie_str(struct cookie_str *cstr, char *str) { memset(cstr, 0, sizeof(*cstr)); cstr->str = str; diff --git a/src/cookies/parser.h b/src/cookies/parser.h index a29b8847..624f360e 100644 --- a/src/cookies/parser.h +++ b/src/cookies/parser.h @@ -6,11 +6,11 @@ extern "C" { #endif struct cookie_str { - unsigned char *str; - unsigned char *nam_end, *val_start, *val_end; + char *str; + char *nam_end, *val_start, *val_end; }; -struct cookie_str *parse_cookie_str(struct cookie_str *cstr, unsigned char *str); +struct cookie_str *parse_cookie_str(struct cookie_str *cstr, char *str); #ifdef __cplusplus } diff --git a/src/cookies/parsetst.c b/src/cookies/parsetst.c index 9e294ce8..2343b1f7 100644 --- a/src/cookies/parsetst.c +++ b/src/cookies/parsetst.c @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { struct cookie_str cstr; - unsigned char name[1024], value[1024], string[1024]; + char name[1024], value[1024], string[1024]; printf("This thing is for testing of cookies name-value pair parser.\n" "You probably do not want to mess with it :).\n"); diff --git a/src/cookies/path.c b/src/cookies/path.c index 5a27d387..f5578937 100644 --- a/src/cookies/path.c +++ b/src/cookies/path.c @@ -4,7 +4,7 @@ #include "cookies/path.h" int -is_path_prefix(unsigned char *cookiepath, unsigned char *requestpath) +is_path_prefix(char *cookiepath, char *requestpath) { int dl = strlen(cookiepath); diff --git a/src/cookies/path.h b/src/cookies/path.h index 4036046c..3622cfdf 100644 --- a/src/cookies/path.h +++ b/src/cookies/path.h @@ -5,7 +5,7 @@ extern "C" { #endif -int is_path_prefix(unsigned char *d, unsigned char *s); +int is_path_prefix(char *d, char *s); #ifdef __cplusplus } diff --git a/src/dialogs/document.c b/src/dialogs/document.c index a401f001..2a4a3983 100644 --- a/src/dialogs/document.c +++ b/src/dialogs/document.c @@ -33,7 +33,7 @@ #include "viewer/text/view.h" void -nowhere_box(struct terminal *term, unsigned char *title) +nowhere_box(struct terminal *term, char *title) { assert(term); if_assert_failed return; @@ -50,7 +50,7 @@ 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; - unsigned char *a; + char *a; struct link *link; if (!doc_view) return; @@ -92,7 +92,7 @@ add_link_info_to_string(struct string *msg, struct session *ses) #ifdef CONFIG_GLOBHIST historyitem = get_global_history_item(link->where); if (historyitem) { - unsigned char *last_visit; + char *last_visit; last_visit = ctime(&historyitem->last_visit); @@ -170,7 +170,7 @@ document_info_dialog(struct session *ses) if (doc_view && doc_view->document->cached) { struct cache_entry *cached = doc_view->document->cached; - unsigned char *a; + char *a; add_format_to_string(&msg, "\n%s: %" OFF_PRINT_FORMAT, _("Size", term), @@ -234,7 +234,7 @@ document_info_dialog(struct session *ses) #ifdef CONFIG_GLOBHIST { - unsigned char *last_visit = NULL; + char *last_visit = NULL; struct global_history_item *historyitem; add_format_to_string(&msg, "\n%s: ", @@ -272,8 +272,8 @@ void cached_header_dialog(struct session *ses, struct cache_entry *cached) { int msgbox_flags = 0; - unsigned char *title = N_("Header info"); - unsigned char *headers = NULL; + char *title = N_("Header info"); + char *headers = NULL; int i = 0, j = 0; if (!cached || !cached->head || !*cached->head) diff --git a/src/dialogs/document.h b/src/dialogs/document.h index 6765cb21..de3fa20c 100644 --- a/src/dialogs/document.h +++ b/src/dialogs/document.h @@ -7,7 +7,7 @@ extern "C" { #endif -void nowhere_box(struct terminal *term, unsigned char *title); +void nowhere_box(struct terminal *term, char *title); void link_info_dialog(struct session *ses); void document_info_dialog(struct session *); void cached_header_dialog(struct session *ses, struct cache_entry *cached); diff --git a/src/dialogs/download.c b/src/dialogs/download.c index 761f3d28..3f9e9c3f 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -133,10 +133,10 @@ download_dialog_layouter(struct dialog_data *dlg_data) int rw = w; int x, y = 0; int url_len; - unsigned char *url; + char *url; struct download *download = &file_download->download; struct color_pair *dialog_text_color = get_bfu_color(term, "dialog.text"); - unsigned char *msg = get_download_msg(download, term, 1, 1, "\n"); + char *msg = get_download_msg(download, term, 1, 1, "\n"); int show_meter = (download_is_progressing(download) && download->progress->size >= 0); #ifdef CONFIG_BITTORRENT @@ -306,11 +306,11 @@ is_file_download_used(struct listbox_item *item) return is_object_used((struct file_download *) item->udata); } -static unsigned char * +static char * get_file_download_text(struct listbox_item *item, struct terminal *term) { struct file_download *file_download = item->udata; - unsigned char *uristring; + char *uristring; uristring = get_uri_string(file_download->uri, URI_PUBLIC); if (uristring) { @@ -325,7 +325,7 @@ get_file_download_text(struct listbox_item *item, struct terminal *term) return uristring; } -static unsigned char * +static char * get_file_download_info(struct listbox_item *item, struct terminal *term) { return NULL; @@ -377,9 +377,9 @@ draw_file_download(struct listbox_item *item, struct listbox_context *context, { struct file_download *file_download = item->udata; struct download *download = &file_download->download; - unsigned char *stylename; + char *stylename; struct color_pair *color; - unsigned char *text; + char *text; int length; int trimmedlen; int meter = DOWNLOAD_METER_WIDTH; diff --git a/src/dialogs/edit.c b/src/dialogs/edit.c index 1787cf6c..e75de8ce 100644 --- a/src/dialogs/edit.c +++ b/src/dialogs/edit.c @@ -39,9 +39,9 @@ my_cancel_dialog(struct dialog_data *dlg_data, struct widget_data *widget_data) /* TODO: In bookmark/dialogs.c most users seem to want also the dialog_data * so we should make when_*() functions take dialog_data instead. --jonas */ void -do_edit_dialog(struct terminal *term, int intl, unsigned char *title, - const unsigned char *src_name, - const unsigned char *src_url, +do_edit_dialog(struct terminal *term, int intl, char *title, + const char *src_name, + const char *src_url, struct session *ses, struct dialog_data *parent, done_handler_T *when_done, void when_cancel(struct dialog *), @@ -49,7 +49,7 @@ do_edit_dialog(struct terminal *term, int intl, unsigned char *title, enum edit_dialog_type dialog_type) { /* [gettext_accelerator_context(do_edit_dialog)] */ - unsigned char *name, *url; + char *name, *url; struct dialog *dlg; if (intl) title = _(title, term); diff --git a/src/dialogs/edit.h b/src/dialogs/edit.h index 19de5cc7..107383c1 100644 --- a/src/dialogs/edit.h +++ b/src/dialogs/edit.h @@ -14,8 +14,8 @@ enum edit_dialog_type { EDIT_DLG_ADD /* edit/add dialog */ }; -void do_edit_dialog(struct terminal *, int, unsigned char *, - const unsigned char *, const unsigned char *, +void do_edit_dialog(struct terminal *, int, char *, + const char *, const char *, struct session *, struct dialog_data *, done_handler_T *when_done, void when_cancel(struct dialog *), diff --git a/src/dialogs/exmode.c b/src/dialogs/exmode.c index 3f08fb13..76168c37 100644 --- a/src/dialogs/exmode.c +++ b/src/dialogs/exmode.c @@ -35,11 +35,11 @@ static INIT_INPUT_HISTORY(exmode_history); -typedef int (*exmode_handler_T)(struct session *, unsigned char *, unsigned char *); +typedef int (*exmode_handler_T)(struct session *, char *, char *); static int -exmode_action_handler(struct session *ses, unsigned char *command, - unsigned char *args) +exmode_action_handler(struct session *ses, char *command, + char *args) { enum main_action action_id = get_action_from_string(KEYMAP_MAIN, command); @@ -60,8 +60,8 @@ exmode_action_handler(struct session *ses, unsigned char *command, } static int -exmode_confcmd_handler(struct session *ses, unsigned char *command, - unsigned char *args) +exmode_confcmd_handler(struct session *ses, char *command, + char *args) { enum parse_error err; @@ -84,14 +84,14 @@ static const exmode_handler_T exmode_handlers[] = { }; static void -exmode_exec(struct session *ses, unsigned char buffer[INPUT_LINE_BUFFER_SIZE]) +exmode_exec(struct session *ses, char buffer[INPUT_LINE_BUFFER_SIZE]) { /* First look it up as action, then try it as an event (but the event * part should be thought out somehow yet, I s'pose... let's leave it * off for now). Then try to evaluate it as configfile command. Then at * least pop up an error. */ - unsigned char *command = buffer; - unsigned char *args = command; + char *command = buffer; + char *args = command; int i; while (*command == ':') command++; diff --git a/src/dialogs/info.c b/src/dialogs/info.c index 910d4ce2..069c7ca7 100644 --- a/src/dialogs/info.c +++ b/src/dialogs/info.c @@ -154,7 +154,7 @@ menu_copying(struct terminal *term, void *xxx, void *xxxx) } -static unsigned char * +static char * get_resource_info(struct terminal *term, void *data) { struct string info; diff --git a/src/dialogs/menu.c b/src/dialogs/menu.c index 36141465..13ef4d28 100644 --- a/src/dialogs/menu.c +++ b/src/dialogs/menu.c @@ -52,7 +52,7 @@ static void menu_url_shortcut(struct terminal *term, void *url_, void *ses_) { - unsigned char *url = url_; + char *url = url_; struct session *ses = ses_; struct uri *uri = get_uri(url, 0); @@ -62,7 +62,7 @@ menu_url_shortcut(struct terminal *term, void *url_, void *ses_) } static void -save_url(struct session *ses, unsigned char *url) +save_url(struct session *ses, char *url) { struct document_view *doc_view; struct uri *uri; @@ -97,7 +97,7 @@ save_url_as(struct session *ses) N_("Save URL"), N_("Enter URL"), ses, &goto_url_history, MAX_STR_LEN, "", 0, 0, NULL, - (void (*)(void *, unsigned char *)) save_url, + (void (*)(void *, char *)) save_url, NULL); } @@ -180,7 +180,7 @@ history_menu_common(struct terminal *term, struct session *ses, int unhist) for (loc = unhist ? cur_loc(ses)->next : cur_loc(ses)->prev; loc != (struct location *) &ses->history.history; loc = unhist ? loc->next : loc->prev) { - unsigned char *url; + char *url; if (!mi) { mi = new_menu(FREE_LIST | FREE_TEXT | NO_INTL); @@ -537,13 +537,13 @@ activate_bfu_technology(struct session *ses, int item) void -dialog_goto_url(struct session *ses, unsigned char *url) +dialog_goto_url(struct session *ses, char *url) { input_dialog(ses->tab->term, NULL, N_("Go to URL"), N_("Enter URL"), ses, &goto_url_history, MAX_STR_LEN, url, 0, 0, NULL, - (void (*)(void *, unsigned char *)) goto_url_with_hook, + (void (*)(void *, char *)) goto_url_with_hook, NULL); } @@ -552,7 +552,7 @@ static INIT_INPUT_HISTORY(file_history); void query_file(struct session *ses, struct uri *uri, void *data, - void (*std)(void *, unsigned char *), + void (*std)(void *, char *), void (*cancel)(void *), int interactive) { struct string def; @@ -601,7 +601,7 @@ query_file(struct session *ses, struct uri *uri, void *data, N_("Download"), N_("Save to file"), data, &file_history, MAX_STR_LEN, def.source, 0, 0, check_nonempty, - (void (*)(void *, unsigned char *)) std, + (void (*)(void *, char *)) std, (void (*)(void *)) cancel); } else { std(data, def.source); @@ -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, char *name) { if (!get_cmd_opt_bool(name)) return; add_to_string(string, " -"); @@ -736,7 +736,7 @@ open_in_new_window(struct terminal *term, void *func_, void *ses_) void -add_new_win_to_menu(struct menu_item **mi, unsigned char *text, +add_new_win_to_menu(struct menu_item **mi, char *text, struct terminal *term) { int c = can_open_in_new(term); @@ -761,7 +761,7 @@ add_new_win_to_menu(struct menu_item **mi, unsigned char *text, static void do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx) { - unsigned char *command = command_; + char *command = command_; exec_on_terminal(term, command, "", TERM_EXEC_BG); mem_free(command); @@ -771,8 +771,8 @@ do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx) * - Support for passing MIME type * - Merge this function with rewrite_uri(), subst_cmd(), subst_file() * and subst_url(). */ -static unsigned char * -format_command(unsigned char *format, struct uri *uri) +static char * +format_command(char *format, struct uri *uri) { struct string string; @@ -792,7 +792,7 @@ format_command(unsigned char *format, struct uri *uri) switch (*format) { case 'c': { - unsigned char *str = struri(uri); + char *str = struri(uri); int length = get_real_uri_length(uri); add_shell_quoted_to_string(&string, @@ -856,7 +856,7 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view, } foreach (option, *tree) { - unsigned char *text, *data; + char *text, *data; if (!strcmp(option->name, "_template_")) continue; @@ -895,7 +895,7 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view, * choose an available accelerator key. */ void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, - unsigned char *text) + char *text) { LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing", NULL); @@ -949,7 +949,7 @@ static struct menu_item empty_directory_menu[] = { static void complete_file_menu(struct terminal *term, int no_elevator, void *data, menu_func_T file_func, menu_func_T dir_func, - unsigned char *dirname, unsigned char *filename) + char *dirname, char *filename) { struct menu_item *menu = new_menu(FREE_LIST | NO_INTL); struct directory_entry *entries, *entry; @@ -965,7 +965,7 @@ complete_file_menu(struct terminal *term, int no_elevator, void *data, } for (entry = entries; entry->name; entry++) { - unsigned char *text; + char *text; int is_dir = (*entry->attrib == 'd'); int is_file = (*entry->attrib == '-'); @@ -1018,7 +1018,7 @@ complete_file_menu(struct terminal *term, int no_elevator, void *data, /* Only one entry */ if (direntries + fileentries == 1) { - unsigned char *text = menu[FILE_COMPLETION_MENU_OFFSET].data; + char *text = menu[FILE_COMPLETION_MENU_OFFSET].data; mem_free(menu); @@ -1047,12 +1047,12 @@ complete_file_menu(struct terminal *term, int no_elevator, void *data, /* Prepares the launching of the file completion menu by expanding the @path * and splitting it in directory and file name part. */ void -auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, +auto_complete_file(struct terminal *term, int no_elevator, char *path, menu_func_T file_func, menu_func_T dir_func, void *data) { struct uri *uri; - unsigned char *dirname; - unsigned char *filename; + char *dirname; + char *filename; assert(term && data && file_func && dir_func && data); @@ -1093,7 +1093,7 @@ auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, /* Make sure the dirname has an ending slash */ if (!dir_sep(path[-1])) { - unsigned char separator = *dirname; + char separator = *dirname; int dirnamelen = path - dirname; insert_in_string(&dirname, dirnamelen, &separator, 1); diff --git a/src/dialogs/menu.h b/src/dialogs/menu.h index f5a26eed..8d183859 100644 --- a/src/dialogs/menu.h +++ b/src/dialogs/menu.h @@ -18,7 +18,7 @@ struct uri; void activate_bfu_technology(struct session *, int); -void dialog_goto_url(struct session *ses, unsigned char *url); +void dialog_goto_url(struct session *ses, char *url); /* void dialog_save_url(struct session *ses); */ void tab_menu(struct session *ses, int x, int y, @@ -26,7 +26,7 @@ void tab_menu(struct session *ses, int x, int y, void free_history_lists(void); -void query_file(struct session *, struct uri *, void *, void (*)(void *, unsigned char *), void (*)(void *), int); +void query_file(struct session *, struct uri *, void *, void (*)(void *, char *), void (*)(void *), int); void query_exit(struct session *ses); void exit_prog(struct session *ses, int query); @@ -43,7 +43,7 @@ void send_open_in_new_window(struct terminal *term, const struct open_in_new *op void open_in_new_window(struct terminal *term, void *func_, void *ses_); -void add_new_win_to_menu(struct menu_item **mi, unsigned char *text, struct terminal *term); +void add_new_win_to_menu(struct menu_item **mi, char *text, struct terminal *term); /* URI passing: */ @@ -54,11 +54,11 @@ enum pass_uri_type { PASS_URI_TAB, }; -void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, unsigned char *text); +void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, char *text); enum frame_event_status pass_uri_to_command(struct session *ses, struct document_view *doc_view, int /* enum pass_uri_type */ type); void -auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, +auto_complete_file(struct terminal *term, int no_elevator, char *path, menu_func_T file_func, menu_func_T dir_func, void *data); #ifdef __cplusplus diff --git a/src/dialogs/options.c b/src/dialogs/options.c index 0f59843e..88cb33de 100644 --- a/src/dialogs/options.c +++ b/src/dialogs/options.c @@ -29,7 +29,7 @@ static void display_codepage(struct terminal *term, void *name_, void *xxx) { - unsigned char *name = name_; + char *name = name_; struct option *opt = get_opt_rec(term->spec, "charset"); int index = get_cp_index(name); @@ -49,14 +49,14 @@ charset_list(struct terminal *term, void *xxx, void *ses_) struct session *ses = ses_; int i, items; int sel = 0; - const unsigned char *const sel_mime = get_cp_mime_name( + const char *const sel_mime = get_cp_mime_name( get_terminal_codepage(term)); struct menu_item *mi = new_menu(FREE_LIST); if (!mi) return; for (i = 0, items = 0; ; i++) { - unsigned char *name = get_cp_name(i); + char *name = get_cp_name(i); if (!name) break; @@ -168,7 +168,7 @@ terminal_options(struct terminal *term, void *xxx, struct session *ses) struct dialog *dlg; union option_value *values; int anonymous = get_cmd_opt_bool("anonymous"); - unsigned char help_text[MAX_STR_LEN], *text; + char help_text[MAX_STR_LEN], *text; size_t help_textlen = 0; size_t add_size = TERM_OPTION_VALUE_SIZE; @@ -203,7 +203,7 @@ terminal_options(struct terminal *term, void *xxx, struct session *ses) dlg->layout.padding_top = 1; dlg->udata = values; - text = ((unsigned char *) values) + TERM_OPTION_VALUE_SIZE; + text = ((char *) values) + TERM_OPTION_VALUE_SIZE; memcpy(text, help_text, help_textlen); add_dlg_text(dlg, text, ALIGN_LEFT, 1); @@ -279,14 +279,14 @@ menu_language_list(struct terminal *term, void *xxx, void *ses) /* FIXME: This doesn't in fact belong here at all. --pasky */ -static unsigned char width_str[4]; -static unsigned char height_str[4]; +static char width_str[4]; +static char height_str[4]; static void push_resize_button(void *data) { struct terminal *term = data; - unsigned char str[MAX_STR_LEN]; + char str[MAX_STR_LEN]; snprintf(str, sizeof(str), "%s,%s,%d,%d", width_str, height_str, term->width, term->height); diff --git a/src/dialogs/progress.c b/src/dialogs/progress.c index 8519414c..d5a46317 100644 --- a/src/dialogs/progress.c +++ b/src/dialogs/progress.c @@ -16,9 +16,9 @@ #include "util/memory.h" #include "util/string.h" -static unsigned char * +static char * get_progress_msg_2(struct progress *progress, struct terminal *term, - int wide, int full, unsigned char *separator, unsigned char *type) + int wide, int full, char *separator, char *type) { struct string msg; int newlines = separator[strlen(separator) - 1] == '\n'; @@ -90,16 +90,16 @@ get_progress_msg_2(struct progress *progress, struct terminal *term, return msg.source; } -unsigned char * +char * get_upload_progress_msg(struct progress *progress, struct terminal *term, - int wide, int full, unsigned char *separator) + int wide, int full, char *separator) { return get_progress_msg_2(progress, term, wide, full, separator, _("Sent", term)); } -unsigned char * +char * get_progress_msg(struct progress *progress, struct terminal *term, - int wide, int full, unsigned char *separator) + int wide, int full, char *separator) { return get_progress_msg_2(progress, term, wide, full, separator, _("Received", term)); } @@ -107,7 +107,7 @@ get_progress_msg(struct progress *progress, struct terminal *term, void draw_progress_bar(struct progress *progress, struct terminal *term, int x, int y, int width, - unsigned char *text, struct color_pair *meter_color) + char *text, struct color_pair *meter_color) { /* Note : values > 100% are theorically possible and were seen. */ int percent = 0; @@ -133,7 +133,7 @@ draw_progress_bar(struct progress *progress, struct terminal *term, width = int_min(width, strlen(text)); } else if (width > 1) { - static unsigned char s[] = "????"; /* Reduce or enlarge at will. */ + static char s[] = "????"; /* Reduce or enlarge at will. */ unsigned int slen = 0; int max = int_min(sizeof(s), width) - 1; diff --git a/src/dialogs/progress.h b/src/dialogs/progress.h index 6abcee07..c1199a5b 100644 --- a/src/dialogs/progress.h +++ b/src/dialogs/progress.h @@ -8,21 +8,21 @@ extern "C" { struct progress; struct terminal; -unsigned char * +char * get_progress_msg(struct progress *progress, struct terminal *term, - int wide, int full, unsigned char *separator); + int wide, int full, char *separator); -unsigned char * +char * get_upload_progress_msg(struct progress *progress, struct terminal *term, - int wide, int full, unsigned char *separator); + int wide, int full, char *separator); /* Draws a progress bar meter or progress coloured text depending on whether * @text is NULL. If @meter_color is NULL dialog.meter color is used. */ void draw_progress_bar(struct progress *progress, struct terminal *term, int x, int y, int width, - unsigned char *text, struct color_pair *meter_color); + char *text, struct color_pair *meter_color); #ifdef __cplusplus } diff --git a/src/dialogs/status.c b/src/dialogs/status.c index 1c90e0bd..666f1da9 100644 --- a/src/dialogs/status.c +++ b/src/dialogs/status.c @@ -41,9 +41,9 @@ #include "viewer/text/view.h" -unsigned char * +char * get_download_msg(struct download *download, struct terminal *term, - int wide, int full, unsigned char *separator) + int wide, int full, char *separator) { if (!download_is_progressing(download)) { /* DBG("%d -> %s", download->state, _(get_err_msg(download->state), term)); */ @@ -142,11 +142,11 @@ update_status(void) } } -static unsigned char * +static char * get_current_link_info_and_title(struct session *ses, struct document_view *doc_view) { - unsigned char *link_info, *link_title, *ret = NULL; + char *link_info, *link_title, *ret = NULL; link_info = get_current_link_info(ses, doc_view); if (!link_info) return NULL; @@ -156,7 +156,7 @@ get_current_link_info_and_title(struct session *ses, assert(*link_title); ret = straconcat(link_info, " - ", link_title, - (unsigned char *) NULL); + (char *) NULL); mem_free(link_info); mem_free(link_title); } @@ -169,7 +169,7 @@ get_current_link_info_and_title(struct session *ses, static inline void display_status_bar(struct session *ses, struct terminal *term, int tabs_count) { - unsigned char *msg = NULL; + char *msg = NULL; unsigned int tab_info_len = 0; struct download *download = get_current_download(ses); struct session_status *status = &ses->status; @@ -245,7 +245,7 @@ display_status_bar(struct session *ses, struct terminal *term, int tabs_count) draw_box(term, &box, ' ', 0, get_bfu_color(term, "status.status-bar")); if (!status->show_tabs_bar && tabs_count > 1) { - unsigned char tab_info[8]; + char tab_info[8]; tab_info[tab_info_len++] = '['; ulongcat(tab_info, &tab_info_len, term->current_tab + 1, 4, 0); @@ -312,7 +312,7 @@ display_tab_bar(struct session *ses, struct terminal *term, int tabs_count) struct document_view *doc_view; struct session *tab_ses = tab->data; int actual_tab_width = tab_width - 1; - unsigned char *msg; + char *msg; /* Adjust tab size to use full term width. */ if (tab_remain_width) { @@ -398,7 +398,7 @@ display_title_bar(struct session *ses, struct terminal *term) struct document_view *doc_view; struct document *document; struct string title; - unsigned char buf[40]; + char buf[40]; int buflen = 0; int height; @@ -486,8 +486,8 @@ display_window_title(struct session *ses, struct terminal *term) { static struct session *last_ses; struct session_status *status = &ses->status; - unsigned char *doc_title = NULL; - unsigned char *title; + char *doc_title = NULL; + char *title; int titlelen; if (ses->doc_view @@ -497,7 +497,7 @@ display_window_title(struct session *ses, struct terminal *term) doc_title = ses->doc_view->document->title; title = doc_title ? straconcat(doc_title, " - ELinks", - (unsigned char *) NULL) + (char *) NULL) : stracpy("ELinks"); if (!title) return; diff --git a/src/dialogs/status.h b/src/dialogs/status.h index fc4bd78f..7448a850 100644 --- a/src/dialogs/status.h +++ b/src/dialogs/status.h @@ -13,9 +13,9 @@ void print_screen_status(struct session *); void update_status(void); -unsigned char * +char * get_download_msg(struct download *download, struct terminal *term, - int wide, int full, unsigned char *separator); + int wide, int full, char *separator); #ifdef __cplusplus } diff --git a/src/document/css/apply.c b/src/document/css/apply.c index a7f03271..10f1eef5 100644 --- a/src/document/css/apply.c +++ b/src/document/css/apply.c @@ -235,10 +235,10 @@ examine_element(struct html_context *html_context, struct css_selector *base, } if (element->attr.class_ && seltype <= CST_CLASS) { - const unsigned char *class_ = element->attr.class_; + const char *class_ = element->attr.class_; for (;;) { - const unsigned char *begin; + const char *begin; while (*class_ == ' ') ++class_; if (*class_ == '\0') break; @@ -266,7 +266,7 @@ get_css_selector_for_element(struct html_context *html_context, struct css_stylesheet *css, LIST_OF(struct html_element) *html_stack) { - unsigned char *code; + char *code; struct css_selector *selector; assert(element && element->options && css); diff --git a/src/document/css/css.c b/src/document/css/css.c index ba6f22e2..e1904fd4 100644 --- a/src/document/css/css.c +++ b/src/document/css/css.c @@ -84,14 +84,14 @@ union option_info css_options_info[] = { * * @return nonzero if the media type is supported, 0 if not. */ int -supports_css_media_type(const unsigned char *optstr, - const unsigned char *token, size_t token_length) +supports_css_media_type(const char *optstr, + const char *token, size_t token_length) { /* Split @optstr into comma-delimited strings, strip leading * and trailing spaces from each, and compare them to the * token. */ while (*optstr != '\0') { - const unsigned char *beg, *end; + const char *beg, *end; while (*optstr == ' ') ++optstr; @@ -142,7 +142,7 @@ import_css(struct css_stylesheet *css, struct uri *uri) fragment = get_cache_fragment(cached); if (fragment) { - unsigned char *end = fragment->data + fragment->length; + char *end = fragment->data + fragment->length; css->import_level++; css_parse_stylesheet(css, uri, fragment->data, end); @@ -153,7 +153,7 @@ import_css(struct css_stylesheet *css, struct uri *uri) static void import_css_file(struct css_stylesheet *css, struct uri *base_uri, - const unsigned char *url, int urllen) + const char *url, int urllen) { struct string string, filename; @@ -169,7 +169,7 @@ import_css_file(struct css_stylesheet *css, struct uri *base_uri, add_bytes_to_string(&filename, url, urllen); if (is_in_state(read_encoded_file(&filename, &string), S_OK)) { - unsigned char *end = string.source + string.length; + char *end = string.source + string.length; css->import_level++; css_parse_stylesheet(css, base_uri, string.source, end); @@ -185,7 +185,7 @@ struct css_stylesheet default_stylesheet = INIT_CSS_STYLESHEET(default_styleshee static void import_default_css(void) { - unsigned char *url = get_opt_str("document.css.stylesheet", NULL); + char *url = get_opt_str("document.css.stylesheet", NULL); if (!css_selector_set_empty(&default_stylesheet.selectors)) done_css_stylesheet(&default_stylesheet); diff --git a/src/document/css/css.h b/src/document/css/css.h index e608816e..5d9849b2 100644 --- a/src/document/css/css.h +++ b/src/document/css/css.h @@ -27,8 +27,8 @@ extern struct module css_module; /** This function will try to import the given @a url from the cache. */ void import_css(struct css_stylesheet *css, struct uri *uri); -int supports_css_media_type(const unsigned char *optstr, - const unsigned char *token, size_t token_length); +int supports_css_media_type(const char *optstr, + const char *token, size_t token_length); #ifdef __cplusplus } diff --git a/src/document/css/parser.c b/src/document/css/parser.c index ee2bfe72..106719c0 100644 --- a/src/document/css/parser.c +++ b/src/document/css/parser.c @@ -137,7 +137,7 @@ css_parse_media_types(struct scanner *scanner) { int matched = 0; int empty = 1; - const unsigned char *const optstr = get_opt_str("document.css.media", NULL); + const char *const optstr = get_opt_str("document.css.media", NULL); struct scanner_token *token = get_scanner_token(scanner); while (token && token->type == CSS_TOKEN_IDENT) { @@ -629,7 +629,7 @@ css_parse_ruleset(struct css_stylesheet *css, struct scanner *scanner) void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri, - const unsigned char *string, const unsigned char *end) + const char *string, const char *end) { struct scanner scanner; diff --git a/src/document/css/parser.h b/src/document/css/parser.h index ed678900..a8709f06 100644 --- a/src/document/css/parser.h +++ b/src/document/css/parser.h @@ -28,7 +28,7 @@ void css_parse_properties(LIST_OF(struct css_property) *props, * given stylesheet @a css. If the selector is already in the stylesheet it * properties are added to the that selector. */ void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri, - const unsigned char *string, const unsigned char *end); + const char *string, const char *end); #ifdef __cplusplus } diff --git a/src/document/css/property.h b/src/document/css/property.h index daa8be62..4d3e8fb9 100644 --- a/src/document/css/property.h +++ b/src/document/css/property.h @@ -114,7 +114,7 @@ typedef int (*css_property_value_parser_T)(struct css_property_info *propinfo, /** The struct css_property_info describes what values the properties can * have and what internal type they have. */ struct css_property_info { - unsigned char *name; + char *name; enum css_property_type type; /** This is the storage type, basically describing what to save to diff --git a/src/document/css/scanner.c b/src/document/css/scanner.c index 00497b57..669992eb 100644 --- a/src/document/css/scanner.c +++ b/src/document/css/scanner.c @@ -91,7 +91,7 @@ struct scanner_info css_scanner_info = { scan_css_tokens, }; -#define check_css_table(c, bit) (css_scanner_info.scan_table[(c)] & (bit)) +#define check_css_table(c, bit) (css_scanner_info.scan_table[(unsigned char)(c)] & (bit)) #define scan_css(scanner, s, bit) \ while ((s) < (scanner)->end && check_css_table(*(s), bit)) (s)++; @@ -113,7 +113,7 @@ struct scanner_info css_scanner_info = { && check_css_precedence(*(s), skipto)) { \ if (isquote(*(s))) { \ int size = (scanner)->end - (s); \ - unsigned char *end = memchr(s + 1, *(s), size); \ + char *end = memchr(s + 1, *(s), size); \ \ if (end) (s) = end; \ } \ @@ -124,7 +124,7 @@ struct scanner_info css_scanner_info = { static inline void scan_css_token(struct scanner *scanner, struct scanner_token *token) { - const unsigned char *string = scanner->position; + const char *string = scanner->position; unsigned char first_char = *string; enum css_token_type type = CSS_TOKEN_GARBAGE; int real_length = -1; @@ -158,7 +158,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token) type = CSS_TOKEN_NUMBER; } else { - const unsigned char *ident = string; + const char *ident = string; scan_css(scanner, string, CSS_CHAR_IDENT); type = map_scanner_string(scanner, ident, string, @@ -169,7 +169,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token) scan_css(scanner, string, CSS_CHAR_IDENT); if (*string == '(') { - const unsigned char *function_end = string + 1; + const char *function_end = string + 1; /* Make sure that we have an ending ')' */ skip_css(scanner, function_end, ')'); @@ -193,8 +193,8 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token) * we should of course handle escape * sequences .. but that will have to * be fixed later. */ - const unsigned char *from = string + 1; - const unsigned char *to = function_end - 1; + const char *from = string + 1; + const char *to = function_end - 1; scan_css(scanner, from, CSS_CHAR_WHITESPACE); scan_back_css(scanner, to, CSS_CHAR_WHITESPACE); @@ -258,7 +258,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token) } else if (first_char == '@') { /* Compose token containing @<ident> */ if (is_css_ident_start(*string)) { - const unsigned char *ident = string; + const char *ident = string; /* Scan both ident start and ident */ scan_css(scanner, string, CSS_CHAR_IDENT); @@ -302,7 +302,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token) } else if (isquote(first_char)) { /* TODO: Escaped delimiters --jonas */ int size = scanner->end - string; - unsigned char *string_end = memchr(string, first_char, size); + char *string_end = memchr(string, first_char, size); if (string_end) { /* We don't want the delimiters in the token */ @@ -320,7 +320,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token) type = CSS_TOKEN_NONE; } else { - const unsigned char *sgml = string; + const char *sgml = string; /* Skip anything looking like SGML "<!--" and "-->" * comments + <![CDATA[ and ]]> notations. */ diff --git a/src/document/css/stylesheet.c b/src/document/css/stylesheet.c index 892f0c5c..42bb3e00 100644 --- a/src/document/css/stylesheet.c +++ b/src/document/css/stylesheet.c @@ -29,7 +29,7 @@ struct css_selector * find_css_selector(struct css_selector_set *sels, enum css_selector_type type, enum css_selector_relation rel, - const unsigned char *name, int namelen) + const char *name, int namelen) { struct css_selector *selector; @@ -50,7 +50,7 @@ struct css_selector * init_css_selector(struct css_selector_set *sels, enum css_selector_type type, enum css_selector_relation relation, - const unsigned char *name, int namelen) + const char *name, int namelen) { struct css_selector *selector; @@ -97,7 +97,7 @@ struct css_selector * get_css_selector(struct css_selector_set *sels, enum css_selector_type type, enum css_selector_relation rel, - const unsigned char *name, int namelen) + const char *name, int namelen) { struct css_selector *selector = NULL; diff --git a/src/document/css/stylesheet.h b/src/document/css/stylesheet.h index 9a1c303f..41ae2fa7 100644 --- a/src/document/css/stylesheet.h +++ b/src/document/css/stylesheet.h @@ -96,7 +96,7 @@ struct css_selector { struct css_selector_set leaves; enum css_selector_type type; - unsigned char *name; + char *name; LIST_OF(struct css_property) properties; }; @@ -104,7 +104,7 @@ struct css_selector { struct css_stylesheet; typedef void (*css_stylesheet_importer_T)(struct css_stylesheet *, struct uri *, - const unsigned char *url, int urllen); + const char *url, int urllen); /** The struct css_stylesheet describes all the useful data that was extracted * from the CSS source. Currently we don't cache anything but the default user @@ -148,7 +148,7 @@ void done_css_stylesheet(struct css_stylesheet *css); struct css_selector *get_css_selector(struct css_selector_set *set, enum css_selector_type type, enum css_selector_relation rel, - const unsigned char *name, int namelen); + const char *name, int namelen); #define get_css_base_selector(stylesheet, type, rel, name, namelen) \ get_css_selector((stylesheet) ? &(stylesheet)->selectors : NULL, \ @@ -159,7 +159,7 @@ struct css_selector *get_css_selector(struct css_selector_set *set, struct css_selector *find_css_selector(struct css_selector_set *set, enum css_selector_type type, enum css_selector_relation rel, - const unsigned char *name, int namelen); + const char *name, int namelen); #define find_css_base_selector(stylesheet, type, rel, name, namelen) \ find_css_selector(&stylesheet->selectors, rel, type, name, namelen) @@ -169,7 +169,7 @@ struct css_selector *find_css_selector(struct css_selector_set *set, struct css_selector *init_css_selector(struct css_selector_set *set, enum css_selector_type type, enum css_selector_relation relation, - const unsigned char *name, int namelen); + const char *name, int namelen); /** Add all properties from the list to the given @a selector. */ void add_selector_properties(struct css_selector *selector, diff --git a/src/document/css/value.c b/src/document/css/value.c index 3d96285e..1ec77a06 100644 --- a/src/document/css/value.c +++ b/src/document/css/value.c @@ -40,7 +40,7 @@ css_parse_color_value(struct css_property_info *propinfo, /* The first two args are terminated by ',' and the * last one by ')'. */ unsigned char paskynator = shift ? ',' : ')'; - const unsigned char *nstring = token->string; + const char *nstring = token->string; int part; /* Are the current and next token valid? */ @@ -152,7 +152,7 @@ css_parse_font_weight_value(struct css_property_info *propinfo, struct scanner *scanner) { struct scanner_token *token = get_scanner_token(scanner); - unsigned char *nstring; + char *nstring; int weight; assert(propinfo->value_type == CSS_VT_FONT_ATTRIBUTE); diff --git a/src/document/document.c b/src/document/document.c index 7eaea8c7..e483d9f0 100644 --- a/src/document/document.c +++ b/src/document/document.c @@ -74,10 +74,10 @@ static INIT_LIST_OF(struct document, format_cache); static void found_dns(void *data, struct sockaddr_storage *addr, int addrlen) { - unsigned char buf[64]; - const unsigned char *res; + char buf[64]; + const char *res; struct sockaddr *s; - unsigned char **ip = (unsigned char **)data; + char **ip = (char **)data; void *src; if (!ip || !addr) return; @@ -265,7 +265,7 @@ release_document(struct document *document) } int -find_tag(struct document *document, unsigned char *name, int namelen) +find_tag(struct document *document, char *name, int namelen) { struct tag *tag; diff --git a/src/document/document.h b/src/document/document.h index a44872fe..1585b31a 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -64,7 +64,7 @@ struct tag { LIST_HEAD(struct tag); int x, y; - unsigned char name[1]; /* must be last of struct. --Zas */ + char name[1]; /* must be last of struct. --Zas */ }; @@ -92,7 +92,7 @@ struct script_event_hook { LIST_HEAD(struct script_event_hook); enum script_event_hook_type type; - unsigned char *src; + char *src; }; struct link { @@ -100,13 +100,13 @@ struct link { enum link_type type; - unsigned char *where; - unsigned char *target; - unsigned char *where_img; + char *where; + char *target; + char *where_img; /** The title of the link. This is in the document charset, * and entities have already been decoded. */ - unsigned char *title; + char *title; /** The set of characters belonging to this link (their coordinates * in the document) - each character has own struct point. */ @@ -125,7 +125,7 @@ struct link { LIST_OF(struct script_event_hook) *event_hooks; union { - unsigned char *name; + char *name; struct el_form_control *form_control; } data; }; @@ -225,10 +225,10 @@ struct document { /* for obtaining IP */ void *querydns; - unsigned char *ip; + char *ip; /** The title of the document. The charset of this string is * document.options.cp. */ - unsigned char *title; + char *title; struct cache_entry *cached; struct frame_desc *frame; @@ -250,7 +250,7 @@ struct document { struct point *search_points; #ifdef CONFIG_UTF8 - unsigned char buf[7]; + char buf[7]; unsigned char buf_length; #endif #ifdef CONFIG_COMBINE @@ -321,7 +321,7 @@ extern struct module document_module; * For now, we only support simple printable character. */ #define accesskey_string_to_unicode(s) (((s)[0] && !(s)[1] && isprint((s)[0])) ? (s)[0] : 0) -int find_tag(struct document *document, unsigned char *name, int namelen); +int find_tag(struct document *document, char *name, int namelen); #ifdef __cplusplus } diff --git a/src/document/dom/renderer.c b/src/document/dom/renderer.c index 97b2854e..9086fcd1 100644 --- a/src/document/dom/renderer.c +++ b/src/document/dom/renderer.c @@ -81,13 +81,13 @@ void render_dom_document(struct cache_entry *cached, struct document *document, struct string *buffer) { - unsigned char *head = empty_string_or_(cached->head); + char *head = empty_string_or_(cached->head); struct dom_renderer renderer; struct dom_config config; struct conv_table *convert_table; struct sgml_parser *parser; enum sgml_parser_type parser_type; - unsigned char *string = struri(cached->uri); + char *string = struri(cached->uri); size_t length = strlen(string); struct dom_string uri = INIT_DOM_STRING(string, length); diff --git a/src/document/dom/rss.c b/src/document/dom/rss.c index 9af95d5f..e642d089 100644 --- a/src/document/dom/rss.c +++ b/src/document/dom/rss.c @@ -66,7 +66,7 @@ render_rss_item(struct dom_renderer *renderer, struct dom_node *item) if (title && is_dom_string_set(title)) { if (item->data.element.type == RSS_ELEMENT_CHANNEL) { - unsigned char *str; + char *str; str = convert_string(renderer->convert_table, title->string, title->length, @@ -175,12 +175,12 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx) static int i_want_struct_module_for_dom; if (!i_want_struct_module_for_dom) { - static const unsigned char default_colors[] = + static const char default_colors[] = "title { color: lightgreen } " "author { color: aqua }" "author-date-sep{ color: aqua }" "date { color: aqua }"; - unsigned char *styles = (unsigned char *) default_colors; + char *styles = (char *) default_colors; i_want_struct_module_for_dom = 1; /* When someone will get here earlier than at 4am, @@ -198,7 +198,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx) for (type = 0; type < RSS_STYLES; type++) { struct screen_char *template_ = &rss->styles[type]; - static const unsigned char *names[RSS_STYLES] = + static const char *names[RSS_STYLES] = { "title", "author", "author-date-sep", "date" }; struct css_selector *selector = NULL; diff --git a/src/document/dom/source.c b/src/document/dom/source.c index 23b1de11..46b92acc 100644 --- a/src/document/dom/source.c +++ b/src/document/dom/source.c @@ -60,7 +60,7 @@ struct source_renderer { static inline void -render_dom_flush(struct dom_renderer *renderer, unsigned char *string) +render_dom_flush(struct dom_renderer *renderer, char *string) { struct source_renderer *data = renderer->data; struct screen_char *template_ = &data->styles[DOM_NODE_TEXT]; @@ -80,7 +80,7 @@ static inline void render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template_, struct dom_node *node) { - unsigned char *string = node->string.string; + char *string = node->string.string; int length = node->string.length; if (node->type == DOM_NODE_ENTITY_REFERENCE) { @@ -104,10 +104,10 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no struct source_renderer *data = renderer->data; regex_t *regex = &data->url_regex; regmatch_t regmatch; - unsigned char *string = node->string.string; + char *string = node->string.string; int length = node->string.length; struct screen_char *template_ = &data->styles[node->type]; - unsigned char *alloc_string; + char *alloc_string; if (check_dom_node_source(renderer, string, length)) { render_dom_flush(renderer, string); @@ -188,7 +188,7 @@ render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, vo struct dom_stack_state *state = get_dom_stack_top(stack); struct sgml_parser_state *pstate = get_dom_stack_state_data(stack->contexts[0], state); struct dom_scanner_token *token = &pstate->end_token; - unsigned char *string = token->string.string; + char *string = token->string.string; int length = token->string.length; assert(node && renderer && renderer->document); @@ -208,10 +208,10 @@ render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, vo } static void -set_base_uri(struct dom_renderer *renderer, unsigned char *value, size_t valuelen) +set_base_uri(struct dom_renderer *renderer, char *value, size_t valuelen) { - unsigned char *href = memacpy(value, valuelen); - unsigned char *uristring; + char *href = memacpy(value, valuelen); + char *uristring; struct uri *uri; if (!href) return; @@ -241,7 +241,7 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void if (is_dom_string_set(&node->data.attribute.value)) { int quoted = node->data.attribute.quoted == 1; - unsigned char *value = node->data.attribute.value.string - quoted; + char *value = node->data.attribute.value.string - quoted; int valuelen = node->data.attribute.value.length + quoted * 2; if (check_dom_node_source(renderer, value, 0)) { @@ -309,7 +309,7 @@ render_dom_cdata_source(struct dom_stack *stack, struct dom_node *node, void *xx { struct dom_renderer *renderer = stack->current->data; struct source_renderer *data = renderer->data; - unsigned char *string = node->string.string; + char *string = node->string.string; assert(node && renderer && renderer->document); @@ -340,7 +340,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void * static int i_want_struct_module_for_dom; if (!i_want_struct_module_for_dom) { - static const unsigned char default_colors[] = + static const char default_colors[] = "document { color: yellow } " "element { color: lightgreen } " "entity-reference { color: red } " diff --git a/src/document/dom/util.c b/src/document/dom/util.c index b585fb86..59a2b8c8 100644 --- a/src/document/dom/util.c +++ b/src/document/dom/util.c @@ -116,7 +116,7 @@ add_search_node(struct dom_renderer *renderer, int width) static void render_dom_line(struct dom_renderer *renderer, struct screen_char *template_, - unsigned char *string, int length) + char *string, int length) { struct document *document = renderer->document; struct conv_table *convert = renderer->convert_table; @@ -124,7 +124,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template_, int x, charlen; #ifdef CONFIG_UTF8 int utf8 = document->options.utf8; - unsigned char *end; + char *end; #endif /* CONFIG_UTF8 */ @@ -145,7 +145,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template_, end = string + length; #endif /* CONFIG_UTF8 */ for (x = 0, charlen = 1; x < length;x += charlen, renderer->canvas_x++) { - unsigned char *text = &string[x]; + char *text = &string[x]; /* This is mostly to be able to break out so the indentation * level won't get to high. */ @@ -194,11 +194,11 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template_, mem_free(string); } -static inline unsigned char * -split_dom_line(unsigned char *line, int length, int *linelen) +static inline char * +split_dom_line(char *line, int length, int *linelen) { - unsigned char *end = line + length; - unsigned char *pos; + char *end = line + length; + char *pos; /* End of line detection. * We handle \r, \r\n and \n types here. */ @@ -223,12 +223,12 @@ split_dom_line(unsigned char *line, int length, int *linelen) void render_dom_text(struct dom_renderer *renderer, struct screen_char *template_, - unsigned char *string, int length) + char *string, int length) { int linelen; for (; length > 0; string += linelen, length -= linelen) { - unsigned char *newline = split_dom_line(string, length, &linelen); + char *newline = split_dom_line(string, length, &linelen); if (linelen) render_dom_line(renderer, template_, string, linelen); @@ -245,13 +245,13 @@ render_dom_text(struct dom_renderer *renderer, struct screen_char *template_, ALIGN_LINK(&(doc)->links, (doc)->nlinks, size) NONSTATIC_INLINE struct link * -add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length, - unsigned char *uristring, int urilength) +add_dom_link(struct dom_renderer *renderer, char *string, int length, + char *uristring, int urilength) { struct document *document = renderer->document; int x = renderer->canvas_x; int y = renderer->canvas_y; - unsigned char *where; + char *where; struct link *link; struct point *point; struct screen_char template_; diff --git a/src/document/dom/util.h b/src/document/dom/util.h index 2857c7bf..93c49e42 100644 --- a/src/document/dom/util.h +++ b/src/document/dom/util.h @@ -31,10 +31,10 @@ struct dom_renderer { struct uri *base_uri; - unsigned char *source; - unsigned char *end; + char *source; + char *end; - unsigned char *position; + char *position; int canvas_x, canvas_y; /* Renderer-specific data */ @@ -50,9 +50,9 @@ void init_template_by_style(struct screen_char *template_, LIST_OF(struct css_property) *properties); void render_dom_text(struct dom_renderer *renderer, struct screen_char *template_, - unsigned char *string, int length); -struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string, - int length, unsigned char *uristring, int urilength); + char *string, int length); +struct link *add_dom_link(struct dom_renderer *renderer, char *string, + int length, char *uristring, int urilength); #ifdef __cplusplus } diff --git a/src/document/forms.c b/src/document/forms.c index 93e09af6..96786a5e 100644 --- a/src/document/forms.c +++ b/src/document/forms.c @@ -23,7 +23,7 @@ struct form_type_name { enum form_type num; - unsigned char *name; + char *name; }; static struct form_type_name form_type2name[] = { @@ -42,7 +42,7 @@ static struct form_type_name form_type2name[] = { #define FORM_TYPE_COUNT (sizeof(form_type2name)/sizeof(struct form_type_name)) int -str2form_type(unsigned char *s) +str2form_type(char *s) { int n; @@ -53,7 +53,7 @@ str2form_type(unsigned char *s) return -1; } -unsigned char * +char * form_type2str(enum form_type num) { int n; diff --git a/src/document/forms.h b/src/document/forms.h index 55bfaebc..55e79679 100644 --- a/src/document/forms.h +++ b/src/document/forms.h @@ -35,10 +35,10 @@ struct form { int form_num; int form_end; /**< @see #form_num */ - unsigned char *action; - unsigned char *name; - unsigned char *onsubmit; - unsigned char *target; + char *action; + char *name; + char *onsubmit; + char *target; enum form_method method; LIST_OF(struct el_form_control) items; @@ -88,33 +88,33 @@ struct el_form_control { enum form_type type; enum form_mode mode; - unsigned char *id; /**< used by scripts */ - unsigned char *name; - unsigned char *alt; + char *id; /**< used by scripts */ + char *name; + char *alt; /** Default value, cannot be changed by document scripts. * - For ::FC_TEXT, ::FC_PASSWORD, and ::FC_TEXTAREA: * @c default_value is in the charset of the document. * - For ::FC_FILE: The parser does not set @c default_value. */ - unsigned char *default_value; + char *default_value; int default_state; int size; int cols, rows; enum form_wrap wrap; int maxlength; int nvalues; - unsigned char **values; + char **values; /** Labels in a selection menu. * - For ::FC_SELECT: @c labels are in the charset of the terminal. * (That charset can be UTF-8 only if CONFIG_UTF8 is defined, * and is assumed to be unibyte otherwise.) The charset of * the document and the UTF-8 I/O option have no effect here. */ - unsigned char **labels; + char **labels; struct menu_item *menu; }; /* Numerical form type <-> form type name */ -int str2form_type(unsigned char *s); -unsigned char *form_type2str(enum form_type num); +int str2form_type(char *s); +char *form_type2str(enum form_type num); struct form *init_form(void); void done_form(struct form *form); diff --git a/src/document/html/frames.c b/src/document/html/frames.c index 4ac1b5ac..15deafeb 100644 --- a/src/document/html/frames.c +++ b/src/document/html/frames.c @@ -28,7 +28,7 @@ void add_frameset_entry(struct frameset_desc *frameset_desc, struct frameset_desc *subframe, - unsigned char *name, unsigned char *url) + char *name, char *url) { struct frame_desc *frame_desc; int offset; @@ -127,7 +127,7 @@ add_frame_to_list(struct session *ses, struct document_view *doc_view) } static struct document_view * -find_fd(struct session *ses, unsigned char *name, +find_fd(struct session *ses, char *name, int depth, int x, int y) { struct document_view *doc_view; @@ -389,15 +389,15 @@ distribute_rows_or_cols_that_left(int *val_, int max_value, int *values, int val /* Returns 0 on error. */ static int -extract_rows_or_cols_values(unsigned char *str, int max_value, int pixels_per_char, +extract_rows_or_cols_values(char *str, int max_value, int pixels_per_char, int **new_values, int *new_values_count) { - unsigned char *tmp_str; + char *tmp_str; int *values = NULL; int values_count = 0; while (1) { - unsigned char *end = str; + char *end = str; int *tmp_values; unsigned long number; int val = -1; /* Wildcard */ @@ -454,7 +454,7 @@ extract_rows_or_cols_values(unsigned char *str, int max_value, int pixels_per_ch * <frameset cols="33%,33%,33%" rows="33%,33%,33%"> values in percentage * */ void -parse_frame_widths(unsigned char *str, int max_value, int pixels_per_char, +parse_frame_widths(char *str, int max_value, int pixels_per_char, int **new_values, int *new_values_count) { int val, ret; diff --git a/src/document/html/frames.h b/src/document/html/frames.h index 67a41ac8..db43bf8a 100644 --- a/src/document/html/frames.h +++ b/src/document/html/frames.h @@ -17,7 +17,7 @@ struct frameset_desc; struct frame_desc { struct frameset_desc *subframe; - unsigned char *name; + char *name; struct uri *uri; int width, height; @@ -45,11 +45,11 @@ struct frameset_desc *create_frameset(struct frameset_param *fp); void add_frameset_entry(struct frameset_desc *parent, struct frameset_desc *subframe, - unsigned char *name, unsigned char *url); + char *name, char *url); void format_frames(struct session *ses, struct frameset_desc *fsd, struct document_options *op, int depth); -void parse_frame_widths(unsigned char *str, int max_value, int pixels_per_char, +void parse_frame_widths(char *str, int max_value, int pixels_per_char, int **new_values, int *new_values_count); #ifdef __cplusplus diff --git a/src/document/html/internal.h b/src/document/html/internal.h index eaec3c20..4d7bdd10 100644 --- a/src/document/html/internal.h +++ b/src/document/html/internal.h @@ -15,8 +15,8 @@ struct uri; /* For parser/parse.c: */ -void process_head(struct html_context *html_context, unsigned char *head); -void put_chrs(struct html_context *html_context, unsigned char *start, int len); +void process_head(struct html_context *html_context, char *head); +void put_chrs(struct html_context *html_context, char *start, int len); enum html_whitespace_state { /* Either we are starting a new "block" or the last segment of the @@ -51,7 +51,7 @@ struct html_context { /* These are global per-document base values, alterable by the <base> * element. */ struct uri *base_href; - unsigned char *base_target; + char *base_target; struct document_options *options; @@ -66,7 +66,7 @@ struct html_context { LIST_OF(struct html_element) stack; /* For parser/parse.c: */ - unsigned char *eoff; /* For parser/forms.c too */ + char *eoff; /* For parser/forms.c too */ int line_breax; /* This is for ln_break. */ int position; /* This is the position on the document canvas relative * to the current line and is maintained by put_chrs. */ @@ -88,7 +88,7 @@ struct html_context { int margin; /* For parser/forms.c: */ - unsigned char *startf; + char *startf; /* For: * html/parser/parse.c @@ -112,7 +112,7 @@ struct html_context { * html/parser.c */ /* Note that this is for usage by put_chrs only; anywhere else in * the parser, one should use put_chrs. */ - void (*put_chars_f)(struct html_context *, unsigned char *, int); + void (*put_chars_f)(struct html_context *, char *, int); /* For: * html/parser/forms.c @@ -141,13 +141,13 @@ struct html_context { /* For parser/link.c: */ -void html_focusable(struct html_context *html_context, unsigned char *a); -void html_skip(struct html_context *html_context, unsigned char *a); -unsigned char *get_target(struct document_options *options, unsigned char *a); +void html_focusable(struct html_context *html_context, char *a); +void html_skip(struct html_context *html_context, char *a); +char *get_target(struct document_options *options, char *a); void import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri, - const unsigned char *unterminated_url, int len); + const char *unterminated_url, int len); #ifdef __cplusplus } diff --git a/src/document/html/parse-meta-refresh.c b/src/document/html/parse-meta-refresh.c index db6c7351..43754ec6 100644 --- a/src/document/html/parse-meta-refresh.c +++ b/src/document/html/parse-meta-refresh.c @@ -16,15 +16,15 @@ #define LWS(c) ((c) == ' ' || (c) == ASCII_TAB) int -html_parse_meta_refresh(const unsigned char *content, +html_parse_meta_refresh(const char *content, unsigned long *delay_out, - unsigned char **url_out) + char **url_out) { - const unsigned char *scan = content; + const char *scan = content; char *delay_end; int saw_delay = 0; - const unsigned char *url_begin; - const unsigned char *url_end; + const char *url_begin; + const char *url_end; *url_out = NULL; *delay_out = 0; @@ -34,8 +34,8 @@ html_parse_meta_refresh(const unsigned char *content, /* TODO: Do we need to switch to the "C" locale and back? */ *delay_out = strtoul(scan, &delay_end, 10); - saw_delay = (scan != (const unsigned char *) delay_end); - scan = (const unsigned char *) delay_end; + saw_delay = (scan != (const char *) delay_end); + scan = (const char *) delay_end; if (saw_delay) { /* Omit any fractional part. */ diff --git a/src/document/html/parse-meta-refresh.h b/src/document/html/parse-meta-refresh.h index 103ce036..b9bcb749 100644 --- a/src/document/html/parse-meta-refresh.h +++ b/src/document/html/parse-meta-refresh.h @@ -18,9 +18,9 @@ extern "C" { * @return * 0 if successful, or negative on error. * On error, *@a url is NULL. */ -int html_parse_meta_refresh(const unsigned char *content, +int html_parse_meta_refresh(const char *content, unsigned long *delay, - unsigned char **url); + char **url); #ifdef __cplusplus } diff --git a/src/document/html/parser.c b/src/document/html/parser.c index b914bb62..d9a84cee 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -52,10 +52,10 @@ /* TODO: This needs rewrite. Yes, no kidding. */ static int -extract_color(struct html_context *html_context, unsigned char *a, - unsigned char *attribute, color_T *rgb) +extract_color(struct html_context *html_context, char *a, + char *attribute, color_T *rgb) { - unsigned char *value; + char *value; int retval; value = get_attr_val(a, attribute, html_context->doc_cp); @@ -68,8 +68,8 @@ extract_color(struct html_context *html_context, unsigned char *a, } int -get_color(struct html_context *html_context, unsigned char *a, - unsigned char *attribute, color_T *rgb) +get_color(struct html_context *html_context, char *a, + char *attribute, color_T *rgb) { if (!use_document_fg_colors(html_context->options)) return -1; @@ -78,7 +78,7 @@ get_color(struct html_context *html_context, unsigned char *a, } int -get_bgcolor(struct html_context *html_context, unsigned char *a, color_T *rgb) +get_bgcolor(struct html_context *html_context, char *a, color_T *rgb) { if (!use_document_bg_colors(html_context->options)) return -1; @@ -86,12 +86,12 @@ get_bgcolor(struct html_context *html_context, unsigned char *a, color_T *rgb) return extract_color(html_context, a, "bgcolor", rgb); } -unsigned char * -get_target(struct document_options *options, unsigned char *a) +char * +get_target(struct document_options *options, char *a) { /* FIXME (bug 784): options->cp is the terminal charset; * should use the document charset instead. */ - unsigned char *v = get_attr_val(a, "target", options->cp); + char *v = get_attr_val(a, "target", options->cp); if (!v) return NULL; @@ -116,7 +116,7 @@ ln_break(struct html_context *html_context, int n) } void -put_chrs(struct html_context *html_context, unsigned char *start, int len) +put_chrs(struct html_context *html_context, char *start, int len) { if (html_is_preformatted()) html_context->putsp = HTML_SPACE_NORMAL; @@ -163,9 +163,9 @@ put_chrs(struct html_context *html_context, unsigned char *start, int len) void set_fragment_identifier(struct html_context *html_context, - unsigned char *attr_name, unsigned char *attr) + char *attr_name, char *attr) { - unsigned char *id_attr; + char *id_attr; id_attr = get_attr_val(attr_name, attr, html_context->doc_cp); @@ -177,7 +177,7 @@ set_fragment_identifier(struct html_context *html_context, void add_fragment_identifier(struct html_context *html_context, - struct part *part, unsigned char *attr) + struct part *part, char *attr) { struct part *saved_part = html_context->part; @@ -189,11 +189,11 @@ add_fragment_identifier(struct html_context *html_context, #ifdef CONFIG_CSS void import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri, - const unsigned char *unterminated_url, int len) + const char *unterminated_url, int len) { struct html_context *html_context = css->import_data; - unsigned char *url; - unsigned char *import_url; + char *url; + char *import_url; struct uri *uri; assert(html_context); @@ -238,9 +238,9 @@ import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri, * attributes even near tags where we're not supposed to (like IFRAME, FRAME or * LINK). I think this doesn't make any harm ;). --pasky */ void -html_focusable(struct html_context *html_context, unsigned char *a) +html_focusable(struct html_context *html_context, char *a) { - unsigned char *accesskey; + char *accesskey; int cp; int tabindex; @@ -272,18 +272,18 @@ html_focusable(struct html_context *html_context, unsigned char *a) } void -html_skip(struct html_context *html_context, unsigned char *a) +html_skip(struct html_context *html_context, char *a) { html_top->invisible = 1; html_top->type = ELEMENT_DONT_KILL; } static void -check_head_for_refresh(struct html_context *html_context, unsigned char *head) +check_head_for_refresh(struct html_context *html_context, char *head) { - unsigned char *refresh; - unsigned char *url = NULL; - unsigned char *joined_url = NULL; + char *refresh; + char *url = NULL; + char *joined_url = NULL; unsigned long seconds; refresh = parse_header(head, "Refresh", NULL); @@ -321,9 +321,9 @@ check_head_for_refresh(struct html_context *html_context, unsigned char *head) static void check_head_for_cache_control(struct html_context *html_context, - unsigned char *head) + char *head) { - unsigned char *d; + char *d; int no_cache = 0; time_t expires = 0; @@ -347,7 +347,7 @@ check_head_for_cache_control(struct html_context *html_context, no_cache = 1; } else { - unsigned char *pos = strstr((const char *)d, "max-age="); + char *pos = strstr((const char *)d, "max-age="); assert(!no_cache); @@ -388,7 +388,7 @@ check_head_for_cache_control(struct html_context *html_context, } void -process_head(struct html_context *html_context, unsigned char *head) +process_head(struct html_context *html_context, char *head) { check_head_for_refresh(html_context, head); @@ -399,10 +399,10 @@ process_head(struct html_context *html_context, unsigned char *head) static int -look_for_map(unsigned char **pos, unsigned char *eof, struct uri *uri, +look_for_map(char **pos, char *eof, struct uri *uri, struct document_options *options) { - unsigned char *al, *attr, *name; + char *al, *attr, *name; int namelen; while (*pos < eof && **pos != '<') { @@ -441,10 +441,10 @@ look_for_map(unsigned char **pos, unsigned char *eof, struct uri *uri, } static int -look_for_tag(unsigned char **pos, unsigned char *eof, - unsigned char *name, int namelen, unsigned char **label) +look_for_tag(char **pos, char *eof, + char *name, int namelen, char **label) { - unsigned char *pos2; + char *pos2; struct string str; if (!init_string(&str)) { @@ -493,13 +493,13 @@ look_for_tag(unsigned char **pos, unsigned char *eof, * tag is found (in which case this also adds *@a menu to *@a ml); or * 1 if this should be called again. */ static int -look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu, +look_for_link(char **pos, char *eof, struct menu_item **menu, struct memory_list **ml, struct uri *href_base, - unsigned char *target_base, struct conv_table *ct, + char *target_base, struct conv_table *ct, struct document_options *options) { - unsigned char *attr, *href, *name, *target; - unsigned char *label = NULL; /* shut up warning */ + char *attr, *href, *name, *target; + char *label = NULL; /* shut up warning */ struct link_def *ld; struct menu_item *nm; int nmenu; @@ -529,7 +529,7 @@ look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu, } else if (!c_strlcasecmp(name, namelen, "AREA", 4)) { /* FIXME (bug 784): options->cp is the terminal charset; * should use the document charset instead. */ - unsigned char *alt = get_attr_val(attr, "alt", options->cp); + char *alt = get_attr_val(attr, "alt", options->cp); if (alt) { /* CSM_NONE because get_attr_val() already @@ -637,9 +637,9 @@ look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu, int -get_image_map(unsigned char *head, unsigned char *pos, unsigned char *eof, +get_image_map(char *head, char *pos, char *eof, struct menu_item **menu, struct memory_list **ml, struct uri *uri, - struct document_options *options, unsigned char *target_base, + struct document_options *options, char *target_base, int to, int def, int hdef) { struct conv_table *ct; @@ -743,9 +743,9 @@ done_html_parser_state(struct html_context *html_context, * and entities have not been decoded. */ struct html_context * init_html_parser(struct uri *uri, struct document_options *options, - unsigned char *start, unsigned char *end, + char *start, char *end, struct string *head, struct string *title, - void (*put_chars)(struct html_context *, unsigned char *, int), + void (*put_chars)(struct html_context *, 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 b957687f..9fbdae2a 100644 --- a/src/document/html/parser.h +++ b/src/document/html/parser.h @@ -41,12 +41,12 @@ struct text_attrib { struct text_style style; int fontsize; - unsigned char *link; - unsigned char *target; - unsigned char *image; + char *link; + char *target; + char *image; /* Any entities in the title have already been decoded. */ - unsigned char *title; + char *title; struct el_form_control *form; @@ -58,22 +58,22 @@ struct text_attrib { * or "class". So cache the results. start_element() sets up * these pointers if html_context->options->css_enable; * otherwise they remain NULL. */ - unsigned char *id; - unsigned char *class_; + char *id; + char *class_; #endif - unsigned char *select; + char *select; enum form_mode select_disabled; unsigned int tabindex; unicode_val_T accesskey; - unsigned char *onclick; - unsigned char *ondblclick; - unsigned char *onmouseover; - unsigned char *onhover; - unsigned char *onfocus; - unsigned char *onmouseout; - unsigned char *onblur; + char *onclick; + char *ondblclick; + char *onmouseover; + char *onhover; + char *onfocus; + char *onmouseout; + char *onblur; }; /* This enum is pretty ugly, yes ;). */ @@ -148,10 +148,10 @@ struct html_element { /* The name of the element without NUL termination. name is a pointer * into the actual document source. */ - unsigned char *name; + char *name; int namelen; - unsigned char *options; + char *options; /* See document/html/parser/parse.c's element_info.linebreak * description. */ int linebreak; @@ -168,9 +168,9 @@ struct html_element { struct html_context * init_html_parser(struct uri *uri, struct document_options *options, - unsigned char *start, unsigned char *end, + char *start, char *end, struct string *head, struct string *title, - void (*put_chars)(struct html_context *, unsigned char *, int), + void (*put_chars)(struct html_context *, char *, int), void (*line_break)(struct html_context *), void *(*special)(struct html_context *, enum html_special_type, ...)); @@ -181,18 +181,18 @@ void done_html_parser_state(struct html_context *html_context, void *state); /* Interface for the table handling */ -int get_bgcolor(struct html_context *html_context, unsigned char *a, color_T *rgb); +int get_bgcolor(struct html_context *html_context, char *a, color_T *rgb); void set_fragment_identifier(struct html_context *html_context, - unsigned char *attr_name, unsigned char *attr); + char *attr_name, char *attr); void add_fragment_identifier(struct html_context *html_context, - struct part *, unsigned char *attr); + struct part *, char *attr); /* Interface for the viewer */ int -get_image_map(unsigned char *head, unsigned char *pos, unsigned char *eof, +get_image_map(char *head, char *pos, char *eof, struct menu_item **menu, struct memory_list **ml, struct uri *uri, - struct document_options *options, unsigned char *target_base, + struct document_options *options, char *target_base, int to, int def, int hdef); /* For html/parser/forms.c,general.c,link.c,parse.c,stack.c */ @@ -207,7 +207,7 @@ get_image_map(unsigned char *head, unsigned char *pos, unsigned char *eof, * will only add two line-breaks for the entire run of <br>'s. */ void ln_break(struct html_context *html_context, int n); -int get_color(struct html_context *html_context, unsigned char *a, unsigned char *c, color_T *rgb); +int get_color(struct html_context *html_context, char *a, char *c, color_T *rgb); #ifdef __cplusplus } diff --git a/src/document/html/parser/forms.c b/src/document/html/parser/forms.c index b586edd6..2281b0dd 100644 --- a/src/document/html/parser/forms.c +++ b/src/document/html/parser/forms.c @@ -36,10 +36,10 @@ void -html_form(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_form(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al; + char *al; struct form *form; html_context->was_br = 1; @@ -53,7 +53,7 @@ html_form(struct html_context *html_context, unsigned char *a, al = get_attr_val(a, "method", html_context->doc_cp); if (al) { if (!c_strcasecmp(al, "post")) { - unsigned char *enctype; + char *enctype; enctype = get_attr_val(a, "enctype", html_context->doc_cp); @@ -112,7 +112,7 @@ html_form(struct html_context *html_context, unsigned char *a, static int -get_form_mode(struct html_context *html_context, unsigned char *attr) +get_form_mode(struct html_context *html_context, char *attr) { if (has_attr(attr, "disabled", html_context->doc_cp)) return FORM_MODE_DISABLED; @@ -124,7 +124,7 @@ get_form_mode(struct html_context *html_context, unsigned char *attr) } static struct el_form_control * -init_form_control(enum form_type type, unsigned char *attr, +init_form_control(enum form_type type, char *attr, struct html_context *html_context) { struct el_form_control *fc; @@ -140,10 +140,10 @@ init_form_control(enum form_type type, unsigned char *attr, } void -html_button(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_button(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al; + char *al; struct el_form_control *fc; enum form_type type = FC_SUBMIT; int cp = html_context->doc_cp; @@ -188,7 +188,7 @@ no_type_attr: } static void -html_input_format(struct html_context *html_context, unsigned char *a, +html_input_format(struct html_context *html_context, char *a, struct el_form_control *fc) { put_chrs(html_context, " ", 1); @@ -219,7 +219,7 @@ html_input_format(struct html_context *html_context, unsigned char *a, break; case FC_IMAGE: { - unsigned char *al; + char *al; mem_free_set(&format.image, NULL); al = get_url_val(a, "src", html_context->doc_cp); @@ -266,10 +266,10 @@ html_input_format(struct html_context *html_context, unsigned char *a, } void -html_input(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_input(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al; + char *al; struct el_form_control *fc; int cp = html_context->doc_cp; @@ -335,16 +335,16 @@ html_input(struct html_context *html_context, unsigned char *a, static struct list_menu lnk_menu; static void -do_html_select(unsigned char *attr, unsigned char *html, - unsigned char *eof, unsigned char **end, +do_html_select(char *attr, char *html, + char *eof, char **end, struct html_context *html_context) { 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; - unsigned char **values = NULL; - unsigned char **labels; - unsigned char *name, *t_attr, *en; + char **values = NULL; + char **labels; + char *name, *t_attr, *en; int namelen; int nnmi = 0; int order = 0; @@ -382,7 +382,7 @@ abort: } if (lbl.source) { - unsigned char *q, *s = en; + char *q, *s = en; int l = html - en; while (l && isspace(s[0])) s++, l--; @@ -424,7 +424,7 @@ abort: add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi); if (!closing_tag) { - unsigned char *value, *label; + char *value, *label; if (has_attr(t_attr, "disabled", html_context->doc_cp)) goto see; @@ -455,7 +455,7 @@ abort: if (group) new_menu_item(&lnk_menu, NULL, -1, 0), group = 0; if (!closing_tag) { - unsigned char *label; + char *label; label = get_attr_val(t_attr, "label", html_context->doc_cp); @@ -475,7 +475,7 @@ end_parse: *end = en; if (!order) goto abort; - labels = mem_calloc(order, sizeof(unsigned char *)); + labels = mem_calloc(order, sizeof(char *)); if (!labels) goto abort; fc = init_form_control(FC_SELECT, attr, html_context); @@ -521,11 +521,11 @@ end_parse: static void -do_html_select_multiple(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, - unsigned char **end) +do_html_select_multiple(struct html_context *html_context, char *a, + char *html, char *eof, + char **end) { - unsigned char *al = get_attr_val(a, "name", html_context->doc_cp); + char *al = get_attr_val(a, "name", html_context->doc_cp); if (!al) return; html_focusable(html_context, a); @@ -537,8 +537,8 @@ do_html_select_multiple(struct html_context *html_context, unsigned char *a, } void -html_select(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_select(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { if (has_attr(a, "multiple", html_context->doc_cp)) do_html_select_multiple(html_context, a, html, eof, end); @@ -548,19 +548,19 @@ html_select(struct html_context *html_context, unsigned char *a, } void -html_option(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_option(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { struct el_form_control *fc; - unsigned char *val; + char *val; if (!format.select) return; val = get_attr_val(a, "value", html_context->doc_cp); if (!val) { struct string str; - unsigned char *p, *r; - unsigned char *name; + char *p, *r; + char *name; int namelen; for (p = a - 1; *p != '<'; p--); @@ -626,11 +626,11 @@ end_parse: } void -html_textarea(struct html_context *html_context, unsigned char *attr, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_textarea(struct html_context *html_context, char *attr, + char *html, char *eof, char **end) { struct el_form_control *fc; - unsigned char *p, *t_name, *wrap_attr; + char *p, *t_name, *wrap_attr; int t_namelen; int cols, rows; int i; diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index 581d1f53..34f66c36 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -43,67 +43,67 @@ void -html_span(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_span(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { } void -html_bold(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_bold(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { format.style.attr |= AT_BOLD; } void -html_italic(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_italic(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { format.style.attr |= AT_ITALIC; } void -html_underline(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_underline(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { format.style.attr |= AT_UNDERLINE; } void -html_fixed(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_fixed(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { format.style.attr |= AT_FIXED; } void -html_subscript(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_subscript(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { put_chrs(html_context, "[", 1); } void -html_subscript_close(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_subscript_close(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { put_chrs(html_context, "]", 1); } void -html_superscript(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_superscript(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { put_chrs(html_context, "^", 1); } /* TODO: Add more languages. * Entities can be used in these strings. */ -static unsigned char *quote_char[2] = { "\"", "'" }; +static char *quote_char[2] = { "\"", "'" }; void -html_quote(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_quote(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /* An HTML document containing extremely many repetitions of * "<q>" could cause @html_context->quote_level to overflow. @@ -113,17 +113,17 @@ html_quote(struct html_context *html_context, unsigned char *a, * won't let the quote level wrap back, so it will render the * quotes incorrectly, but such a document probably doesn't * make sense anyway. */ - unsigned char *q = quote_char[html_context->quote_level++ % 2]; + char *q = quote_char[html_context->quote_level++ % 2]; put_chrs(html_context, q, 1); } void -html_quote_close(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, - unsigned char **xxx5) +html_quote_close(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, + char **xxx5) { - unsigned char *q; + char *q; if (html_context->quote_level > 0) html_context->quote_level--; @@ -134,16 +134,16 @@ html_quote_close(struct html_context *html_context, unsigned char *a, } void -html_font(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_font(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al = get_attr_val(a, "size", html_context->doc_cp); + char *al = get_attr_val(a, "size", html_context->doc_cp); if (al) { int p = 0; unsigned s; - unsigned char *nn = al; - unsigned char *end; + char *nn = al; + char *end; if (*al == '+') p = 1, nn++; else if (*al == '-') p = -1, nn++; @@ -163,8 +163,8 @@ html_font(struct html_context *html_context, unsigned char *a, } void -html_body(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_body(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { get_color(html_context, a, "text", &format.style.color.foreground); get_color(html_context, a, "link", &format.color.clink); @@ -205,14 +205,14 @@ html_apply_canvas_bgcolor(struct html_context *html_context) } void -html_script(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_script(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { #ifdef CONFIG_ECMASCRIPT /* TODO: <noscript> processing. Well, same considerations apply as to * CSS property display: none processing. */ /* TODO: Charsets for external scripts. */ - unsigned char *type, *language, *src; + char *type, *language, *src; int in_comment = 0; #endif @@ -226,7 +226,7 @@ html_script(struct html_context *html_context, unsigned char *a, */ type = get_attr_val(a, "type", html_context->doc_cp); if (type) { - unsigned char *pos = type; + char *pos = type; if (!c_strncasecmp(type, "text/", 5)) { pos += 5; @@ -284,7 +284,7 @@ not_processed: && (src = get_attr_val(a, "src", html_context->doc_cp))) { /* External reference. */ - unsigned char *import_url; + char *import_url; struct uri *uri; if (!get_opt_bool("ecmascript.enable", NULL)) { @@ -347,7 +347,7 @@ imported: * contents is wrapped in a comment. See i.e. Mozilla bug 26857 for fun * reading regarding this. */ for (; *end < eof; (*end)++) { - unsigned char *name; + char *name; int namelen; if (in_comment) { @@ -393,23 +393,23 @@ imported: } void -html_style(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_style(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { html_context->was_style = 1; html_skip(html_context, a); } void -html_style_close(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_style_close(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { html_context->was_style = 0; } void -html_html(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_html(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /* This is here just to get CSS stuff applied. */ @@ -422,8 +422,8 @@ html_html(struct html_context *html_context, unsigned char *a, } void -html_html_close(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_html_close(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { if (html_top->type >= ELEMENT_KILLABLE && !html_context->was_body_background) @@ -431,24 +431,24 @@ html_html_close(struct html_context *html_context, unsigned char *a, } void -html_head(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_head(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /* This makes sure it gets to the stack and helps tame down unclosed * <title>. */ } void -html_meta(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_meta(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /* html_handle_body_meta() does all the work. */ } /* Handles meta tags in the HTML body. */ void -html_handle_body_meta(struct html_context *html_context, unsigned char *meta, - unsigned char *eof) +html_handle_body_meta(struct html_context *html_context, char *meta, + char *eof) { struct string head; @@ -462,16 +462,16 @@ html_handle_body_meta(struct html_context *html_context, unsigned char *meta, } void -html_title(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_title(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { html_top->invisible = 1; html_top->type = ELEMENT_WEAK; } void -html_center(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_center(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { par_format.align = ALIGN_CENTER; if (!html_context->table_level) @@ -479,10 +479,10 @@ html_center(struct html_context *html_context, unsigned char *a, } void -html_linebrk(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_linebrk(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al = get_attr_val(a, "align", html_context->doc_cp); + char *al = get_attr_val(a, "align", html_context->doc_cp); if (al) { if (!c_strcasecmp(al, "left")) par_format.align = ALIGN_LEFT; @@ -497,8 +497,8 @@ html_linebrk(struct html_context *html_context, unsigned char *a, } void -html_br(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_br(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_linebrk(html_context, a, html, eof, end); if (html_context->was_br) @@ -508,8 +508,8 @@ html_br(struct html_context *html_context, unsigned char *a, } void -html_p(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_p(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { int_lower_bound(&par_format.leftmargin, html_context->margin); int_lower_bound(&par_format.rightmargin, html_context->margin); @@ -518,25 +518,25 @@ html_p(struct html_context *html_context, unsigned char *a, } void -html_address(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_address(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { par_format.leftmargin++; par_format.align = ALIGN_LEFT; } void -html_blockquote(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_blockquote(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { par_format.leftmargin += 2; par_format.align = ALIGN_LEFT; } void -html_h(int h, unsigned char *a, +html_h(int h, char *a, enum format_align default_align, struct html_context *html_context, - unsigned char *html, unsigned char *eof, unsigned char **end) + char *html, char *eof, char **end) { if (!par_format.align) par_format.align = default_align; html_linebrk(html_context, a, html, eof, end); @@ -563,51 +563,51 @@ html_h(int h, unsigned char *a, } void -html_h1(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_h1(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { format.style.attr |= AT_BOLD; html_h(1, a, ALIGN_CENTER, html_context, html, eof, end); } void -html_h2(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_h2(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_h(2, a, ALIGN_LEFT, html_context, html, eof, end); } void -html_h3(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_h3(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_h(3, a, ALIGN_LEFT, html_context, html, eof, end); } void -html_h4(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_h4(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_h(4, a, ALIGN_LEFT, html_context, html, eof, end); } void -html_h5(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_h5(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_h(5, a, ALIGN_LEFT, html_context, html, eof, end); } void -html_h6(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_h6(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_h(6, a, ALIGN_LEFT, html_context, html, eof, end); } void -html_pre(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_pre(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { format.style.attr |= AT_PREFORMATTED; par_format.leftmargin = (par_format.leftmargin > 1); @@ -615,29 +615,29 @@ html_pre(struct html_context *html_context, unsigned char *a, } void -html_xmp(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_xmp(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_context->was_xmp = 1; html_pre(html_context, a, html, eof, end); } void -html_xmp_close(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_xmp_close(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_context->was_xmp = 0; } void -html_hr(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_hr(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { int i/* = par_format.width - 10*/; - unsigned char r = (unsigned char) BORDER_DHLINE; + char r = BORDER_DHLINE; int q = get_num(a, "size", html_context->doc_cp); - if (q >= 0 && q < 2) r = (unsigned char) BORDER_SHLINE; + if (q >= 0 && q < 2) r = BORDER_SHLINE; html_stack_dup(html_context, ELEMENT_KILLABLE); par_format.align = ALIGN_CENTER; mem_free_set(&format.link, NULL); @@ -659,8 +659,8 @@ html_hr(struct html_context *html_context, unsigned char *a, } void -html_table(struct html_context *html_context, unsigned char *attr, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_table(struct html_context *html_context, char *attr, + char *html, char *eof, char **end) { if (html_context->options->tables && html_context->table_level < HTML_MAX_TABLE_LEVEL) { @@ -677,21 +677,21 @@ html_table(struct html_context *html_context, unsigned char *attr, } void -html_tt(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_tt(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { } void -html_tr(struct html_context *html_context, unsigned char *a, - unsigned char *html, unsigned char *eof, unsigned char **end) +html_tr(struct html_context *html_context, char *a, + char *html, char *eof, char **end) { html_linebrk(html_context, a, html, eof, end); } void -html_th(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_th(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /*html_linebrk(html_context, a, html, eof, end);*/ kill_html_stack_until(html_context, 1, @@ -701,8 +701,8 @@ html_th(struct html_context *html_context, unsigned char *a, } void -html_td(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_td(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /*html_linebrk(html_context, a, html, eof, end);*/ kill_html_stack_until(html_context, 1, @@ -712,14 +712,14 @@ html_td(struct html_context *html_context, unsigned char *a, } void -html_base(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_base(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al; + char *al; al = get_url_val(a, "href", html_context->doc_cp); if (al) { - unsigned char *base = join_urls(html_context->base_href, al); + char *base = join_urls(html_context->base_href, al); struct uri *uri = base ? get_uri(base, 0) : NULL; mem_free(al); @@ -736,10 +736,10 @@ html_base(struct html_context *html_context, unsigned char *a, } void -html_ul(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_ul(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al; + char *al; /* dump_html_stack(html_context); */ par_format.list_level++; @@ -765,10 +765,10 @@ html_ul(struct html_context *html_context, unsigned char *a, } void -html_ol(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_ol(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *al; + char *al; int st; par_format.list_level++; @@ -801,7 +801,7 @@ html_ol(struct html_context *html_context, unsigned char *a, static struct { int n; - unsigned char *s; + char *s; } roman_tbl[] = { {1000, "m"}, {999, "im"}, @@ -851,8 +851,8 @@ roman(struct string *p, unsigned n) } void -html_li(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_li(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { int t = par_format.flags & P_LISTMASK; @@ -904,13 +904,13 @@ html_li(struct html_context *html_context, unsigned char *a, } else if (t == P_ROMAN || t == P_roman) { roman(&n, par_format.list_number); if (t == P_ROMAN) { - unsigned char *x; + char *x; for (x = n.source; *x; x++) *x = c_toupper(*x); } } else { - unsigned char n0[64]; + char n0[64]; if (par_format.list_number < 10) { put_chrs(html_context, " ", 6); c = 1; @@ -944,8 +944,8 @@ html_li(struct html_context *html_context, unsigned char *a, } void -html_dl(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_dl(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { par_format.flags &= ~P_COMPACT; if (has_attr(a, "compact", html_context->doc_cp)) @@ -963,8 +963,8 @@ html_dl(struct html_context *html_context, unsigned char *a, } void -html_dt(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_dt(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { kill_html_stack_until(html_context, 0, "", "DL", NULL); par_format.align = ALIGN_LEFT; @@ -975,8 +975,8 @@ html_dt(struct html_context *html_context, unsigned char *a, } void -html_dd(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_dd(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { kill_html_stack_until(html_context, 0, "", "DL", NULL); @@ -992,8 +992,8 @@ html_dd(struct html_context *html_context, unsigned char *a, void -html_noframes(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_noframes(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { struct html_element *element; @@ -1006,10 +1006,10 @@ html_noframes(struct html_context *html_context, unsigned char *a, } void -html_frame(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_frame(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *name, *src, *url; + char *name, *src, *url; src = get_url_val(a, "src", html_context->doc_cp); if (!src) { @@ -1046,11 +1046,11 @@ html_frame(struct html_context *html_context, unsigned char *a, } void -html_frameset(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_frameset(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { struct frameset_param fp; - unsigned char *cols, *rows; + char *cols, *rows; int width, height; /* XXX: This is still not 100% correct. We should also ignore the @@ -1115,8 +1115,8 @@ free_and_return: } void -html_noscript(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_noscript(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { /* We shouldn't throw <noscript> away until our ECMAScript support is * halfway decent. */ diff --git a/src/document/html/parser/general.h b/src/document/html/parser/general.h index d6985c73..561c15fd 100644 --- a/src/document/html/parser/general.h +++ b/src/document/html/parser/general.h @@ -63,7 +63,7 @@ element_handler_T html_xmp; element_handler_T html_xmp_close; void html_apply_canvas_bgcolor(struct html_context *); -void html_handle_body_meta(struct html_context *, unsigned char *, unsigned char *); +void html_handle_body_meta(struct html_context *, char *, char *); #ifdef __cplusplus } diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c index c80e04db..78330699 100644 --- a/src/document/html/parser/link.c +++ b/src/document/html/parser/link.c @@ -42,14 +42,14 @@ void -html_a(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_a(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *href; + char *href; href = get_url_val(a, "href", html_context->doc_cp); if (href) { - unsigned char *target; + char *target; mem_free_set(&format.link, join_urls(html_context->base_href, @@ -108,10 +108,10 @@ html_a(struct html_context *html_context, unsigned char *a, * allocation failure occurs. * Example: * truncate_label("some_string", 5) => "so*ng" */ -static unsigned char * -truncate_label(unsigned char *label, int max_len) +static char * +truncate_label(char *label, int max_len) { - unsigned char *new_label; + char *new_label; int len = strlen(label); int left_part_len; int right_part_len; @@ -143,11 +143,11 @@ truncate_label(unsigned char *label, int max_len) } /* Get image filename from its src attribute. */ -static unsigned char * -get_image_filename_from_src(int max_len, unsigned char *src) +static char * +get_image_filename_from_src(int max_len, char *src) { - unsigned char *text = NULL; - unsigned char *start, *filename; + char *text = NULL; + char *start, *filename; int len; if (!src) return NULL; @@ -176,10 +176,10 @@ get_image_filename_from_src(int max_len, unsigned char *src) /* Returns an allocated string containing formatted @label. */ -static unsigned char * -get_image_label(int max_len, unsigned char *label) +static char * +get_image_label(int max_len, char *label) { - unsigned char *formatted_label; + char *formatted_label; if (!label) return NULL; @@ -190,7 +190,7 @@ get_image_label(int max_len, unsigned char *label) } static void -put_image_label(unsigned char *a, unsigned char *label, +put_image_label(char *a, char *label, struct html_context *html_context) { color_T saved_foreground; @@ -211,14 +211,14 @@ put_image_label(unsigned char *a, unsigned char *label, } static void -html_img_do(unsigned char *a, unsigned char *object_src, +html_img_do(char *a, char *object_src, struct html_context *html_context) { int ismap, usemap = 0; int add_brackets = 0; - unsigned char *src = NULL; - unsigned char *label = NULL; - unsigned char *usemap_attr; + char *src = NULL; + char *label = NULL; + char *usemap_attr; struct document_options *options = html_context->options; int display_style = options->image_link.display_style; @@ -230,14 +230,14 @@ html_img_do(unsigned char *a, unsigned char *object_src, usemap_attr = get_attr_val(a, "usemap", html_context->doc_cp); if (usemap_attr) { - unsigned char *joined_urls = join_urls(html_context->base_href, + char *joined_urls = join_urls(html_context->base_href, usemap_attr); - unsigned char *map_url; + char *map_url; mem_free(usemap_attr); if (!joined_urls) return; map_url = straconcat("MAP@", joined_urls, - (unsigned char *) NULL); + (char *) NULL); mem_free(joined_urls); if (!map_url) return; @@ -311,9 +311,9 @@ html_img_do(unsigned char *a, unsigned char *object_src, int img_link_tag = options->image_link.tagging; if (img_link_tag && (img_link_tag == 2 || add_brackets)) { - unsigned char *img_link_prefix = options->image_link.prefix; - unsigned char *img_link_suffix = options->image_link.suffix; - unsigned char *new_label = straconcat(img_link_prefix, label, img_link_suffix, (unsigned char *) NULL); + char *img_link_prefix = options->image_link.prefix; + char *img_link_suffix = options->image_link.suffix; + char *new_label = straconcat(img_link_prefix, label, img_link_suffix, (char *) NULL); if (new_label) mem_free_set(&label, new_label); } @@ -329,10 +329,10 @@ html_img_do(unsigned char *a, unsigned char *object_src, format.title = get_attr_val(a, "title", html_context->doc_cp); if (ismap) { - unsigned char *new_link; + char *new_link; html_stack_dup(html_context, ELEMENT_KILLABLE); - new_link = straconcat(format.link, "?0,0", (unsigned char *) NULL); + new_link = straconcat(format.link, "?0,0", (char *) NULL); if (new_link) mem_free_set(&format.link, new_link); } @@ -352,17 +352,17 @@ html_img_do(unsigned char *a, unsigned char *object_src, } void -html_img(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_img(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { html_img_do(a, NULL, html_context); } void -html_source(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_source(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *src, *title; + char *src, *title; struct document_options *options = html_context->options; int display_style = options->image_link.display_style; @@ -392,8 +392,8 @@ html_source(struct html_context *html_context, unsigned char *a, /* prefix can have entities in it, but linkname cannot. */ void -put_link_line(unsigned char *prefix, unsigned char *linkname, - unsigned char *link, unsigned char *target, +put_link_line(char *prefix, char *linkname, + char *link, char *target, struct html_context *html_context) { html_context->has_link_lines = 1; @@ -418,10 +418,10 @@ put_link_line(unsigned char *prefix, unsigned char *linkname, void -html_applet(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_applet(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *code, *alt; + char *code, *alt; code = get_url_val(a, "code", html_context->doc_cp); if (!code) return; @@ -443,10 +443,10 @@ html_applet(struct html_context *html_context, unsigned char *a, } void -html_audio(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_audio(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *url; + char *url; /* This just places a link where a audio element would be. */ @@ -464,10 +464,10 @@ html_audio(struct html_context *html_context, unsigned char *a, } static void -html_iframe_do(unsigned char *a, unsigned char *object_src, +html_iframe_do(char *a, char *object_src, struct html_context *html_context) { - unsigned char *name, *url = NULL; + char *name, *url = NULL; url = null_or_stracpy(object_src); if (!url) url = get_url_val(a, "src", html_context->doc_cp); @@ -496,17 +496,17 @@ html_iframe_do(unsigned char *a, unsigned char *object_src, } void -html_iframe(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_iframe(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { html_iframe_do(a, NULL, html_context); } void -html_object(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_object(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *type, *url; + char *type, *url; /* This is just some dirty wrapper. We emulate various things through * this, which is anyway in the spirit of <object> element, unifying @@ -529,7 +529,7 @@ html_object(struct html_context *html_context, unsigned char *a, /* TODO: Use the enclosed text as 'alt' attribute. */ html_img_do(a, url, html_context); } else { - unsigned char *name; + char *name; name = get_attr_val(a, "standby", html_context->doc_cp); @@ -553,11 +553,11 @@ html_object(struct html_context *html_context, unsigned char *a, } void -html_embed(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_embed(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *type, *extension; - unsigned char *object_src; + char *type, *extension; + char *object_src; /* This is just some dirty wrapper. We emulate various things through * this, which is anyway in the spirit of <object> element, unifying @@ -587,10 +587,10 @@ html_embed(struct html_context *html_context, unsigned char *a, } void -html_video(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_video(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { - unsigned char *url; + char *url; /* This just places a link where a video element would be. */ @@ -710,25 +710,25 @@ enum hlink_direction { struct hlink { enum hlink_type type; enum hlink_direction direction; - unsigned char *content_type; - unsigned char *media; - unsigned char *href; - unsigned char *hreflang; - unsigned char *title; - unsigned char *lang; - unsigned char *name; + char *content_type; + char *media; + char *href; + char *hreflang; + char *title; + char *lang; + char *name; /* Not implemented yet. - unsigned char *charset; - unsigned char *target; - unsigned char *id; - unsigned char *class_; - unsigned char *dir; + char *charset; + char *target; + char *id; + char *class_; + char *dir; */ }; struct lt_default_name { enum hlink_type type; - unsigned char *str; + char *str; }; /* TODO: i18n */ @@ -769,7 +769,7 @@ static struct lt_default_name lt_names[] = { }; /* Search for default name for this link according to its type. */ -static unsigned char * +static char * get_lt_default_name(struct hlink *link) { struct lt_default_name *entry = lt_names; @@ -803,7 +803,7 @@ html_link_clear(struct hlink *link) /* Parse a link and return results in @link. * It tries to identify known types. */ static int -html_link_parse(struct html_context *html_context, unsigned char *a, +html_link_parse(struct html_context *html_context, char *a, struct hlink *link) { int i; @@ -859,11 +859,11 @@ html_link_parse(struct html_context *html_context, unsigned char *a, } void -html_link(struct html_context *html_context, unsigned char *a, - unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) +html_link(struct html_context *html_context, char *a, + char *xxx3, char *xxx4, char **xxx5) { int link_display = html_context->options->meta_link_display; - unsigned char *name; + char *name; struct hlink link; struct string text; int name_neq_title = 0; @@ -947,9 +947,9 @@ html_link(struct html_context *html_context, unsigned char *a, put_link_line: { - unsigned char *prefix = (link.direction == LD_REL) + char *prefix = (link.direction == LD_REL) ? "Link: " : "Reverse link: "; - unsigned char *link_name = (text.length) + char *link_name = (text.length) ? text.source : name; put_link_line(prefix, link_name, link.href, diff --git a/src/document/html/parser/link.h b/src/document/html/parser/link.h index 5b5c900e..ec199215 100644 --- a/src/document/html/parser/link.h +++ b/src/document/html/parser/link.h @@ -10,7 +10,7 @@ extern "C" { struct html_context; -void put_link_line(unsigned char *prefix, unsigned char *linkname, unsigned char *link, unsigned char *target, struct html_context *html_context); +void put_link_line(char *prefix, char *linkname, char *link, char *target, struct html_context *html_context); element_handler_T html_a; element_handler_T html_applet; diff --git a/src/document/html/parser/parse.c b/src/document/html/parser/parse.c index 54e8cca0..c8d77504 100644 --- a/src/document/html/parser/parse.c +++ b/src/document/html/parser/parse.c @@ -53,9 +53,9 @@ atchr(register unsigned char c) /* It returns -1 when it failed (returned values in pointers are invalid) and * 0 for success. */ int -parse_element(register unsigned char *e, unsigned char *eof, - unsigned char **name, int *namelen, - unsigned char **attr, unsigned char **end) +parse_element(register char *e, char *eof, + char **name, int *namelen, + char **attr, char **end) { #define next_char() if (++e == eof) return -1; @@ -137,13 +137,13 @@ end: (s)[(l)++] = (c); \ } while (0) -unsigned char * -get_attr_value(register unsigned char *e, unsigned char *name, +char * +get_attr_value(register char *e, char *name, int cp, enum html_attr_flags flags) { - unsigned char *n; - unsigned char *name_start; - unsigned char *attr = NULL; + char *n; + char *name_start; + char *attr = NULL; int attrlen = 0; int found; @@ -209,7 +209,7 @@ found_endattr: if (/* Unused: !(flags & HTML_ATTR_NO_CONV) && */ memchr(attr, '&', attrlen)) { - unsigned char *saved_attr = attr; + char *saved_attr = attr; attr = convert_string(NULL, saved_attr, attrlen, cp, CSM_QUERY, NULL, NULL, NULL); @@ -250,13 +250,13 @@ parse_error: * It will return a positive integer value on success, * or -1 on error. */ int -get_num(unsigned char *a, unsigned char *name, int cp) +get_num(char *a, char *name, int cp) { - unsigned char *al = get_attr_val(a, name, cp); + char *al = get_attr_val(a, name, cp); int result = -1; if (al) { - unsigned char *end; + char *end; long num; errno = 0; @@ -275,12 +275,12 @@ get_num(unsigned char *a, unsigned char *name, int cp) * @limited must be set to be able to parse percentage widths. */ /* The function returns width in characters or -1 in case of error. */ int -get_width(unsigned char *a, unsigned char *name, int limited, +get_width(char *a, char *name, int limited, struct html_context *html_context) { - unsigned char *value = get_attr_val(a, name, html_context->doc_cp); - unsigned char *str = value; - unsigned char *end; + char *value = get_attr_val(a, name, html_context->doc_cp); + char *str = value; + char *end; int percentage = 0; int len; long width; @@ -359,8 +359,8 @@ get_width(unsigned char *a, unsigned char *name, int limited, } -unsigned char * -skip_comment(unsigned char *html, unsigned char *eof) +char * +skip_comment(char *html, char *eof) { if (html + 4 <= eof && html[2] == '-' && html[3] == '-') { html += 4; @@ -399,7 +399,7 @@ enum element_type { struct element_info { /* Element name, uppercase. */ - unsigned char *name; + char *name; /* Element handler. This does the relevant arguments processing and * formatting (by calling renderer hooks). Note that in a few cases, @@ -568,9 +568,9 @@ free_tags_lookup(void) } -static unsigned char *process_element(unsigned char *name, int namelen, int endingtag, - unsigned char *html, unsigned char *prev_html, - unsigned char *eof, unsigned char *attr, +static char *process_element(char *name, int namelen, int endingtag, + char *html, char *prev_html, + char *eof, char *attr, struct html_context *html_context); /* Count the consecutive newline entity references (e.g. " ") at @@ -580,15 +580,15 @@ static unsigned char *process_element(unsigned char *name, int namelen, int endi * This function currently requires a semicolon at the end of any * entity reference, and does not support U+2028 LINE SEPARATOR and * U+2029 PARAGRAPH SEPARATOR. */ -static const unsigned char * -count_newline_entities(const unsigned char *html, const unsigned char *eof, +static const char * +count_newline_entities(const char *html, const char *eof, int *newlines_out) { int newlines = 0; int prev_was_cr = 0; /* treat CRLF as one newline, not two */ while ((html + 5 < eof && html[0] == '&' && html[1] == '#')) { - const unsigned char *peek = html + 2; + const char *peek = html + 2; int this_is_cr; if (*peek == 'x' || *peek == 'X') { @@ -635,11 +635,11 @@ count_newline_entities(const unsigned char *html, const unsigned char *eof, } void -parse_html(unsigned char *html, unsigned char *eof, - struct part *part, unsigned char *head, +parse_html(char *html, char *eof, + struct part *part, char *head, struct html_context *html_context) { - unsigned char *base_pos = html; + char *base_pos = html; int noupdate = 0; html_context->putsp = HTML_SPACE_SUPPRESS; @@ -655,7 +655,7 @@ parse_html(unsigned char *html, unsigned char *eof, main_loop: while (html < eof) { - unsigned char *name, *attr, *end; + char *name, *attr, *end; int namelen, endingtag; int dotcounter = 0; @@ -668,7 +668,7 @@ main_loop: } if (isspace(*html) && !html_is_preformatted()) { - unsigned char *h = html; + char *h = html; while (h < eof && isspace(*h)) h++; @@ -737,7 +737,7 @@ next_break: int length = html - base_pos; int newlines; - html = (unsigned char *) count_newline_entities(html, eof, &newlines); + html = (char *) count_newline_entities(html, eof, &newlines); if (newlines) { put_chrs(html_context, base_pos, length); ln_break(html_context, newlines); @@ -746,14 +746,14 @@ next_break: } } - while (*html < ' ') { + while ((unsigned char)*html < ' ') { if (html - base_pos) put_chrs(html_context, base_pos, html - base_pos); dotcounter++; base_pos = ++html; if (*html >= ' ' || isspace(*html) || html >= eof) { - unsigned char *dots = fmem_alloc(dotcounter); + char *dots = fmem_alloc(dotcounter); if (dots) { memset(dots, '.', dotcounter); @@ -783,8 +783,8 @@ element: put_chrs(html_context, " ", 1); put_chrs(html_context, base_pos, html - base_pos); if (!html_is_preformatted() && !endingtag && html_context->putsp == HTML_SPACE_NORMAL) { - unsigned char *ee = end; - unsigned char *nm; + char *ee = end; + char *nm; while (!parse_element(ee, eof, &nm, NULL, NULL, &ee)) if (*nm == '/') @@ -811,11 +811,11 @@ ng: /* Perform the processing of the element that should take place when its open * tag is encountered. Viewing the document as a tree of elements, this * routine runs as a callback for pre-order traversal. */ -static unsigned char * +static char * start_element(struct element_info *ei, - unsigned char *name, int namelen, - unsigned char *html, - unsigned char *eof, unsigned char *attr, + char *name, int namelen, + char *html, + char *eof, char *attr, struct html_context *html_context) { #define ELEMENT_RENDER_PROLOGUE \ @@ -826,7 +826,7 @@ start_element(struct element_info *ei, mem_free(a); \ } - unsigned char *a; + char *a; struct par_attrib old_format; int restore_format; #ifdef CONFIG_CSS @@ -870,7 +870,7 @@ start_element(struct element_info *ei, /* If this is a style tag, parse it. */ #ifdef CONFIG_CSS if (ei->open == html_style && html_context->options->css_enable) { - unsigned char *media + char *media = get_attr_val(attr, "media", html_context->doc_cp); int support = supports_html_media_attr(media); mem_free_if(media); @@ -1025,11 +1025,11 @@ start_element(struct element_info *ei, * tag is encountered. Viewing the document as a tree of elements and assuming * that all tags are properly nested and closed, this routine runs as a * callback for post-order traversal. */ -static unsigned char * +static char * end_element(struct element_info *ei, - unsigned char *name, int namelen, - unsigned char *html, - unsigned char *eof, unsigned char *attr, + char *name, int namelen, + char *html, + char *eof, char *attr, struct html_context *html_context) { struct html_element *e, *elt; @@ -1124,10 +1124,10 @@ end_element(struct element_info *ei, return html; } -static unsigned char * -process_element(unsigned char *name, int namelen, int endingtag, - unsigned char *html, unsigned char *prev_html, - unsigned char *eof, unsigned char *attr, +static char * +process_element(char *name, int namelen, int endingtag, + char *html, char *prev_html, + char *eof, char *attr, struct html_context *html_context) { @@ -1165,10 +1165,10 @@ process_element(unsigned char *name, int namelen, int endingtag, } void -scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head, +scan_http_equiv(char *s, char *eof, struct string *head, struct string *title, int cp) { - unsigned char *name, *attr, *he, *c; + char *name, *attr, *he, *c; int namelen; if (title && !init_string(title)) return; @@ -1192,7 +1192,7 @@ ps: if (!c_strlcasecmp(name, namelen, "/HEAD", 5)) return; if (!c_strlcasecmp(name, namelen, "BODY", 4)) return; if (title && !title->length && !c_strlcasecmp(name, namelen, "TITLE", 5)) { - unsigned char *s1; + char *s1; xse: s1 = s; @@ -1250,9 +1250,9 @@ xsp: /** Check whether ELinks claims to support any of the media types * listed in the media attribute of an HTML STYLE or LINK element. */ int -supports_html_media_attr(const unsigned char *media) +supports_html_media_attr(const char *media) { - const unsigned char *optstr; + const char *optstr; /* The 1999-12-24 edition of HTML 4.01 is inconsistent on what * it means if a STYLE or LINK element has no media attribute: @@ -1283,7 +1283,7 @@ supports_html_media_attr(const unsigned char *media) optstr = get_opt_str("document.css.media", NULL); while (*media != '\0') { - const unsigned char *beg, *end; + const char *beg, *end; while (*media == ' ') ++media; diff --git a/src/document/html/parser/parse.h b/src/document/html/parser/parse.h index 50fbdd4a..ab75275d 100644 --- a/src/document/html/parser/parse.h +++ b/src/document/html/parser/parse.h @@ -41,7 +41,7 @@ enum html_attr_flags { * - name is searched attribute * * Returns allocated string containing the attribute, or NULL on unsuccess. */ -unsigned char *get_attr_value(register unsigned char *e, unsigned char *name, int cp, enum html_attr_flags flags); +char *get_attr_value(register char *e, char *name, int cp, enum html_attr_flags flags); /* Wrappers for get_attr_value(). */ #define get_attr_val(e, name, cp) get_attr_value(e, name, cp, HTML_ATTR_NONE) @@ -52,27 +52,27 @@ unsigned char *get_attr_value(register unsigned char *e, unsigned char *name, in /* Interface for both the renderer and the table handling */ -void parse_html(unsigned char *html, unsigned char *eof, struct part *part, unsigned char *head, struct html_context *html_context); +void parse_html(char *html, char *eof, struct part *part, char *head, struct html_context *html_context); /* Interface for element handlers */ -typedef void (element_handler_T)(struct html_context *, unsigned char *attr, - unsigned char *html, unsigned char *eof, - unsigned char **end); +typedef void (element_handler_T)(struct html_context *, char *attr, + char *html, char *eof, + char **end); /* Interface for the table handling */ -int parse_element(unsigned char *, unsigned char *, unsigned char **, int *, unsigned char **, unsigned char **); +int parse_element(char *, char *, char **, int *, char **, char **); -int get_num(unsigned char *, unsigned char *, int); -int get_width(unsigned char *, unsigned char *, int, struct html_context *); +int get_num(char *, char *, int); +int get_width(char *, char *, int, struct html_context *); -unsigned char *skip_comment(unsigned char *, unsigned char *); +char *skip_comment(char *, char *); -void scan_http_equiv(unsigned char *s, unsigned char *eof, struct string *head, struct string *title, int cp); +void scan_http_equiv(char *s, char *eof, struct string *head, struct string *title, int cp); -int supports_html_media_attr(const unsigned char *media); +int supports_html_media_attr(const char *media); /* Lifecycle functions for the tags fastfind cache, if being in use. */ diff --git a/src/document/html/parser/stack.c b/src/document/html/parser/stack.c index 594ef424..cf851e41 100644 --- a/src/document/html/parser/stack.c +++ b/src/document/html/parser/stack.c @@ -47,7 +47,7 @@ dump_html_stack(struct html_context *html_context) struct html_element * -search_html_stack(struct html_context *html_context, unsigned char *name) +search_html_stack(struct html_context *html_context, char *name) { struct html_element *element; int namelen; @@ -75,7 +75,7 @@ void kill_html_stack_item(struct html_context *html_context, struct html_element *e) { #ifdef CONFIG_ECMASCRIPT - unsigned char *onload = NULL; + char *onload = NULL; #endif assert(e); @@ -207,7 +207,7 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...) va_start(arg, ls); while (1) { - unsigned char *s = va_arg(arg, unsigned char *); + char *s = va_arg(arg, char *); int slen; if (!s) break; diff --git a/src/document/html/parser/stack.h b/src/document/html/parser/stack.h index 5ff77700..3d813427 100644 --- a/src/document/html/parser/stack.h +++ b/src/document/html/parser/stack.h @@ -11,7 +11,7 @@ extern "C" { struct html_context; struct html_element *search_html_stack(struct html_context *html_context, - unsigned char *name); + char *name); void html_stack_dup(struct html_context *html_context, enum html_element_mortality_type type); diff --git a/src/document/html/parser/table.c b/src/document/html/parser/table.c index dfee23ab..6eb3a04b 100644 --- a/src/document/html/parser/table.c +++ b/src/document/html/parser/table.c @@ -34,7 +34,7 @@ mem_align_alloc(bad_html, size, (size) + 1, 0xFF) static void -add_table_bad_html_start(struct table *table, unsigned char *start) +add_table_bad_html_start(struct table *table, char *start) { if (table->caption.start && !table->caption.end) return; @@ -49,7 +49,7 @@ add_table_bad_html_start(struct table *table, unsigned char *start) } static void -add_table_bad_html_end(struct table *table, unsigned char *end) +add_table_bad_html_end(struct table *table, char *end) { if (table->caption.start && !table->caption.end) { table->caption.end = end; @@ -63,9 +63,9 @@ add_table_bad_html_end(struct table *table, unsigned char *end) static void -get_bordercolor(struct html_context *html_context, unsigned char *a, color_T *rgb) +get_bordercolor(struct html_context *html_context, char *a, color_T *rgb) { - unsigned char *at; + char *at; if (!use_document_fg_colors(html_context->options)) return; @@ -83,9 +83,9 @@ get_bordercolor(struct html_context *html_context, unsigned char *a, color_T *rg } static void -get_align(struct html_context *html_context, unsigned char *attr, int *a) +get_align(struct html_context *html_context, char *attr, int *a) { - unsigned char *al = get_attr_val(attr, "align", html_context->doc_cp); + char *al = get_attr_val(attr, "align", html_context->doc_cp); if (!al) return; @@ -98,9 +98,9 @@ get_align(struct html_context *html_context, unsigned char *attr, int *a) } static void -get_valign(struct html_context *html_context, unsigned char *attr, int *a) +get_valign(struct html_context *html_context, char *attr, int *a) { - unsigned char *al = get_attr_val(attr, "valign", html_context->doc_cp); + char *al = get_attr_val(attr, "valign", html_context->doc_cp); if (!al) return; @@ -112,17 +112,17 @@ get_valign(struct html_context *html_context, unsigned char *attr, int *a) } static void -get_column_width(unsigned char *attr, int *width, int sh, +get_column_width(char *attr, int *width, int sh, struct html_context *html_context) { - unsigned char *al = get_attr_val(attr, "width", html_context->doc_cp); + char *al = get_attr_val(attr, "width", html_context->doc_cp); int len; if (!al) return; len = strlen(al); if (len && al[len - 1] == '*') { - unsigned char *en; + char *en; int n; al[len - 1] = '\0'; @@ -140,9 +140,9 @@ get_column_width(unsigned char *attr, int *width, int sh, static void set_table_frame(struct html_context *html_context, struct table *table, - unsigned char *attr) + char *attr) { - unsigned char *al; + char *al; if (!table->border) { table->frame = TABLE_FRAME_VOID; @@ -170,9 +170,9 @@ set_table_frame(struct html_context *html_context, struct table *table, static void set_table_rules(struct html_context *html_context, struct table *table, - unsigned char *attr) + char *attr) { - unsigned char *al; + char *al; table->rules = table->border ? TABLE_RULE_ALL : TABLE_RULE_NONE; @@ -188,7 +188,7 @@ set_table_rules(struct html_context *html_context, struct table *table, } static void -parse_table_attributes(struct table *table, unsigned char *attr, int real, +parse_table_attributes(struct table *table, char *attr, int real, struct html_context *html_context) { table->fragment_id = get_attr_val(attr, "id", html_context->doc_cp); @@ -501,13 +501,13 @@ set_td_width(struct table *table, int col, int width, int force) table->cols_x[col] = (table->cols_x[col] + width) >> 1; } -static unsigned char * -skip_table(unsigned char *html, unsigned char *eof) +static char * +skip_table(char *html, char *eof) { int level = 1; while (1) { - unsigned char *name; + char *name; int namelen, closing_tag = 0; while (html < eof @@ -539,13 +539,13 @@ skip_table(unsigned char *html, unsigned char *eof) } struct table * -parse_table(unsigned char *html, unsigned char *eof, unsigned char **end, - unsigned char *attr, int sh, struct html_context *html_context) +parse_table(char *html, char *eof, char **end, + char *attr, int sh, struct html_context *html_context) { struct table *table; struct table_cell *cell; - unsigned char *t_attr, *en, *name; - unsigned char *l_fragment_id = NULL; + char *t_attr, *en, *name; + char *l_fragment_id = NULL; color_T last_bgcolor; int namelen; int in_cell = 0; diff --git a/src/document/html/parser/table.h b/src/document/html/parser/table.h index 8926696e..a7b0a10f 100644 --- a/src/document/html/parser/table.h +++ b/src/document/html/parser/table.h @@ -41,13 +41,13 @@ struct part; #define TABLE_RULE_GROUPS 4 struct html_start_end { - unsigned char *start, *end; + char *start, *end; }; struct table_cell { - unsigned char *start; - unsigned char *end; - unsigned char *fragment_id; + char *start; + char *end; + char *fragment_id; color_T bgcolor; int col, row; int align; @@ -80,7 +80,7 @@ struct table_colors { struct table { struct part *part; struct table_cell *cells; - unsigned char *fragment_id; + char *fragment_id; struct table_colors color; int align; @@ -121,8 +121,8 @@ struct table { #define CELL(table, col, row) (&(table)->cells[(row) * (table)->real_cols + (col)]) struct table * -parse_table(unsigned char *html, unsigned char *eof, unsigned char **end, - unsigned char *attr, int sh, struct html_context *html_context); +parse_table(char *html, char *eof, char **end, + char *attr, int sh, struct html_context *html_context); void free_table(struct table *table); diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index d0ed0c10..1987133a 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -63,15 +63,15 @@ enum link_state { }; struct link_state_info { - unsigned char *link; - unsigned char *target; - unsigned char *image; + char *link; + char *target; + char *image; struct el_form_control *form; }; struct table_cache_entry_key { - unsigned char *start; - unsigned char *end; + char *start; + char *end; int align; int margin; int width; @@ -128,7 +128,7 @@ static struct renderer_context renderer_context; /* Prototypes */ static void line_break(struct html_context *); -static void put_chars(struct html_context *, unsigned char *, int); +static void put_chars(struct html_context *, char *, int); #define X(x_) (part->box.x + (x_)) #define Y(y_) (part->box.y + (y_)) @@ -473,7 +473,7 @@ put_combined(struct part *part, int x) /* First possibly do the format change and then find out what coordinates * to use since sub- or superscript might change them */ static inline int -set_hline(struct html_context *html_context, unsigned char *chars, int charslen, +set_hline(struct html_context *html_context, char *chars, int charslen, enum link_state link_state) { struct part *const part = html_context->part; @@ -532,14 +532,14 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen, if (orig_length < 0) /* error */ return 0; if (utf8) { - unsigned char *const end = chars + charslen; + char *const end = chars + charslen; unicode_val_T data; if (document->buf_length) { /* previous char was broken in the middle */ int length = utf8charlen(document->buf); unsigned char i; - unsigned char *buf_ptr = document->buf; + char *buf_ptr = document->buf; for (i = document->buf_length; i < length && chars < end;) { document->buf[i++] = *chars++; @@ -695,7 +695,7 @@ good_char: len = x - x2; } else { /* part->document == NULL */ if (utf8) { - unsigned char *const end = chars + charslen; + char *const end = chars + charslen; while (chars < end) { unicode_val_T data; @@ -745,7 +745,7 @@ good_char: /* First possibly do the format change and then find out what coordinates * to use since sub- or superscript might change them */ static inline void -set_hline(struct html_context *html_context, unsigned char *chars, int charslen, +set_hline(struct html_context *html_context, char *chars, int charslen, enum link_state link_state) { struct part *part = html_context->part; @@ -1413,7 +1413,7 @@ init_link_event_hooks(struct html_context *html_context, struct link *link) } static struct link * -new_link(struct html_context *html_context, unsigned char *name, int namelen) +new_link(struct html_context *html_context, char *name, int namelen) { struct document *document; struct part *part; @@ -1513,7 +1513,7 @@ new_link(struct html_context *html_context, unsigned char *name, int namelen) } static void -html_special_tag(struct document *document, unsigned char *t, int x, int y) +html_special_tag(struct document *document, char *t, int x, int y) { struct tag *tag; int tag_len; @@ -1537,7 +1537,7 @@ html_special_tag(struct document *document, unsigned char *t, int x, int y) static void put_chars_conv(struct html_context *html_context, - unsigned char *chars, int charslen) + char *chars, int charslen) { assert(html_context); if_assert_failed return; @@ -1553,7 +1553,7 @@ put_chars_conv(struct html_context *html_context, convert_string(renderer_context.convert_table, chars, charslen, html_context->options->cp, (format.style.attr & AT_NO_ENTITIES) ? CSM_NONE : CSM_DEFAULT, - NULL, (void (*)(void *, unsigned char *, int)) put_chars, html_context); + NULL, (void (*)(void *, char *, int)) put_chars, html_context); } /* @@ -1562,7 +1562,7 @@ put_chars_conv(struct html_context *html_context, * friendly key="gfdsahjkl;trewqyuiopvcxznm". Returns the length of link_sym. */ int -dec2qwerty(int num, unsigned char *link_sym, const unsigned char *key, int base) +dec2qwerty(int num, char *link_sym, const char *key, int base) { int newlen, i, pow; @@ -1583,7 +1583,7 @@ dec2qwerty(int num, unsigned char *link_sym, const unsigned char *key, int base) * Returns the value of link_sym in decimal according to key. */ int -qwerty2dec(const unsigned char *link_sym, const unsigned char *key, int base) +qwerty2dec(const char *link_sym, const char *key, int base) { int z = 0; int symlen = strlen(link_sym); @@ -1603,10 +1603,10 @@ put_link_number(struct html_context *html_context) { char *symkey = get_opt_str("document.browse.links.label_key", NULL); struct part *part = html_context->part; - unsigned char s[64]; - unsigned char *fl = format.link; - unsigned char *ft = format.target; - unsigned char *fi = format.image; + char s[64]; + char *fl = format.link; + char *ft = format.target; + char *fi = format.image; struct text_style old_style = format.style; struct el_form_control *ff = format.form; int slen = 0; @@ -1645,8 +1645,8 @@ put_link_number(struct html_context *html_context) assertm(!(old), "Old link value [%s]. New value [%s]", old, new); static inline void -init_link_state_info(unsigned char *link, unsigned char *target, - unsigned char *image, struct el_form_control *form) +init_link_state_info(char *link, char *target, + char *image, struct el_form_control *form) { assert_link_variable(renderer_context.link_state_info.image, image); assert_link_variable(renderer_context.link_state_info.target, target); @@ -1671,11 +1671,11 @@ done_link_state_info(void) #ifdef CONFIG_UTF8 static inline void process_link(struct html_context *html_context, enum link_state link_state, - unsigned char *chars, int charslen, int cells) + char *chars, int charslen, int cells) #else static inline void process_link(struct html_context *html_context, enum link_state link_state, - unsigned char *chars, int charslen) + char *chars, int charslen) #endif /* CONFIG_UTF8 */ { struct part *part = html_context->part; @@ -1684,7 +1684,7 @@ process_link(struct html_context *html_context, enum link_state link_state, switch (link_state) { case LINK_STATE_SAME: { - unsigned char *name; + char *name; if (!part->document) return; @@ -1695,10 +1695,10 @@ process_link(struct html_context *html_context, enum link_state link_state, name = get_link_name(link); if (name) { - unsigned char *new_name; + char *new_name; new_name = straconcat(name, chars, - (unsigned char *) NULL); + (char *) NULL); if (new_name) { mem_free(name); link->data.name = new_name; @@ -1800,7 +1800,7 @@ get_link_state(struct html_context *html_context) } static inline int -html_has_non_space_chars(unsigned char *chars, int charslen) +html_has_non_space_chars(char *chars, int charslen) { int pos = 0; @@ -1812,7 +1812,7 @@ html_has_non_space_chars(unsigned char *chars, int charslen) } static void -put_chars(struct html_context *html_context, unsigned char *chars, int charslen) +put_chars(struct html_context *html_context, char *chars, int charslen) { enum link_state link_state; struct part *part; @@ -2230,7 +2230,7 @@ html_special(struct html_context *html_context, enum html_special_type c, ...) switch (c) { case SP_TAG: if (document) { - unsigned char *t = va_arg(l, unsigned char *); + char *t = va_arg(l, char *); html_special_tag(document, t, X(part->cx), Y(part->cy)); } @@ -2293,8 +2293,8 @@ html_special(struct html_context *html_context, enum html_special_type c, ...) case SP_FRAME: { struct frameset_desc *parent = va_arg(l, struct frameset_desc *); - unsigned char *name = va_arg(l, unsigned char *); - unsigned char *url = va_arg(l, unsigned char *); + char *name = va_arg(l, char *); + char *url = va_arg(l, char *); add_frameset_entry(parent, NULL, name, url); break; @@ -2305,7 +2305,7 @@ html_special(struct html_context *html_context, enum html_special_type c, ...) case SP_REFRESH: { unsigned long seconds = va_arg(l, unsigned long); - unsigned char *t = va_arg(l, unsigned char *); + char *t = va_arg(l, char *); if (document) { if (document->refresh) @@ -2362,9 +2362,9 @@ free_table_cache(void) struct part * format_html_part(struct html_context *html_context, - unsigned char *start, unsigned char *end, + char *start, char *end, int align, int margin, int width, struct document *document, - int x, int y, unsigned char *head, + int x, int y, char *head, int link_num) { struct part *part; @@ -2395,7 +2395,7 @@ format_html_part(struct html_context *html_context, key.link_num = link_num; item = get_hash_item(table_cache, - (unsigned char *) &key, + (char *) &key, sizeof(key)); if (item) { /* We found it in cache, so just copy and return. */ part = mem_alloc(sizeof(*part)); @@ -2493,7 +2493,7 @@ ret: copy_struct(&tce->part, part); if (!add_hash_item(table_cache, - (unsigned char *) &tce->key, + (char *) &tce->key, sizeof(tce->key), tce)) { mem_free(tce); } else { @@ -2511,8 +2511,8 @@ render_html_document(struct cache_entry *cached, struct document *document, { struct html_context *html_context; struct part *part; - unsigned char *start; - unsigned char *end; + char *start; + char *end; struct string title; struct string head; @@ -2613,7 +2613,7 @@ render_html_document(struct cache_entry *cached, struct document *document, { FILE *f = fopen("forms", "ab"); struct el_form_control *form; - unsigned char *qq; + char *qq; fprintf(f,"FORM:\n"); foreach (form, document->forms) { fprintf(f, "g=%d f=%d c=%d t:%d\n", diff --git a/src/document/html/renderer.h b/src/document/html/renderer.h index c503e849..7294671c 100644 --- a/src/document/html/renderer.h +++ b/src/document/html/renderer.h @@ -46,10 +46,10 @@ enum html_special_type { struct part { struct document *document; - unsigned char *spaces; + char *spaces; int spaces_len; #ifdef CONFIG_UTF8 - unsigned char *char_width; + char *char_width; #endif @@ -70,10 +70,10 @@ void draw_frame_vchars(struct part *, int, int, int, unsigned char data, color_T void free_table_cache(void); -struct part *format_html_part(struct html_context *html_context, unsigned char *, unsigned char *, int, int, int, struct document *, int, int, unsigned char *, int); +struct part *format_html_part(struct html_context *html_context, char *, char *, int, int, int, struct document *, int, int, char *, int); -int dec2qwerty(int num, unsigned char *link_sym, const unsigned char *key, int base); -int qwerty2dec(const unsigned char *link_sym, const unsigned char *key, int base); +int dec2qwerty(int num, char *link_sym, const char *key, int base); +int qwerty2dec(const char *link_sym, const char *key, int base); #ifdef __cplusplus } diff --git a/src/document/html/tables.c b/src/document/html/tables.c index 37119dd0..91cf422a 100644 --- a/src/document/html/tables.c +++ b/src/document/html/tables.c @@ -95,7 +95,7 @@ format_cell(struct html_context *html_context, struct table *table, static inline void get_cell_width(struct html_context *html_context, - unsigned char *start, unsigned char *end, + char *start, char *end, int cellpadding, int width, int a, int *min, int *max, int link_num, int *new_link_num) @@ -708,8 +708,8 @@ check_table_height(struct table *table, struct table_frames *frames, int y) static int get_table_caption_height(struct html_context *html_context, struct table *table) { - unsigned char *start = table->caption.start; - unsigned char *end = table->caption.end; + char *start = table->caption.start; + char *end = table->caption.end; struct part *part; if (!start || !end) return 0; @@ -1206,8 +1206,8 @@ static void draw_table_caption(struct html_context *html_context, struct table *table, int x, int y) { - unsigned char *start = table->caption.start; - unsigned char *end = table->caption.end; + char *start = table->caption.start; + char *end = table->caption.end; struct part *part; if (!start || !end) return; @@ -1241,8 +1241,8 @@ draw_table_bad_html(struct html_context *html_context, struct table *table) for (i = 0; i < table->bad_html_size; i++) { struct html_start_end *html = &table->bad_html[i]; - unsigned char *start = html->start; - unsigned char *end = html->end; + char *start = html->start; + char *end = html->end; while (start < end && isspace(*start)) start++; @@ -1270,8 +1270,8 @@ distribute_table_widths(struct table *table) } void -format_table(unsigned char *attr, unsigned char *html, unsigned char *eof, - unsigned char **end, struct html_context *html_context) +format_table(char *attr, char *html, char *eof, + char **end, struct html_context *html_context) { struct part *part = html_context->part; struct table *table; diff --git a/src/document/html/tables.h b/src/document/html/tables.h index 84007a9a..d6cce08f 100644 --- a/src/document/html/tables.h +++ b/src/document/html/tables.h @@ -8,7 +8,7 @@ extern "C" { struct html_context; -void format_table(unsigned char *, unsigned char *, unsigned char *, unsigned char **, struct html_context *); +void format_table(char *, char *, char *, char **, struct html_context *); #ifdef __cplusplus } diff --git a/src/document/html/test/parse-meta-refresh-test.c b/src/document/html/test/parse-meta-refresh-test.c index 35dca744..a16dbc25 100644 --- a/src/document/html/test/parse-meta-refresh-test.c +++ b/src/document/html/test/parse-meta-refresh-test.c @@ -16,10 +16,10 @@ struct meta_refresh_test_case { - const unsigned char *content; + const char *content; int error; unsigned long delay; - const unsigned char *url; + const char *url; }; static const struct meta_refresh_test_case meta_refresh_test_cases[] = { @@ -180,9 +180,9 @@ main(void) int count_fail = 0; for (test = meta_refresh_test_cases; test->content; test++) { - static unsigned char dummy[] = "dummy"; + static char dummy[] = "dummy"; unsigned long delay = 21; - unsigned char *url = dummy; + char *url = dummy; int error = html_parse_meta_refresh(test->content, &delay, &url); diff --git a/src/document/libdom/renderer.c b/src/document/libdom/renderer.c index 1b885429..5090b7d3 100644 --- a/src/document/libdom/renderer.c +++ b/src/document/libdom/renderer.c @@ -381,7 +381,7 @@ render_source_document(struct cache_entry *cached, struct document *document, struct string *buffer) { struct source_renderer renderer; - unsigned char *head = empty_string_or_(cached->head); + char *head = empty_string_or_(cached->head); (void)get_convert_table(head, document->options.cp, document->options.assume_cp, diff --git a/src/document/options.c b/src/document/options.c index 5cadb57f..21aac9d8 100644 --- a/src/document/options.c +++ b/src/document/options.c @@ -141,7 +141,7 @@ done_document_options(struct document_options *options) } void -toggle_document_option(struct session *ses, unsigned char *option_name) +toggle_document_option(struct session *ses, char *option_name) { struct option *option; diff --git a/src/document/options.h b/src/document/options.h index 0743df83..f1f557c6 100644 --- a/src/document/options.h +++ b/src/document/options.h @@ -41,8 +41,8 @@ struct document_options_colors { }; struct document_options_image_link { - unsigned char *prefix; - unsigned char *suffix; + char *prefix; + char *suffix; int filename_maxlen; int label_maxlen; int display_style; @@ -114,7 +114,7 @@ struct document_options { unsigned int wrap:1; /* XXX: Everything past this comment is specialy handled by compare_opt() */ - unsigned char *framename; + char *framename; /** The location of the window in which the document is rendered. * @@ -185,7 +185,7 @@ int compare_opt(struct document_options *o1, struct document_options *o2); /** Increments the numeric value of the option identified by @a option_name, * resetting it to the minimum value when it is already at the maximum value, * and redraws the document. */ -void toggle_document_option(struct session *ses, unsigned char *option_name); +void toggle_document_option(struct session *ses, char *option_name); #ifdef __cplusplus } diff --git a/src/document/plain/renderer.c b/src/document/plain/renderer.c index e00972ed..d3178f85 100644 --- a/src/document/plain/renderer.c +++ b/src/document/plain/renderer.c @@ -36,7 +36,7 @@ struct plain_renderer { struct document *document; /* The data and data length of the defragmented cache entry */ - unsigned char *source; + char *source; int length; /* The convert table that should be used for converting line strings to @@ -77,7 +77,7 @@ realloc_line(struct document *document, int x, int y) } static inline struct link * -add_document_link(struct document *document, unsigned char *uri, int length, +add_document_link(struct document *document, char *uri, int length, int x, int y) { struct link *link; @@ -110,12 +110,12 @@ add_document_link(struct document *document, unsigned char *uri, int length, /* Searches a word to find an email adress or an URI to add as a link. */ static inline struct link * -check_link_word(struct document *document, unsigned char *uri, int length, +check_link_word(struct document *document, char *uri, int length, int x, int y) { struct uri test; - unsigned char *where = NULL; - unsigned char *mailto = memchr(uri, '@', length); + char *where = NULL; + char *mailto = memchr(uri, '@', length); int keep = uri[length]; struct link *new_link; @@ -125,7 +125,7 @@ check_link_word(struct document *document, unsigned char *uri, int length, uri[length] = 0; if (mailto && mailto > uri && mailto - uri < length - 1) { - where = straconcat("mailto:", uri, (unsigned char *) NULL); + where = straconcat("mailto:", uri, (char *) NULL); } else if (parse_uri(&test, uri) == URI_ERRNO_OK && test.protocol != PROTOCOL_UNKNOWN @@ -157,7 +157,7 @@ check_link_word(struct document *document, unsigned char *uri, int length, && !isquote(c)) static inline int -get_uri_length(unsigned char *line, int length) +get_uri_length(char *line, int length) { int uri_end = 0; @@ -176,16 +176,16 @@ get_uri_length(unsigned char *line, int length) static int print_document_link(struct plain_renderer *renderer, int lineno, - unsigned char *line, int line_pos, int width, + char *line, int line_pos, int width, int expanded, struct screen_char *pos, int cells) { struct document *document = renderer->document; - unsigned char *start = &line[line_pos]; + char *start = &line[line_pos]; int len = get_uri_length(start, width - line_pos); int screen_column = cells + expanded; struct link *new_link; int link_end = line_pos + len; - unsigned char saved_char; + char saved_char; struct document_options *doc_opts = &document->options; struct screen_char template_ = renderer->template_; int i; @@ -229,7 +229,7 @@ print_document_link(struct plain_renderer *renderer, int lineno, } static void -decode_esc_color(unsigned char *text, int *line_pos, int width, +decode_esc_color(char *text, int *line_pos, int width, struct screen_char *template_, enum color_mode mode, int *was_reversed) { @@ -258,7 +258,7 @@ decode_esc_color(unsigned char *text, int *line_pos, int width, f1 = foreground = ch.c.color[0] & 15; while (tail < end) { - unsigned char kod = (unsigned char)strtol(begin, &tail, 10); + char kod = (char)strtol(begin, &tail, 10); begin = tail + 1; switch (kod) { @@ -311,7 +311,7 @@ decode_esc_color(unsigned char *text, int *line_pos, int width, static inline int add_document_line(struct plain_renderer *renderer, - unsigned char *line, int line_width) + char *line, int line_width) { struct document *document = renderer->document; struct screen_char *template_ = &renderer->template_; @@ -336,14 +336,14 @@ add_document_line(struct plain_renderer *renderer, /* Now expand tabs */ for (line_pos = 0; line_pos < width;) { - unsigned char line_char = line[line_pos]; + char line_char = line[line_pos]; int charlen = 1; int cell = 1; #ifdef CONFIG_UTF8 unicode_val_T data; if (utf8) { - unsigned char *line_char2 = &line[line_pos]; + char *line_char2 = &line[line_pos]; charlen = utf8charlen(&line_char); data = utf8_to_unicode(&line_char2, &line[width]); @@ -395,15 +395,15 @@ add_document_line(struct plain_renderer *renderer, cells = 0; expanded = 0; for (line_pos = 0; line_pos < width;) { - unsigned char line_char = line[line_pos]; - unsigned char next_char, prev_char; + char line_char = line[line_pos]; + char next_char, prev_char; int charlen = 1; int cell = 1; #ifdef CONFIG_UTF8 unicode_val_T data = UCS_NO_CHAR; if (utf8) { - unsigned char *line_char2 = &line[line_pos]; + char *line_char2 = &line[line_pos]; charlen = utf8charlen(&line_char); data = utf8_to_unicode(&line_char2, &line[width]); @@ -594,7 +594,7 @@ add_node(struct plain_renderer *renderer, int x, int width, int height) static void add_document_lines(struct plain_renderer *renderer) { - unsigned char *source = renderer->source; + char *source = renderer->source; int length = renderer->length; int was_empty_line = 0; int was_wrapped = 0; @@ -602,7 +602,7 @@ add_document_lines(struct plain_renderer *renderer) int utf8 = is_cp_utf8(renderer->document->cp); #endif for (; length > 0; renderer->lineno++) { - unsigned char *xsource; + char *xsource; int width, added, only_spaces = 1, spaces = 0, was_spaces = 0; int last_space = 0; int tab_spaces = 0; @@ -632,7 +632,7 @@ add_document_lines(struct plain_renderer *renderer) } #ifdef CONFIG_UTF8 if (utf8) { - unsigned char *text = &source[width]; + char *text = &source[width]; unicode_val_T data = utf8_to_unicode(&text, &source[length]); @@ -708,7 +708,7 @@ render_plain_document(struct cache_entry *cached, struct document *document, struct string *buffer) { struct conv_table *convert_table; - unsigned char *head = empty_string_or_(cached->head); + char *head = empty_string_or_(cached->head); struct plain_renderer renderer; convert_table = get_convert_table(head, document->options.cp, diff --git a/src/document/refresh.c b/src/document/refresh.c index 4d815409..38cb68eb 100644 --- a/src/document/refresh.c +++ b/src/document/refresh.c @@ -27,7 +27,7 @@ struct document_refresh * -init_document_refresh(unsigned char *url, unsigned long seconds) +init_document_refresh(char *url, unsigned long seconds) { struct document_refresh *refresh; diff --git a/src/document/refresh.h b/src/document/refresh.h index c9af5ef1..611dc4dc 100644 --- a/src/document/refresh.h +++ b/src/document/refresh.h @@ -17,7 +17,7 @@ struct document_refresh { unsigned int restart:1; }; -struct document_refresh *init_document_refresh(unsigned char *url, unsigned long seconds); +struct document_refresh *init_document_refresh(char *url, unsigned long seconds); void done_document_refresh(struct document_refresh *refresh); void kill_document_refresh(struct document_refresh *refresh); void start_document_refreshes(struct session *ses); diff --git a/src/document/renderer.c b/src/document/renderer.c index 150e72aa..41fa4f24 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -123,7 +123,7 @@ process_snippets(struct ecmascript_interpreter *interpreter, for (; *current != (struct string_list_item *) snippets; (*current) = (*current)->next) { struct string *string = &(*current)->string; - unsigned char *uristring; + char *uristring; struct uri *uri; struct cache_entry *cached; struct fragment *fragment; @@ -220,7 +220,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document) } if (uri->protocol != PROTOCOL_FILE) { - unsigned char *extension = get_extension_from_uri(uri); + char *extension = get_extension_from_uri(uri); if (extension) { encoding = guess_encoding(extension); @@ -229,7 +229,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document) if (encoding != ENCODING_NONE) { int length = 0; - unsigned char *source; + char *source; struct stream_encoded *stream = open_encoded(-1, encoding); if (!stream) { @@ -291,7 +291,7 @@ void render_document(struct view_state *vs, struct document_view *doc_view, struct document_options *options) { - unsigned char *name; + char *name; struct document *document; struct cache_entry *cached; @@ -591,11 +591,11 @@ sort_links(struct document *document) } struct conv_table * -get_convert_table(unsigned char *head, int to_cp, +get_convert_table(char *head, int to_cp, int default_cp, int *from_cp, enum cp_status *cp_status, int ignore_server_cp) { - unsigned char *part = head; + char *part = head; int cp_index = -1; assert(head); @@ -608,13 +608,13 @@ get_convert_table(unsigned char *head, int to_cp, } while (cp_index == -1) { - unsigned char *ct_charset; + char *ct_charset; /* scan_http_equiv() appends the meta http-equiv directives to * the protocol header before this function is called, but the * HTTP Content-Type header has precedence, so the HTTP header * will be used if it exists and the meta header is only used * as a fallback. See bug 983. */ - unsigned char *a = parse_header(part, "Content-Type", &part); + char *a = parse_header(part, "Content-Type", &part); if (!a) break; @@ -627,7 +627,7 @@ get_convert_table(unsigned char *head, int to_cp, } if (cp_index == -1) { - unsigned char *a = parse_header(head, "Content-Charset", NULL); + char *a = parse_header(head, "Content-Charset", NULL); if (a) { cp_index = get_cp_index(a); @@ -636,7 +636,7 @@ get_convert_table(unsigned char *head, int to_cp, } if (cp_index == -1) { - unsigned char *a = parse_header(head, "Charset", NULL); + char *a = parse_header(head, "Charset", NULL); if (a) { cp_index = get_cp_index(a); diff --git a/src/document/renderer.h b/src/document/renderer.h index 884c79b8..5817718c 100644 --- a/src/document/renderer.h +++ b/src/document/renderer.h @@ -16,7 +16,7 @@ struct screen_char; void render_document(struct view_state *, struct document_view *, struct document_options *); void render_document_frames(struct session *ses, int no_cache); -struct conv_table *get_convert_table(unsigned char *head, int to_cp, int default_cp, int *from_cp, enum cp_status *cp_status, int ignore_server_cp); +struct conv_table *get_convert_table(char *head, int to_cp, int default_cp, int *from_cp, enum cp_status *cp_status, int ignore_server_cp); void sort_links(struct document *document); #ifdef __cplusplus diff --git a/src/document/view.h b/src/document/view.h index 253b9c02..b6f62114 100644 --- a/src/document/view.h +++ b/src/document/view.h @@ -15,8 +15,8 @@ struct view_state; struct document_view { LIST_HEAD(struct document_view); - unsigned char *name; - unsigned char **search_word; + char *name; + char **search_word; struct session *session; struct document *document; diff --git a/src/dom/configuration.c b/src/dom/configuration.c index 56977caf..857b1821 100644 --- a/src/dom/configuration.c +++ b/src/dom/configuration.c @@ -15,10 +15,10 @@ static enum dom_code normalize_text_node_whitespace(struct dom_node *node) { - unsigned char buf[256]; + char buf[256]; struct dom_string string = INIT_DOM_STRING(NULL, 0); int count = 0, i = 0; - unsigned char *text = node->string.string; + char *text = node->string.string; assert(node->type == DOM_NODE_TEXT); @@ -26,7 +26,7 @@ normalize_text_node_whitespace(struct dom_node *node) int j; for (j = 0; j < sizeof(buf) && i < node->string.length; i++) { - unsigned char data = text[i]; + char data = text[i]; if (isspace(data)) { if (count == 1) @@ -327,12 +327,12 @@ get_dom_config_flag(struct dom_string *name) } enum dom_config_flag -parse_dom_config(unsigned char *flaglist, unsigned char separator) +parse_dom_config(char *flaglist, char separator) { enum dom_config_flag flags = 0; while (flaglist) { - unsigned char *end = separator ? strchr((const char *)flaglist, separator) : NULL; + char *end = separator ? strchr((const char *)flaglist, separator) : NULL; int length = end ? end - flaglist : strlen(flaglist); struct dom_string name = INIT_DOM_STRING(flaglist, length); diff --git a/src/dom/configuration.h b/src/dom/configuration.h index dfe2364d..6566cebe 100644 --- a/src/dom/configuration.h +++ b/src/dom/configuration.h @@ -94,7 +94,7 @@ add_dom_config_normalizer(struct dom_stack *stack, struct dom_config *config, enum dom_config_flag flags); enum dom_config_flag -parse_dom_config(unsigned char *flaglist, unsigned char separator); +parse_dom_config(char *flaglist, char separator); #ifdef __cplusplus } diff --git a/src/dom/css/scanner.c b/src/dom/css/scanner.c index ac1eb9da..499a86e6 100644 --- a/src/dom/css/scanner.c +++ b/src/dom/css/scanner.c @@ -94,7 +94,7 @@ struct dom_scanner_info dom_css_scanner_info = { scan_css_tokens, }; -#define check_css_table(c, bit) (dom_css_scanner_info.scan_table[(c)] & (bit)) +#define check_css_table(c, bit) (dom_css_scanner_info.scan_table[(unsigned char)(c)] & (bit)) #define scan_css(scanner, s, bit) \ while ((s) < (scanner)->end && check_css_table(*(s), bit)) (s)++; @@ -116,7 +116,7 @@ struct dom_scanner_info dom_css_scanner_info = { && check_css_precedence(*(s), skipto)) { \ if (isquote(*(s))) { \ int size = (scanner)->end - (s); \ - unsigned char *end = memchr(s + 1, *(s), size); \ + char *end = memchr(s + 1, *(s), size); \ \ if (end) (s) = end; \ } \ @@ -127,7 +127,7 @@ struct dom_scanner_info dom_css_scanner_info = { static inline void scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) { - unsigned char *string = scanner->position; + char *string = scanner->position; unsigned char first_char = *string; enum css_token_type type = CSS_TOKEN_GARBAGE; int real_length = -1; @@ -161,7 +161,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) type = CSS_TOKEN_NUMBER; } else { - unsigned char *ident = string; + char *ident = string; scan_css(scanner, string, CSS_CHAR_IDENT); type = map_dom_scanner_string(scanner, ident, string, @@ -172,7 +172,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) scan_css(scanner, string, CSS_CHAR_IDENT); if (*string == '(') { - unsigned char *function_end = string + 1; + char *function_end = string + 1; /* Make sure that we have an ending ')' */ skip_css(scanner, function_end, ')'); @@ -196,8 +196,8 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) * we should of course handle escape * sequences .. but that will have to * be fixed later. */ - unsigned char *from = string + 1; - unsigned char *to = function_end - 1; + char *from = string + 1; + char *to = function_end - 1; scan_css(scanner, from, CSS_CHAR_WHITESPACE); scan_back_css(scanner, to, CSS_CHAR_WHITESPACE); @@ -261,7 +261,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) } else if (first_char == '@') { /* Compose token containing @<ident> */ if (is_css_ident_start(*string)) { - unsigned char *ident = string; + char *ident = string; /* Scan both ident start and ident */ scan_css(scanner, string, CSS_CHAR_IDENT); @@ -305,7 +305,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) } else if (isquote(first_char)) { /* TODO: Escaped delimiters --jonas */ int size = scanner->end - string; - unsigned char *string_end = memchr(string, first_char, size); + char *string_end = memchr(string, first_char, size); if (string_end) { /* We don't want the delimiters in the token */ @@ -323,7 +323,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token) type = CSS_TOKEN_NONE; } else { - unsigned char *sgml = string; + char *sgml = string; /* Skip anything looking like SGML "<!--" and "-->" * comments + <![CDATA[ and ]]> notations. */ diff --git a/src/dom/node.c b/src/dom/node.c index fbf2d5c0..83ede15f 100644 --- a/src/dom/node.c +++ b/src/dom/node.c @@ -353,7 +353,7 @@ get_dom_node_child(struct dom_node *parent, enum dom_node_type type, struct dom_node * init_dom_node_at( #ifdef DEBUG_MEMLEAK - unsigned char *file, int line, + char *file, int line, #endif struct dom_node *parent, enum dom_node_type type, struct dom_string *string, int allocated) diff --git a/src/dom/node.h b/src/dom/node.h index 3bb2b4c0..43b17dc5 100644 --- a/src/dom/node.h +++ b/src/dom/node.h @@ -340,7 +340,7 @@ init_dom_node_at(struct dom_node *parent, enum dom_node_type type, #else struct dom_node * -init_dom_node_at(unsigned char *file, int line, +init_dom_node_at(char *file, int line, struct dom_node *parent, enum dom_node_type type, struct dom_string *string, int allocated); diff --git a/src/dom/scanner.c b/src/dom/scanner.c index c3cd1baa..764355a9 100644 --- a/src/dom/scanner.c +++ b/src/dom/scanner.c @@ -16,7 +16,7 @@ int map_dom_scanner_string(struct dom_scanner *scanner, - unsigned char *ident, unsigned char *end, int base_type) + char *ident, char *end, int base_type) { const struct dom_scanner_string_mapping *mappings = scanner->info->mappings; struct dom_string name = INIT_DOM_STRING(ident, end - ident); @@ -56,7 +56,7 @@ dump_dom_scanner(struct dom_scanner *scanner) unsigned char buffer[MAX_STR_LEN]; struct dom_scanner_token *token = scanner->current; struct dom_scanner_token *table_end = scanner->table + scanner->tokens; - unsigned char *srcpos = token->string, *bufpos = buffer; + char *srcpos = token->string, *bufpos = buffer; int src_lookahead = 50; int token_lookahead = 4; int srclen; @@ -141,13 +141,13 @@ init_dom_scanner_info(struct dom_scanner_info *scanner_info) scan_table[index] |= info[i].bits; } else { - unsigned char *string = info[i].data.string; + char *string = info[i].data.string; int pos = info[i].data.length - 1; assert(info[i].type == DOM_SCAN_STRING && pos >= 0); for (; pos >= 0; pos--) - scan_table[string[pos]] |= info[i].bits; + scan_table[(unsigned char)string[pos]] |= info[i].bits; } } } diff --git a/src/dom/scanner.h b/src/dom/scanner.h index ece2705e..615d2f3d 100644 --- a/src/dom/scanner.h +++ b/src/dom/scanner.h @@ -125,15 +125,15 @@ void init_dom_scanner(struct dom_scanner *scanner, struct dom_scanner_info *scan * Holds the current state of the scanner. */ struct dom_scanner { /** The start of the scanned string. */ - unsigned char *string; + char *string; /** The end of the scanned string. */ - unsigned char *end; + char *end; /** The current position in the sstring being scanned. * * The position in the string where to scan next and the end of the * string. If position is NULL it means that no more tokens can be * retrieved from the string. */ - unsigned char *position; + char *position; /** The current token. * @@ -149,7 +149,7 @@ struct dom_scanner { #ifdef DEBUG_SCANNER /* Debug info about the caller. */ - unsigned char *file; + char *file; int line; #endif @@ -233,7 +233,7 @@ skip_dom_scanner_tokens(struct dom_scanner *scanner, int skipto, int precedence) * table. */ int map_dom_scanner_string(struct dom_scanner *scanner, - unsigned char *ident, unsigned char *end, int base_type); + char *ident, char *end, int base_type); #ifdef DEBUG_DOM_SCANNER void dump_dom_scanner(struct dom_scanner *scanner); diff --git a/src/dom/sgml/parser.c b/src/dom/sgml/parser.c index 680d0bda..2db4e490 100644 --- a/src/dom/sgml/parser.c +++ b/src/dom/sgml/parser.c @@ -424,7 +424,7 @@ parse_sgml_plain(struct dom_stack *stack, struct dom_scanner *scanner) } enum dom_code -parse_sgml(struct sgml_parser *parser, unsigned char *buf, size_t bufsize, +parse_sgml(struct sgml_parser *parser, char *buf, size_t bufsize, int complete) { struct dom_string source = INIT_DOM_STRING(buf, bufsize); diff --git a/src/dom/sgml/parser.h b/src/dom/sgml/parser.h index fba7a541..5b692b56 100644 --- a/src/dom/sgml/parser.h +++ b/src/dom/sgml/parser.h @@ -136,7 +136,7 @@ void done_sgml_parser(struct sgml_parser *parser); * else a code hinting at the error. */ enum dom_code -parse_sgml(struct sgml_parser *parser, unsigned char *buf, size_t bufsize, int complete); +parse_sgml(struct sgml_parser *parser, char *buf, size_t bufsize, int complete); /** Get the line position in the source * diff --git a/src/dom/sgml/scanner.c b/src/dom/sgml/scanner.c index 63522946..ba5cf60b 100644 --- a/src/dom/sgml/scanner.c +++ b/src/dom/sgml/scanner.c @@ -67,7 +67,7 @@ struct dom_scanner_info sgml_scanner_info = { scan_sgml_tokens, }; -#define check_sgml_table(c, bit) (sgml_scanner_info.scan_table[(c)] & (bit)) +#define check_sgml_table(c, bit) (sgml_scanner_info.scan_table[(unsigned char)(c)] & (bit)) #define scan_sgml(scanner, s, bit) \ while ((s) < (scanner)->end && check_sgml_table(*(s), bit)) (s)++; @@ -81,9 +81,9 @@ struct dom_scanner_info sgml_scanner_info = { #define is_sgml_attribute(c) !check_sgml_table(c, SGML_CHAR_NOT_ATTRIBUTE | SGML_CHAR_WHITESPACE) static inline void -skip_sgml_space(struct dom_scanner *scanner, unsigned char **string) +skip_sgml_space(struct dom_scanner *scanner, char **string) { - unsigned char *pos = *string; + char *pos = *string; if (!scanner->count_lines) { scan_sgml(scanner, pos, SGML_CHAR_WHITESPACE); @@ -129,9 +129,9 @@ check_sgml_error(struct dom_scanner *scanner) return scanner->detect_errors && !found_error; } -static unsigned char * +static char * get_sgml_error_end(struct dom_scanner *scanner, enum sgml_token_type type, - unsigned char *end) + char *end) { switch (type) { case SGML_TOKEN_CDATA_SECTION: @@ -172,7 +172,7 @@ get_sgml_error_end(struct dom_scanner *scanner, enum sgml_token_type type, static struct dom_scanner_token * -set_sgml_error(struct dom_scanner *scanner, unsigned char *end) +set_sgml_error(struct dom_scanner *scanner, char *end) { struct dom_scanner_token *token = scanner->current; struct dom_scanner_token *next; @@ -206,7 +206,7 @@ set_sgml_error(struct dom_scanner *scanner, unsigned char *end) static inline void scan_sgml_text_token(struct dom_scanner *scanner, struct dom_scanner_token *token) { - unsigned char *string = scanner->position; + char *string = scanner->position; unsigned char first_char = *string; enum sgml_token_type type = SGML_TOKEN_GARBAGE; int real_length = -1; @@ -296,8 +296,8 @@ check_sgml_precedence(int type, int skipto) } /* Skip until @skipto is found, without taking precedence into account. */ -static inline unsigned char * -skip_sgml_chars(struct dom_scanner *scanner, unsigned char *string, +static inline char * +skip_sgml_chars(struct dom_scanner *scanner, char *string, unsigned char skipto) { int newlines; @@ -327,11 +327,11 @@ skip_sgml_chars(struct dom_scanner *scanner, unsigned char *string, /* XXX: Only element or ``in tag'' precedence is handled correctly however * using this function for CDATA or text would be overkill. */ -static inline unsigned char * -skip_sgml(struct dom_scanner *scanner, unsigned char **string, unsigned char skipto, +static inline char * +skip_sgml(struct dom_scanner *scanner, char **string, unsigned char skipto, int check_quoting) { - unsigned char *pos = *string; + char *pos = *string; for (; pos < scanner->end; pos++) { if (*pos == skipto) { @@ -343,7 +343,7 @@ skip_sgml(struct dom_scanner *scanner, unsigned char **string, unsigned char ski break; if (check_quoting && isquote(*pos)) { - unsigned char *end; + char *end; end = skip_sgml_chars(scanner, pos + 1, *pos); if (end) pos = end; @@ -358,10 +358,10 @@ skip_sgml(struct dom_scanner *scanner, unsigned char **string, unsigned char ski } static inline int -skip_sgml_comment(struct dom_scanner *scanner, unsigned char **string, +skip_sgml_comment(struct dom_scanner *scanner, char **string, int *possibly_incomplete) { - unsigned char *pos = *string; + char *pos = *string; int length = 0; for ( ; (pos = skip_sgml_chars(scanner, pos, '>')); pos++) { @@ -398,10 +398,10 @@ skip_sgml_comment(struct dom_scanner *scanner, unsigned char **string, } static inline int -skip_sgml_cdata_section(struct dom_scanner *scanner, unsigned char **string, +skip_sgml_cdata_section(struct dom_scanner *scanner, char **string, int *possibly_incomplete) { - unsigned char *pos = *string; + char *pos = *string; int length = 0; for ( ; (pos = skip_sgml_chars(scanner, pos, '>')); pos++) { @@ -434,7 +434,7 @@ skip_sgml_cdata_section(struct dom_scanner *scanner, unsigned char **string, static inline void scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *token) { - unsigned char *string = scanner->position; + char *string = scanner->position; unsigned char first_char = *string; enum sgml_token_type type = SGML_TOKEN_GARBAGE; int real_length = -1; @@ -486,7 +486,7 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t } } else if (*string == '!') { - unsigned char *ident; + char *ident; enum sgml_token_type base = SGML_TOKEN_NOTATION; string++; @@ -522,7 +522,7 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t } } else if (*string == '?') { - unsigned char *pos; + char *pos; enum sgml_token_type base = SGML_TOKEN_PROCESS; string++; @@ -662,7 +662,7 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t } } else if (isquote(first_char)) { - unsigned char *string_end = skip_sgml_chars(scanner, string, first_char); + char *string_end = skip_sgml_chars(scanner, string, first_char); if (string_end) { /* We don't want the delimiters in the token */ @@ -710,7 +710,7 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t } if (check_sgml_error(scanner) && string == scanner->end) { - unsigned char *end; + char *end; end = get_sgml_error_end(scanner, type, string); token = set_sgml_error(scanner, end); @@ -735,7 +735,7 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t static inline void scan_sgml_proc_inst_token(struct dom_scanner *scanner, struct dom_scanner_token *token) { - unsigned char *string = scanner->position; + char *string = scanner->position; /* The length can be empty for '<??>'. */ ssize_t length = -1; diff --git a/src/dom/stack.c b/src/dom/stack.c index a55548f1..6a385312 100644 --- a/src/dom/stack.c +++ b/src/dom/stack.c @@ -34,7 +34,7 @@ realloc_dom_stack_context(struct dom_stack_context ***contexts, size_t size) DOM_STACK_STATE_GRANULARITY); } -static inline unsigned char * +static inline char * realloc_dom_stack_state_objects(struct dom_stack_context *context, size_t depth) { #ifdef DEBUG_MEMLEAK @@ -448,8 +448,8 @@ walk_dom_nodes(struct dom_stack *stack, struct dom_node *root) /* Compress a string to a single line with newlines etc. replaced with "\\n" * sequence. */ -static inline unsigned char * -compress_string(unsigned char *string, unsigned int length) +static inline char * +compress_string(char *string, unsigned int length) { struct string buffer; unsigned char escape[2] = "\\"; @@ -457,7 +457,7 @@ compress_string(unsigned char *string, unsigned int length) if (!init_string(&buffer)) return NULL; for (; length > 0; string++, length--) { - unsigned char *bytes = string; + char *bytes = string; if (*string == '\n' || *string == '\r' || *string == '\t') { bytes = escape; diff --git a/src/dom/stack.h b/src/dom/stack.h index 5a60b649..ce10bcc2 100644 --- a/src/dom/stack.h +++ b/src/dom/stack.h @@ -111,7 +111,7 @@ struct dom_stack_context { * parser this holds DTD-oriented info about the node (recorded in * struct #sgml_node_info). E.g. whether an element node is optional. */ - unsigned char *state_objects; + char *state_objects; /** Info about node callbacks and such. */ struct dom_stack_context_info *info; diff --git a/src/dom/string.h b/src/dom/string.h index 441c0f98..d348f4bd 100644 --- a/src/dom/string.h +++ b/src/dom/string.h @@ -16,7 +16,7 @@ extern "C" { struct dom_string { unsigned int length; - unsigned char *string; + char *string; }; #define INIT_DOM_STRING(strvalue, strlength) \ @@ -26,7 +26,7 @@ struct dom_string { { sizeof(strvalue) - 1, (strvalue) } static inline void -set_dom_string(struct dom_string *string, unsigned char *value, size_t length) +set_dom_string(struct dom_string *string, char *value, size_t length) { string->string = value; string->length = length == -1 ? strlen(value) : length; @@ -53,9 +53,9 @@ dom_string_ncasecmp(struct dom_string *string1, struct dom_string *string2, size set_dom_string(string1, (string2)->string, (string2)->length) static inline struct dom_string * -add_to_dom_string(struct dom_string *string, unsigned char *str, size_t len) +add_to_dom_string(struct dom_string *string, char *str, size_t len) { - unsigned char *newstring; + char *newstring; newstring = mem_realloc(string->string, string->length + len + 1); if (!newstring) diff --git a/src/dom/test/sgml-parser.c b/src/dom/test/sgml-parser.c index 9e106ade..ac14fc8f 100644 --- a/src/dom/test/sgml-parser.c +++ b/src/dom/test/sgml-parser.c @@ -316,7 +316,7 @@ main(int argc, char *argv[]) add_dom_stack_context(&parser->stack, NULL, &sgml_parser_test_context_info); if (read_stdin > 0) { - unsigned char *buffer; + char *buffer; buffer = mem_alloc(read_stdin); if (!buffer) diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index 33f40eeb..10eb9ac9 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -72,7 +72,7 @@ static int interpreter_count; static INIT_LIST_OF(struct string_list_item, allowed_urls); static int -is_prefix(unsigned char *prefix, unsigned char *url, int dl) +is_prefix(char *prefix, char *url, int dl) { return memcmp(prefix, url, dl); } @@ -81,7 +81,7 @@ static void read_url_list(void) { char line[4096]; - unsigned char *filename; + char *filename; FILE *f; if (!elinks_home) { @@ -109,7 +109,7 @@ int get_ecmascript_enable(struct ecmascript_interpreter *interpreter) { struct string_list_item *item; - unsigned char *url; + char *url; if (!get_opt_bool("ecmascript.enable", NULL) || !interpreter || !interpreter->vs || !interpreter->vs->doc_view @@ -227,11 +227,11 @@ ecmascript_call_function(struct ecmascript_interpreter *interpreter, } -unsigned char * +char * ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code) { - unsigned char *result; + char *result; if (!get_ecmascript_enable(interpreter)) return NULL; @@ -302,7 +302,7 @@ 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))); - unsigned char *redirect_url, *redirect_abs_url; + char *redirect_url, *redirect_abs_url; struct uri *redirect_uri; if (!doc_view) /* Blank initial document. TODO: Start at about:blank? */ @@ -351,7 +351,7 @@ ecmascript_timeout_dialog(struct terminal *term, int max_exec_time) } void -ecmascript_set_action(unsigned char **action, unsigned char *string) +ecmascript_set_action(char **action, char *string) { struct uri *protocol; @@ -366,19 +366,19 @@ ecmascript_set_action(unsigned char **action, unsigned char *string) struct uri *uri = get_uri(*action, URI_HTTP_REFERRER_HOST); if (uri->protocol == PROTOCOL_FILE) { - mem_free_set(action, straconcat(struri(uri), string, (unsigned char *) NULL)); + mem_free_set(action, straconcat(struri(uri), string, (char *) NULL)); } else - mem_free_set(action, straconcat(struri(uri), string + 1, (unsigned char *) NULL)); + mem_free_set(action, straconcat(struri(uri), string + 1, (char *) NULL)); done_uri(uri); mem_free(string); } else { /* relative uri */ - unsigned char *last_slash = strrchr((const char *)*action, '/'); - unsigned char *new_action; + char *last_slash = strrchr((const char *)*action, '/'); + char *new_action; if (last_slash) *(last_slash + 1) = '\0'; new_action = straconcat(*action, string, - (unsigned char *) NULL); + (char *) NULL); mem_free_set(action, new_action); mem_free(string); } @@ -421,7 +421,7 @@ ecmascript_timeout_handler2(void *i) void -ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout) +ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, char *code, int timeout) { assert(interpreter && interpreter->vs->doc_view->document); if (!code) return; diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index c5011d50..57698b61 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -77,7 +77,7 @@ struct ecmascript_interpreter { * reset for each rerendering, and it sucks to do all the magic to preserve the * interpreter over the rerenderings (we tried). */ -int ecmascript_check_url(unsigned char *url, unsigned char *frame); +int ecmascript_check_url(char *url, char *frame); void ecmascript_free_urls(struct module *module); struct ecmascript_interpreter *ecmascript_get_interpreter(struct view_state*vs); @@ -91,7 +91,7 @@ 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); +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); @@ -101,9 +101,9 @@ void ecmascript_protocol_handler(struct session *ses, struct uri *uri); void ecmascript_timeout_dialog(struct terminal *term, int max_exec_time); -void ecmascript_set_action(unsigned char **action, unsigned char *string); +void ecmascript_set_action(char **action, char *string); -void ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout); +void ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, char *code, int timeout); void ecmascript_set_timeout2(struct ecmascript_interpreter *interpreter, JS::HandleValue f, int timeout); diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 9e30a50b..604b8e16 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -53,12 +53,12 @@ JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSPropertySpec *static_ps, const spidermonkeyFunctionSpec *static_fs); -static unsigned char *jsval_to_string(JSContext *ctx, JS::HandleValue hvp); -static unsigned char *jsid_to_string(JSContext *ctx, JS::HandleId hid); +static char *jsval_to_string(JSContext *ctx, JS::HandleValue hvp); +static char *jsid_to_string(JSContext *ctx, JS::HandleId hid); /* Inline functions */ -static inline unsigned char * +static inline char * jsval_to_string(JSContext *ctx, JS::HandleValue hvp) { // JS::RootedValue r_vp(ctx, *vp); @@ -68,7 +68,7 @@ jsval_to_string(JSContext *ctx, JS::HandleValue hvp) return empty_string_or_(JS_EncodeString(ctx, str)); } -static inline unsigned char * +static inline char * jsid_to_string(JSContext *ctx, JS::HandleId hid) { JS::RootedValue v(ctx); diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 1b58186a..f20c98a8 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -150,7 +150,7 @@ error_reporter(JSContext *ctx, JSErrorReport *report) struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); struct session *ses = interpreter->vs->doc_view->session; struct terminal *term; - unsigned char *strict, *exception, *warning, *error; + char *strict, *exception, *warning, *error; struct string msg; char *prefix = nullptr; @@ -402,14 +402,14 @@ spidermonkey_call_function(struct ecmascript_interpreter *interpreter, } -unsigned char * +char * spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code) { bool ret; JSContext *ctx; JS::Value rval; - unsigned char *result = NULL; + char *result = NULL; assert(interpreter); if (!js_module_init_ok) return NULL; diff --git a/src/ecmascript/spidermonkey.h b/src/ecmascript/spidermonkey.h index f74eead2..b6d641f4 100644 --- a/src/ecmascript/spidermonkey.h +++ b/src/ecmascript/spidermonkey.h @@ -16,7 +16,7 @@ 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); +char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code); int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code); void spidermonkey_call_function(struct ecmascript_interpreter *interpreter, JS::HandleValue fun, struct string *ret); diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index fed609e2..0cc304d2 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -216,7 +216,7 @@ document_get_property_referrer(JSContext *ctx, unsigned int argc, JS::Value *vp) case REFERER_TRUE: /* XXX: Encode as in add_url_to_httset_prop_string(&prop, ) ? --pasky */ if (ses->referrer) { - unsigned char *str = get_uri_string(ses->referrer, URI_HTTP_REFERRER); + char *str = get_uri_string(ses->referrer, URI_HTTP_REFERRER); if (str) { args.rval().setString(JS_NewStringCopyZ(ctx, str)); @@ -228,7 +228,7 @@ document_get_property_referrer(JSContext *ctx, unsigned int argc, JS::Value *vp) break; case REFERER_SAME_URL: - unsigned char *str = get_uri_string(document->uri, URI_HTTP_REFERRER); + char *str = get_uri_string(document->uri, URI_HTTP_REFERRER); if (str) { args.rval().setString(JS_NewStringCopyZ(ctx, str)); @@ -329,7 +329,7 @@ document_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) } doc_view = vs->doc_view; document = doc_view->document; - unsigned char *str = get_uri_string(document->uri, URI_ORIGINAL); + char *str = get_uri_string(document->uri, URI_ORIGINAL); if (str) { args.rval().setString(JS_NewStringCopyZ(ctx, str)); @@ -392,7 +392,7 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J struct document_view *doc_view; struct document *document; struct form *form; - unsigned char *string; + char *string; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { @@ -454,7 +454,7 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin int i = 0; for (; i < argc; ++i) { - unsigned char *code = jsval_to_string(ctx, args[i]); + char *code = jsval_to_string(ctx, args[i]); add_to_string(ret, code); } diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index adbfc3d3..ef9638f3 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -1126,7 +1126,7 @@ input_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; - unsigned char *s = NULL; + char *s = NULL; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { @@ -1606,7 +1606,7 @@ static JSClass form_elements_class = { }; static bool form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp); -static bool form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *string, JS::MutableHandleValue hvp); +static bool form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, char *string, JS::MutableHandleValue hvp); static bool form_elements_item(JSContext *ctx, unsigned int argc, JS::Value *rval); static bool form_elements_namedItem(JSContext *ctx, unsigned int argc, JS::Value *rval); @@ -1669,7 +1669,7 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if (JSID_IS_STRING(id)) { JS::RootedValue r_idval(ctx, idval); JS_IdToValue(ctx, id, &r_idval); - unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); + char *string = JS_EncodeString(ctx, r_idval.toString()); form_elements_namedItem2(ctx, hobj, string, hvp); return true; @@ -1818,7 +1818,7 @@ form_elements_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp) // JS::Value *argv = JS_ARGV(ctx, rval); - unsigned char *string = JS_EncodeString(ctx, args[0].toString()); + char *string = JS_EncodeString(ctx, args[0].toString()); bool ret = form_elements_namedItem2(ctx, hobj, string, &rval); args.rval().set(rval); // JS_SET_RVAL(ctx, rval, val); @@ -1826,7 +1826,7 @@ form_elements_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp) } static bool -form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *string, JS::MutableHandleValue hvp) +form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, char *string, JS::MutableHandleValue hvp) { JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ @@ -1968,7 +1968,7 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M if (JSID_IS_STRING(hid)) { struct el_form_control *fc; - unsigned char *string = jsid_to_string(ctx, hid); + char *string = jsid_to_string(ctx, hid); foreach (fc, form->items) { JSObject *fcobj = NULL; @@ -2049,7 +2049,7 @@ form_set_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; - unsigned char *string; + char *string; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { @@ -2178,7 +2178,7 @@ form_set_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; - unsigned char *string; + char *string; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { @@ -2318,7 +2318,7 @@ form_set_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; - unsigned char *string; + char *string; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { @@ -2716,7 +2716,7 @@ JSPropertySpec forms_props[] = { static void find_form_by_name(JSContext *ctx, struct document_view *doc_view, - unsigned char *string, JS::MutableHandleValue hvp) + char *string, JS::MutableHandleValue hvp) { struct form *form; @@ -2760,7 +2760,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: doc_view = vs->doc_view; if (JSID_IS_STRING(hid)) { - unsigned char *string = jsid_to_string(ctx, hid); + char *string = jsid_to_string(ctx, hid); char *end; strtoll(string, &end, 10); @@ -2774,7 +2774,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: * we must leave *vp unchanged here, to avoid * "TypeError: forms.namedItem is not a function". */ JS_IdToValue(ctx, hid, &r_idval); - unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); + char *string = JS_EncodeString(ctx, r_idval.toString()); find_form_by_name(ctx, doc_view, string, hvp); return true; @@ -2904,7 +2904,7 @@ forms_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp) return true; args.rval().setUndefined(); - unsigned char *string = JS_EncodeString(ctx, args[0].toString()); + char *string = JS_EncodeString(ctx, args[0].toString()); JS::RootedValue rval(ctx, val); diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index 4a8a6951..355a8bee 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -209,7 +209,7 @@ location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) return false; } - unsigned char *str = get_uri_string(vs->uri, URI_ORIGINAL); + char *str = get_uri_string(vs->uri, URI_ORIGINAL); if (!str) { return false; @@ -301,9 +301,9 @@ delayed_goto(void *data) } void -location_goto(struct document_view *doc_view, unsigned char *url) +location_goto(struct document_view *doc_view, char *url) { - unsigned char *new_abs_url; + char *new_abs_url; struct uri *new_uri; struct delayed_goto *deg; diff --git a/src/ecmascript/spidermonkey/location.h b/src/ecmascript/spidermonkey/location.h index c9b7bb88..8e66cd8b 100644 --- a/src/ecmascript/spidermonkey/location.h +++ b/src/ecmascript/spidermonkey/location.h @@ -13,6 +13,6 @@ extern JSClass location_class; extern const spidermonkeyFunctionSpec location_funcs[]; extern JSPropertySpec location_props[]; -void location_goto(struct document_view *doc_view, unsigned char *url); +void location_goto(struct document_view *doc_view, char *url); #endif diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index 2d19acd3..d9dfe7b7 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -147,12 +147,12 @@ static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); - unsigned char *optstr; + char *optstr; optstr = get_opt_str("protocol.http.user_agent", NULL); if (*optstr && strcmp(optstr, " ")) { - unsigned char *ustr, ts[64] = ""; + char *ustr, ts[64] = ""; static unsigned char custr[256]; /* TODO: Somehow get the terminal in which the * document is actually being displayed. */ diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index bf54b311..650223e3 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -96,7 +96,7 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) struct view_state *vs; struct document_view *doc_view; struct session_status *status; - unsigned char *bar; + char *bar; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { @@ -149,7 +149,7 @@ unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) struct view_state *vs; struct document_view *doc_view; struct session_status *status; - unsigned char *bar; + char *bar; JSCompartment *comp = js::GetContextCompartment(ctx); if (!comp) { diff --git a/src/ecmascript/spidermonkey/util.h b/src/ecmascript/spidermonkey/util.h index 19a7f4a2..955d9512 100644 --- a/src/ecmascript/spidermonkey/util.h +++ b/src/ecmascript/spidermonkey/util.h @@ -5,8 +5,8 @@ #include "ecmascript/spidermonkey-shared.h" #include "util/memory.h" -static void string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string); -static void astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string); +static void string_to_jsval(JSContext *ctx, JS::Value *vp, char *string); +static void astring_to_jsval(JSContext *ctx, JS::Value *vp, char *string); static int jsval_to_boolean(JSContext *ctx, JS::Value *vp); @@ -15,7 +15,7 @@ static int jsval_to_boolean(JSContext *ctx, JS::Value *vp); /** Inline functions */ static inline void -string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string) +string_to_jsval(JSContext *ctx, JS::Value *vp, char *string) { if (!string) { *vp = JS::NullValue(); @@ -25,7 +25,7 @@ string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string) } static inline void -astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string) +astring_to_jsval(JSContext *ctx, JS::Value *vp, char *string) { string_to_jsval(ctx, vp, string); mem_free_if(string); diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 416644bb..2b5e7adc 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -95,7 +95,7 @@ JSPropertySpec window_props[] = { static JSObject * -try_resolve_frame(struct document_view *doc_view, unsigned char *id) +try_resolve_frame(struct document_view *doc_view, char *id) { struct session *ses = doc_view->session; struct frame *target; @@ -173,7 +173,7 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: return true; } -void location_goto(struct document_view *doc_view, unsigned char *url); +void location_goto(struct document_view *doc_view, char *url); static bool window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval); static bool window_open(JSContext *ctx, unsigned int argc, JS::Value *rval); @@ -204,7 +204,7 @@ window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) // JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; - unsigned char *string; + char *string; if (!JS_InstanceOf(ctx, hobj, &window_class, nullptr)) { return false; @@ -240,8 +240,8 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) struct view_state *vs; struct document_view *doc_view; struct session *ses; - unsigned char *frame = NULL; - unsigned char *url, *url2; + char *frame = NULL; + char *url, *url2; struct uri *uri; static time_t ratelimit_start; static int ratelimit_count; @@ -361,7 +361,7 @@ window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) JS::CallArgs args = JS::CallArgsFromVp(argc, rval); // struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); - unsigned char *code; + char *code; int timeout; if (argc != 2) diff --git a/src/encoding/brotli.c b/src/encoding/brotli.c index 98e268c9..85f8a405 100644 --- a/src/encoding/brotli.c +++ b/src/encoding/brotli.c @@ -31,7 +31,7 @@ struct br_enc_data { size_t avail_in; size_t avail_out; size_t total_out; - unsigned char *buffer; + uint8_t *buffer; /* The file descriptor from which we read. */ int fdread; @@ -63,8 +63,9 @@ brotli_open(struct stream_encoded *stream, int fd) } static int -brotli_read(struct stream_encoded *stream, unsigned char *buf, int len) +brotli_read(struct stream_encoded *stream, char *bufc, int len) { + uint8_t *buf = (uint8_t*)bufc; struct br_enc_data *data = (struct br_enc_data *) stream->data; int err = 0; @@ -75,7 +76,7 @@ brotli_read(struct stream_encoded *stream, unsigned char *buf, int len) if (data->last_read) return 0; data->avail_out = len; - data->next_out = buf; + data->next_out = (uint8_t *)buf; do { if (data->avail_in == 0) { @@ -111,9 +112,11 @@ brotli_read(struct stream_encoded *stream, unsigned char *buf, int len) return len - data->avail_out; } -static unsigned char * -brotli_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int *new_len) +static char * +brotli_decode_buffer(struct stream_encoded *st, char *datac, int len, int *new_len) { + uint8_t *data = (uint8_t *)datac; + struct br_enc_data *enc_data = (struct br_enc_data *)st->data; BrotliDecoderState *state = enc_data->state; int error; @@ -126,7 +129,7 @@ brotli_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, in enc_data->avail_in = len; do { - unsigned char *new_buffer; + char *new_buffer; size_t size = enc_data->total_out + ELINKS_BROTLI_BUFFER_LENGTH; new_buffer = mem_realloc(enc_data->buffer, size); @@ -135,7 +138,7 @@ brotli_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, in break; } - enc_data->buffer = new_buffer; + enc_data->buffer = (uint8_t *)new_buffer; enc_data->next_out = enc_data->buffer + enc_data->total_out; enc_data->avail_out = ELINKS_BROTLI_BUFFER_LENGTH; @@ -145,7 +148,7 @@ brotli_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, in if (error == BROTLI_DECODER_RESULT_SUCCESS) { *new_len = enc_data->total_out; enc_data->after_end = 1; - return enc_data->buffer; + return (char *)enc_data->buffer; } } while (error == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT); @@ -172,7 +175,7 @@ brotli_close(struct stream_encoded *stream) } } -static const unsigned char *const brotli_extensions[] = { ".br", NULL }; +static const char *const brotli_extensions[] = { ".br", NULL }; const struct decoding_backend brotli_decoding_backend = { "brotli", diff --git a/src/encoding/bzip2.c b/src/encoding/bzip2.c index 9de17cc5..45ded820 100644 --- a/src/encoding/bzip2.c +++ b/src/encoding/bzip2.c @@ -42,7 +42,7 @@ struct bz2_enc_data { /* A buffer for data that has been read from the file but not * yet decompressed. fbz_stream.next_in and fbz_stream.avail_in * refer to this buffer. */ - unsigned char buf[ELINKS_BZ_BUFFER_LENGTH]; + char buf[ELINKS_BZ_BUFFER_LENGTH]; }; static int @@ -81,7 +81,7 @@ bzip2_open(struct stream_encoded *stream, int fd) } static int -bzip2_read(struct stream_encoded *stream, unsigned char *buf, int len) +bzip2_read(struct stream_encoded *stream, char *buf, int len) { struct bz2_enc_data *data = (struct bz2_enc_data *) stream->data; int err = 0; @@ -123,7 +123,7 @@ bzip2_read(struct stream_encoded *stream, unsigned char *buf, int len) } } while (data->fbz_stream.avail_out > 0); - assert(len - data->fbz_stream.avail_out == data->fbz_stream.next_out - (char *) buf); + assert(len - data->fbz_stream.avail_out == data->fbz_stream.next_out - buf); return len - data->fbz_stream.avail_out; } @@ -133,12 +133,12 @@ bzip2_read(struct stream_encoded *stream, unsigned char *buf, int len) #define BZIP2_SMALL 0 #endif -static unsigned char * -bzip2_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int *new_len) +static char * +bzip2_decode_buffer(struct stream_encoded *st, char *data, int len, int *new_len) { struct bz2_enc_data *enc_data = (struct bz2_enc_data *)st->data; bz_stream *stream = &enc_data->fbz_stream; - unsigned char *buffer = NULL; + char *buffer = NULL; int error; *new_len = 0; /* default, left there if an error occurs */ @@ -149,7 +149,7 @@ bzip2_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int stream->total_out_hi32 = 0; do { - unsigned char *new_buffer; + char *new_buffer; size_t size = stream->total_out_lo32 + MAX_STR_LEN; /* FIXME: support for 64 bit. real size is @@ -212,7 +212,7 @@ bzip2_close(struct stream_encoded *stream) } } -static const unsigned char *const bzip2_extensions[] = { ".bz2", ".tbz", NULL }; +static const char *const bzip2_extensions[] = { ".bz2", ".tbz", NULL }; const struct decoding_backend bzip2_decoding_backend = { "bzip2", diff --git a/src/encoding/deflate.c b/src/encoding/deflate.c index 7969752c..0e0fabad 100644 --- a/src/encoding/deflate.c +++ b/src/encoding/deflate.c @@ -91,8 +91,9 @@ deflate_gzip_open(struct stream_encoded *stream, int fd) } static int -deflate_read(struct stream_encoded *stream, unsigned char *buf, int len) +deflate_read(struct stream_encoded *stream, char *bufc, int len) { + unsigned char *buf = (unsigned char *)bufc; struct deflate_enc_data *data = (struct deflate_enc_data *) stream->data; int err = 0; int l = 0; @@ -171,9 +172,10 @@ restart: return len - data->deflate_stream.avail_out; } -static unsigned char * -deflate_decode_buffer(struct stream_encoded *st, int window_size, unsigned char *data, int len, int *new_len) +static char * +deflate_decode_buffer(struct stream_encoded *st, int window_size, char *datac, int len, int *new_len) { + unsigned char *data = (unsigned char *)datac; struct deflate_enc_data *enc_data = (struct deflate_enc_data *) st->data; z_stream *stream = &enc_data->deflate_stream; unsigned char *buffer = NULL; @@ -224,22 +226,22 @@ restart2: if (error == Z_OK) { *new_len = stream->total_out; - return buffer; + return (char *)buffer; } else { mem_free_if(buffer); return NULL; } } -static unsigned char * -deflate_raw_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int *new_len) +static char * +deflate_raw_decode_buffer(struct stream_encoded *st, char *data, int len, int *new_len) { /* raw DEFLATE with neither zlib nor gzip header */ return deflate_decode_buffer(st, -MAX_WBITS, data, len, new_len); } -static unsigned char * -deflate_gzip_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int *new_len) +static char * +deflate_gzip_decode_buffer(struct stream_encoded *st, char *data, int len, int *new_len) { /* detect gzip header, else assume zlib header */ return deflate_decode_buffer(st, MAX_WBITS + 32, data, len, new_len); @@ -262,7 +264,7 @@ deflate_close(struct stream_encoded *stream) } } -static const unsigned char *const deflate_extensions[] = { NULL }; +static const char *const deflate_extensions[] = { NULL }; const struct decoding_backend deflate_decoding_backend = { "deflate", @@ -273,7 +275,7 @@ const struct decoding_backend deflate_decoding_backend = { deflate_close, }; -static const unsigned char *const gzip_extensions[] = { ".gz", ".tgz", NULL }; +static const char *const gzip_extensions[] = { ".gz", ".tgz", NULL }; const struct decoding_backend gzip_decoding_backend = { "gzip", diff --git a/src/encoding/encoding.c b/src/encoding/encoding.c index fe2cdb28..103de8a3 100644 --- a/src/encoding/encoding.c +++ b/src/encoding/encoding.c @@ -46,15 +46,15 @@ dummy_open(struct stream_encoded *stream, int fd) } static int -dummy_read(struct stream_encoded *stream, unsigned char *data, int len) +dummy_read(struct stream_encoded *stream, char *data, int len) { return safe_read(((struct dummy_enc_data *) stream->data)->fd, data, len); } -static unsigned char * -dummy_decode_buffer(struct stream_encoded *stream, unsigned char *data, int len, int *new_len) +static char * +dummy_decode_buffer(struct stream_encoded *stream, char *data, int len, int *new_len) { - unsigned char *buffer = memacpy(data, len); + char *buffer = memacpy(data, len); if (!buffer) return NULL; @@ -69,7 +69,7 @@ dummy_close(struct stream_encoded *stream) mem_free(stream->data); } -static const unsigned char *const dummy_extensions[] = { NULL }; +static const char *const dummy_extensions[] = { NULL }; static const struct decoding_backend dummy_decoding_backend = { "none", @@ -126,7 +126,7 @@ open_encoded(int fd, enum stream_encoding encoding) * their size during decoding, 'len' indicates desired size of _returned_ data, * not desired size of data read from stream. */ int -read_encoded(struct stream_encoded *stream, unsigned char *data, int len) +read_encoded(struct stream_encoded *stream, char *data, int len) { return decoding_backends[stream->encoding]->read(stream, data, len); } @@ -134,8 +134,8 @@ read_encoded(struct stream_encoded *stream, unsigned char *data, int len) /* Decode an entire file from a buffer. This function is not suitable * for parts of files. @data contains the original data, @len bytes * long. The resulting decoded data chunk is *@new_len bytes long. */ -unsigned char * -decode_encoded_buffer(struct stream_encoded *stream, enum stream_encoding encoding, unsigned char *data, int len, +char * +decode_encoded_buffer(struct stream_encoded *stream, enum stream_encoding encoding, char *data, int len, int *new_len) { return decoding_backends[encoding]->decode_buffer(stream, data, len, new_len); @@ -152,20 +152,20 @@ close_encoded(struct stream_encoded *stream) /* Return a list of extensions associated with that encoding. */ -const unsigned char *const *listext_encoded(enum stream_encoding encoding) +const char *const *listext_encoded(enum stream_encoding encoding) { return decoding_backends[encoding]->extensions; } enum stream_encoding -guess_encoding(unsigned char *filename) +guess_encoding(char *filename) { int fname_len = strlen(filename); - unsigned char *fname_end = filename + fname_len; + char *fname_end = filename + fname_len; int enc; for (enc = 1; enc < ENCODINGS_KNOWN; enc++) { - const unsigned char *const *ext = decoding_backends[enc]->extensions; + const char *const *ext = decoding_backends[enc]->extensions; while (ext && *ext) { int len = strlen(*ext); @@ -180,7 +180,7 @@ guess_encoding(unsigned char *filename) return ENCODING_NONE; } -const unsigned char * +const char * get_encoding_name(enum stream_encoding encoding) { return decoding_backends[encoding]->name; @@ -199,7 +199,7 @@ try_encoding_extensions(struct string *filename, int *fd) /* No file of that name was found, try some others names. */ for (encoding = 1; encoding < ENCODINGS_KNOWN; encoding++) { - const unsigned char *const *ext = listext_encoded(encoding); + const char *const *ext = listext_encoded(encoding); for (; ext && *ext; ext++) { add_to_string(filename, *ext); @@ -242,7 +242,7 @@ read_file(struct stream_encoded *stream, int readsize, struct string *page) if (!readsize) readsize = 4096; while (realloc_string(page, page->length + readsize)) { - unsigned char *string_pos = page->source + page->length; + char *string_pos = page->source + page->length; int readlen = read_encoded(stream, string_pos, readsize); if (readlen < 0) { diff --git a/src/encoding/encoding.h b/src/encoding/encoding.h index d24cbe64..bd724cb5 100644 --- a/src/encoding/encoding.h +++ b/src/encoding/encoding.h @@ -27,22 +27,22 @@ struct stream_encoded { }; struct decoding_backend { - const unsigned char *name; - const unsigned char *const *extensions; + const char *name; + const char *const *extensions; int (*open)(struct stream_encoded *stream, int fd); - int (*read)(struct stream_encoded *stream, unsigned char *data, int len); - unsigned char *(*decode_buffer)(struct stream_encoded *stream, unsigned char *data, int len, int *new_len); + int (*read)(struct stream_encoded *stream, char *data, int len); + char *(*decode_buffer)(struct stream_encoded *stream, char *data, int len, int *new_len); void (*close)(struct stream_encoded *stream); }; struct stream_encoded *open_encoded(int, enum stream_encoding); -int read_encoded(struct stream_encoded *, unsigned char *, int); -unsigned char *decode_encoded_buffer(struct stream_encoded *stream, enum stream_encoding encoding, unsigned char *data, int len, int *new_len); +int read_encoded(struct stream_encoded *, char *, int); +char *decode_encoded_buffer(struct stream_encoded *stream, enum stream_encoding encoding, char *data, int len, int *new_len); void close_encoded(struct stream_encoded *); -const unsigned char *const *listext_encoded(enum stream_encoding); -enum stream_encoding guess_encoding(unsigned char *filename); -const unsigned char *get_encoding_name(enum stream_encoding encoding); +const char *const *listext_encoded(enum stream_encoding); +enum stream_encoding guess_encoding(char *filename); +const char *get_encoding_name(enum stream_encoding encoding); /* Read from open @stream into the @page string */ struct connection_state diff --git a/src/encoding/lzma.c b/src/encoding/lzma.c index 8ae452b3..a7a44238 100644 --- a/src/encoding/lzma.c +++ b/src/encoding/lzma.c @@ -60,7 +60,7 @@ lzma_open(struct stream_encoded *stream, int fd) } static int -lzma_read(struct stream_encoded *stream, unsigned char *buf, int len) +lzma_read(struct stream_encoded *stream, char *buf, int len) { struct lzma_enc_data *data = (struct lzma_enc_data *) stream->data; int err = 0; @@ -106,12 +106,12 @@ lzma_read(struct stream_encoded *stream, unsigned char *buf, int len) return len - data->flzma_stream.avail_out; } -static unsigned char * -lzma_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int *new_len) +static char * +lzma_decode_buffer(struct stream_encoded *st, char *data, int len, int *new_len) { struct lzma_enc_data *enc_data = (struct lzma_enc_data *) st->data; lzma_stream *stream = &enc_data->flzma_stream; - unsigned char *buffer = NULL; + char *buffer = NULL; int error; *new_len = 0; /* default, left there if an error occurs */ @@ -124,7 +124,7 @@ lzma_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int return NULL; do { - unsigned char *new_buffer; + char *new_buffer; size_t size = stream->total_out + MAX_STR_LEN; new_buffer = mem_realloc(buffer, size); @@ -176,7 +176,7 @@ lzma_close(struct stream_encoded *stream) } } -static const unsigned char *const lzma_extensions[] = { ".lzma", ".xz", NULL }; +static const char *const lzma_extensions[] = { ".lzma", ".xz", NULL }; const struct decoding_backend lzma_decoding_backend = { "lzma", diff --git a/src/encoding/zstd.c b/src/encoding/zstd.c index 665f8c83..aca2e368 100644 --- a/src/encoding/zstd.c +++ b/src/encoding/zstd.c @@ -57,8 +57,8 @@ zstd_open(struct stream_encoded *stream, int fd) } -static unsigned char * -zstd_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int *new_len) +static char * +zstd_decode_buffer(struct stream_encoded *st, char *data, int len, int *new_len) { struct zstd_enc_data *enc_data = (struct zstd_enc_data *)st->data; int error; @@ -73,7 +73,7 @@ zstd_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int enc_data->output.dst = NULL; do { - unsigned char *new_buffer; + char *new_buffer; size_t size = enc_data->output.size + ELINKS_ZSTD_BUFFER_LENGTH; new_buffer = mem_realloc(enc_data->output.dst, size); @@ -99,7 +99,7 @@ zstd_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int } static int -zstd_read(struct stream_encoded *stream, unsigned char *buf, int len) +zstd_read(struct stream_encoded *stream, char *buf, int len) { struct zstd_enc_data *data = (struct zstd_enc_data *) stream->data; @@ -109,7 +109,7 @@ zstd_read(struct stream_encoded *stream, unsigned char *buf, int len) if (!data->decoded) { size_t read_pos = 0; - unsigned char *tmp_buf = malloc(len); + char *tmp_buf = malloc(len); int new_len; if (!tmp_buf) { @@ -170,7 +170,7 @@ zstd_close(struct stream_encoded *stream) } } -static const unsigned char *const zstd_extensions[] = { ".zst", NULL }; +static const char *const zstd_extensions[] = { ".zst", NULL }; const struct decoding_backend zstd_decoding_backend = { "zstd", diff --git a/src/formhist/dialogs.c b/src/formhist/dialogs.c index c4a65dda..768287a9 100644 --- a/src/formhist/dialogs.c +++ b/src/formhist/dialogs.c @@ -42,7 +42,7 @@ is_formhist_data_used(struct listbox_item *item) return is_object_used((struct formhist_data *) item->udata); } -static unsigned char * +static char * get_formhist_data_text(struct listbox_item *item, struct terminal *term) { struct formhist_data *formhist_data = item->udata; @@ -50,7 +50,7 @@ get_formhist_data_text(struct listbox_item *item, struct terminal *term) return stracpy(formhist_data->url); } -static unsigned char * +static char * get_formhist_data_info(struct listbox_item *item, struct terminal *term) { struct formhist_data *formhist_data = item->udata; diff --git a/src/formhist/formhist.c b/src/formhist/formhist.c index c17d65e6..60e987e0 100644 --- a/src/formhist/formhist.c +++ b/src/formhist/formhist.c @@ -45,7 +45,7 @@ static union option_info forms_history_options[] = { INIT_LIST_OF(struct formhist_data, saved_forms); static struct formhist_data * -new_formhist_item(unsigned char *url) +new_formhist_item(char *url) { struct formhist_data *form; int url_len = strlen(url); @@ -91,8 +91,8 @@ int load_formhist_from_file(void) { struct formhist_data *form; - unsigned char tmp[MAX_STR_LEN]; - unsigned char *file; + char tmp[MAX_STR_LEN]; + char *file; FILE *f; if (loaded) return 1; @@ -100,7 +100,7 @@ load_formhist_from_file(void) if (!elinks_home) return 0; file = straconcat(elinks_home, FORMS_HISTORY_FILENAME, - (unsigned char *) NULL); + (char *) NULL); if (!file) return 0; f = fopen(file, "rb"); @@ -108,7 +108,7 @@ load_formhist_from_file(void) if (!f) return 0; while (fgets(tmp, MAX_STR_LEN, f)) { - unsigned char *p; + char *p; int dontsave = 0; if (tmp[0] == '\n' && !tmp[1]) continue; @@ -140,8 +140,8 @@ load_formhist_from_file(void) /* Fields type, name, value */ while (fgets(tmp, MAX_STR_LEN, f)) { struct submitted_value *sv; - unsigned char *type, *name, *value; - unsigned char *enc_value; + char *type, *name, *value; + char *enc_value; enum form_type ftype; int ret; @@ -216,7 +216,7 @@ int save_formhist_to_file(void) { struct secure_save_info *ssi; - unsigned char *file; + char *file; struct formhist_data *form; int r; @@ -224,7 +224,7 @@ save_formhist_to_file(void) return 0; file = straconcat(elinks_home, FORMS_HISTORY_FILENAME, - (unsigned char *) NULL); + (char *) NULL); if (!file) return 0; ssi = secure_open(file); @@ -244,7 +244,7 @@ save_formhist_to_file(void) secure_fprintf(ssi, "%s\n", form->url); foreach (sv, *form->submit) { - unsigned char *encvalue; + char *encvalue; if (sv->value && *sv->value) { /* Obfuscate the value. If we do @@ -293,7 +293,7 @@ form_exists(struct formhist_data *form1) /* Iterate through submitted entries. */ foreach (sv, *form1->submit) { struct submitted_value *sv2; - unsigned char *value = NULL; + char *value = NULL; count++; foreach (sv2, *form->submit) { @@ -317,7 +317,7 @@ form_exists(struct formhist_data *form1) } static int -forget_forms_with_url(unsigned char *url) +forget_forms_with_url(char *url) { struct formhist_data *form, *next; int count = 0; @@ -361,8 +361,8 @@ never_for_this_site(void *form_) remember_form(form); } -unsigned char * -get_form_history_value(unsigned char *url, unsigned char *name) +char * +get_form_history_value(char *url, char *name) { struct formhist_data *form; diff --git a/src/formhist/formhist.h b/src/formhist/formhist.h index a5c8a31d..24662268 100644 --- a/src/formhist/formhist.h +++ b/src/formhist/formhist.h @@ -23,12 +23,12 @@ struct formhist_data { unsigned int dontsave:1; /* <action> URI for this form. Must be at end of struct. */ - unsigned char url[1]; + char url[1]; }; /* Look up @name form of @url document in the form history. Returns the saved * value if present, NULL upon an error. */ -unsigned char *get_form_history_value(unsigned char *url, unsigned char *name); +char *get_form_history_value(char *url, char *name); void memorize_form(struct session *ses, LIST_OF(struct submitted_value) *submit, diff --git a/src/globhist/dialogs.c b/src/globhist/dialogs.c index 3023b4bc..36cb60ed 100644 --- a/src/globhist/dialogs.c +++ b/src/globhist/dialogs.c @@ -41,7 +41,7 @@ is_globhist_item_used(struct listbox_item *item) return is_object_used((struct global_history_item *) item->udata); } -static unsigned char * +static char * get_globhist_item_text(struct listbox_item *box_item, struct terminal *term) { struct global_history_item *item = box_item->udata; @@ -56,7 +56,7 @@ get_globhist_item_text(struct listbox_item *box_item, struct terminal *term) return info.source; } -static unsigned char * +static char * get_globhist_item_info(struct listbox_item *box_item, struct terminal *term) { struct global_history_item *item = box_item->udata; diff --git a/src/globhist/globhist.c b/src/globhist/globhist.c index 6bf73964..76e06469 100644 --- a/src/globhist/globhist.c +++ b/src/globhist/globhist.c @@ -43,8 +43,8 @@ INIT_LIST_OF(struct global_history_item, global_history_reap_list); /* GUI stuff. Declared here because done_global_history() frees it. */ -unsigned char *gh_last_searched_title = NULL; -unsigned char *gh_last_searched_url = NULL; +char *gh_last_searched_title = NULL; +char *gh_last_searched_url = NULL; enum global_history_options { GLOBHIST_TREE, @@ -143,7 +143,7 @@ delete_global_history_item(struct global_history_item *history_item) /* Search global history for item matching url. */ struct global_history_item * -get_global_history_item(unsigned char *url) +get_global_history_item(char *url) { struct hash_item *item; @@ -160,7 +160,7 @@ get_global_history_item(unsigned char *url) /* Search global history for certain item. There must be full match with the * parameter or the parameter must be NULL/zero. */ struct global_history_item * -multiget_global_history_item(unsigned char *url, unsigned char *title, time_t time) +multiget_global_history_item(char *url, char *title, time_t time) { struct global_history_item *history_item; @@ -183,7 +183,7 @@ multiget_global_history_item(unsigned char *url, unsigned char *title, time_t ti #endif static struct global_history_item * -init_global_history_item(unsigned char *url, unsigned char *title, time_t vtime) +init_global_history_item(char *url, char *title, time_t vtime) { struct global_history_item *history_item; @@ -264,7 +264,7 @@ add_item_to_global_history(struct global_history_item *history_item, /* Add a new entry in history list, take care of duplicate, respect history * size limit, and update any open history dialogs. */ void -add_global_history_item(unsigned char *url, unsigned char *title, time_t vtime) +add_global_history_item(char *url, char *title, time_t vtime) { struct global_history_item *history_item; int max_globhist_items; @@ -288,7 +288,7 @@ add_global_history_item(unsigned char *url, unsigned char *title, time_t vtime) int -globhist_simple_search(unsigned char *search_url, unsigned char *search_title) +globhist_simple_search(char *search_url, char *search_title) { struct global_history_item *history_item; @@ -329,9 +329,9 @@ globhist_simple_search(unsigned char *search_url, unsigned char *search_title) static void read_global_history(void) { - unsigned char in_buffer[MAX_STR_LEN * 3]; - unsigned char *file_name = GLOBAL_HISTORY_FILENAME; - unsigned char *title; + char in_buffer[MAX_STR_LEN * 3]; + char *file_name = GLOBAL_HISTORY_FILENAME; + char *title; FILE *f; if (!get_globhist_enable() @@ -340,7 +340,7 @@ read_global_history(void) if (elinks_home) { file_name = straconcat(elinks_home, file_name, - (unsigned char *) NULL); + (char *) NULL); if (!file_name) return; } f = fopen(file_name, "rb"); @@ -351,7 +351,7 @@ read_global_history(void) global_history.nosave = 1; while (fgets(in_buffer, sizeof(in_buffer), f)) { - unsigned char *url, *last_visit, *eol; + char *url, *last_visit, *eol; url = strchr((const char *)title, '\t'); if (!url) continue; @@ -376,7 +376,7 @@ static void write_global_history(void) { struct global_history_item *history_item; - unsigned char *file_name; + char *file_name; struct secure_save_info *ssi; if (!global_history.dirty || !elinks_home @@ -385,7 +385,7 @@ write_global_history(void) return; file_name = straconcat(elinks_home, GLOBAL_HISTORY_FILENAME, - (unsigned char *) NULL); + (char *) NULL); if (!file_name) return; ssi = secure_open(file_name); diff --git a/src/globhist/globhist.h b/src/globhist/globhist.h index 92c8fee2..50d053fc 100644 --- a/src/globhist/globhist.h +++ b/src/globhist/globhist.h @@ -17,23 +17,23 @@ struct global_history_item { struct listbox_item *box_item; - unsigned char *title; - unsigned char *url; + char *title; + char *url; time_t last_visit; }; extern struct input_history global_history; -extern unsigned char *gh_last_searched_title; -extern unsigned char *gh_last_searched_url; +extern char *gh_last_searched_title; +extern char *gh_last_searched_url; extern struct module global_history_module; void delete_global_history_item(struct global_history_item *); -struct global_history_item *get_global_history_item(unsigned char *); -void add_global_history_item(unsigned char *, unsigned char *, time_t); -int globhist_simple_search(unsigned char *, unsigned char *); +struct global_history_item *get_global_history_item(char *); +void add_global_history_item(char *, char *, time_t); +int globhist_simple_search(char *, char *); #ifdef __cplusplus } diff --git a/src/intl/charsets.c b/src/intl/charsets.c index ecbc7b27..c02f2ed7 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -51,8 +51,8 @@ struct table_entry { }; struct codepage_desc { - unsigned char *name; - unsigned char *const *aliases; + char *name; + char *const *aliases; /* The Unicode mappings of codepage bytes 0x80...0xFF. * (0x00...0x7F are assumed to be ASCII in all codepages.) @@ -86,10 +86,10 @@ struct codepage_desc { * The non-inline declarations in charsets.h also make sure that the * compiler emits global definitions for the symbols so that the * functions can be called from other translation units. */ -NONSTATIC_INLINE unsigned char *encode_utf8(unicode_val_T u); -NONSTATIC_INLINE int utf8charlen(const unsigned char *p); -NONSTATIC_INLINE unicode_val_T utf8_to_unicode(unsigned char **string, - const unsigned char *end); +NONSTATIC_INLINE char *encode_utf8(unicode_val_T u); +NONSTATIC_INLINE int utf8charlen(const char *p); +NONSTATIC_INLINE unicode_val_T utf8_to_unicode(char **string, + const char *end); static const char strings[256][2] = { "\000", "\001", "\002", "\003", "\004", "\005", "\006", "\007", @@ -147,7 +147,7 @@ free_translation_table(struct conv_table *p) * named array rather than a pointer so that it won't share storage * with any other string literal that happens to have the same * characters. */ -static const unsigned char no_str[] = "*"; +static const char no_str[] = "*"; static void new_translation_table(struct conv_table *p) @@ -194,7 +194,7 @@ static const unicode_val_T strange_chars[32] = { #define SYSTEM_CHARSET_FLAG 128 #define is_cp_ptr_utf8(cp_ptr) ((cp_ptr)->aliases == aliases_utf8) -const unsigned char * +const char * u2cp_(unicode_val_T u, int to, enum nbsp_mode nbsp_mode) { int j; @@ -234,9 +234,9 @@ u2cp_(unicode_val_T u, int to, enum nbsp_mode nbsp_mode) return no_str; } -static unsigned char utf_buffer[7]; +static char utf_buffer[7]; -NONSTATIC_INLINE unsigned char * +NONSTATIC_INLINE char * encode_utf8(unicode_val_T u) { memset(utf_buffer, 0, 7); @@ -286,16 +286,16 @@ static const char utf8char_len_tab[256] = { #ifdef CONFIG_UTF8 NONSTATIC_INLINE int -utf8charlen(const unsigned char *p) +utf8charlen(const char *p) { - return p ? utf8char_len_tab[*p] : 0; + return p ? utf8char_len_tab[(unsigned char)*p] : 0; } int -strlen_utf8(unsigned char **str) +strlen_utf8(char **str) { - unsigned char *s = *str; - unsigned char *end = strchr((const char *)s, '\0'); + char *s = *str; + char *end = strchr((const char *)s, '\0'); int x; int len; @@ -312,8 +312,8 @@ strlen_utf8(unsigned char **str) /* Start from @current and move back to @pos char. This pointer return. The * most left pointer is @start. */ -unsigned char * -utf8_prevchar(unsigned char *current, int pos, unsigned char *start) +char * +utf8_prevchar(char *current, int pos, char *start) { if (current == NULL || start == NULL || pos < 0) return NULL; @@ -328,7 +328,7 @@ utf8_prevchar(unsigned char *current, int pos, unsigned char *start) /* Count number of standard terminal cells needed for displaying UTF-8 * character. */ int -utf8_char2cells(unsigned char *utf8_char, unsigned char *end) +utf8_char2cells(char *utf8_char, char *end) { unicode_val_T u; @@ -346,7 +346,7 @@ utf8_char2cells(unsigned char *utf8_char, unsigned char *end) /* Count number of standard terminal cells needed for displaying string * with UTF-8 characters. */ int -utf8_ptr2cells(unsigned char *string, unsigned char *end) +utf8_ptr2cells(char *string, char *end) { int charlen, cell, cells = 0; @@ -374,7 +374,7 @@ utf8_ptr2cells(unsigned char *string, unsigned char *end) /* Count number of characters in string. */ int -utf8_ptr2chars(unsigned char *string, unsigned char *end) +utf8_ptr2chars(char *string, char *end) { int charlen, chars = 0; @@ -401,7 +401,7 @@ utf8_ptr2chars(unsigned char *string, unsigned char *end) * specified number of cells. */ int -utf8_cells2bytes(unsigned char *string, int max_cells, unsigned char *end) +utf8_cells2bytes(char *string, int max_cells, char *end) { unsigned int bytes = 0, cells = 0; @@ -443,12 +443,12 @@ utf8_cells2bytes(unsigned char *string, int max_cells, unsigned char *end) * * This function can do some of the same jobs as utf8charlen(), * utf8_cells2bytes(), and strlen_utf8(). */ -unsigned char * -utf8_step_forward(unsigned char *string, unsigned char *end, +char * +utf8_step_forward(char *string, char *end, int max, enum utf8_step way, int *count) { int steps = 0; - unsigned char *current = string; + char *current = string; assert(string); assert(max >= 0); @@ -469,7 +469,7 @@ utf8_step_forward(unsigned char *string, unsigned char *end, case UTF8_STEP_CELLS_MORE: while (steps < max && current < end) { unicode_val_T u; - unsigned char *prev = current; + char *prev = current; int width; u = utf8_to_unicode(¤t, end); @@ -511,12 +511,12 @@ invalid_arg: * may be inconsistent. * * This function can do some of the same jobs as utf8_prevchar(). */ -unsigned char * -utf8_step_backward(unsigned char *string, unsigned char *start, +char * +utf8_step_backward(char *string, char *start, int max, enum utf8_step way, int *count) { int steps = 0; - unsigned char *current = string; + char *current = string; assert(string); assert(start); @@ -535,8 +535,8 @@ utf8_step_backward(unsigned char *string, unsigned char *start, case UTF8_STEP_CELLS_FEWER: case UTF8_STEP_CELLS_MORE: while (steps < max) { - unsigned char *prev = current; - unsigned char *look; + char *prev = current; + char *look; unicode_val_T u; int width; @@ -655,13 +655,13 @@ unicode_fold_label_case(unicode_val_T c) #endif /* CONFIG_UTF8 */ NONSTATIC_INLINE unicode_val_T -utf8_to_unicode(unsigned char **string, const unsigned char *end) +utf8_to_unicode(char **string, const char *end) { - unsigned char *str = *string; + char *str = *string; unicode_val_T u; int length; - length = utf8char_len_tab[str[0]]; + length = utf8char_len_tab[(unsigned char)str[0]]; if (str + length > end) { return UCS_NO_CHAR; @@ -764,7 +764,7 @@ cp2u(int from, unsigned char c) } /* This slow and ugly code is used by the terminal utf_8_io */ -const unsigned char * +const char * cp2utf8(int from, int c) { from &= ~SYSTEM_CHARSET_FLAG; @@ -776,7 +776,7 @@ cp2utf8(int from, int c) } unicode_val_T -cp_to_unicode(int codepage, unsigned char **string, const unsigned char *end) +cp_to_unicode(int codepage, char **string, const char *end) { unicode_val_T ret; @@ -809,7 +809,7 @@ get_combined(unicode_val_T *data, int length) if (!combined_hash) combined_hash = init_hash8(); if (!combined_hash) return UCS_NO_CHAR; - item = get_hash_item(combined_hash, (unsigned char *)data, length * sizeof(*data)); + item = get_hash_item(combined_hash, (char *)data, length * sizeof(*data)); if (item) return (unicode_val_T)(long)item->value; if (last_combined >= UCS_END_COMBINED) return UCS_NO_CHAR; @@ -830,7 +830,7 @@ get_combined(unicode_val_T *data, int length) return UCS_NO_CHAR; } combined[indeks] = key; - item = add_hash_item(combined_hash, (unsigned char *)key, + item = add_hash_item(combined_hash, (char *)key, length * sizeof(*data), (void *)(long)(last_combined)); if (!item) { last_combined--; @@ -855,9 +855,9 @@ free_combined() static void -add_utf8(struct conv_table *ct, unicode_val_T u, const unsigned char *str) +add_utf8(struct conv_table *ct, unicode_val_T u, const char *str) { - unsigned char *p = encode_utf8(u); + unsigned char *p = (unsigned char *)encode_utf8(u); while (p[1]) { if (ct[*p].t) ct = ct[*p].u.tbl; @@ -898,7 +898,7 @@ free_utf_table(void) /* Cast away const. */ for (i = 128; i < 256; i++) - mem_free((unsigned char *) utf_table[i].u.str); + mem_free((char *) utf_table[i].u.str); } static struct conv_table * @@ -1033,7 +1033,7 @@ get_translation_table(int from, int to) for (i = 128; i < 256; i++) { if (codepages[from].highhalf[i - 0x80] != 0xFFFF) { - const unsigned char *u; + const char *u; u = u2cp(codepages[from].highhalf[i - 0x80], to); if (u) table[i].u.str = u; @@ -1045,7 +1045,7 @@ get_translation_table(int from, int to) } static inline int -xxstrcmp(unsigned char *s1, unsigned char *s2, int l2) +xxstrcmp(char *s1, char *s2, int l2) { while (l2) { if (*s1 > *s2) return 1; @@ -1069,8 +1069,8 @@ struct entity_cache { unsigned int hits; int strlen; int encoding; - const unsigned char *result; - unsigned char str[20]; /* Suffice in any case. */ + const char *result; + char str[20]; /* Suffice in any case. */ }; /* comparison function for qsort() */ @@ -1090,14 +1090,14 @@ compare_entities(const void *key_, const void *element_) struct string *key = (struct string *) key_; struct entity *element = (struct entity *) element_; int length = key->length; - unsigned char *first = key->source; - unsigned char *second = element->s; + char *first = key->source; + char *second = element->s; return xxstrcmp(first, second, length); } -const unsigned char * -get_entity_string(const unsigned char *str, const int strlen, int encoding) +const char * +get_entity_string(const char *str, const int strlen, int encoding) { #define ENTITY_CACHE_SIZE 10 /* 10 seems a good value. */ #define ENTITY_CACHE_MAXLEN 9 /* entities with length >= ENTITY_CACHE_MAXLEN or == 1 @@ -1105,7 +1105,7 @@ get_entity_string(const unsigned char *str, const int strlen, int encoding) static struct entity_cache entity_cache[ENTITY_CACHE_MAXLEN][ENTITY_CACHE_SIZE]; static unsigned int nb_entity_cache[ENTITY_CACHE_MAXLEN]; unsigned int slen = 0; - const unsigned char *result = NULL; + const char *result = NULL; /* Note that an object of static storage duration is automatically * initialised to zero in C. */ @@ -1172,7 +1172,7 @@ skip: #endif /* CONFIG_UTF8 */ if (*str == '#') { /* Numeric entity. */ int l = (int) strlen; - unsigned char *st = (unsigned char *) str; + char *st = (char *) str; unicode_val_T n = 0; if (l == 1) goto end; /* &#; ? */ @@ -1212,7 +1212,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((char *) str, strlen); struct entity *element = bsearch((void *) &key, entities, N_ENTITIES, sizeof(*element), @@ -1269,17 +1269,17 @@ end: return result; } -unsigned char * +char * convert_string(struct conv_table *convert_table, - unsigned char *chars2, int charslen2, int cp, + char *chars2, int charslen2, int cp, enum convert_string_mode mode, int *length, - void (*callback)(void *data, unsigned char *buf, int buflen), + void (*callback)(void *data, char *buf, int buflen), void *callback_data) { - unsigned char *buffer; + char *buffer; int bufferpos = 0; int charspos = 0; - unsigned char *chars = chars2; + unsigned char *chars = (unsigned char *)chars2; int charslen = charslen2; #ifdef HAVE_ICONV @@ -1293,12 +1293,12 @@ convert_string(struct conv_table *convert_table, int is_iconv = 0; int chars_offset = 0; - if (!convert_table && !memchr(chars, '&', charslen)) { + if (!convert_table && !memchr((char *)chars, '&', charslen)) { if (callback) { - if (charslen) callback(callback_data, chars, charslen); + if (charslen) callback(callback_data, (char *)chars, charslen); return NULL; } else { - return memacpy(chars, charslen); + return memacpy((char *)chars, charslen); } } @@ -1379,7 +1379,7 @@ repeat: out: while (charspos < charslen) { - const unsigned char *translit; + const char *translit; #define PUTC do { \ buffer[bufferpos++] = chars[charspos++]; \ @@ -1396,12 +1396,12 @@ out: t = convert_table; i = charspos; - while (t[chars[i]].t) { - t = t[chars[i++]].u.tbl; + while (t[(unsigned char)chars[i]].t) { + t = t[(unsigned char)chars[i++]].u.tbl; if (i >= charslen) PUTC; } - translit = t[chars[i]].u.str; + translit = t[(unsigned char)chars[i]].u.str; charspos = i + 1; } else if (mode == CSM_FORM || mode == CSM_NONE) { @@ -1424,7 +1424,7 @@ out: if ((mode == CSM_DEFAULT || (chars[i] != '&' && chars[i] != '=')) && i > start && !isasciialpha(chars[i]) && !isdigit(chars[i])) { - translit = get_entity_string(&chars[start], i - start, + translit = get_entity_string((const char *)&chars[start], i - start, cp); if (chars[i] != ';') { /* Eat    <foo> happily, but @@ -1448,7 +1448,7 @@ out: } while (*translit) { - unsigned char *new_; + char *new_; buffer[bufferpos++] = *(translit++); flush: @@ -1490,7 +1490,7 @@ flush: #ifndef USE_FASTFIND int -get_cp_index(const unsigned char *name) +get_cp_index(const char *name) { int i, a; int syscp = 0; @@ -1571,7 +1571,7 @@ static struct fastfind_index ff_charsets_index /* It searchs for a charset named @name or one of its aliases and * returns index for it or -1 if not found. */ int -get_cp_index(const unsigned char *name) +get_cp_index(const char *name) { const struct codepage_desc *codepage; int syscp = 0; @@ -1621,7 +1621,7 @@ free_charsets_lookup(void) * localize these with gettext. So it may be best not to use this * function if the name will have to be converted back to an * index. */ -unsigned char * +char * get_cp_name(int cp_index) { if (cp_index < 0) return "none"; @@ -1633,7 +1633,7 @@ get_cp_name(int cp_index) /* Get the codepage's name for saving to a configuration file. These * names can be converted back to indexes, even in future versions of * ELinks. */ -unsigned char * +char * get_cp_config_name(int cp_index) { if (cp_index < 0) return "none"; @@ -1646,7 +1646,7 @@ get_cp_config_name(int cp_index) /* Get the codepage's name for sending to a library or server that * understands MIME charset names. This function irreversibly maps * the "System" codepage to the underlying charset. */ -unsigned char * +char * get_cp_mime_name(int cp_index) { if (cp_index < 0) return "none"; @@ -1665,7 +1665,7 @@ is_cp_utf8(int cp_index) /* This function will be used by the xhtml parser. */ const uint16_t * -get_cp_highhalf(const unsigned char *name) +get_cp_highhalf(const char *name) { int cp = get_cp_index(name); diff --git a/src/intl/charsets.h b/src/intl/charsets.h index b2fc8b5f..55ad6be9 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -71,7 +71,7 @@ struct conv_table { * However, if the conversion table is to UTF-8, then * the strings in elements 0x80 to 0xFF are allocated * with @mem_alloc and owned by the table. */ - const unsigned char *str; + const char *str; /* If @t==1: a pointer to a nested conversion table * (with 256 elements) that describes how to convert * each possible subsequent byte. The conversion @@ -101,7 +101,7 @@ enum nbsp_mode { }; struct conv_table *get_translation_table(int, int); -const unsigned char *get_entity_string(const unsigned char *str, +const char *get_entity_string(const char *str, const int strlen, int encoding); /* The convert_string() name is also used by Samba (version 3.0.3), which @@ -118,28 +118,28 @@ const unsigned char *get_entity_string(const unsigned char *str, * converted string of length @length, or if the @callback is non-NULL it calls * it each few bytes instead and always returns NULL (@length is undefined). * Note that it's ok not to care and pass NULL as @length. */ -unsigned char *convert_string(struct conv_table *convert_table, - unsigned char *chars, int charslen, int cp, +char *convert_string(struct conv_table *convert_table, + char *chars, int charslen, int cp, enum convert_string_mode mode, int *length, - void (*callback)(void *data, unsigned char *buf, int buflen), + void (*callback)(void *data, char *buf, int buflen), void *callback_data); -int get_cp_index(const unsigned char *); -unsigned char *get_cp_name(int); -unsigned char *get_cp_config_name(int); -unsigned char *get_cp_mime_name(int); -const uint16_t *get_cp_highhalf(const unsigned char *); +int get_cp_index(const char *); +char *get_cp_name(int); +char *get_cp_config_name(int); +char *get_cp_mime_name(int); +const uint16_t *get_cp_highhalf(const char *); int is_cp_utf8(int); void free_conv_table(void); -unsigned char *encode_utf8(unicode_val_T); +char *encode_utf8(unicode_val_T); #ifdef CONFIG_UTF8 -unsigned char *utf8_prevchar(unsigned char *, int, unsigned char *); -int utf8charlen(const unsigned char *); -int utf8_char2cells(unsigned char *, unsigned char *); -int utf8_ptr2cells(unsigned char *, unsigned char *); -int utf8_ptr2chars(unsigned char *, unsigned char *); -int utf8_cells2bytes(unsigned char *, int, unsigned char *); +char *utf8_prevchar(char *, int, char *); +int utf8charlen(const char *); +int utf8_char2cells(char *, char *); +int utf8_ptr2cells(char *, char *); +int utf8_ptr2chars(char *, char *); +int utf8_cells2bytes(char *, int, char *); /* How utf8_step_forward and utf8_step_backward count steps. */ enum utf8_step { /* Each step is one character, even if it is a combining or @@ -156,16 +156,16 @@ enum utf8_step { * include the whole character. */ UTF8_STEP_CELLS_MORE }; -unsigned char *utf8_step_forward(unsigned char *, unsigned char *, +char *utf8_step_forward(char *, char *, int, enum utf8_step, int *); -unsigned char *utf8_step_backward(unsigned char *, unsigned char *, +char *utf8_step_backward(char *, char *, int, enum utf8_step, int *); int unicode_to_cell(unicode_val_T); unicode_val_T unicode_fold_label_case(unicode_val_T); -int strlen_utf8(unsigned char **); +int strlen_utf8(char **); #endif /* CONFIG_UTF8 */ -unicode_val_T utf8_to_unicode(unsigned char **, const unsigned char *); -unicode_val_T cp_to_unicode(int, unsigned char **, const unsigned char *); +unicode_val_T utf8_to_unicode(char **, const char *); +unicode_val_T cp_to_unicode(int, char **, const char *); #ifdef CONFIG_COMBINE extern unicode_val_T last_combined; @@ -176,9 +176,9 @@ void free_combined(); #endif /* CONFIG_COMBINE */ unicode_val_T cp2u(int, unsigned char); -const unsigned char *cp2utf8(int, int); +const char *cp2utf8(int, int); -const unsigned char *u2cp_(unicode_val_T, int, enum nbsp_mode); +const char *u2cp_(unicode_val_T, int, enum nbsp_mode); #define u2cp(u, to) u2cp_(u, to, NBSP_MODE_HACK) #define u2cp_no_nbsp(u, to) u2cp_(u, to, NBSP_MODE_ASCII) diff --git a/src/intl/codepage.inc b/src/intl/codepage.inc index dfc63788..17d95c74 100644 --- a/src/intl/codepage.inc +++ b/src/intl/codepage.inc @@ -10,7 +10,7 @@ #define table_7bit table_NULL -unsigned char *const aliases_7bit [] = { +char *const aliases_7bit [] = { "us-ascii", "ascii", "7bit", @@ -166,7 +166,7 @@ const uint16_t highhalf_8859_1 [] = { #define table_8859_1 table_NULL -unsigned char *const aliases_8859_1 [] = { +char *const aliases_8859_1 [] = { "ISO-8859-1", "iso8859-1", "8859-1", @@ -320,7 +320,7 @@ const uint16_t highhalf_8859_2 [] = { #define table_8859_2 table_NULL -unsigned char *const aliases_8859_2 [] = { +char *const aliases_8859_2 [] = { "ISO-8859-2", "iso8859-2", "8859-2", @@ -471,7 +471,7 @@ const uint16_t highhalf_8859_3 [] = { #define table_8859_3 table_NULL -unsigned char *const aliases_8859_3 [] = { +char *const aliases_8859_3 [] = { "ISO-8859-3", "8859-3", "ISO_8859-3:1988", @@ -621,7 +621,7 @@ const uint16_t highhalf_8859_4 [] = { #define table_8859_4 table_NULL -unsigned char *const aliases_8859_4 [] = { +char *const aliases_8859_4 [] = { "ISO-8859-4", "iso8859-4", "8859-4", @@ -772,7 +772,7 @@ const uint16_t highhalf_8859_5 [] = { #define table_8859_5 table_NULL -unsigned char *const aliases_8859_5 [] = { +char *const aliases_8859_5 [] = { "ISO-8859-5", "iso8859-5", "8859-5", @@ -921,7 +921,7 @@ const uint16_t highhalf_8859_6 [] = { #define table_8859_6 table_NULL -unsigned char *const aliases_8859_6 [] = { +char *const aliases_8859_6 [] = { "ISO-8859-6", "8859-6", "ISO_8859-6", @@ -1072,7 +1072,7 @@ const uint16_t highhalf_8859_7 [] = { #define table_8859_7 table_NULL -unsigned char *const aliases_8859_7 [] = { +char *const aliases_8859_7 [] = { "ISO-8859-7", "iso8859-7", "8859-7", @@ -1224,7 +1224,7 @@ const uint16_t highhalf_8859_8 [] = { #define table_8859_8 table_NULL -unsigned char *const aliases_8859_8 [] = { +char *const aliases_8859_8 [] = { "ISO-8859-8", "8859-8", "ISO_8859-8:1988", @@ -1372,7 +1372,7 @@ const uint16_t highhalf_8859_9 [] = { #define table_8859_9 table_NULL -unsigned char *const aliases_8859_9 [] = { +char *const aliases_8859_9 [] = { "ISO-8859-9", "iso8859-9", "8859-9", @@ -1521,7 +1521,7 @@ const uint16_t highhalf_8859_10 [] = { #define table_8859_10 table_NULL -unsigned char *const aliases_8859_10 [] = { +char *const aliases_8859_10 [] = { "ISO-8859-10", "8859-10", "ISO_8859-10:1992", @@ -1669,7 +1669,7 @@ const uint16_t highhalf_8859_13 [] = { #define table_8859_13 table_NULL -unsigned char *const aliases_8859_13 [] = { +char *const aliases_8859_13 [] = { "ISO-8859-13", "iso8859-13", "8859-13", @@ -1817,7 +1817,7 @@ const uint16_t highhalf_8859_14 [] = { #define table_8859_14 table_NULL -unsigned char *const aliases_8859_14 [] = { +char *const aliases_8859_14 [] = { "ISO-8859-14", "8859-14", "ISO_8859-14", @@ -1964,7 +1964,7 @@ const uint16_t highhalf_8859_15 [] = { #define table_8859_15 table_NULL -unsigned char *const aliases_8859_15 [] = { +char *const aliases_8859_15 [] = { "ISO-8859-15", "iso8859-15", "8859-15", @@ -2116,7 +2116,7 @@ const uint16_t highhalf_8859_16 [] = { #define table_8859_16 table_NULL -unsigned char *const aliases_8859_16 [] = { +char *const aliases_8859_16 [] = { "ISO-8859-16", "iso8859-16", "8859-16", @@ -2266,7 +2266,7 @@ const uint16_t highhalf_cp1250 [] = { #define table_cp1250 table_NULL -unsigned char *const aliases_cp1250 [] = { +char *const aliases_cp1250 [] = { "windows-1250", "windows1250", "1250", @@ -2411,7 +2411,7 @@ const uint16_t highhalf_cp1251 [] = { #define table_cp1251 table_NULL -unsigned char *const aliases_cp1251 [] = { +char *const aliases_cp1251 [] = { "windows-1251", "windows1251", "1251", @@ -2556,7 +2556,7 @@ const uint16_t highhalf_cp1252 [] = { #define table_cp1252 table_NULL -unsigned char *const aliases_cp1252 [] = { +char *const aliases_cp1252 [] = { "windows-1252", "1252", NULL @@ -2698,7 +2698,7 @@ const uint16_t highhalf_cp1256 [] = { #define table_cp1256 table_NULL -unsigned char *const aliases_cp1256 [] = { +char *const aliases_cp1256 [] = { "windows-1256", "1256", "cp1256", @@ -2842,7 +2842,7 @@ const uint16_t highhalf_cp1257 [] = { #define table_cp1257 table_NULL -unsigned char *const aliases_cp1257 [] = { +char *const aliases_cp1257 [] = { "windows-1257", "windows1257", "1257", @@ -2987,7 +2987,7 @@ const uint16_t highhalf_cp437 [] = { #define table_cp437 table_NULL -unsigned char *const aliases_cp437 [] = { +char *const aliases_cp437 [] = { "cp437", "437", "IBM437", @@ -3131,7 +3131,7 @@ const uint16_t highhalf_cp737 [] = { #define table_cp737 table_NULL -unsigned char *const aliases_cp737 [] = { +char *const aliases_cp737 [] = { "cp737", "737", NULL @@ -3273,7 +3273,7 @@ const uint16_t highhalf_cp850 [] = { #define table_cp850 table_NULL -unsigned char *const aliases_cp850 [] = { +char *const aliases_cp850 [] = { "cp850", "850", "IBM850", @@ -3417,7 +3417,7 @@ const uint16_t highhalf_cp852 [] = { #define table_cp852 table_NULL -unsigned char *const aliases_cp852 [] = { +char *const aliases_cp852 [] = { "cp852", "852", "csPCp852", @@ -3560,7 +3560,7 @@ const uint16_t highhalf_cp866 [] = { #define table_cp866 table_NULL -unsigned char *const aliases_cp866 [] = { +char *const aliases_cp866 [] = { "cp866", "866", "IBM866", @@ -3704,7 +3704,7 @@ const uint16_t highhalf_cp1125 [] = { #define table_cp1125 table_NULL -unsigned char *const aliases_cp1125 [] = { +char *const aliases_cp1125 [] = { "x-cp866-u", "ruscii", "1125", @@ -3848,7 +3848,7 @@ const uint16_t highhalf_macroman [] = { #define table_macroman table_NULL -unsigned char *const aliases_macroman [] = { +char *const aliases_macroman [] = { "x-mac", "mac", "macroman", @@ -3993,7 +3993,7 @@ const uint16_t highhalf_mac_lat2 [] = { #define table_mac_lat2 table_NULL -unsigned char *const aliases_mac_lat2 [] = { +char *const aliases_mac_lat2 [] = { "x-mac-ce", "mac-ce", "maclatin2", @@ -4138,7 +4138,7 @@ const uint16_t highhalf_kamen [] = { #define table_kamen table_NULL -unsigned char *const aliases_kamen [] = { +char *const aliases_kamen [] = { "x-kam-cs", "kam", "867", @@ -4282,7 +4282,7 @@ const uint16_t highhalf_koi8_r [] = { #define table_koi8_r table_NULL -unsigned char *const aliases_koi8_r [] = { +char *const aliases_koi8_r [] = { "koi8-r", "csKOI8R", NULL @@ -4424,7 +4424,7 @@ const uint16_t highhalf_koi8_u [] = { #define table_koi8_u table_NULL -unsigned char *const aliases_koi8_u [] = { +char *const aliases_koi8_u [] = { "koi8-u", NULL }; @@ -4565,7 +4565,7 @@ const uint16_t highhalf_koi8_ru [] = { #define table_koi8_ru table_NULL -unsigned char *const aliases_koi8_ru [] = { +char *const aliases_koi8_ru [] = { "koi8-ru", NULL }; @@ -4710,7 +4710,7 @@ const struct table_entry table_tcvn5712 [] = { {0, 0} }; -unsigned char *const aliases_tcvn5712 [] = { +char *const aliases_tcvn5712 [] = { "TCVN-5712", "TCVN", "TCVN-0", @@ -4861,7 +4861,7 @@ const struct table_entry table_viscii [] = { {0, 0} }; -unsigned char *const aliases_viscii [] = { +char *const aliases_viscii [] = { "VISCII", "VISCII-1", "VISCII 1.1", @@ -4878,7 +4878,7 @@ unsigned char *const aliases_viscii [] = { #define table_utf8 table_NULL -unsigned char *const aliases_utf8 [] = { +char *const aliases_utf8 [] = { "utf-8", "utf8", NULL @@ -4888,7 +4888,7 @@ unsigned char *const aliases_utf8 [] = { /* many sites set charset="Big5", although they really use "Big5-hkscs". Big5-hkscs is superset of Big5. */ -unsigned char *const aliases_big5 [] = { +char *const aliases_big5 [] = { "Big5-HKSCS", "Big5", NULL @@ -4896,7 +4896,7 @@ unsigned char *const aliases_big5 [] = { /*** Shift JIS ***/ -unsigned char *const aliases_shift_jis [] = { +char *const aliases_shift_jis [] = { "shift_jis", "shift-jis", "sjis", @@ -4905,7 +4905,7 @@ unsigned char *const aliases_shift_jis [] = { /*** EUC_CN ***/ -unsigned char *const aliases_euc_cn [] = { +char *const aliases_euc_cn [] = { "euc-cn", "euc_cn", NULL @@ -4913,7 +4913,7 @@ unsigned char *const aliases_euc_cn [] = { /*** EUC_JP ***/ -unsigned char *const aliases_euc_jp [] = { +char *const aliases_euc_jp [] = { "euc-jp", "euc_jp", NULL @@ -4921,7 +4921,7 @@ unsigned char *const aliases_euc_jp [] = { /*** EUC_KR ***/ -unsigned char *const aliases_euc_kr [] = { +char *const aliases_euc_kr [] = { "euc-kr", "euc_kr", NULL @@ -4929,7 +4929,7 @@ unsigned char *const aliases_euc_kr [] = { /*** EUC_TW ***/ -unsigned char *const aliases_euc_tw [] = { +char *const aliases_euc_tw [] = { "euc-tw", "euc_tw", NULL @@ -4937,7 +4937,7 @@ unsigned char *const aliases_euc_tw [] = { /*** GBK ***/ -unsigned char *const aliases_gbk [] = { +char *const aliases_gbk [] = { "gbk", "936", "cp936", @@ -4948,7 +4948,7 @@ unsigned char *const aliases_gbk [] = { /*** GB2312 ***/ -unsigned char *const aliases_gb2312 [] = { +char *const aliases_gb2312 [] = { "gb2312", "gb-2312", "gb_2312", @@ -4958,7 +4958,7 @@ unsigned char *const aliases_gb2312 [] = { /*** GB18030 ***/ -unsigned char *const aliases_gb18030 [] = { +char *const aliases_gb18030 [] = { "gb18030", "gb-18030", "gb_18030", @@ -4968,7 +4968,7 @@ unsigned char *const aliases_gb18030 [] = { /*** ISO2022JP ***/ -unsigned char *const aliases_iso2022jp [] = { +char *const aliases_iso2022jp [] = { "iso2022jp", "iso-2022-jp", NULL diff --git a/src/intl/gettext/Makefile b/src/intl/gettext/Makefile index 14a7418e..ce9c0b51 100644 --- a/src/intl/gettext/Makefile +++ b/src/intl/gettext/Makefile @@ -40,7 +40,7 @@ plural.c: plural.y .SUFFIXES: .y .c .y.c: $(YACC) $(YFLAGS) --output $@ $< - rm -f $*.h + ##rm -f $*.h install-local: $(builddir)/charset.alias all @if test '$(CONFIG_NLS)' = yes; then \ diff --git a/src/intl/gettext/bindtextdom.c b/src/intl/gettext/bindtextdom.c index 834bb146..c210effd 100644 --- a/src/intl/gettext/bindtextdom.c +++ b/src/intl/gettext/bindtextdom.c @@ -30,15 +30,15 @@ #include "util/string.h" /* Contains the default location of the message catalogs. */ -extern const unsigned char *_nl_default_dirname__; +extern const char *_nl_default_dirname__; /* List with bindings of specific domains. */ extern struct binding *_nl_domain_bindings__; /* Prototypes for local functions. */ -static void set_binding_values(const unsigned char *domainname, - const unsigned char **dirnamep, - const unsigned char **codesetp); +static void set_binding_values(const char *domainname, + const char **dirnamep, + const char **codesetp); /* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP to be used for the DOMAINNAME message catalog. @@ -47,9 +47,9 @@ static void set_binding_values(const unsigned char *domainname, If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither modified nor returned. */ static void -set_binding_values(const unsigned char *domainname, - const unsigned char **dirnamep, - const unsigned char **codesetp) +set_binding_values(const char *domainname, + const char **dirnamep, + const char **codesetp) { struct binding *binding; int modified; @@ -81,7 +81,7 @@ set_binding_values(const unsigned char *domainname, if (binding != NULL) { if (dirnamep) { - const unsigned char *dirname = *dirnamep; + const char *dirname = *dirnamep; if (dirname == NULL) /* The current binding has be to returned. */ @@ -90,12 +90,12 @@ set_binding_values(const unsigned char *domainname, /* The domain is already bound. If the new value and the old one are equal we simply do nothing. Otherwise replace the old binding. */ - unsigned char *result = binding->dirname; + char *result = binding->dirname; if (strcmp(dirname, result) != 0) { if (strcmp(dirname, _nl_default_dirname__) == 0) - result = (unsigned char *) + result = (char *) _nl_default_dirname__; else { result = strdup(dirname); @@ -115,7 +115,7 @@ set_binding_values(const unsigned char *domainname, } if (codesetp) { - const unsigned char *codeset = *codesetp; + const char *codeset = *codesetp; if (codeset == NULL) /* The current binding has be to returned. */ @@ -124,7 +124,7 @@ set_binding_values(const unsigned char *domainname, /* The domain is already bound. If the new value and the old one are equal we simply do nothing. Otherwise replace the old binding. */ - unsigned char *result = binding->codeset; + char *result = binding->codeset; if (result == NULL || strcmp(codeset, result) != 0) { @@ -162,7 +162,7 @@ set_binding_values(const unsigned char *domainname, memcpy(new_binding->domainname, domainname, len); if (dirnamep) { - const unsigned char *dirname = *dirnamep; + const char *dirname = *dirnamep; if (dirname == NULL) /* The default value. */ @@ -171,7 +171,7 @@ set_binding_values(const unsigned char *domainname, if (strcmp(dirname, _nl_default_dirname__) == 0) dirname = _nl_default_dirname__; else { - unsigned char *result; + char *result; result = strdup(dirname); if (result == NULL) @@ -180,18 +180,18 @@ set_binding_values(const unsigned char *domainname, } } *dirnamep = dirname; - new_binding->dirname = (unsigned char *) dirname; + new_binding->dirname = (char *) dirname; } else /* The default value. */ - new_binding->dirname = (unsigned char *) _nl_default_dirname__; + new_binding->dirname = (char *) _nl_default_dirname__; new_binding->codeset_cntr = 0; if (codesetp) { - const unsigned char *codeset = *codesetp; + const char *codeset = *codesetp; if (codeset != NULL) { - unsigned char *result; + char *result; result = strdup(codeset); if (result == NULL) @@ -200,7 +200,7 @@ set_binding_values(const unsigned char *domainname, new_binding->codeset_cntr++; } *codesetp = codeset; - new_binding->codeset = (unsigned char *) codeset; + new_binding->codeset = (char *) codeset; } else new_binding->codeset = NULL; @@ -246,18 +246,18 @@ failed: /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ -unsigned char * -bindtextdomain__(const unsigned char *domainname, const unsigned char *dirname) +char * +bindtextdomain__(const char *domainname, const char *dirname) { set_binding_values(domainname, &dirname, NULL); - return (unsigned char *) dirname; + return (char *) dirname; } /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ -unsigned char * -bind_textdomain_codeset__(const unsigned char *domainname, const unsigned char *codeset) +char * +bind_textdomain_codeset__(const char *domainname, const char *codeset) { set_binding_values(domainname, NULL, &codeset); - return (unsigned char *) codeset; + return (char *) codeset; } diff --git a/src/intl/gettext/dcgettext.c b/src/intl/gettext/dcgettext.c index 2b4d50d6..30e39a7a 100644 --- a/src/intl/gettext/dcgettext.c +++ b/src/intl/gettext/dcgettext.c @@ -26,8 +26,8 @@ /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ -unsigned char * -dcgettext__(const unsigned char *domainname, const unsigned char *msgid, int category) +char * +dcgettext__(const char *domainname, const char *msgid, int category) { return dcigettext__(domainname, msgid, NULL, 0, 0, category); } diff --git a/src/intl/gettext/dcigettext.c b/src/intl/gettext/dcigettext.c index a683b628..8d0d0056 100644 --- a/src/intl/gettext/dcigettext.c +++ b/src/intl/gettext/dcigettext.c @@ -132,7 +132,7 @@ extern int errno; are stored. */ struct known_translation_t { /* Domain in which to search. */ - unsigned char *domainname; + char *domainname; /* The category. */ int category; @@ -144,11 +144,11 @@ struct known_translation_t { struct loaded_l10nfile *domain; /* And finally the translation. */ - const unsigned char *translation; + const char *translation; size_t translation_length; /* Pointer to the string in question. */ - unsigned char msgid[1]; + char msgid[1]; }; /* Root of the search tree with known translations. We can use this @@ -190,34 +190,34 @@ transcmp(const void *p1, const void *p2) textdomain(3). The default value for this is "messages". */ const char _AAA_nl_default_default_domain__[] = "messages"; -const unsigned char *_nl_default_default_domain__ = (const unsigned char *)_AAA_nl_default_default_domain__; +const char *_nl_default_default_domain__ = (const char *)_AAA_nl_default_default_domain__; /* Value used as the default domain for gettext(3). */ -const unsigned char *_nl_current_default_domain__ = (const unsigned char *)_AAA_nl_default_default_domain__; +const char *_nl_current_default_domain__ = (const char *)_AAA_nl_default_default_domain__; /* Contains the default location of the message catalogs. */ const char _AAA_nl_default_dirname__[] = LOCALEDIR; -const unsigned char *_nl_default_dirname__ = (const unsigned char *)_AAA_nl_default_dirname__; +const char *_nl_default_dirname__ = (const char *)_AAA_nl_default_dirname__; /* Contains application-specific LANGUAGE variation, taking precedence to the * $LANGUAGE environment variable. */ -unsigned char *LANGUAGE = NULL; +char *LANGUAGE = NULL; /* List with bindings of specific domains created by bindtextdomain() calls. */ struct binding *_nl_domain_bindings__; /* Prototypes for local functions. */ -static unsigned char *plural_lookup(struct loaded_l10nfile * domain, +static char *plural_lookup(struct loaded_l10nfile * domain, unsigned long int n, - const unsigned char *translation, + const char *translation, size_t translation_len); static unsigned long int plural_eval(struct expression * pexp, unsigned long int n); -static const unsigned char *category_to_name(int category); -static const unsigned char *guess_category_value(int category, - const unsigned char *categoryname); +static const char *category_to_name(int category); +static const char *guess_category_value(int category, + const char *categoryname); /* For those loosing systems which don't have `alloca' we have to add some additional code emulating it. */ @@ -254,7 +254,7 @@ struct block_list { #define alloca(size) (malloc (size)) #endif /* have alloca */ -typedef unsigned char transmem_block_t; +typedef char transmem_block_t; /* Checking whether the binaries runs SUID must be done and glibc provides easier methods therefore we make a difference here. */ @@ -289,8 +289,8 @@ static int enable_secure; /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale and, if PLURAL is nonzero, search over string depending on the plural form determined by N. */ -unsigned char * -dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const unsigned char *msgid2, +char * +dcigettext__(const char *domainname, const char *msgid1, const char *msgid2, int plural, unsigned long int n, int category) { #ifndef HAVE_ALLOCA @@ -298,11 +298,11 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const #endif struct loaded_l10nfile *domain; struct binding *binding; - const unsigned char *categoryname; - const unsigned char *categoryvalue; - unsigned char *dirname, *xdomainname; - unsigned char *single_locale; - unsigned char *retval; + const char *categoryname; + const char *categoryvalue; + char *dirname, *xdomainname; + char *single_locale; + char *retval; size_t retlen; int saved_errno; @@ -332,7 +332,7 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const alloca(offsetof(struct known_translation_t, msgid) + msgid_len); memcpy(search->msgid, msgid1, msgid_len); - search->domainname = (unsigned char *) domainname; + search->domainname = (char *) domainname; search->category = category; foundp = (struct known_translation_t **) tfind(search, &root, transcmp); @@ -343,7 +343,7 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const (*foundp)->translation, (*foundp)->translation_length); else - retval = (unsigned char *) (*foundp)->translation; + retval = (char *) (*foundp)->translation; return retval; } @@ -371,20 +371,20 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const } if (binding == NULL) - dirname = (unsigned char *) _nl_default_dirname__; + dirname = (char *) _nl_default_dirname__; else if (IS_ABSOLUTE_PATH(binding->dirname)) dirname = binding->dirname; else { /* We have a relative path. Make it absolute now. */ size_t dirname_len = strlen(binding->dirname) + 1; size_t path_max; - unsigned char *ret; + char *ret; path_max = (unsigned int) PATH_MAX; path_max += 2; /* The getcwd docs say to do this. */ for (;;) { - dirname = (unsigned char *) alloca(path_max + dirname_len); + dirname = (char *) alloca(path_max + dirname_len); ADD_BLOCK(block_list, dirname); errno = 0; @@ -401,9 +401,9 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const error but simply return the default string. */ FREE_BLOCKS(block_list); errno = saved_errno; - return (plural == 0 ? (unsigned char *) msgid1 + return (plural == 0 ? (char *) msgid1 /* Use the Germanic plural rule. */ - : n == 1 ? (unsigned char *) msgid1 : (unsigned char *) msgid2); + : n == 1 ? (char *) msgid1 : (char *) msgid2); } stpcpy(stpcpy(strchr((const char *)dirname, '\0'), "/"), binding->dirname); @@ -414,7 +414,7 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const categoryvalue = guess_category_value(category, categoryname); domainname_len = strlen(domainname); - xdomainname = (unsigned char *) alloca(strlen(categoryname) + xdomainname = (char *) alloca(strlen(categoryname) + domainname_len + 5); ADD_BLOCK(block_list, xdomainname); @@ -422,7 +422,7 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const domainname, domainname_len), ".mo"); /* Creating working area. */ - single_locale = (unsigned char *) alloca(strlen(categoryvalue) + 1); + single_locale = (char *) alloca(strlen(categoryvalue) + 1); ADD_BLOCK(block_list, single_locale); /* Search for the given string. This is a loop because we perhaps @@ -439,7 +439,7 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const single_locale[0] = 'C'; single_locale[1] = '\0'; } else { - unsigned char *cp = single_locale; + char *cp = single_locale; while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') @@ -459,9 +459,9 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const || strcmp(single_locale, "POSIX") == 0) { FREE_BLOCKS(block_list); errno = saved_errno; - return (plural == 0 ? (unsigned char *) msgid1 + return (plural == 0 ? (char *) msgid1 /* Use the Germanic plural rule. */ - : n == 1 ? (unsigned char *) msgid1 : (unsigned char *) msgid2); + : n == 1 ? (char *) msgid1 : (char *) msgid2); } /* Find structure describing the message catalog matching the @@ -553,14 +553,14 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const /* NOTREACHED */ } -unsigned char * +char * _nl_find_msg(struct loaded_l10nfile *domain_file, struct binding *domainbinding, - const unsigned char *msgid, size_t *lengthp) + const char *msgid, size_t *lengthp) { struct loaded_domain *domain; size_t act; - unsigned char *result; + char *result; size_t resultlen; if (domain_file->decided == 0) @@ -639,7 +639,7 @@ _nl_find_msg(struct loaded_l10nfile *domain_file, found: /* The translation was found at index ACT. If we have to convert the string to use a different character set, this is the time. */ - result = ((unsigned char *) domain->data + result = ((char *) domain->data + W(domain->must_swap, domain->trans_tab[act].offset)); resultlen = W(domain->must_swap, domain->trans_tab[act].length) + 1; @@ -664,13 +664,13 @@ found: NULs. */ if (domain->conv_tab == NULL - && ((domain->conv_tab = (unsigned char **) calloc(domain->nstrings, - sizeof(unsigned char *))) + && ((domain->conv_tab = (char **) calloc(domain->nstrings, + sizeof(char *))) == NULL)) /* Mark that we didn't succeed allocating a table. */ - domain->conv_tab = (unsigned char **) -1; + domain->conv_tab = (char **) -1; - if (domain->conv_tab == (unsigned char **) -1) + if (domain->conv_tab == (char **) -1) /* Nothing we can do, no more memory. */ goto converted; @@ -681,15 +681,15 @@ found: We allocate always larger blocks which get used over time. This is faster than many small allocations. */ #define INITIAL_BLOCK_SIZE 4080 - static unsigned char *freemem; + static char *freemem; static size_t freemem_size; - const unsigned char *inbuf; - unsigned char *outbuf; + const char *inbuf; + char *outbuf; int malloc_count; transmem_block_t *transmem_list = NULL; - inbuf = (const unsigned char *) result; + inbuf = (const char *) result; outbuf = freemem + sizeof(size_t); malloc_count = 0; @@ -697,7 +697,7 @@ found: transmem_block_t *newmem; ICONV_CONST char *inptr = (ICONV_CONST char *) inbuf; size_t inleft = resultlen; - char *outptr = (unsigned char *) outbuf; + char *outptr = (char *) outbuf; size_t outleft; if (freemem_size < sizeof(size_t)) @@ -707,7 +707,7 @@ found: if (iconv(domain->conv, &inptr, &inleft, &outptr, &outleft) != (size_t) (-1)) { - outbuf = (unsigned char *) outptr; + outbuf = (char *) outptr; break; } if (errno != E2BIG) { @@ -743,7 +743,7 @@ resize_freemem: /* We have now in our buffer a converted string. Put this into the table of conversions. */ *(size_t *) freemem = outbuf - freemem - sizeof(size_t); - domain->conv_tab[act] = (unsigned char *) freemem; + domain->conv_tab[act] = (char *) freemem; /* Shrink freemem, but keep it aligned. */ freemem_size -= outbuf - freemem; freemem = outbuf; @@ -768,14 +768,14 @@ converted: } /* Look up a plural variant. */ -static unsigned char * +static char * plural_lookup(struct loaded_l10nfile *domain, unsigned long int n, - const unsigned char *translation, size_t translation_len) + const char *translation, size_t translation_len) { struct loaded_domain *domaindata = (struct loaded_domain *) domain->data; unsigned long int indexx; - const unsigned char *p; + const char *p; indexx = plural_eval(domaindata->plural, n); if (indexx >= domaindata->nplurals) @@ -795,9 +795,9 @@ plural_lookup(struct loaded_l10nfile *domain, unsigned long int n, /* This should never happen. It means the plural expression evaluated to a value larger than the number of variants available for MSGID1. */ - return (unsigned char *) translation; + return (char *) translation; } - return (unsigned char *) p; + return (char *) p; } /* Function to evaluate the plural expression and return an index value. */ @@ -895,10 +895,10 @@ default: } /* Return string representation of locale CATEGORY. */ -static const unsigned char * +static const char * category_to_name(int category) { - const unsigned char *retval; + const char *retval; switch (category) { #ifdef LC_COLLATE @@ -952,11 +952,11 @@ default: } /* Guess value of current locale from value of the environment variables. */ -static const unsigned char * -guess_category_value(int category, const unsigned char *categoryname) +static const char * +guess_category_value(int category, const char *categoryname) { - const unsigned char *language; - const unsigned char *retval; + const char *language; + const char *retval; /* Takes precedence to anything else, damn it's what the application wants! * ;-) --pasky */ diff --git a/src/intl/gettext/dcngettext.c b/src/intl/gettext/dcngettext.c index 90a3134d..d41b838f 100644 --- a/src/intl/gettext/dcngettext.c +++ b/src/intl/gettext/dcngettext.c @@ -26,8 +26,8 @@ /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ -unsigned char * -dcngettext__(const unsigned char *domainname, const unsigned char *msgid1, const unsigned char *msgid2, +char * +dcngettext__(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category) { return dcigettext__(domainname, msgid1, msgid2, 1, n, category); diff --git a/src/intl/gettext/dgettext.c b/src/intl/gettext/dgettext.c index e00ccbd9..862dffb1 100644 --- a/src/intl/gettext/dgettext.c +++ b/src/intl/gettext/dgettext.c @@ -27,8 +27,8 @@ /* Look up MSGID in the DOMAINNAME message catalog of the current LC_MESSAGES locale. */ -unsigned char * -dgettext__(const unsigned char *domainname, const unsigned char *msgid) +char * +dgettext__(const char *domainname, const char *msgid) { return dcgettext__(domainname, msgid, LC_MESSAGES); } diff --git a/src/intl/gettext/dngettext.c b/src/intl/gettext/dngettext.c index 303a0238..6f7a091c 100644 --- a/src/intl/gettext/dngettext.c +++ b/src/intl/gettext/dngettext.c @@ -26,9 +26,9 @@ /* Look up MSGID in the DOMAINNAME message catalog of the current LC_MESSAGES locale and skip message according to the plural form. */ -unsigned char * -dngettext__(const unsigned char *domainname, const unsigned char *msgid1, - const unsigned char *msgid2, unsigned long int n) +char * +dngettext__(const char *domainname, const char *msgid1, + const char *msgid2, unsigned long int n) { return dcngettext__(domainname, msgid1, msgid2, n, LC_MESSAGES); } diff --git a/src/intl/gettext/explodename.c b/src/intl/gettext/explodename.c index 2fcd6270..1bf8fd58 100644 --- a/src/intl/gettext/explodename.c +++ b/src/intl/gettext/explodename.c @@ -38,24 +38,24 @@ /* @@ end of prolog @@ */ -unsigned char * -_nl_find_language(const unsigned char *name) +char * +_nl_find_language(const char *name) { while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '+' && name[0] != ',') ++name; - return (unsigned char *) name; + return (char *) name; } int -_nl_explode_name(unsigned char *name, const unsigned char **language, const unsigned char **modifier, - const unsigned char **territory, const unsigned char **codeset, - const unsigned char **normalized_codeset, const unsigned char **special, - const unsigned char **sponsor, const unsigned char **revision) +_nl_explode_name(char *name, const char **language, const char **modifier, + const char **territory, const char **codeset, + const char **normalized_codeset, const char **special, + const char **sponsor, const char **revision) { enum { undecided, xpg, cen } syntax; - unsigned char *cp; + char *cp; int mask; *modifier = NULL; @@ -105,7 +105,7 @@ _nl_explode_name(unsigned char *name, const unsigned char **language, const unsi _nl_normalize_codeset(*codeset, cp - *codeset); if (strcmp(*codeset, *normalized_codeset) == 0) - free((unsigned char *) *normalized_codeset); + free((char *) *normalized_codeset); else mask |= XPG_NORM_CODESET; } diff --git a/src/intl/gettext/finddomain.c b/src/intl/gettext/finddomain.c index cfd9d2cf..3de02a64 100644 --- a/src/intl/gettext/finddomain.c +++ b/src/intl/gettext/finddomain.c @@ -42,19 +42,19 @@ static struct loaded_l10nfile *_nl_loaded_domains; the DOMAINNAME and CATEGORY parameters with respect to the currently established bindings. */ struct loaded_l10nfile * -_nl_find_domain(const unsigned char *dirname, unsigned char *locale, const unsigned char *domainname, +_nl_find_domain(const char *dirname, char *locale, const char *domainname, struct binding *domainbinding) { struct loaded_l10nfile *retval; - const unsigned char *language; - const unsigned char *modifier; - const unsigned char *territory; - const unsigned char *codeset; - const unsigned char *normalized_codeset; - const unsigned char *special; - const unsigned char *sponsor; - const unsigned char *revision; - const unsigned char *alias_value; + const char *language; + const char *modifier; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *special; + const char *sponsor; + const char *revision; + const char *alias_value; int mask; /* LOCALE can consist of up to four recognized parts for the XPG syntax: diff --git a/src/intl/gettext/gettext.c b/src/intl/gettext/gettext.c index ae50f7b4..48daddd4 100644 --- a/src/intl/gettext/gettext.c +++ b/src/intl/gettext/gettext.c @@ -30,8 +30,8 @@ /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ -unsigned char * -gettext__(const unsigned char *msgid) +char * +gettext__(const char *msgid) { return dcgettext__(NULL, msgid, LC_MESSAGES); } diff --git a/src/intl/gettext/gettextP.h b/src/intl/gettext/gettextP.h index ee3f05fd..ba5cf98c 100644 --- a/src/intl/gettext/gettextP.h +++ b/src/intl/gettext/gettextP.h @@ -84,13 +84,13 @@ struct expression { /* This is the data structure to pass information to the parser and get the result in a thread-safe way. */ struct parse_args { - const unsigned char *cp; + const char *cp; struct expression *res; }; /* The representation of an opened message catalog. */ struct loaded_domain { - const unsigned char *data; + const char *data; int use_mmap; size_t mmap_size; int must_swap; @@ -103,7 +103,7 @@ struct loaded_domain { #if HAVE_ICONV iconv_t conv; #endif - unsigned char **conv_tab; + char **conv_tab; struct expression *plural; unsigned long int nplurals; @@ -113,57 +113,57 @@ struct loaded_domain { from bindtextdomain() and bind_textdomain_codeset(). */ struct binding { struct binding *next; - unsigned char *dirname; + char *dirname; int codeset_cntr; /* Incremented each time codeset changes. */ - unsigned char *codeset; - unsigned char domainname[1]; + char *codeset; + char domainname[1]; }; -extern unsigned char *LANGUAGE; +extern char *LANGUAGE; /* A counter which is incremented each time some previous translations become invalid. This variable is part of the external ABI of the GNU libintl. */ extern int _nl_msg_cat_cntr; -struct loaded_l10nfile *_nl_find_domain(const unsigned char *__dirname, - unsigned char *__locale, - const unsigned char *__domainname, +struct loaded_l10nfile *_nl_find_domain(const char *__dirname, + char *__locale, + const char *__domainname, struct binding * __domainbinding); void _nl_load_domain(struct loaded_l10nfile * __domain, struct binding * __domainbinding); void _nl_unload_domain(struct loaded_domain * __domain); -const unsigned char *_nl_init_domain_conv(struct loaded_l10nfile * __domain_file, +const char *_nl_init_domain_conv(struct loaded_l10nfile * __domain_file, struct loaded_domain * __domain, struct binding * __domainbinding); void _nl_free_domain_conv(struct loaded_domain * __domain); -unsigned char *_nl_find_msg(struct loaded_l10nfile * domain_file, +char *_nl_find_msg(struct loaded_l10nfile * domain_file, struct binding * domainbinding, - const unsigned char *msgid, size_t * lengthp); + const char *msgid, size_t * lengthp); -extern unsigned char *gettext__(const unsigned char *__msgid); -extern unsigned char *dgettext__(const unsigned char *__domainname, const unsigned char *__msgid); -extern unsigned char *dcgettext__(const unsigned char *__domainname, - const unsigned char *__msgid, int __category); -extern unsigned char *ngettext__(const unsigned char *__msgid1, const unsigned char *__msgid2, +extern char *gettext__(const char *__msgid); +extern char *dgettext__(const char *__domainname, const char *__msgid); +extern char *dcgettext__(const char *__domainname, + const char *__msgid, int __category); +extern char *ngettext__(const char *__msgid1, const char *__msgid2, unsigned long int __n); -extern unsigned char *dngettext__(const unsigned char *__domainname, - const unsigned char *__msgid1, const unsigned char *__msgid2, +extern char *dngettext__(const char *__domainname, + const char *__msgid1, const char *__msgid2, unsigned long int __n); -extern unsigned char *dcngettext__(const unsigned char *__domainname, - const unsigned char *__msgid1, const unsigned char *__msgid2, +extern char *dcngettext__(const char *__domainname, + const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category); -extern unsigned char *dcigettext__(const unsigned char *__domainname, - const unsigned char *__msgid1, const unsigned char *__msgid2, +extern char *dcigettext__(const char *__domainname, + const char *__msgid1, const char *__msgid2, int __plural, unsigned long int __n, int __category); -extern unsigned char *textdomain__(const unsigned char *__domainname); -extern unsigned char *bindtextdomain__(const unsigned char *__domainname, - const unsigned char *__dirname); -extern unsigned char *bind_textdomain_codeset__(const unsigned char *__domainname, - const unsigned char *__codeset); +extern char *textdomain__(const char *__domainname); +extern char *bindtextdomain__(const char *__domainname, + const char *__dirname); +extern char *bind_textdomain_codeset__(const char *__domainname, + const char *__codeset); extern void gettext_free_exp__(struct expression * exp); extern int gettext__parse(struct parse_args *arg); diff --git a/src/intl/gettext/hash-string.h b/src/intl/gettext/hash-string.h index c386c27b..2119b6a1 100644 --- a/src/intl/gettext/hash-string.h +++ b/src/intl/gettext/hash-string.h @@ -21,13 +21,13 @@ /* Defines the so called `hashpjw' function by P.J. Weinberger [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, 1986, 1987 Bell Telephone Laboratories, Inc.] */ -static unsigned long int hash_string(const unsigned char *__str_param); +static unsigned long int hash_string(const char *__str_param); static inline unsigned long int -hash_string(const unsigned char *str_param) +hash_string(const char *str_param) { unsigned long int hval, g; - const unsigned char *str = str_param; + const char *str = str_param; /* Compute the hash value for the given string. */ hval = 0; diff --git a/src/intl/gettext/intl-compat.c b/src/intl/gettext/intl-compat.c index 55e941c6..7482f47a 100644 --- a/src/intl/gettext/intl-compat.c +++ b/src/intl/gettext/intl-compat.c @@ -77,58 +77,58 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef bindtextdomain #undef bind_textdomain_codeset -unsigned char * -gettext(const unsigned char *msgid) +char * +gettext(const char *msgid) { return gettext__(msgid); } -unsigned char * -dgettext(const unsigned char *domainname, const unsigned char *msgid) +char * +dgettext(const char *domainname, const char *msgid) { return dgettext__(domainname, msgid); } -unsigned char * -dcgettext(const unsigned char *domainname, const unsigned char *msgid, int category) +char * +dcgettext(const char *domainname, const char *msgid, int category) { return dcgettext__(domainname, msgid, category); } -unsigned char * -ngettext(const unsigned char *msgid1, const unsigned char *msgid2, unsigned long int n) +char * +ngettext(const char *msgid1, const char *msgid2, unsigned long int n) { return ngettext__(msgid1, msgid2, n); } -unsigned char * -dngettext(const unsigned char *domainname, const unsigned char *msgid1, const unsigned char *msgid2, +char * +dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n) { return dngettext__(domainname, msgid1, msgid2, n); } -unsigned char * -dcngettext(const unsigned char *domainname, const unsigned char *msgid1, const unsigned char *msgid2, +char * +dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category) { return dcngettext__(domainname, msgid1, msgid2, n, category); } -unsigned char * -textdomain(const unsigned char *domainname) +char * +textdomain(const char *domainname) { return textdomain__(domainname); } -unsigned char * -bindtextdomain(const unsigned char *domainname, const unsigned char *dirname) +char * +bindtextdomain(const char *domainname, const char *dirname) { return bindtextdomain__(domainname, dirname); } -unsigned char * -bind_textdomain_codeset(const unsigned char *domainname, const unsigned char *codeset) +char * +bind_textdomain_codeset(const char *domainname, const char *codeset) { return bind_textdomain_codeset__(domainname, codeset); } diff --git a/src/intl/gettext/l10nflist.c b/src/intl/gettext/l10nflist.c index 50ef0be5..3a218934 100644 --- a/src/intl/gettext/l10nflist.c +++ b/src/intl/gettext/l10nflist.c @@ -67,10 +67,10 @@ #if !defined HAVE___ARGZ_COUNT /* Returns the number of strings in ARGZ. */ -static size_t argz_count__(const unsigned char *argz, size_t len); +static size_t argz_count__(const char *argz, size_t len); static size_t -argz_count__(const unsigned char *argz, size_t len) +argz_count__(const char *argz, size_t len) { size_t count = 0; @@ -91,10 +91,10 @@ argz_count__(const unsigned char *argz, size_t len) #if !defined HAVE___ARGZ_STRINGIFY /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's except the last into the character SEP. */ -static void argz_stringify__(unsigned char *argz, size_t len, int sep); +static void argz_stringify__(char *argz, size_t len, int sep); static void -argz_stringify__(unsigned char *argz, size_t len, int sep) +argz_stringify__(char *argz, size_t len, int sep) { while (len > 0) { size_t part_len = strlen(argz); @@ -111,17 +111,17 @@ argz_stringify__(unsigned char *argz, size_t len, int sep) #endif /* !HAVE___ARGZ_STRINGIFY */ #if !defined HAVE___ARGZ_NEXT -static unsigned char *argz_next__(unsigned char *argz, size_t argz_len, - const unsigned char *entry); +static char *argz_next__(char *argz, size_t argz_len, + const char *entry); -static unsigned char * -argz_next__(unsigned char *argz, size_t argz_len, const unsigned char *entry) +static char * +argz_next__(char *argz, size_t argz_len, const char *entry) { if (entry) { if (entry < argz + argz_len) entry = strchr((const char *)entry, '\0') + 1; - return entry >= argz + argz_len ? NULL : (unsigned char *) entry; + return entry >= argz + argz_len ? NULL : (char *) entry; } else if (argz_len > 0) return argz; else @@ -147,30 +147,30 @@ pop(int x) struct loaded_l10nfile * _nl_make_l10nflist(struct loaded_l10nfile **l10nfile_list, - const unsigned char *dirlist, + const char *dirlist, size_t dirlist_len, int mask, - const unsigned char *language, - const unsigned char *territory, - const unsigned char *codeset, - const unsigned char *normalized_codeset, - const unsigned char *modifier, - const unsigned char *special, - const unsigned char *sponsor, - const unsigned char *revision, - const unsigned char *filename, + const char *language, + const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, + const char *special, + const char *sponsor, + const char *revision, + const char *filename, int do_allocate) { - unsigned char *abs_filename, *abs_langdirname; + char *abs_filename, *abs_langdirname; int abs_langdirnamelen; struct loaded_l10nfile *last = NULL; struct loaded_l10nfile *retval; - unsigned char *cp; + char *cp; size_t entries; int cnt; /* Allocate room for the full file name. */ - abs_filename = (unsigned char *) malloc(dirlist_len + strlen(language) + abs_filename = (char *) malloc(dirlist_len + strlen(language) + ((mask & TERRITORY) != 0 ? strlen(territory) + 1 : 0) + ((mask & XPG_CODESET) != 0 @@ -299,10 +299,10 @@ _nl_make_l10nflist(struct loaded_l10nfile **l10nfile_list, && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) { /* Iterate over all elements of the DIRLIST. */ - unsigned char *dir = NULL; + char *dir = NULL; while ((dir = - __argz_next((unsigned char *) dirlist, dirlist_len, dir)) + __argz_next((char *) dirlist, dirlist_len, dir)) != NULL) retval->successor[entries++] = _nl_make_l10nflist(l10nfile_list, dir, @@ -323,13 +323,13 @@ _nl_make_l10nflist(struct loaded_l10nfile **l10nfile_list, names. Normalization allows the user to use any of the common names. The return value is dynamically allocated and has to be freed by the caller. */ -const unsigned char * -_nl_normalize_codeset(const unsigned char *codeset, size_t name_len) +const char * +_nl_normalize_codeset(const char *codeset, size_t name_len) { int len = 0; int only_digit = 1; - unsigned char *retval; - unsigned char *wp; + char *retval; + char *wp; size_t cnt; for (cnt = 0; cnt < name_len; ++cnt) @@ -340,7 +340,7 @@ _nl_normalize_codeset(const unsigned char *codeset, size_t name_len) only_digit = 0; } - retval = (unsigned char *) malloc((only_digit ? 3 : 0) + len + 1); + retval = (char *) malloc((only_digit ? 3 : 0) + len + 1); if (retval != NULL) { if (only_digit) @@ -357,5 +357,5 @@ _nl_normalize_codeset(const unsigned char *codeset, size_t name_len) *wp = '\0'; } - return (const unsigned char *) retval; + return (const char *) retval; } diff --git a/src/intl/gettext/libgettext.h b/src/intl/gettext/libgettext.h index 630dc4b1..89b8c9e0 100644 --- a/src/intl/gettext/libgettext.h +++ b/src/intl/gettext/libgettext.h @@ -34,14 +34,14 @@ extern "C" { #define dgettext(Domainname, Msgid) (Msgid) #define dcgettext(Domainname, Msgid, Category) (Msgid) #define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (unsigned char *) (Msgid1) : (unsigned char *) (Msgid2)) + ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) #define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (unsigned char *) (Msgid1) : (unsigned char *) (Msgid2)) + ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) #define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (unsigned char *) (Msgid1) : (unsigned char *) (Msgid2)) -#define textdomain(Domainname) ((unsigned char *) (Domainname)) -#define bindtextdomain(Domainname, Dirname) ((unsigned char *) (Dirname)) -#define bind_textdomain_codeset(Domainname, Codeset) ((unsigned char *) (Codeset)) + ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) +#define textdomain(Domainname) ((char *) (Domainname)) +#define bindtextdomain(Domainname, Dirname) ((char *) (Dirname)) +#define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset)) #endif diff --git a/src/intl/gettext/libgnuintl.h b/src/intl/gettext/libgnuintl.h index cf3ae49f..9a8c23cd 100644 --- a/src/intl/gettext/libgnuintl.h +++ b/src/intl/gettext/libgnuintl.h @@ -47,47 +47,47 @@ extern "C" { /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ - extern unsigned char *gettext(const unsigned char *__msgid); + extern char *gettext(const char *__msgid); /* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ - extern unsigned char *dgettext(const unsigned char *__domainname, const unsigned char *__msgid); + extern char *dgettext(const char *__domainname, const char *__msgid); /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ - extern unsigned char *dcgettext(const unsigned char *__domainname, const unsigned char *__msgid, + extern char *dcgettext(const char *__domainname, const char *__msgid, int __category); /* Similar to `gettext' but select the plural form corresponding to the number N. */ - extern unsigned char *ngettext(const unsigned char *__msgid1, const unsigned char *__msgid2, + extern char *ngettext(const char *__msgid1, const char *__msgid2, unsigned long int __n); /* Similar to `dgettext' but select the plural form corresponding to the number N. */ - extern unsigned char *dngettext(const unsigned char *__domainname, const unsigned char *__msgid1, - const unsigned char *__msgid2, unsigned long int __n); + extern char *dngettext(const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n); /* Similar to `dcgettext' but select the plural form corresponding to the number N. */ - extern unsigned char *dcngettext(const unsigned char *__domainname, const unsigned char *__msgid1, - const unsigned char *__msgid2, unsigned long int __n, + extern char *dcngettext(const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n, int __category); /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ - extern unsigned char *textdomain(const unsigned char *__domainname); + extern char *textdomain(const char *__domainname); /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ - extern unsigned char *bindtextdomain(const unsigned char *__domainname, - const unsigned char *__dirname); + extern char *bindtextdomain(const char *__domainname, + const char *__dirname); /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ - extern unsigned char *bind_textdomain_codeset(const unsigned char *__domainname, - const unsigned char *__codeset); + extern char *bind_textdomain_codeset(const char *__domainname, + const char *__codeset); /* Optimized version of the functions above. */ #if defined __OPTIMIZED diff --git a/src/intl/gettext/libintl.c b/src/intl/gettext/libintl.c index 1faa7d94..03ac2f76 100644 --- a/src/intl/gettext/libintl.c +++ b/src/intl/gettext/libintl.c @@ -71,10 +71,10 @@ struct language languages[] = { * other side, it's ISO639 for gettext as well etc. So what? --pasky */ int -iso639_to_language(unsigned char *iso639) +iso639_to_language(char *iso639) { - unsigned char *l = stracpy(iso639); - unsigned char *p; + char *l = stracpy(iso639); + char *p; int i, ll; if (!l) @@ -133,7 +133,7 @@ iso639_to_language(unsigned char *iso639) int system_language = 0; -unsigned char * +char * language_to_iso639(int language) { /* Language is "system", we need to extract the index from @@ -148,7 +148,7 @@ language_to_iso639(int language) } int -name_to_language(const unsigned char *name) +name_to_language(const char *name) { int i; @@ -160,7 +160,7 @@ name_to_language(const unsigned char *name) return 1; } -unsigned char * +char * language_to_name(int language) { return languages[language].name; @@ -169,7 +169,7 @@ language_to_name(int language) int get_system_language_index(void) { - unsigned char *l; + char *l; /* At this point current_language must be "system" yet. */ l = getenv("LANGUAGE"); @@ -188,7 +188,7 @@ int current_language = 0; void set_language(int language) { - unsigned char *p; + char *p; if (!system_language) system_language = get_system_language_index(); diff --git a/src/intl/gettext/libintl.h b/src/intl/gettext/libintl.h index 0a3f00e8..35bae0ab 100644 --- a/src/intl/gettext/libintl.h +++ b/src/intl/gettext/libintl.h @@ -37,14 +37,14 @@ extern "C" { /* In order to make it able to compile using -Werror this has to be a function * so that local @term variables will not be reported as unused. */ -static inline unsigned char * -_(unsigned char *msg, struct terminal *term) +static inline char * +_(char *msg, struct terminal *term) { return gettext_noop(msg); } -static inline unsigned char * -n_(unsigned char *msg1, unsigned char *msg2, unsigned long int n, struct terminal *term) +static inline char * +n_(char *msg1, char *msg2, unsigned long int n, struct terminal *term) { return gettext_noop(msg1); } @@ -94,8 +94,8 @@ intl_set_charset(struct terminal *term) /* Wraps around gettext(), employing charset multiplexing. If you don't care * about charset (usually during initialization or when you don't use terminals * at all), use gettext() directly. */ -static inline unsigned char * -_(unsigned char *msg, struct terminal *term) +static inline char * +_(char *msg, struct terminal *term) { /* Prevent useless (and possibly dangerous) calls. */ if (!msg || !*msg) @@ -103,7 +103,7 @@ _(unsigned char *msg, struct terminal *term) if (term) intl_set_charset(term); - return (unsigned char *) gettext(msg); + return (char *) gettext(msg); } #else @@ -119,15 +119,15 @@ _(unsigned char *msg, struct terminal *term) #define _(m, t) __(__FILE__, __LINE__, __FUNCTION__, m, t) /* Overflows are theorically possible here. Debug purpose only. */ -static inline unsigned char * -__(unsigned char *file, unsigned int line, unsigned char *func, - unsigned char *msg, struct terminal *term) +static inline char * +__(char *file, unsigned int line, char *func, + char *msg, struct terminal *term) { - static unsigned char last_file[512] = ""; + static char last_file[512] = ""; static unsigned int last_line = 0; - static unsigned char last_func[1024] = ""; - static unsigned char last_result[16384] = ""; - unsigned char *result; + static char last_func[1024] = ""; + static char last_result[16384] = ""; + char *result; /* Prevent useless (and possibly dangerous) calls. */ if (!msg || !*msg) { @@ -137,7 +137,7 @@ __(unsigned char *file, unsigned int line, unsigned char *func, if (term) intl_set_charset(term); - result = (unsigned char *) gettext(msg); + result = (char *) gettext(msg); if (!strcmp(result, last_result) && !strcmp(file, last_file) @@ -161,8 +161,8 @@ __(unsigned char *file, unsigned int line, unsigned char *func, /* Wraps around ngettext(), employing charset multiplexing. If you don't care * about charset (usually during initialization or when you don't use terminals * at all), use ngettext() directly. */ -static inline unsigned char * -n_(unsigned char *msg1, unsigned char *msg2, unsigned long int n, struct terminal *term) +static inline char * +n_(char *msg1, char *msg2, unsigned long int n, struct terminal *term) { /* Prevent useless (and possibly dangerous) calls. */ if (!msg1 || !*msg1) @@ -170,25 +170,25 @@ n_(unsigned char *msg1, unsigned char *msg2, unsigned long int n, struct termina if (term) intl_set_charset(term); - return (unsigned char *) ngettext(msg1, msg2, n); + return (char *) ngettext(msg1, msg2, n); } /* Languages table lookups. */ struct language { - unsigned char *name; - unsigned char *iso639; + char *name; + char *iso639; }; extern struct language languages[]; /* These two calls return 1 (english) if the code/name wasn't found. */ -extern int name_to_language(const unsigned char *name); -extern int iso639_to_language(unsigned char *iso639); +extern int name_to_language(const char *name); +extern int iso639_to_language(char *iso639); -extern unsigned char *language_to_name(int language); -extern unsigned char *language_to_iso639(int language); +extern char *language_to_name(int language); +extern char *language_to_iso639(int language); extern int get_system_language_index(void); diff --git a/src/intl/gettext/loadinfo.h b/src/intl/gettext/loadinfo.h index d9d6ab81..52913970 100644 --- a/src/intl/gettext/loadinfo.h +++ b/src/intl/gettext/loadinfo.h @@ -46,8 +46,8 @@ extern "C" { #define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) struct loaded_l10nfile { - const unsigned char *filename; - const unsigned char *langdirname; + const char *filename; + const char *langdirname; int langdirnamelen; int decided; @@ -62,31 +62,31 @@ struct loaded_l10nfile { names. Normalization allows the user to use any of the common names. The return value is dynamically allocated and has to be freed by the caller. */ -extern const unsigned char *_nl_normalize_codeset(const unsigned char *codeset, +extern const char *_nl_normalize_codeset(const char *codeset, size_t name_len); extern struct loaded_l10nfile *_nl_make_l10nflist( - struct loaded_l10nfile ** l10nfile_list, const unsigned char *dirlist, - size_t dirlist_len, int mask, const unsigned char *language, - const unsigned char *territory, const unsigned char *codeset, - const unsigned char *normalized_codeset, const unsigned char *modifier, - const unsigned char *special, const unsigned char *sponsor, const unsigned char *revision, - const unsigned char *filename, int do_allocate); + struct loaded_l10nfile ** l10nfile_list, const char *dirlist, + size_t dirlist_len, int mask, const char *language, + const char *territory, const char *codeset, + const char *normalized_codeset, const char *modifier, + const char *special, const char *sponsor, const char *revision, + const char *filename, int do_allocate); -extern const unsigned char *_nl_expand_alias(const unsigned char *name); +extern const char *_nl_expand_alias(const char *name); /* normalized_codeset is dynamically allocated and has to be freed by the caller. */ -extern int _nl_explode_name(unsigned char *name, const unsigned char **language, - const unsigned char **modifier, - const unsigned char **territory, - const unsigned char **codeset, - const unsigned char **normalized_codeset, - const unsigned char **special, - const unsigned char **sponsor, - const unsigned char **revision); +extern int _nl_explode_name(char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision); -extern unsigned char *_nl_find_language(const unsigned char *name); +extern char *_nl_find_language(const char *name); #ifdef __cplusplus } diff --git a/src/intl/gettext/loadmsgcat.c b/src/intl/gettext/loadmsgcat.c index 3ad37cff..c2863189 100644 --- a/src/intl/gettext/loadmsgcat.c +++ b/src/intl/gettext/loadmsgcat.c @@ -115,7 +115,7 @@ init_germanic_plural(void) /* Initialize the codeset dependent parts of an opened message catalog. Return the header entry. */ -const unsigned char * +const char * _nl_init_domain_conv(struct loaded_l10nfile *domain_file, struct loaded_domain *domain, struct binding *domainbinding) @@ -125,7 +125,7 @@ _nl_init_domain_conv(struct loaded_l10nfile *domain_file, entry does not exist or if this does not contain the `charset=' information, we will assume the charset matches the one the current locale and we don't have to perform any conversion. */ - unsigned char *nullentry; + char *nullentry; size_t nullentrylen; /* Preinitialize fields, to avoid recursion during _nl_find_msg. */ @@ -141,19 +141,19 @@ _nl_init_domain_conv(struct loaded_l10nfile *domain_file, if (nullentry != NULL) { #if HAVE_ICONV - const unsigned char *charsetstr; + const char *charsetstr; charsetstr = strstr((const char *)nullentry, "charset="); if (charsetstr != NULL) { size_t len; - unsigned char *charset; - const unsigned char *outcharset; + char *charset; + const char *outcharset; charsetstr += strlen("charset="); len = strcspn(charsetstr, " \t\n"); - charset = (unsigned char *) fmem_alloc(len + 1); - *((unsigned char *) mempcpy(charset, charsetstr, len)) = '\0'; + charset = (char *) fmem_alloc(len + 1); + *((char *) mempcpy(charset, charsetstr, len)) = '\0'; /* The output charset should normally be determined by the locale. But sometimes the locale is not used or not correctly @@ -166,7 +166,7 @@ _nl_init_domain_conv(struct loaded_l10nfile *domain_file, else { outcharset = getenv("OUTPUT_CHARSET"); if (outcharset == NULL || outcharset[0] == '\0') { - extern const unsigned char *elinks_locale_charset(void); + extern const char *elinks_locale_charset(void); outcharset = elinks_locale_charset(); } @@ -176,7 +176,7 @@ _nl_init_domain_conv(struct loaded_l10nfile *domain_file, #if _LIBICONV_VERSION >= 0x0105 len = strlen(outcharset); { - unsigned char *tmp = (unsigned char *) fmem_alloc(len + 10 + 1); + char *tmp = (char *) fmem_alloc(len + 10 + 1); memcpy(tmp, outcharset, len); memcpy(tmp + len, "//TRANSLIT", 10 + 1); @@ -200,7 +200,7 @@ _nl_init_domain_conv(struct loaded_l10nfile *domain_file, void _nl_free_domain_conv(struct loaded_domain *domain) { - if (domain->conv_tab != NULL && domain->conv_tab != (unsigned char **) -1) + if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1) free(domain->conv_tab); #if HAVE_ICONV if (domain->conv != (iconv_t) - 1) @@ -216,7 +216,7 @@ _nl_free_domain_conv(struct loaded_domain *domain) static struct string * add_filename_to_string(struct string *str, struct loaded_l10nfile *domain_file) { - unsigned char *slash = strrchr((const char *)program.path, '/'); + char *slash = strrchr((const char *)program.path, '/'); size_t dirnamelen = (slash ? slash - program.path + 1 : 0); /* Check if elinks is being run from the source tree. */ @@ -227,7 +227,7 @@ add_filename_to_string(struct string *str, struct loaded_l10nfile *domain_file) if ((dirnamelen && !add_bytes_to_string(str, program.path, dirnamelen)) || !add_to_string(str, "../po/") || !add_bytes_to_string(str, - (unsigned char *) domain_file->langdirname, + (char *) domain_file->langdirname, domain_file->langdirnamelen) || !add_to_string(str, ".gmo")) return NULL; @@ -247,7 +247,7 @@ _nl_load_domain(struct loaded_l10nfile *domain_file, struct mo_file_header *data = (struct mo_file_header *) -1; int use_mmap = 0; struct loaded_domain *domain; - const unsigned char *nullentry; + const char *nullentry; domain_file->decided = 1; domain_file->data = NULL; @@ -309,14 +309,14 @@ source_success: it manually. */ if (data == (struct mo_file_header *) -1) { size_t to_read; - unsigned char *read_ptr; + char *read_ptr; data = (struct mo_file_header *) malloc(size); if (data == NULL) return; to_read = size; - read_ptr = (unsigned char *) data; + read_ptr = (char *) data; do { ssize_t nb = safe_read(fd, read_ptr, to_read); @@ -349,7 +349,7 @@ source_success: return; domain_file->data = domain; - domain->data = (unsigned char *) data; + domain->data = (char *) data; domain->use_mmap = use_mmap; domain->mmap_size = size; domain->must_swap = data->magic != _MAGIC; @@ -359,15 +359,15 @@ source_success: case 0: domain->nstrings = W(domain->must_swap, data->nstrings); domain->orig_tab = (struct string_desc *) - ((unsigned char *) data + + ((char *) data + W(domain->must_swap, data->orig_tab_offset)); domain->trans_tab = (struct string_desc *) - ((unsigned char *) data + + ((char *) data + W(domain->must_swap, data->trans_tab_offset)); domain->hash_size = W(domain->must_swap, data->hash_tab_size); domain->hash_tab = (nls_uint32 *) - ((unsigned char *) data + + ((char *) data + W(domain->must_swap, data->hash_tab_offset)); break; default: @@ -390,8 +390,8 @@ default: /* Also look for a plural specification. */ if (nullentry != NULL) { - const unsigned char *plural; - const unsigned char *nplurals; + const char *plural; + const char *nplurals; plural = strstr((const char *)nullentry, "plural="); nplurals = strstr((const char *)nullentry, "nplurals="); @@ -399,14 +399,14 @@ default: goto no_plural; else { /* First get the number. */ - unsigned char *endp; + char *endp; unsigned long int n; struct parse_args args; nplurals += 9; skip_space(nplurals); - for (endp = (unsigned char *) nplurals, n = 0; + for (endp = (char *) nplurals, n = 0; isdigit(*endp); endp++) n = n * 10 + (*endp - '0'); diff --git a/src/intl/gettext/localcharset.c b/src/intl/gettext/localcharset.c index 207f3364..5dad1f0a 100644 --- a/src/intl/gettext/localcharset.c +++ b/src/intl/gettext/localcharset.c @@ -75,21 +75,21 @@ /* Pointer to the contents of the charset.alias file, if it has already been read, else NULL. Its format is: ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ -static const unsigned char *volatile charset_aliases; +static const char *volatile charset_aliases; /* Return a pointer to the contents of the charset.alias file. */ -static const unsigned char * +static const char * get_charset_aliases(void) { - const unsigned char *cp; + const char *cp; cp = charset_aliases; if (cp == NULL) { #ifndef WIN32 FILE *fp; - const unsigned char *dir = LIBDIR; - const unsigned char *base = "charset.alias"; - unsigned char *file_name; + const char *dir = LIBDIR; + const char *base = "charset.alias"; + char *file_name; /* Concatenate dir and base into freshly allocated file_name. */ { @@ -98,7 +98,7 @@ get_charset_aliases(void) int add_slash = (dir_len > 0 && !ISSLASH(dir[dir_len - 1])); file_name = - (unsigned char *) malloc(dir_len + add_slash + base_len + + (char *) malloc(dir_len + add_slash + base_len + 1); if (file_name != NULL) { memcpy(file_name, dir, dir_len); @@ -116,9 +116,9 @@ get_charset_aliases(void) else { /* Parse the file's contents. */ int c; - unsigned char buf1[50 + 1]; - unsigned char buf2[50 + 1]; - unsigned char *res_ptr = NULL; + char buf1[50 + 1]; + char buf2[50 + 1]; + char *res_ptr = NULL; size_t res_size = 0; size_t l1, l2; @@ -193,16 +193,16 @@ get_charset_aliases(void) name. */ /* Should be in .h file, used in _nl_init_domain_conv() function. */ -const unsigned char *elinks_locale_charset(void); +const char *elinks_locale_charset(void); #ifdef STATIC STATIC #endif -const unsigned char * +const char * elinks_locale_charset(void) { - const unsigned char *codeset; - const unsigned char *aliases; + const char *codeset; + const char *aliases; #ifndef WIN32 @@ -214,7 +214,7 @@ elinks_locale_charset(void) #else /* On old systems which lack it, use setlocale or getenv. */ - const unsigned char *locale = NULL; + const char *locale = NULL; /* But most old systems don't have a complete set of locales. Some (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't @@ -241,7 +241,7 @@ elinks_locale_charset(void) #else /* WIN32 */ - static unsigned char buf[2 + 10 + 1]; + static char buf[2 + 10 + 1]; /* Win32 has a function returning the locale's codepage as a number. */ sprintf(buf, "CP%u", GetACP()); diff --git a/src/intl/gettext/localealias.c b/src/intl/gettext/localealias.c index dcdeca21..141130aa 100644 --- a/src/intl/gettext/localealias.c +++ b/src/intl/gettext/localealias.c @@ -48,11 +48,11 @@ #endif struct alias_map { - const unsigned char *alias; - const unsigned char *value; + const char *alias; + const char *value; }; -static unsigned char *string_space; +static char *string_space; static size_t string_space_act; static size_t string_space_max; static struct alias_map *map; @@ -60,17 +60,17 @@ static size_t nmap; static size_t maxmap; /* Prototypes for local functions. */ -static size_t read_alias_file(const unsigned char *fname, int fname_len); +static size_t read_alias_file(const char *fname, int fname_len); static int extend_alias_table(void); static int alias_compare(const struct alias_map * map1, const struct alias_map * map2); -const unsigned char * -_nl_expand_alias(const unsigned char *name) +const char * +_nl_expand_alias(const char *name) { - static const unsigned char *locale_alias_path = LOCALEDIR; + static const char *locale_alias_path = LOCALEDIR; struct alias_map *retval; - const unsigned char *result = NULL; + const char *result = NULL; size_t added; do { @@ -98,7 +98,7 @@ _nl_expand_alias(const unsigned char *name) /* Perhaps we can find another alias file. */ added = 0; while (added == 0 && locale_alias_path[0] != '\0') { - const unsigned char *start; + const char *start; while (locale_alias_path[0] == PATH_SEPARATOR) ++locale_alias_path; @@ -120,14 +120,14 @@ _nl_expand_alias(const unsigned char *name) } static size_t -read_alias_file(const unsigned char *fname, int fname_len) +read_alias_file(const char *fname, int fname_len) { FILE *fp; - unsigned char *full_fname; + char *full_fname; size_t added; - static const unsigned char aliasfile[] = "/locale.alias"; + static const char aliasfile[] = "/locale.alias"; - full_fname = (unsigned char *) fmem_alloc(fname_len + sizeof(aliasfile)); + full_fname = (char *) fmem_alloc(fname_len + sizeof(aliasfile)); mempcpy(mempcpy(full_fname, fname, fname_len), aliasfile, sizeof(aliasfile)); @@ -143,10 +143,10 @@ read_alias_file(const unsigned char *fname, int fname_len) b) these fields must be usable as file names and so must not be that long */ - unsigned char buf[BUFSIZ]; - unsigned char *alias; - unsigned char *value; - unsigned char *cp; + char buf[BUFSIZ]; + char *alias; + char *value; + char *cp; if (fgets(buf, sizeof(buf), fp) == NULL) /* EOF reached. */ @@ -155,7 +155,7 @@ read_alias_file(const unsigned char *fname, int fname_len) /* Possibly not the whole line fits into the buffer. Ignore the rest of the line. */ if (strchr((const char *)buf, '\n') == NULL) { - unsigned char altbuf[BUFSIZ]; + char altbuf[BUFSIZ]; do if (fgets(altbuf, sizeof(altbuf), fp) == NULL) @@ -212,8 +212,8 @@ read_alias_file(const unsigned char *fname, int fname_len) 1024 ? alias_len + value_len : 1024)); - unsigned char *new_pool = - (unsigned char *) realloc(string_space, + char *new_pool = + (char *) realloc(string_space, new_size); if (new_pool == NULL) return added; diff --git a/src/intl/gettext/ngettext.c b/src/intl/gettext/ngettext.c index 67f79597..b58b2d10 100644 --- a/src/intl/gettext/ngettext.c +++ b/src/intl/gettext/ngettext.c @@ -29,8 +29,8 @@ /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ -unsigned char * -ngettext__(const unsigned char *msgid1, const unsigned char *msgid2, unsigned long int n) +char * +ngettext__(const char *msgid1, const char *msgid2, unsigned long int n) { return dcngettext__(NULL, msgid1, msgid2, n, LC_MESSAGES); } diff --git a/src/intl/gettext/plural.c b/src/intl/gettext/plural.c index 83d3d2e7..771f46f9 100644 --- a/src/intl/gettext/plural.c +++ b/src/intl/gettext/plural.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.7.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -40,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30704 -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" +/* Bison version string. */ +#define YYBISON_VERSION "3.7.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -66,9 +71,8 @@ #define yydebug gettext__debug #define yynerrs gettext__nerrs - -/* Copy the first part of user declarations. */ -#line 1 "plural.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 1 "plural.y" /* Expression parsing for plural form selection. Copyright (C) 2000, 2001 Free Software Foundation, Inc. @@ -104,82 +108,59 @@ #include "intl/gettext/gettextP.h" -#line 108 "plural.c" /* yacc.c:339 */ +#line 112 "plural.c" -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast<Type> (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) # else -# define YY_NULLPTR 0 +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "plural.h". */ -#ifndef YY_GETTEXT_PLURAL_H_INCLUDED -# define YY_GETTEXT_PLURAL_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int gettext__debug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - EQUOP2 = 258, - CMPOP2 = 259, - ADDOP2 = 260, - MULOP2 = 261, - NUMBER = 262 - }; -#endif -/* Tokens. */ -#define EQUOP2 258 -#define CMPOP2 259 -#define ADDOP2 260 -#define MULOP2 261 -#define NUMBER 262 - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +#include "plural.h" +/* Symbol kind. */ +enum yysymbol_kind_t { -#line 42 "plural.y" /* yacc.c:355 */ - - unsigned long int num; - enum operator_ op; - struct expression *exp; - -#line 168 "plural.c" /* yacc.c:355 */ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_3_ = 3, /* '?' */ + YYSYMBOL_4_ = 4, /* '|' */ + YYSYMBOL_5_ = 5, /* '&' */ + YYSYMBOL_6_ = 6, /* '!' */ + YYSYMBOL_EQUOP2 = 7, /* EQUOP2 */ + YYSYMBOL_CMPOP2 = 8, /* CMPOP2 */ + YYSYMBOL_ADDOP2 = 9, /* ADDOP2 */ + YYSYMBOL_MULOP2 = 10, /* MULOP2 */ + YYSYMBOL_NUMBER = 11, /* NUMBER */ + YYSYMBOL_12_ = 12, /* ':' */ + YYSYMBOL_13_n_ = 13, /* 'n' */ + YYSYMBOL_14_ = 14, /* '(' */ + YYSYMBOL_15_ = 15, /* ')' */ + YYSYMBOL_YYACCEPT = 16, /* $accept */ + YYSYMBOL_start = 17, /* start */ + YYSYMBOL_exp = 18 /* exp */ }; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif +typedef enum yysymbol_kind_t yysymbol_kind_t; - -int gettext__parse (struct parse_args *arg); - -#endif /* !YY_GETTEXT_PLURAL_H_INCLUDED */ - -/* Copy the second part of user declarations. */ -#line 48 "plural.y" /* yacc.c:358 */ +/* Second part of user prologue. */ +#line 48 "plural.y" /* Prototypes for local functions. */ static struct expression *new_exp(int nargs, enum operator_ op, @@ -195,7 +176,7 @@ static inline struct expression *new_exp_3(enum operator_ op, struct expression *tbranch, struct expression *fbranch); static int yylex(YYSTYPE *lval, struct parse_args *arg); -static void yyerror(struct parse_args *arg, const unsigned char *str); +static void yyerror(struct parse_args *arg, const char *str); /* Allocation of expressions. */ @@ -266,34 +247,82 @@ new_exp_3(enum operator_ op, struct expression *bexp, struct expression *tbranch } -#line 270 "plural.c" /* yacc.c:358 */ +#line 251 "plural.c" + #ifdef short # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + <limits.h> and (if available) <stdint.h> are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include <limits.h> /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short int yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -301,15 +330,28 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_int8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -323,30 +365,20 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif @@ -357,13 +389,13 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -376,8 +408,22 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif -#if ! defined yyoverflow || YYERROR_VERBOSE + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -442,8 +488,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* !defined yyoverflow */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -452,17 +497,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -475,11 +520,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -491,12 +536,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -508,7 +553,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 9 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 54 +#define YYLAST 56 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 16 @@ -519,22 +564,25 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 27 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 +/* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 262 -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 10, 2, 2, 2, 2, 5, 2, + 2, 2, 2, 6, 2, 2, 2, 2, 5, 2, 14, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, @@ -556,8 +604,8 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 6, 7, - 8, 9, 11 + 2, 2, 2, 2, 2, 2, 1, 2, 7, 8, + 9, 10, 11 }; #if YYDEBUG @@ -569,50 +617,63 @@ static const yytype_uint8 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2", - "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'", - "$accept", "start", "exp", YY_NULLPTR + "\"end of file\"", "error", "\"invalid token\"", "'?'", "'|'", "'&'", + "'!'", "EQUOP2", "CMPOP2", "ADDOP2", "MULOP2", "NUMBER", "':'", "'n'", + "'('", "')'", "$accept", "start", "exp", YY_NULLPTR +}; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} +#endif + +#ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_int16 yytoknum[] = +{ + 0, 256, 257, 63, 124, 38, 33, 258, 259, 260, + 261, 262, 58, 110, 40, 41 }; #endif -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 63, 124, 38, 258, 259, 260, 261, - 33, 262, 58, 110, 40, 41 -}; -# endif +#define YYPACT_NINF (-4) -#define YYPACT_NINF -10 +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-10))) +#define YYTABLE_NINF (-1) -#define YYTABLE_NINF -1 - -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int8 yypact[] = { - -9, -9, -10, -10, -9, 8, 36, -10, 13, -10, - -9, -9, -9, -9, -9, -9, -9, -10, 26, 41, - 45, 18, -2, 14, -10, -9, 36 + 27, 27, -4, -4, 27, 1, 39, -4, 13, -4, + 27, 27, 27, 27, 27, 27, 27, -4, 22, -3, + 43, 46, 26, -2, -4, 27, 39 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const yytype_int8 yydefact[] = { 0, 0, 12, 11, 0, 0, 2, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 13, 0, 4, @@ -622,7 +683,7 @@ static const yytype_uint8 yydefact[] = /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -10, -10, -1 + -4, -4, -1 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -634,54 +695,54 @@ static const yytype_int8 yydefgoto[] = /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_uint8 yytable[] = +static const yytype_int8 yytable[] = { - 7, 1, 2, 8, 3, 4, 15, 16, 9, 18, - 19, 20, 21, 22, 23, 24, 10, 11, 12, 13, - 14, 15, 16, 16, 26, 14, 15, 16, 17, 10, - 11, 12, 13, 14, 15, 16, 0, 0, 25, 10, - 11, 12, 13, 14, 15, 16, 12, 13, 14, 15, - 16, 13, 14, 15, 16 + 7, 9, 12, 8, 13, 14, 15, 16, 16, 18, + 19, 20, 21, 22, 23, 24, 10, 11, 12, 0, + 13, 14, 15, 16, 26, 10, 11, 12, 17, 13, + 14, 15, 16, 1, 25, 15, 16, 0, 2, 0, + 3, 4, 10, 11, 12, 0, 13, 14, 15, 16, + 13, 14, 15, 16, 14, 15, 16 }; static const yytype_int8 yycheck[] = { - 1, 10, 11, 4, 13, 14, 8, 9, 0, 10, - 11, 12, 13, 14, 15, 16, 3, 4, 5, 6, - 7, 8, 9, 9, 25, 7, 8, 9, 15, 3, - 4, 5, 6, 7, 8, 9, -1, -1, 12, 3, - 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, - 9, 6, 7, 8, 9 + 1, 0, 5, 4, 7, 8, 9, 10, 10, 10, + 11, 12, 13, 14, 15, 16, 3, 4, 5, -1, + 7, 8, 9, 10, 25, 3, 4, 5, 15, 7, + 8, 9, 10, 6, 12, 9, 10, -1, 11, -1, + 13, 14, 3, 4, 5, -1, 7, 8, 9, 10, + 7, 8, 9, 10, 8, 9, 10 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_int8 yystos[] = { - 0, 10, 11, 13, 14, 17, 18, 18, 18, 0, - 3, 4, 5, 6, 7, 8, 9, 15, 18, 18, + 0, 6, 11, 13, 14, 17, 18, 18, 18, 0, + 3, 4, 5, 7, 8, 9, 10, 15, 18, 18, 18, 18, 18, 18, 18, 12, 18 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_int8 yyr1[] = { 0, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 1, 5, 3, 3, 3, 3, 3, 3, 2, 1, 1, 3 }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab @@ -690,27 +751,26 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (arg, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (arg, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* Enable debugging if requested. */ @@ -728,55 +788,59 @@ do { \ } while (0) /* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +# ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value, arg); \ + Kind, Value, arg); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parse_args *arg) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, struct parse_args *arg) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); YYUSE (arg); if (!yyvaluep) return; # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); # endif - YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parse_args *arg) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, struct parse_args *arg) { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, arg); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep, arg); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -785,7 +849,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, str `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -808,21 +872,21 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct parse_args *arg) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule, struct parse_args *arg) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , arg); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)], arg); YYFPRINTF (stderr, "\n"); } } @@ -837,8 +901,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -861,249 +925,34 @@ int yydebug; #endif -#if YYERROR_VERBOSE -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct parse_args *arg) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep, struct parse_args *arg) { YYUSE (yyvaluep); YYUSE (arg); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YYUSE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } + + /*----------. | yyparse. | `----------*/ @@ -1111,7 +960,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct parse_args int yyparse (struct parse_args *arg) { -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; @@ -1122,45 +971,38 @@ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ - int yynerrs; + int yynerrs = 0; - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The semantic value stack. */ + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; + + /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1168,58 +1010,60 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1228,9 +1072,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); @@ -1240,30 +1085,30 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1274,18 +1119,29 @@ yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (&yylval, arg); } if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1313,15 +1169,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1336,7 +1190,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1356,107 +1210,108 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 156 "plural.y" /* yacc.c:1646 */ - { + case 2: /* start: exp */ +#line 156 "plural.y" + { if ((yyvsp[0].exp) == NULL) YYABORT; ((struct parse_args *) arg)->res = (yyvsp[0].exp); } -#line 1367 "plural.c" /* yacc.c:1646 */ +#line 1221 "plural.c" break; - case 3: -#line 164 "plural.y" /* yacc.c:1646 */ - { + case 3: /* exp: exp '?' exp ':' exp */ +#line 164 "plural.y" + { (yyval.exp) = new_exp_3 (qmop, (yyvsp[-4].exp), (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1375 "plural.c" /* yacc.c:1646 */ +#line 1229 "plural.c" break; - case 4: -#line 168 "plural.y" /* yacc.c:1646 */ - { + case 4: /* exp: exp '|' exp */ +#line 168 "plural.y" + { (yyval.exp) = new_exp_2 (lor, (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1383 "plural.c" /* yacc.c:1646 */ +#line 1237 "plural.c" break; - case 5: -#line 172 "plural.y" /* yacc.c:1646 */ - { + case 5: /* exp: exp '&' exp */ +#line 172 "plural.y" + { (yyval.exp) = new_exp_2 (land, (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1391 "plural.c" /* yacc.c:1646 */ +#line 1245 "plural.c" break; - case 6: -#line 176 "plural.y" /* yacc.c:1646 */ - { + case 6: /* exp: exp EQUOP2 exp */ +#line 176 "plural.y" + { (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1399 "plural.c" /* yacc.c:1646 */ +#line 1253 "plural.c" break; - case 7: -#line 180 "plural.y" /* yacc.c:1646 */ - { + case 7: /* exp: exp CMPOP2 exp */ +#line 180 "plural.y" + { (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1407 "plural.c" /* yacc.c:1646 */ +#line 1261 "plural.c" break; - case 8: -#line 184 "plural.y" /* yacc.c:1646 */ - { + case 8: /* exp: exp ADDOP2 exp */ +#line 184 "plural.y" + { (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1415 "plural.c" /* yacc.c:1646 */ +#line 1269 "plural.c" break; - case 9: -#line 188 "plural.y" /* yacc.c:1646 */ - { + case 9: /* exp: exp MULOP2 exp */ +#line 188 "plural.y" + { (yyval.exp) = new_exp_2 ((yyvsp[-1].op), (yyvsp[-2].exp), (yyvsp[0].exp)); } -#line 1423 "plural.c" /* yacc.c:1646 */ +#line 1277 "plural.c" break; - case 10: -#line 192 "plural.y" /* yacc.c:1646 */ - { + case 10: /* exp: '!' exp */ +#line 192 "plural.y" + { (yyval.exp) = new_exp_1 (lnot, (yyvsp[0].exp)); } -#line 1431 "plural.c" /* yacc.c:1646 */ +#line 1285 "plural.c" break; - case 11: -#line 196 "plural.y" /* yacc.c:1646 */ - { + case 11: /* exp: 'n' */ +#line 196 "plural.y" + { (yyval.exp) = new_exp_0 (var); } -#line 1439 "plural.c" /* yacc.c:1646 */ +#line 1293 "plural.c" break; - case 12: -#line 200 "plural.y" /* yacc.c:1646 */ - { + case 12: /* exp: NUMBER */ +#line 200 "plural.y" + { if (((yyval.exp) = new_exp_0 (num)) != NULL) (yyval.exp)->val.num = (yyvsp[0].num); } -#line 1448 "plural.c" /* yacc.c:1646 */ +#line 1302 "plural.c" break; - case 13: -#line 205 "plural.y" /* yacc.c:1646 */ - { + case 13: /* exp: '(' exp ')' */ +#line 205 "plural.y" + { (yyval.exp) = (yyvsp[-1].exp); } -#line 1456 "plural.c" /* yacc.c:1646 */ +#line 1310 "plural.c" break; -#line 1460 "plural.c" /* yacc.c:1646 */ +#line 1314 "plural.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1470,25 +1325,23 @@ yyreduce: case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -1499,50 +1352,14 @@ yyreduce: yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE yyerror (arg, YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (arg, yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif } - - if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -1571,12 +1388,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -1593,13 +1408,14 @@ yyerrorlab: yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -1613,7 +1429,7 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp, arg); + YY_ACCESSING_SYMBOL (yystate), yyvsp, arg); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1625,7 +1441,7 @@ yyerrlab1: /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1638,6 +1454,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -1645,16 +1462,21 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE + +#if !defined yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (arg, YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ + goto yyreturn; #endif + +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -1671,20 +1493,18 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, arg); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, arg); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif + return yyresult; } -#line 210 "plural.y" /* yacc.c:1906 */ + +#line 210 "plural.y" void @@ -1716,7 +1536,7 @@ gettext_free_exp__(struct expression *exp) static int yylex(YYSTYPE *lval, struct parse_args *arg) { - const unsigned char *exp = arg->cp; + const char *exp = arg->cp; int result; while (1) @@ -1857,7 +1677,7 @@ yylex(YYSTYPE *lval, struct parse_args *arg) static void -yyerror(struct parse_args *arg, const unsigned char *str) +yyerror(struct parse_args *arg, const char *str) { /* Do nothing. We don't print error messages here. */ } diff --git a/src/intl/gettext/plural.y b/src/intl/gettext/plural.y index 2388e35c..0432d6e0 100644 --- a/src/intl/gettext/plural.y +++ b/src/intl/gettext/plural.y @@ -60,7 +60,7 @@ static inline struct expression *new_exp_3(enum operator_ op, struct expression *tbranch, struct expression *fbranch); static int yylex(YYSTYPE *lval, struct parse_args *arg); -static void yyerror(struct parse_args *arg, const unsigned char *str); +static void yyerror(struct parse_args *arg, const char *str); /* Allocation of expressions. */ @@ -238,7 +238,7 @@ gettext_free_exp__(struct expression *exp) static int yylex(YYSTYPE *lval, struct parse_args *arg) { - const unsigned char *exp = arg->cp; + const char *exp = arg->cp; int result; while (1) @@ -379,7 +379,7 @@ yylex(YYSTYPE *lval, struct parse_args *arg) static void -yyerror(struct parse_args *arg, const unsigned char *str) +yyerror(struct parse_args *arg, const char *str) { /* Do nothing. We don't print error messages here. */ } diff --git a/src/intl/gettext/textdomain.c b/src/intl/gettext/textdomain.c index 4cebc334..2e603804 100644 --- a/src/intl/gettext/textdomain.c +++ b/src/intl/gettext/textdomain.c @@ -29,31 +29,31 @@ #include "util/string.h" /* Name of the default text domain. */ -extern const unsigned char *_nl_default_default_domain__; +extern const char *_nl_default_default_domain__; /* Default text domain in which entries for gettext(3) are to be found. */ -extern const unsigned char *_nl_current_default_domain__; +extern const char *_nl_current_default_domain__; /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ -unsigned char * -textdomain__(const unsigned char *domainname) +char * +textdomain__(const char *domainname) { - unsigned char *new_domain; - unsigned char *old_domain; + char *new_domain; + char *old_domain; /* A NULL pointer requests the current setting. */ if (domainname == NULL) - return (unsigned char *) _nl_current_default_domain__; + return (char *) _nl_current_default_domain__; - old_domain = (unsigned char *) _nl_current_default_domain__; + old_domain = (char *) _nl_current_default_domain__; /* If domain name is the null string set to default domain "messages". */ if (domainname[0] == '\0' || strcmp(domainname, _nl_default_default_domain__) == 0) { _nl_current_default_domain__ = _nl_default_default_domain__; - new_domain = (unsigned char *) _nl_current_default_domain__; + new_domain = (char *) _nl_current_default_domain__; } else if (strcmp(domainname, old_domain) == 0) /* This can happen and people will use it to signal that some environment variable changed. */ diff --git a/src/intl/test/utf8-step-test.c b/src/intl/test/utf8-step-test.c index 0276c47c..10e6d205 100644 --- a/src/intl/test/utf8-step-test.c +++ b/src/intl/test/utf8-step-test.c @@ -47,7 +47,7 @@ main(int argc, char **argv) enum direction direction; enum utf8_step way; int max_steps; - unsigned char *begin, *end; + char *begin, *end; int expect_bytes; int expect_steps; int bytes; diff --git a/src/intl/uni_7b.inc b/src/intl/uni_7b.inc index 2d90491f..cc54b8b5 100644 --- a/src/intl/uni_7b.inc +++ b/src/intl/uni_7b.inc @@ -1,7 +1,7 @@ /* Automatically generated by gen-7b */ /* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */ -static const struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = { +static const struct { unicode_val_T x; char *s; } unicode_7b [2453] = { {0x00000000, "NUL"}, {0x00000001, "SH"}, {0x00000002, "SX"}, diff --git a/src/main/event.c b/src/main/event.c index 0190e358..a81688aa 100644 --- a/src/main/event.c +++ b/src/main/event.c @@ -42,7 +42,7 @@ struct event_handler { struct event { /* The event name has to be unique. */ - unsigned char *name; + char *name; /* There are @count event @handlers all ordered by priority. */ struct event_handler *handlers; @@ -74,7 +74,7 @@ invalid_event_id(register int id) } int -register_event(unsigned char *name) +register_event(char *name) { int id = get_event_id(name); struct event *event; @@ -117,7 +117,7 @@ register_event(unsigned char *name) } int -get_event_id(unsigned char *name) +get_event_id(char *name) { struct hash_item *item; int namelen; @@ -141,7 +141,7 @@ get_event_id(unsigned char *name) return EVENT_NONE; } -unsigned char * +char * get_event_name(int id) { if (invalid_event_id(id)) return NULL; @@ -181,7 +181,7 @@ trigger_event(int id, ...) } void -trigger_event_name(unsigned char *name, ...) +trigger_event_name(char *name, ...) { va_list ap; int id = get_event_id(name); diff --git a/src/main/event.h b/src/main/event.h index 4c865e3e..724c5547 100644 --- a/src/main/event.h +++ b/src/main/event.h @@ -60,7 +60,7 @@ typedef enum evhook_status (*event_hook_T)(va_list ap, void *data); /* This registers an event of name @name, allocating an id number for it. */ /* The function returns the id or negative number upon error. */ -int register_event(unsigned char *name); +int register_event(char *name); /* This unregisters an event number @event, freeing the resources it * occupied, chain of associated hooks and unallocating the event id for @@ -76,7 +76,7 @@ void unregister_event_hook(int id, event_hook_T callback); /*** Interface for table driven event hooks maintainance */ struct event_hook_info { - unsigned char *name; + char *name; int priority; event_hook_T callback; void *data; @@ -95,14 +95,14 @@ void unregister_event_hooks(struct event_hook_info *hooks); * unregistration), thus it may be cached intermediatelly. */ /* It returns the event id on success or a negative number upon failure * (ie. there is no such event). */ -int get_event_id(unsigned char *name); +int get_event_id(char *name); /* This looks up the events table and returns the name of a given event * @id. */ /* It returns the event name on success (statically allocated, you are * not permitted to modify it) or NULL upon failure (ie. there is no * such event). */ -unsigned char *get_event_name(int id); +char *get_event_name(int id); #define set_event_id(event, name) \ do { \ @@ -115,7 +115,7 @@ unsigned char *get_event_name(int id); void trigger_event(int id, ...); -void trigger_event_name(unsigned char *name, ...); +void trigger_event_name(char *name, ...); /*** The very events subsystem itself */ diff --git a/src/main/interlink.c b/src/main/interlink.c index f5ea559f..c46e42c9 100644 --- a/src/main/interlink.c +++ b/src/main/interlink.c @@ -327,10 +327,10 @@ setsock_reuse_addr(int fd) #define CONNECT_TRIES_DELAY 50000 static void -report_af_unix_error(unsigned char *function, int error) +report_af_unix_error(char *function, int error) { ERROR(gettext("The call to %s failed: %d (%s)"), - function, error, (unsigned char *) strerror(error)); + function, error, (char *) strerror(error)); } /* Called when we receive a connection on listening socket. */ @@ -338,7 +338,7 @@ static void af_unix_connection(struct socket_info *info) { int ns; - int l; + socklen_t l; assert(info); if_assert_failed return; diff --git a/src/main/main.c b/src/main/main.c index 22a90893..00d0f2d7 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -58,7 +58,7 @@ struct program program; static int ac; -static unsigned char **av; +static char **av; static int init_b = 0; static int init_o = 0; @@ -93,10 +93,10 @@ check_stdio(LIST_OF(struct string_list_item) *url_list) static void check_cwd(void) { - unsigned char *cwd = get_cwd(); + char *cwd = get_cwd(); if (!cwd || !file_is_dir(cwd)) { - unsigned char *home = getenv("HOME"); + char *home = getenv("HOME"); if (home && file_is_dir(home)) chdir(home); @@ -207,7 +207,7 @@ init(void) if (!list_empty(url_list)) { dump_next(&url_list); } else { - unsigned char *arg = get_cmd_opt_bool("dump") + char *arg = get_cmd_opt_bool("dump") ? "dump" : "source"; usrerror(gettext("URL expected after -%s"), arg); @@ -352,7 +352,7 @@ main(int argc, char *argv[]) program.retval = RET_OK; program.path = argv[0]; ac = argc; - av = (unsigned char **) argv; + av = (char **) argv; select_loop(init); terminate_all_subsystems(); diff --git a/src/main/main.h b/src/main/main.h index 5c330058..c8eb631e 100644 --- a/src/main/main.h +++ b/src/main/main.h @@ -19,7 +19,7 @@ enum retval { struct program { int terminate; enum retval retval; - unsigned char *path; + char *path; }; extern struct program program; diff --git a/src/main/module.h b/src/main/module.h index 002367c3..1dc8c034 100644 --- a/src/main/module.h +++ b/src/main/module.h @@ -13,7 +13,7 @@ extern "C" { struct module { /* The name of the module. It needs to be unique in its class (ie. in * the scope of root modules or submodules of one parent module). */ - unsigned char *name; + char *name; /* The options that should be registered for this module. * The table should end with NULL_OPTION_INFO. */ diff --git a/src/main/object.h b/src/main/object.h index 9218efde..e6248c3b 100644 --- a/src/main/object.h +++ b/src/main/object.h @@ -14,7 +14,7 @@ extern "C" { struct object { int refcount; #ifdef CONFIG_DEBUG - unsigned char *name; + char *name; #endif }; diff --git a/src/main/select.c b/src/main/select.c index 95bf1190..aca46f51 100644 --- a/src/main/select.c +++ b/src/main/select.c @@ -199,7 +199,7 @@ int event_enabled = 0; static inline struct event *timer_event(struct timer *tm) { - return (struct event *)((unsigned char *)tm - sizeof_struct_event); + return (struct event *)((char *)tm - sizeof_struct_event); } #ifdef HAVE_EVENT_BASE_SET @@ -559,7 +559,7 @@ select_loop(void (*init)(void)) uninstall_alarm(); if (errno_from_select != EINTR) { ERROR(gettext("The call to %s failed: %d (%s)"), - "select()", errno_from_select, (unsigned char *) strerror(errno_from_select)); + "select()", errno_from_select, (char *) strerror(errno_from_select)); if (++select_errors > 10) /* Infinite loop prevention. */ INTERNAL(gettext("%d select() failures."), select_errors); diff --git a/src/main/timer.c b/src/main/timer.c index 0befa06a..7c157592 100644 --- a/src/main/timer.c +++ b/src/main/timer.c @@ -79,7 +79,7 @@ timer_callback(int h, short ev, void *data) static inline struct event *timer_event(struct timer *tm) { - return (struct event *)((unsigned char *)tm - sizeof_struct_event); + return (struct event *)((char *)tm - sizeof_struct_event); } #endif @@ -162,7 +162,7 @@ install_timer(timer_id_T *id, milliseconds_T delay, void (*func)(void *), void * assert(id && delay > 0); #ifdef USE_LIBEVENT - unsigned char *q = mem_alloc(sizeof_struct_event + sizeof(struct timer)); + char *q = mem_alloc(sizeof_struct_event + sizeof(struct timer)); new_timer = (struct timer *)(q + sizeof_struct_event); #else new_timer = mem_alloc(sizeof(*new_timer)); diff --git a/src/main/version.c b/src/main/version.c index 4e5eabb7..229fd160 100644 --- a/src/main/version.c +++ b/src/main/version.c @@ -64,8 +64,8 @@ add_modules_to_string(struct string *string, struct terminal *term) static void wrap_string(struct string *string, int start_at, int maxlen) { - unsigned char *pos, *start_pos; - unsigned char *last_pos = NULL; + char *pos, *start_pos; + char *last_pos = NULL; assert(string && string->source && start_at < string->length); if_assert_failed return; @@ -88,10 +88,10 @@ wrap_string(struct string *string, int start_at, int maxlen) } /* @more will add more information especially for info box. */ -unsigned char * +char * get_dyn_full_version(struct terminal *term, int more) { - static const unsigned char comma[] = ", "; + static unsigned char comma[] = ", "; struct string string; if (!init_string(&string)) return NULL; @@ -165,14 +165,14 @@ get_dyn_full_version(struct terminal *term, int more) comma, (get_cmd_opt_bool("terminfo") ? _("terminfo", term) : _("terminfo (disabled)", term)), #endif comma, - (unsigned char *) NULL + (char *) NULL ); add_modules_to_string(&string, term); if (!more) { int start_at = 0; - unsigned char *last_newline = strrchr((const char *)string.source, '\n'); + char *last_newline = strrchr((const char *)string.source, '\n'); if (last_newline) { start_at = last_newline - string.source + 1; @@ -188,7 +188,7 @@ get_dyn_full_version(struct terminal *term, int more) void init_static_version(void) { - unsigned char *s = get_dyn_full_version((struct terminal *) NULL, 0); + char *s = get_dyn_full_version((struct terminal *) NULL, 0); if (s) { safe_strncpy(full_static_version, s, sizeof(full_static_version)); diff --git a/src/main/version.h b/src/main/version.h index 138b8b4a..b8ec66dd 100644 --- a/src/main/version.h +++ b/src/main/version.h @@ -7,7 +7,7 @@ extern "C" { struct terminal; -unsigned char *get_dyn_full_version(struct terminal *term, int more); +char *get_dyn_full_version(struct terminal *term, int more); void init_static_version(void); #ifdef __cplusplus diff --git a/src/meson.build b/src/meson.build index 6b09afbb..e1deaf2e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -41,7 +41,7 @@ srcs += files('vernum.c') incs = include_directories('..', '.') -extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] + extracflags +extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-builtin-declaration-mismatch', '-Wno-address'] + extracflags elinks = executable( 'elinks', srcs, diff --git a/src/mime/backend/common.c b/src/mime/backend/common.c index a103c199..eeceb596 100644 --- a/src/mime/backend/common.c +++ b/src/mime/backend/common.c @@ -36,15 +36,15 @@ static const struct mime_backend *const mime_backends[] = { }; -unsigned char * -get_content_type_backends(unsigned char *extension) +char * +get_content_type_backends(char *extension) { const struct mime_backend *backend; int i; foreach_module (backend, mime_backends, i) { if (backend->get_content_type) { - unsigned char *content_type; + char *content_type; content_type = backend->get_content_type(extension); if (content_type) return content_type; @@ -55,7 +55,7 @@ get_content_type_backends(unsigned char *extension) } struct mime_handler * -get_mime_handler_backends(unsigned char *ctype, int have_x) +get_mime_handler_backends(char *ctype, int have_x) { const struct mime_backend *backend; int i; @@ -72,11 +72,11 @@ get_mime_handler_backends(unsigned char *ctype, int have_x) return NULL; } -unsigned char * -get_next_path_filename(unsigned char **path_ptr, unsigned char separator) +char * +get_next_path_filename(char **path_ptr, unsigned char separator) { - unsigned char *path = *path_ptr; - unsigned char *filename = path; + char *path = *path_ptr; + char *filename = path; int filenamelen; /* Extract file from path */ @@ -92,7 +92,7 @@ get_next_path_filename(unsigned char **path_ptr, unsigned char separator) *path_ptr = path; if (filenamelen > 0) { - unsigned char *tmp = memacpy(filename, filenamelen); + char *tmp = memacpy(filename, filenamelen); if (!tmp) return NULL; filename = expand_tilde(tmp); @@ -105,8 +105,8 @@ get_next_path_filename(unsigned char **path_ptr, unsigned char separator) } struct mime_handler * -init_mime_handler(unsigned char *program, unsigned char *description, - unsigned char *backend_name, int ask, int block) +init_mime_handler(char *program, char *description, + char *backend_name, int ask, int block) { int programlen = strlen(program); struct mime_handler *handler; diff --git a/src/mime/backend/common.h b/src/mime/backend/common.h index c4b5debd..c3e29576 100644 --- a/src/mime/backend/common.h +++ b/src/mime/backend/common.h @@ -10,28 +10,28 @@ extern "C" { struct mime_backend { /* Resolve the content type from the @extension. */ - unsigned char *(*get_content_type)(unsigned char *extension); + char *(*get_content_type)(char *extension); /* Given a mime type find a associated handler. The handler can * be given options such */ - struct mime_handler *(*get_mime_handler)(unsigned char *type, int have_x); + struct mime_handler *(*get_mime_handler)(char *type, int have_x); }; /* Multiplexor functions for the backends. */ -unsigned char *get_content_type_backends(unsigned char *extension); +char *get_content_type_backends(char *extension); struct mime_handler * -get_mime_handler_backends(unsigned char *content_type, int have_x); +get_mime_handler_backends(char *content_type, int have_x); /* Extracts a filename from @path separated by @separator. Targeted for use * with the general unix PATH style strings. */ -unsigned char * -get_next_path_filename(unsigned char **path_ptr, unsigned char separator); +char * +get_next_path_filename(char **path_ptr, unsigned char separator); struct mime_handler * -init_mime_handler(unsigned char *program, unsigned char *description, - unsigned char *backend_name, int ask, int block); +init_mime_handler(char *program, char *description, + char *backend_name, int ask, int block); #ifdef __cplusplus } diff --git a/src/mime/backend/default.c b/src/mime/backend/default.c index 8e191fa7..038f6607 100644 --- a/src/mime/backend/default.c +++ b/src/mime/backend/default.c @@ -110,12 +110,12 @@ static union option_info default_mime_options[] = { NULL_OPTION_INFO, }; -static unsigned char * -get_content_type_default(unsigned char *extension) +static char * +get_content_type_default(char *extension) { struct option *opt_tree; struct option *opt; - unsigned char *extend = extension + strlen(extension) - 1; + char *extend = extension + strlen(extension) - 1; if (extend < extension) return NULL; @@ -123,8 +123,8 @@ get_content_type_default(unsigned char *extension) assert(opt_tree); foreach (opt, *opt_tree->value.tree) { - unsigned char *namepos = opt->name + strlen(opt->name) - 1; - unsigned char *extpos = extend; + char *namepos = opt->name + strlen(opt->name) - 1; + char *extpos = extend; /* Match the longest possible part of URL.. */ @@ -149,7 +149,7 @@ get_content_type_default(unsigned char *extension) } static struct option * -get_mime_type_option(unsigned char *type) +get_mime_type_option(char *type) { struct option *opt; struct string name; @@ -161,7 +161,7 @@ get_mime_type_option(unsigned char *type) if (add_optname_to_string(&name, type, strlen(type))) { /* Search for end of the base type. */ - unsigned char *pos = strchr((const char *)name.source, '/'); + char *pos = strchr((const char *)name.source, '/'); if (pos) { *pos = '.'; @@ -193,7 +193,7 @@ get_mime_handler_option(struct option *type_opt, int xwin) } static struct mime_handler * -get_mime_handler_default(unsigned char *type, int have_x) +get_mime_handler_default(char *type, int have_x) { struct option *type_opt = get_mime_type_option(type); struct option *handler_opt; diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index 37a6d430..e1787850 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -45,17 +45,17 @@ struct mailcap_hash_item { LIST_OF(struct mailcap_entry) entries; /* The content type of all @entries. Must be last! */ - unsigned char type[1]; + char type[1]; }; struct mailcap_entry { LIST_HEAD(struct mailcap_entry); /* To verify if command qualifies. Cannot contain %s formats. */ - unsigned char *testcommand; + char *testcommand; /* Used to inform the user of the type or handler. */ - unsigned char *description; + char *description; /* Used to determine between an exact match and a wildtype match. Lower * is better. Increased for each sourced file. */ @@ -70,7 +70,7 @@ struct mailcap_entry { unsigned int copiousoutput:1; /* The 'raw' unformatted (view)command from the mailcap files. */ - unsigned char command[1]; + char command[1]; }; enum mailcap_option { @@ -147,7 +147,7 @@ done_mailcap_entry(struct mailcap_entry *entry) * Clear memory to make freeing it safer later and we get * needsterminal and copiousoutput initialized for free. */ static inline struct mailcap_entry * -init_mailcap_entry(unsigned char *command, int priority) +init_mailcap_entry(char *command, int priority) { struct mailcap_entry *entry; int commandlen = strlen(command); @@ -163,7 +163,7 @@ init_mailcap_entry(unsigned char *command, int priority) } static inline void -add_mailcap_entry(struct mailcap_entry *entry, unsigned char *type, int typelen) +add_mailcap_entry(struct mailcap_entry *entry, char *type, int typelen) { struct mailcap_hash_item *mitem; struct hash_item *item; @@ -214,11 +214,11 @@ add_mailcap_entry(struct mailcap_entry *entry, unsigned char *type, int typelen) /* Returns a NULL terminated RFC 1524 field, while modifying @next to point * to the next field. */ -static unsigned char * -get_mailcap_field(unsigned char **next) +static char * +get_mailcap_field(char **next) { - unsigned char *field; - unsigned char *fieldend; + char *field; + char *fieldend; if (!next || !*next) return NULL; @@ -258,8 +258,8 @@ get_mailcap_field(unsigned char **next) * above). Allocates and returns a NULL terminated token, or NULL if parsing * fails. */ -static unsigned char * -get_mailcap_field_text(unsigned char *field) +static char * +get_mailcap_field_text(char *field) { skip_space(field); @@ -275,10 +275,10 @@ get_mailcap_field_text(unsigned char *field) /* Parse optional extra definitions. Zero return value means syntax error */ static inline int -parse_optional_fields(struct mailcap_entry *entry, unsigned char *line) +parse_optional_fields(struct mailcap_entry *entry, char *line) { while (0xf131d5) { - unsigned char *field = get_mailcap_field(&line); + char *field = get_mailcap_field(&line); if (!field) break; @@ -319,10 +319,10 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line) /* Parses whole mailcap files line-by-line adding entries to the map * assigning them the given @priority */ static void -parse_mailcap_file(unsigned char *filename, unsigned int priority) +parse_mailcap_file(char *filename, unsigned int priority) { FILE *file = fopen(filename, "rb"); - unsigned char *line = NULL; + char *line = NULL; size_t linelen = MAX_STR_LEN; int lineno = 1; @@ -330,10 +330,10 @@ parse_mailcap_file(unsigned char *filename, unsigned int priority) while ((line = file_read_line(line, &linelen, file, &lineno))) { struct mailcap_entry *entry; - unsigned char *linepos; - unsigned char *command; - unsigned char *basetypeend; - unsigned char *type; + char *linepos; + char *command; + char *basetypeend; + char *type; int typelen; /* Ignore comments */ @@ -364,7 +364,7 @@ parse_mailcap_file(unsigned char *filename, unsigned int priority) typelen = strlen(type); if (!basetypeend) { - unsigned char implicitwild[64]; + char implicitwild[64]; if (typelen + 3 > sizeof(implicitwild)) { done_mailcap_entry(entry); @@ -399,7 +399,7 @@ parse_mailcap_file(unsigned char *filename, unsigned int priority) static struct hash * init_mailcap_map(void) { - unsigned char *path; + char *path; unsigned int priority = 0; mailcap_map = init_hash8(); @@ -411,7 +411,7 @@ init_mailcap_map(void) if (!path) path = DEFAULT_MAILCAP_PATH; while (*path) { - unsigned char *filename = get_next_path_filename(&path, ':'); + char *filename = get_next_path_filename(&path, ':'); if (!filename) continue; parse_mailcap_file(filename, priority++); @@ -496,15 +496,15 @@ init_mailcap(struct module *module) /* The formatting is postponed until the command is needed. This means * @type can be NULL. If '%t' is used in command we bail out. */ -static unsigned char * -format_command(unsigned char *command, unsigned char *type, int copiousoutput) +static char * +format_command(char *command, char *type, int copiousoutput) { struct string cmd; if (!init_string(&cmd)) return NULL; while (*command) { - unsigned char *start = command; + char *start = command; while (*command && *command != '%' && *command != '\\' && *command != '\'') command++; @@ -564,7 +564,7 @@ check_entries(struct mailcap_hash_item *item) struct mailcap_entry *entry; foreach (entry, item->entries) { - unsigned char *test; + char *test; /* Accept current if no test is needed */ if (!entry->testcommand) @@ -596,7 +596,7 @@ check_entries(struct mailcap_hash_item *item) * that need a file will be taken as failed. */ static struct mailcap_entry * -get_mailcap_entry(unsigned char *type) +get_mailcap_entry(char *type) { struct mailcap_entry *entry; struct hash_item *item; @@ -610,11 +610,11 @@ get_mailcap_entry(unsigned char *type) /* The type lookup has either failed or we need to check * the priorities so get the wild card handler */ struct mailcap_entry *wildcard = NULL; - unsigned char *wildpos = strchr((const char *)type, '/'); + char *wildpos = strchr((const char *)type, '/'); if (wildpos) { int wildlen = wildpos - type + 1; /* include '/' */ - unsigned char *wildtype = memacpy(type, wildlen + 2); + char *wildtype = memacpy(type, wildlen + 2); if (!wildtype) return NULL; @@ -681,7 +681,7 @@ get_mailcap_entry(unsigned char *type) static void set_display(int xwin, int restore) { - static unsigned char *display = NULL; + static char *display = NULL; if (!restore) { assert(display == NULL); @@ -708,7 +708,7 @@ set_display(int xwin, int restore) setenv("DISPLAY", display, 1); #else { - static unsigned char DISPLAY[1024] = "DISPLAY="; + static char DISPLAY[1024] = "DISPLAY="; /* DISPLAY[1023] == '\0' and we don't let * strncpy write that far, so putenv always @@ -730,11 +730,11 @@ set_display(int xwin, int restore) #endif static struct mime_handler * -get_mime_handler_mailcap(unsigned char *type, int xwin) +get_mime_handler_mailcap(char *type, int xwin) { struct mailcap_entry *entry; struct mime_handler *handler; - unsigned char *program; + char *program; int block; if (!get_mailcap_enable() @@ -795,7 +795,7 @@ LIST_OF(struct terminal) terminals; int main(int argc, char *argv[]) { - unsigned char *format = "description,ask,block,program"; + char *format = "description,ask,block,program"; int has_gotten = 0; int i; diff --git a/src/mime/backend/mimetypes.c b/src/mime/backend/mimetypes.c index 31cadab6..d2150a3e 100644 --- a/src/mime/backend/mimetypes.c +++ b/src/mime/backend/mimetypes.c @@ -28,8 +28,8 @@ #define BACKEND_NAME "mimetypes" struct mimetypes_entry { - unsigned char *content_type; - unsigned char extension[1]; + char *content_type; + char extension[1]; }; enum mimetypes_option { @@ -85,14 +85,14 @@ done_mimetypes_entry(struct mimetypes_entry *entry) * Comments starts with '#'. */ static inline void -parse_mimetypes_extensions(unsigned char *token, unsigned char *ctype) +parse_mimetypes_extensions(char *token, char *ctype) { int ctypelen = strlen(ctype); /* Cycle through the file extensions */ while (*token) { struct mimetypes_entry *entry; - unsigned char *extension; + char *extension; struct hash_item *item; int extlen; @@ -129,16 +129,16 @@ parse_mimetypes_extensions(unsigned char *token, unsigned char *ctype) } static void -parse_mimetypes_file(unsigned char *filename) +parse_mimetypes_file(char *filename) { FILE *file = fopen(filename, "rb"); - unsigned char line[MAX_STR_LEN]; + char line[MAX_STR_LEN]; if (!file) return; while (fgets(line, MAX_STR_LEN - 1, file)) { - unsigned char *ctype = line; - unsigned char *token; + char *ctype = line; + char *token; /* Weed out any comments */ token = strchr((const char *)line, '#'); @@ -166,7 +166,7 @@ parse_mimetypes_file(unsigned char *filename) static struct hash * init_mimetypes_map(void) { - unsigned char *path; + char *path; mimetypes_map = init_hash8(); if (!mimetypes_map) @@ -177,7 +177,7 @@ init_mimetypes_map(void) if (!path || !*path) path = DEFAULT_MIMETYPES_PATH; while (*path) { - unsigned char *filename = get_next_path_filename(&path, ':'); + char *filename = get_next_path_filename(&path, ':'); if (!filename) continue; parse_mimetypes_file(filename); @@ -234,8 +234,8 @@ init_mimetypes(struct module *module) } -static unsigned char * -get_content_type_mimetypes(unsigned char *extension) +static char * +get_content_type_mimetypes(char *extension) { struct hash_item *item; int extensionlen; @@ -247,7 +247,7 @@ get_content_type_mimetypes(unsigned char *extension) extension++; /* Skip the leading '.' */ extensionlen = strlen(extension); while (extensionlen) { - unsigned char *trimmed; + char *trimmed; /* First the given type is looked up. */ item = get_hash_item(mimetypes_map, extension, extensionlen); diff --git a/src/mime/dialogs.c b/src/mime/dialogs.c index e52d8c33..15dd4608 100644 --- a/src/mime/dialogs.c +++ b/src/mime/dialogs.c @@ -21,7 +21,7 @@ static struct option * -get_real_opt(unsigned char *base, unsigned char *id) +get_real_opt(char *base, char *id) { struct option *opt = get_opt_rec_real(config_options, base); struct string translated; @@ -42,7 +42,7 @@ static void really_del_ext(void *fcp) { struct option *opt = get_real_opt("mime.extension", - (unsigned char *) fcp); + (char *) fcp); if (opt) delete_option(opt); } @@ -52,7 +52,7 @@ menu_del_ext(struct terminal *term, void *fcp, void *xxx2) { /* [gettext_accelerator_context(menu_del_ext)] */ struct option *opt = NULL; - unsigned char *extension = fcp; + char *extension = fcp; if (!extension) return; @@ -73,9 +73,9 @@ menu_del_ext(struct terminal *term, void *fcp, void *xxx2) struct extension { - unsigned char ext_orig[MAX_STR_LEN]; - unsigned char ext[MAX_STR_LEN]; - unsigned char ct[MAX_STR_LEN]; + char ext_orig[MAX_STR_LEN]; + char ext[MAX_STR_LEN]; + char ct[MAX_STR_LEN]; }; static void @@ -153,8 +153,8 @@ menu_list_ext(struct terminal *term, void *fn_, void *xxx) foreachback (opt, *opt_tree) { struct string translated; - unsigned char *translated2; - unsigned char *optptr2; + char *translated2; + char *optptr2; if (!strcmp(opt->name, "_template_")) continue; diff --git a/src/mime/mime.c b/src/mime/mime.c index d3734246..eea136ad 100644 --- a/src/mime/mime.c +++ b/src/mime/mime.c @@ -52,10 +52,10 @@ static union option_info mime_options[] = { #define get_default_mime_type() get_opt_mime(MIME_DEFAULT_TYPE).value.string /* Checks protocols headers for a suitable filename */ -static unsigned char * +static char * get_content_filename(struct uri *uri, struct cache_entry *cached) { - unsigned char *filename, *pos; + char *filename, *pos; if (!cached) cached = find_in_cache(uri); @@ -100,19 +100,19 @@ get_content_filename(struct uri *uri, struct cache_entry *cached) } /* Checks if application/x-<extension> has any handlers. */ -static inline unsigned char * -check_extension_type(unsigned char *extension) +static inline char * +check_extension_type(char *extension) { /* Trim the extension so only last .<extension> is used. */ - unsigned char *trimmed = strrchr((const char *)extension, '.'); + char *trimmed = strrchr((const char *)extension, '.'); struct mime_handler *handler; - unsigned char *content_type; + char *content_type; if (!trimmed) return NULL; content_type = straconcat("application/x-", trimmed + 1, - (unsigned char *) NULL); + (char *) NULL); if (!content_type) return NULL; @@ -128,12 +128,12 @@ check_extension_type(unsigned char *extension) /* Check if part of the extension coresponds to a supported encoding and if it * has any handlers. */ -static inline unsigned char * -check_encoding_type(unsigned char *extension) +static inline char * +check_encoding_type(char *extension) { enum stream_encoding encoding = guess_encoding(extension); - const unsigned char *const *extension_list; - unsigned char *last_extension = strrchr((const char *)extension, '.'); + const char *const *extension_list; + char *last_extension = strrchr((const char *)extension, '.'); if (encoding == ENCODING_NONE || !last_extension) return NULL; @@ -141,7 +141,7 @@ check_encoding_type(unsigned char *extension) for (extension_list = listext_encoded(encoding); extension_list && *extension_list; extension_list++) { - unsigned char *content_type; + char *content_type; if (strcmp(*extension_list, last_extension)) continue; @@ -171,10 +171,10 @@ check_encoding_type(unsigned char *extension) #define debug_extension(extension__) #endif -unsigned char * -get_extension_content_type(unsigned char *extension) +char * +get_extension_content_type(char *extension) { - unsigned char *ctype; + char *ctype; assert(extension && *extension); @@ -191,14 +191,14 @@ get_extension_content_type(unsigned char *extension) return ctype; } -unsigned char * +char * get_cache_header_content_type(struct cache_entry *cached) { - unsigned char *extension, *ctype; + char *extension, *ctype; ctype = parse_header(cached->head, "Content-Type", NULL); if (ctype) { - unsigned char *end = strchr((const char *)ctype, ';'); + char *end = strchr((const char *)ctype, ';'); int ctypelen; if (end) *end = '\0'; @@ -230,13 +230,13 @@ get_cache_header_content_type(struct cache_entry *cached) return NULL; } -static unsigned char * +static char * get_fragment_content_type(struct cache_entry *cached) { struct fragment *fragment; size_t length; - unsigned char *sample; - unsigned char *ctype = NULL; + char *sample; + char *ctype = NULL; if (list_empty(cached->frag)) return NULL; @@ -258,10 +258,10 @@ get_fragment_content_type(struct cache_entry *cached) return ctype; } -unsigned char * +char * get_content_type(struct cache_entry *cached) { - unsigned char *extension, *ctype; + char *extension, *ctype; debug_get_content_type_params(cached); @@ -323,7 +323,7 @@ get_content_type(struct cache_entry *cached) } struct mime_handler * -get_mime_type_handler(unsigned char *content_type, int xwin) +get_mime_type_handler(char *content_type, int xwin) { return get_mime_handler_backends(content_type, xwin); } @@ -331,7 +331,7 @@ get_mime_type_handler(unsigned char *content_type, int xwin) struct string * add_mime_filename_to_string(struct string *string, struct uri *uri) { - unsigned char *filename = get_content_filename(uri, NULL); + char *filename = get_content_filename(uri, NULL); assert(uri->data); diff --git a/src/mime/mime.h b/src/mime/mime.h index 3e60c26c..452c5ee2 100644 --- a/src/mime/mime.h +++ b/src/mime/mime.h @@ -11,26 +11,26 @@ struct cache_entry; struct uri; struct mime_handler { - unsigned char *description; - unsigned char *backend_name; + char *description; + char *backend_name; unsigned int ask:1; unsigned int block:1; unsigned int copiousoutput:1; - unsigned char program[1]; /* XXX: Keep last! */ + char program[1]; /* XXX: Keep last! */ }; extern struct module mime_module; /* Guess content type of the document. Either from the protocol header or * scanning the uri for extensions. */ -unsigned char *get_content_type(struct cache_entry *cached); +char *get_content_type(struct cache_entry *cached); /* Guess content type by looking at configurations of the given @extension */ -unsigned char *get_extension_content_type(unsigned char *extension); +char *get_extension_content_type(char *extension); /* Find program to handle mimetype. The @xwin tells about X capabilities. */ struct mime_handler * -get_mime_type_handler(unsigned char *content_type, int xwin); +get_mime_type_handler(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 diff --git a/src/network/dns.c b/src/network/dns.c index f409dda7..bf95960d 100644 --- a/src/network/dns.c +++ b/src/network/dns.c @@ -46,7 +46,7 @@ struct dnsentry { struct sockaddr_storage *addr; /* Pointer to array of addresses. */ int addrno; /* Adress array length. */ timeval_T creation_time; /* Creation time; let us do timeouts. */ - unsigned char name[1]; /* Associated host; XXX: Must be last. */ + char name[1]; /* Associated host; XXX: Must be last. */ }; struct dnsquery { @@ -68,7 +68,7 @@ struct dnsquery { #ifndef NO_ASYNC_LOOKUP int h; /* One end of the async thread pipe. */ #endif - unsigned char name[1]; /* Associated host; XXX: Must be last. */ + char name[1]; /* Associated host; XXX: Must be last. */ }; @@ -84,7 +84,7 @@ static void done_dns_lookup(struct dnsquery *query, enum dns_result res); /* DNS cache management: */ static struct dnsentry * -find_in_dns_cache(unsigned char *name) +find_in_dns_cache(char *name) { struct dnsentry *dnsentry; @@ -98,7 +98,7 @@ find_in_dns_cache(unsigned char *name) } static void -add_to_dns_cache(unsigned char *name, struct sockaddr_storage *addr, int addrno) +add_to_dns_cache(char *name, struct sockaddr_storage *addr, int addrno) { int namelen = strlen(name); struct dnsentry *dnsentry; @@ -138,7 +138,7 @@ del_dns_cache_entry(struct dnsentry *dnsentry) /* Synchronous DNS lookup management: */ enum dns_result -do_real_lookup(unsigned char *name, struct sockaddr_storage **addrs, int *addrno, +do_real_lookup(char *name, struct sockaddr_storage **addrs, int *addrno, int in_thread) { #ifdef CONFIG_IPV6 @@ -261,7 +261,7 @@ write_dns_data(int h, void *data, size_t datalen) static void async_dns_writer(void *data, int h) { - unsigned char *name = (unsigned char *) data; + char *name = (char *) data; struct sockaddr_storage *addrs; int addrno, i; @@ -467,7 +467,7 @@ done: } static enum dns_result -init_dns_lookup(unsigned char *name, void **queryref, +init_dns_lookup(char *name, void **queryref, dns_callback_T done, void *data) { struct dnsquery *query; @@ -493,7 +493,7 @@ init_dns_lookup(unsigned char *name, void **queryref, enum dns_result -find_host(unsigned char *name, void **queryref, +find_host(char *name, void **queryref, dns_callback_T done, void *data, int no_cache) { struct dnsentry *dnsentry; diff --git a/src/network/dns.h b/src/network/dns.h index 0f53d72a..7b475f57 100644 --- a/src/network/dns.h +++ b/src/network/dns.h @@ -24,7 +24,7 @@ typedef void (*dns_callback_T)(void *, struct sockaddr_storage *, int); * the correct allocation method. */ /* Returns non-zero on error and zero on success. */ enum dns_result -do_real_lookup(unsigned char *host, struct sockaddr_storage **addr, int *addrlen, +do_real_lookup(char *host, struct sockaddr_storage **addr, int *addrlen, int called_from_thread); /* Look up the specified @host storing private query information in struct @@ -33,7 +33,7 @@ do_real_lookup(unsigned char *host, struct sockaddr_storage **addr, int *addrlen * address array length. If the boolean @no_cache is non-zero cached DNS queries * are ignored. */ /* Returns whether the query is asynchronious. */ -enum dns_result find_host(unsigned char *name, void **queryref, +enum dns_result find_host(char *name, void **queryref, dns_callback_T done, void *data, int no_cache); /* Stop the DNS request pointed to by the @queryref reference. */ diff --git a/src/network/socket.c b/src/network/socket.c index f43d4c68..7c159854 100644 --- a/src/network/socket.c +++ b/src/network/socket.c @@ -86,7 +86,7 @@ static INIT_LIST_OF(struct socket_weak_ref, socket_weak_refs); #define DEBUG_TRANSFER_LOGFILE "/tmp/log" static void -debug_transfer_log(unsigned char *data, int len) +debug_transfer_log(char *data, int len) { int fd = open(DEBUG_TRANSFER_LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0622); @@ -257,7 +257,7 @@ void make_connection(struct socket *socket, struct uri *uri, socket_connect_T connect_done, int no_cache) { - unsigned char *host = get_uri_string(uri, URI_DNS_HOST); + char *host = get_uri_string(uri, URI_DNS_HOST); struct connect_info *connect_info; enum dns_result result; enum blacklist_flags verify; @@ -554,8 +554,8 @@ connect_socket(struct socket *csocket, struct connection_state state) * about such a connection attempt. * XXX: Unify with @local_only handling? --pasky */ int silent_fail = 0; - unsigned char *bind_address = get_cmd_opt_str("bind-address"); - unsigned char *bind_address_ipv6 = get_cmd_opt_str("bind-address-ipv6"); + char *bind_address = get_cmd_opt_str("bind-address"); + char *bind_address_ipv6 = get_cmd_opt_str("bind-address-ipv6"); int to_bind = (bind_address && *bind_address); int to_bind_ipv6 = (bind_address_ipv6 && *bind_address_ipv6); @@ -753,11 +753,11 @@ struct write_buffer { int length; int pos; - unsigned char data[1]; /* must be at end of struct */ + char data[1]; /* must be at end of struct */ }; static int -generic_write(struct socket *socket, unsigned char *data, int len) +generic_write(struct socket *socket, char *data, int len) { int wr = safe_write(socket->fd, data, len); @@ -852,7 +852,7 @@ write_select(struct socket *socket) } void -write_to_socket(struct socket *socket, unsigned char *data, int len, +write_to_socket(struct socket *socket, char *data, int len, struct connection_state state, socket_write_T write_done) { select_handler_T read_handler; @@ -893,7 +893,7 @@ write_to_socket(struct socket *socket, unsigned char *data, int len, #define RD_SIZE(rb, len) ((RD_MEM(rb) + (len)) & ~(RD_ALLOC_GR - 1)) static ssize_t -generic_read(struct socket *socket, unsigned char *data, int len) +generic_read(struct socket *socket, char *data, int len) { ssize_t rd = safe_read(socket->fd, data, len); @@ -1055,7 +1055,7 @@ read_response_from_socket(struct socket *socket) } void -request_from_socket(struct socket *socket, unsigned char *data, int datalen, +request_from_socket(struct socket *socket, char *data, int datalen, struct connection_state state, enum socket_state sock_state, socket_read_T read_done) { diff --git a/src/network/socket.h b/src/network/socket.h index 99f6fbd8..a2740b88 100644 --- a/src/network/socket.h +++ b/src/network/socket.h @@ -65,7 +65,7 @@ struct read_buffer { int length; int freespace; - unsigned char data[1]; /* must be at end of struct */ + char data[1]; /* must be at end of struct */ }; struct socket { @@ -161,11 +161,11 @@ void read_from_socket(struct socket *socket, struct read_buffer *buffer, /* Writes @datalen bytes from @data buffer to the passed @socket. When all data * is written the @done callback will be called. */ void write_to_socket(struct socket *socket, - unsigned char *data, int datalen, + char *data, int datalen, struct connection_state state, socket_write_T write_done); /* Send request and get response. */ -void request_from_socket(struct socket *socket, unsigned char *data, int datalen, +void request_from_socket(struct socket *socket, char *data, int datalen, struct connection_state state, enum socket_state sock_state, socket_read_T read_done); diff --git a/src/network/ssl/match-hostname.c b/src/network/ssl/match-hostname.c index 80d93b02..6e379c77 100644 --- a/src/network/ssl/match-hostname.c +++ b/src/network/ssl/match-hostname.c @@ -39,13 +39,13 @@ * This function does not allocate memory, and consumes at most * O(@a hostname_length * @a pattern_length) time. */ int -match_hostname_pattern(const unsigned char *hostname, +match_hostname_pattern(const char *hostname, size_t hostname_length, - const unsigned char *pattern, + const char *pattern, size_t pattern_length) { - const unsigned char *const hostname_end = hostname + hostname_length; - const unsigned char *const pattern_end = pattern + pattern_length; + const char *const hostname_end = hostname + hostname_length; + const char *const pattern_end = pattern + pattern_length; assert(hostname <= hostname_end); assert(pattern <= pattern_end); @@ -53,7 +53,7 @@ match_hostname_pattern(const unsigned char *hostname, while (pattern < pattern_end) { if (*pattern == '*') { - const unsigned char *next_wildcard; + const char *next_wildcard; size_t literal_length; ++pattern; @@ -97,7 +97,7 @@ match_hostname_pattern(const unsigned char *hostname, * '*' must not match such characters. * Do the same if invalid UTF-8 is found. * Cast away const. */ - uni = utf8_to_unicode((unsigned char **) &hostname, + uni = utf8_to_unicode((char **) &hostname, hostname_end); if (uni == 0x002E || uni == 0x3002 diff --git a/src/network/ssl/match-hostname.h b/src/network/ssl/match-hostname.h index fda7dee5..0a5f5a30 100644 --- a/src/network/ssl/match-hostname.h +++ b/src/network/ssl/match-hostname.h @@ -6,9 +6,9 @@ extern "C" { #endif -int match_hostname_pattern(const unsigned char *hostname, +int match_hostname_pattern(const char *hostname, size_t hostname_length, - const unsigned char *pattern, + const char *pattern, size_t pattern_length); #ifdef __cplusplus diff --git a/src/network/ssl/socket.c b/src/network/ssl/socket.c index a68a01c8..37826a9e 100644 --- a/src/network/ssl/socket.c +++ b/src/network/ssl/socket.c @@ -108,7 +108,7 @@ verify_certificates(struct socket *socket) gnutls_session_t session = *(ssl_t *)socket->ssl; struct connection *conn = socket->conn; const gnutls_datum_t *cert_list; - unsigned char *hostname; + char *hostname; int ret; unsigned int cert_list_size, status; @@ -191,7 +191,7 @@ verify_certificates(struct socket *socket) * SubjectAltName, rather than in commonName. For comparing those, * match_uri_host_ip() must be used instead of this function. */ static int -match_uri_host_name(const unsigned char *uri_host, +match_uri_host_name(const char *uri_host, ASN1_STRING *cert_host_asn1) { const size_t uri_host_len = strlen(uri_host); @@ -211,7 +211,7 @@ match_uri_host_name(const unsigned char *uri_host, goto mismatch; matched = match_hostname_pattern(uri_host, uri_host_len, - cert_host, cert_host_len); + (char *)cert_host, cert_host_len); mismatch: if (cert_host) @@ -244,7 +244,7 @@ mismatch: * in the name constraints extension of a CA certificate (RFC 5280 * section 4.2.1.10). */ static int -match_uri_host_ip(const unsigned char *uri_host, +match_uri_host_ip(const char *uri_host, ASN1_OCTET_STRING *cert_host_asn1) { #ifdef HAVE_ASN1_STRING_GET0_DATA @@ -302,7 +302,7 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx) SSL *ssl; struct socket *socket; struct connection *conn; - unsigned char *host_in_uri; + char *host_in_uri; GENERAL_NAMES *alts; int saw_dns_name = 0; int matched = 0; @@ -420,7 +420,7 @@ int ssl_connect(struct socket *socket) { int ret; - unsigned char *server_name; + char *server_name; struct connection *conn = socket->conn; /* TODO: Recode server_name to UTF-8. */ @@ -455,7 +455,7 @@ ssl_connect(struct socket *socket) verify_callback); if (get_opt_bool("connection.ssl.client_cert.enable", NULL)) { - unsigned char *client_cert; + char *client_cert; #ifdef CONFIG_NSS_COMPAT_OSSL client_cert = get_opt_str( @@ -532,7 +532,7 @@ ssl_connect(struct socket *socket) /* Return enum socket_error on error, bytes written on success. */ ssize_t -ssl_write(struct socket *socket, unsigned char *data, int len) +ssl_write(struct socket *socket, char *data, int len) { ssize_t wr = ssl_do_write(socket, data, len); @@ -561,7 +561,7 @@ ssl_write(struct socket *socket, unsigned char *data, int len) /* Return enum socket_error on error, bytes read on success. */ ssize_t -ssl_read(struct socket *socket, unsigned char *data, int len) +ssl_read(struct socket *socket, char *data, int len) { ssize_t rd = ssl_do_read(socket, data, len); diff --git a/src/network/ssl/socket.h b/src/network/ssl/socket.h index 68f5b45e..bf453354 100644 --- a/src/network/ssl/socket.h +++ b/src/network/ssl/socket.h @@ -11,8 +11,8 @@ extern "C" { struct socket; int ssl_connect(struct socket *socket); -ssize_t ssl_write(struct socket *socket, unsigned char *data, int len); -ssize_t ssl_read(struct socket *socket, unsigned char *data, int len); +ssize_t ssl_write(struct socket *socket, char *data, int len); +ssize_t ssl_read(struct socket *socket, char *data, int len); int ssl_close(struct socket *socket); #endif diff --git a/src/network/ssl/ssl.c b/src/network/ssl/ssl.c index f141df50..1938fe5d 100644 --- a/src/network/ssl/ssl.c +++ b/src/network/ssl/ssl.c @@ -78,7 +78,7 @@ socket_SSL_ex_data_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, static void init_openssl(struct module *module) { - unsigned char f_randfile[PATH_MAX]; + char f_randfile[PATH_MAX]; /* In a nutshell, on OS's without a /dev/urandom, the OpenSSL library * cannot initialize the PRNG and so every attempt to use SSL fails. @@ -189,7 +189,7 @@ static void init_gnutls(struct module *module) { int ret = gnutls_global_init(); - unsigned char *ca_file = get_opt_str("connection.ssl.trusted_ca_file", + char *ca_file = get_opt_str("connection.ssl.trusted_ca_file", NULL); if (ret < 0) @@ -218,7 +218,7 @@ init_gnutls(struct module *module) GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT); if (get_opt_bool("connection.ssl.client_cert.enable", NULL)) { - unsigned char *client_cert; + char *client_cert; client_cert = get_opt_str("connection.ssl.client_cert.file", NULL); if (!*client_cert) { @@ -335,7 +335,7 @@ struct module ssl_module = struct_module( int init_ssl_connection(struct socket *socket, - const unsigned char *server_name) + const char *server_name) { #ifdef USE_OPENSSL socket->ssl = SSL_new(context); @@ -446,7 +446,7 @@ done_ssl_connection(struct socket *socket) socket->ssl = NULL; } -unsigned char * +char * get_ssl_connection_cipher(struct socket *socket) { ssl_t *ssl = socket->ssl; diff --git a/src/network/ssl/ssl.h b/src/network/ssl/ssl.h index 1a6151de..fca7d457 100644 --- a/src/network/ssl/ssl.h +++ b/src/network/ssl/ssl.h @@ -26,12 +26,12 @@ extern struct module ssl_module; * server_name does not affect how ELinks verifies the certificate * after the server has returned it. */ int init_ssl_connection(struct socket *socket, - const unsigned char *server_name); + const char *server_name); /* Releases the SSL connection data */ void done_ssl_connection(struct socket *socket); -unsigned char *get_ssl_connection_cipher(struct socket *socket); +char *get_ssl_connection_cipher(struct socket *socket); #if defined(CONFIG_OPENSSL) || defined(CONFIG_NSS_COMPAT_OSSL) extern int socket_SSL_ex_data_idx; diff --git a/src/network/ssl/test/match-hostname-test.c b/src/network/ssl/test/match-hostname-test.c index fbdf6fa6..72b424ac 100644 --- a/src/network/ssl/test/match-hostname-test.c +++ b/src/network/ssl/test/match-hostname-test.c @@ -14,8 +14,8 @@ struct match_hostname_pattern_test_case { - const unsigned char *pattern; - const unsigned char *hostname; + const char *pattern; + const char *hostname; int match; }; diff --git a/src/network/state.c b/src/network/state.c index 92430b05..b0af6151 100644 --- a/src/network/state.c +++ b/src/network/state.c @@ -21,7 +21,7 @@ /* Global variables */ struct s_msg_dsc { int n; - unsigned char *msg; + char *msg; }; static const struct s_msg_dsc msg_dsc[] = { {S_WAIT, N_("Waiting in queue")}, @@ -142,7 +142,7 @@ static const struct s_msg_dsc msg_dsc[] = { struct strerror_val { LIST_HEAD(struct strerror_val); - unsigned char msg[1]; /* must be last */ + char msg[1]; /* must be last */ }; static INIT_LIST_OF(struct strerror_val, strerror_buf); @@ -150,13 +150,13 @@ static INIT_LIST_OF(struct strerror_val, strerror_buf); /* It returns convenient error message, depending on @state. * It never returns NULL (if one changes that, be warn that * callers may not test for this condition) --Zas */ -unsigned char * +char * get_state_message(struct connection_state state, struct terminal *term) { - unsigned char *e; + char *e; struct strerror_val *s; int len; - unsigned char *unknown_error = _("Unknown error", term); + char *unknown_error = _("Unknown error", term); if (!is_system_error(state)) { int i; @@ -168,7 +168,7 @@ get_state_message(struct connection_state state, struct terminal *term) return unknown_error; } - e = (unsigned char *) strerror(state.syserr); + e = (char *) strerror(state.syserr); if (!e || !*e) return unknown_error; len = strlen(e); diff --git a/src/network/state.h b/src/network/state.h index edc9de93..c1b8be2a 100644 --- a/src/network/state.h +++ b/src/network/state.h @@ -126,7 +126,7 @@ struct connection_state { int syserr; }; -unsigned char *get_state_message(struct connection_state state, struct terminal *term); +char *get_state_message(struct connection_state state, struct terminal *term); void done_state_message(void); static inline struct connection_state diff --git a/src/osdep/beos/beos.c b/src/osdep/beos/beos.c index 1011013f..558f700e 100644 --- a/src/osdep/beos/beos.c +++ b/src/osdep/beos/beos.c @@ -39,7 +39,7 @@ int get_system_env(void) { int env = get_common_env(); - unsigned char *term = getenv("TERM"); + char *term = getenv("TERM"); if (!term || (c_toupper(term[0]) == 'B' && c_toupper(term[1]) == 'E')) env |= ENV_BE; @@ -78,7 +78,7 @@ started_thr(void *data) } int -start_thr(void (*fn)(void *), void *data, unsigned char *name) +start_thr(void (*fn)(void *), void *data, char *name) { struct active_thread *thrd; int tid; @@ -230,7 +230,7 @@ get_output_handle(void) #if defined(HAVE_SETPGID) int -exe(unsigned char *path) +exe(char *path) { pid_t pid = fork(); diff --git a/src/osdep/beos/beos.h b/src/osdep/beos/beos.h index 05ec241e..a93ccb69 100644 --- a/src/osdep/beos/beos.h +++ b/src/osdep/beos/beos.h @@ -10,8 +10,8 @@ extern "C" { struct terminal; -void open_in_new_be(struct terminal *term, unsigned char *exe_name, - unsigned char *param); +void open_in_new_be(struct terminal *term, char *exe_name, + char *param); #endif diff --git a/src/osdep/getifaddrs.c b/src/osdep/getifaddrs.c index 3936ba7e..7dba22ad 100644 --- a/src/osdep/getifaddrs.c +++ b/src/osdep/getifaddrs.c @@ -291,10 +291,10 @@ print_addr(const char *s, struct sockaddr *sa) #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN for (i = 0; i < sa->sa_len - ((long) sa->sa_data - (long) &sa->sa_family); i++) - printf("%02x", ((unsigned char *) sa->sa_data)[i]); + printf("%02x", ((char *) sa->sa_data)[i]); #else for (i = 0; i < sizeof(sa->sa_data); i++) - printf("%02x", ((unsigned char *) sa->sa_data)[i]); + printf("%02x", ((char *) sa->sa_data)[i]); #endif printf("\n"); } diff --git a/src/osdep/newwin.c b/src/osdep/newwin.c index 8c92300d..8c39ca6c 100644 --- a/src/osdep/newwin.c +++ b/src/osdep/newwin.c @@ -60,10 +60,10 @@ can_open_in_new(struct terminal *term) } void -open_new_window(struct terminal *term, unsigned char *exe_name, - enum term_env_type environment, unsigned char *param) +open_new_window(struct terminal *term, char *exe_name, + enum term_env_type environment, char *param) { - unsigned char *command = NULL; + char *command = NULL; int i; foreach_open_in_new (i, environment) { @@ -74,20 +74,20 @@ open_new_window(struct terminal *term, unsigned char *exe_name, assert(command); if (environment & ENV_XWIN) { - unsigned char *xterm = getenv("ELINKS_XTERM"); + char *xterm = getenv("ELINKS_XTERM"); if (!xterm) xterm = getenv("LINKS_XTERM"); if (xterm) command = xterm; } else if (environment & ENV_TWIN) { - unsigned char *twterm = getenv("ELINKS_TWTERM"); + char *twterm = getenv("ELINKS_TWTERM"); if (!twterm) twterm = getenv("LINKS_TWTERM"); if (twterm) command = twterm; } command = straconcat(command, " ", exe_name, " ", param, - (unsigned char *) NULL); + (char *) NULL); if (!command) return; exec_on_terminal(term, command, "", TERM_EXEC_NEWWIN); diff --git a/src/osdep/newwin.h b/src/osdep/newwin.h index 8747ad03..4baa195c 100644 --- a/src/osdep/newwin.h +++ b/src/osdep/newwin.h @@ -11,8 +11,8 @@ extern "C" { * of how new windows can be opened. */ struct open_in_new { enum term_env_type env; /* The term->environment the entry covers */ - unsigned char *command; /* The default command for openning a window */ - unsigned char *text; /* The menu text */ + char *command; /* The default command for openning a window */ + char *text; /* The menu text */ }; /* The table containing all the possible environment types */ @@ -32,8 +32,8 @@ int can_open_in_new(struct terminal *term); * * For the ENV_XWIN environment, @exe_name being 'elinks' and @param empty the * window will be opened using: 'xterm -e elinks' */ -void open_new_window(struct terminal *term, unsigned char *exe_name, - enum term_env_type environment, unsigned char *param); +void open_new_window(struct terminal *term, char *exe_name, + enum term_env_type environment, char *param); #ifdef __cplusplus } diff --git a/src/osdep/os2/os2.c b/src/osdep/os2/os2.c index 6477bb46..e0797188 100644 --- a/src/osdep/os2/os2.c +++ b/src/osdep/os2/os2.c @@ -159,12 +159,12 @@ get_terminal_size(int fd, int *x, int *y) int -exe(unsigned char *path) +exe(char *path) { int flags = P_SESSION; int pid; int ret = -1; - unsigned char *shell = get_shell(); + char *shell = get_shell(); if (is_xterm()) flags |= P_BACKGROUND; @@ -175,7 +175,7 @@ exe(unsigned char *path) return ret; } -unsigned char * +char * get_clipboard_text(void) { PTIB tib; @@ -183,7 +183,7 @@ get_clipboard_text(void) HAB hab; HMQ hmq; ULONG oldType; - unsigned char *ret = 0; + char *ret = 0; DosGetInfoBlocks(&tib, &pib); @@ -220,7 +220,7 @@ get_clipboard_text(void) } void -set_clipboard_text(unsigned char *data) +set_clipboard_text(char *data) { PTIB tib; PPIB pib; @@ -254,12 +254,12 @@ set_clipboard_text(unsigned char *data) pib->pib_ultype = oldType; } -unsigned char * +char * get_window_title(int codepage) { #ifndef DEBUG_OS2 - unsigned char *org_switch_title; - unsigned char *org_win_title = NULL; + char *org_switch_title; + char *org_win_title = NULL; static PTIB tib = NULL; static PPIB pib = NULL; ULONG oldType; @@ -303,7 +303,7 @@ get_window_title(int codepage) } void -set_window_title(unsigned char *title, int codepage) +set_window_title(char *title, int codepage) { #ifndef DEBUG_OS2 static PTIB tib; @@ -321,7 +321,7 @@ set_window_title(unsigned char *title, int codepage) memset(&swData, 0, sizeof(swData)); if (hSw == NULLHANDLE) hSw = WinQuerySwitchHandle(0, pib->pib_ulpid); if (hSw != NULLHANDLE && !WinQuerySwitchEntry(hSw, &swData)) { - unsigned char *p; + char *p; safe_strncpy(new_title, title, MAXNAMEL - 1); sanitize_title(new_title); @@ -454,7 +454,7 @@ int mouse_h = -1; struct os2_mouse_spec { int p[2]; - void (*fn)(void *, unsigned char *, int); + void (*fn)(void *, char *, int); void *data; unsigned char buffer[sizeof(struct interlink_event)]; int bufptr; @@ -515,7 +515,7 @@ mouse_thread(void *p) } set_mouse_interlink_event(&ev, mouse.x, mouse.y, mouse.button); - if (hard_write(oms->p[1], (unsigned char *) &ev, sizeof(ev)) != sizeof(ev)) break; + if (hard_write(oms->p[1], (char *) &ev, sizeof(ev)) != sizeof(ev)) break; } #ifdef HAVE_SYS_FMUTEX_H _fmutex_request(&mouse_mutex, _FMR_IGNINT); @@ -550,7 +550,7 @@ mouse_handle(struct os2_mouse_spec *oms) } void * -handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), +handle_mouse(int cons, void (*fn)(void *, char *, int), void *data) { struct os2_mouse_spec *oms; @@ -758,7 +758,7 @@ get_input_handle(void) #ifdef USE_OPEN_PREALLOC int -open_prealloc(unsigned char *name, int flags, int mode, off_t siz) +open_prealloc(char *name, int flags, int mode, off_t siz) { /* This is good for OS/2, where this will prevent file fragmentation, * preallocating the desired file size upon open(). */ diff --git a/src/osdep/os2/os2.h b/src/osdep/os2/os2.h index d432df75..733a4b3f 100644 --- a/src/osdep/os2/os2.h +++ b/src/osdep/os2/os2.h @@ -10,10 +10,10 @@ extern "C" { struct terminal; -void open_in_new_vio(struct terminal *term, unsigned char *exe_name, - unsigned char *param); -void open_in_new_fullscreen(struct terminal *term, unsigned char *exe_name, - unsigned char *param); +void open_in_new_vio(struct terminal *term, char *exe_name, + char *param); +void open_in_new_fullscreen(struct terminal *term, char *exe_name, + char *param); #endif diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index a8369094..ddd0312d 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -137,18 +137,18 @@ set_ip_tos_throughput(int socket) } int -get_e(unsigned char *env) +get_e(char *env) { char *v = getenv(env); return (v ? atoi(v) : 0); } -unsigned char * +char * get_cwd(void) { int bufsize = 128; - unsigned char *buf; + char *buf; while (1) { buf = mem_alloc(bufsize); @@ -165,15 +165,15 @@ get_cwd(void) } void -set_cwd(unsigned char *path) +set_cwd(char *path) { if (path) while (chdir(path) && errno == EINTR); } -unsigned char * +char * get_shell(void) { - unsigned char *shell = GETSHELL; + char *shell = GETSHELL; if (!shell || !*shell) shell = DEFAULT_SHELL; @@ -295,16 +295,16 @@ is_gnuscreen(void) static int check_more_envs(void) { - unsigned char *envs[] = { "WINDOWID", + char *envs[] = { "WINDOWID", "KONSOLE_DCOP_SESSION", "GNOME_TERMINAL_SERVICE", NULL }; - unsigned char **v; + char **v; for (v = envs; *v; ++v) { - unsigned char *value = getenv(*v); + char *value = getenv(*v); if (value && *value) { return 1; @@ -338,7 +338,7 @@ is_xterm(void) * In general, proper xterm detection is a nightmarish task... * * -- Adam Borowski <kilobyte@mimuw.edu.pl> */ - unsigned char *display = getenv("DISPLAY"); + char *display = getenv("DISPLAY"); xt = (display && *display && check_more_envs()); } @@ -355,16 +355,16 @@ unsigned int resize_count = 0; #if !(defined(CONFIG_OS_BEOS) && defined(HAVE_SETPGID)) && !defined(CONFIG_OS_WIN32) int -exe(unsigned char *path) +exe(char *path) { return system(path); } #endif -static unsigned char *clipboard; +static char *clipboard; -unsigned char * +char * get_clipboard_text(void) { /* The following support for GNU Screen's clipboard is @@ -403,13 +403,13 @@ get_clipboard_text(void) } void -set_clipboard_text(unsigned char *data) +set_clipboard_text(char *data) { #ifdef HAVE_ACCESS - unsigned char *f = get_opt_str("ui.clipboard_file", NULL); + char *f = get_opt_str("ui.clipboard_file", NULL); if (f && *f) { - unsigned char *filename = expand_tilde(f); + char *filename = expand_tilde(f); if (filename) { if (access(filename, W_OK) >= 0) { @@ -445,7 +445,7 @@ set_clipboard_text(unsigned char *data) /* Set xterm-like term window's title. */ void -set_window_title(unsigned char *title, int codepage) +set_window_title(char *title, int codepage) { struct string filtered; @@ -458,8 +458,8 @@ set_window_title(unsigned char *title, int codepage) /* Copy title to filtered if different from NULL */ if (title) { - unsigned char *scan = title; - unsigned char *end = title + strlen(title); + char *scan = title; + char *end = title + strlen(title); /* Remove control characters, so that they cannot * interfere with the command we send to the terminal. @@ -470,7 +470,7 @@ set_window_title(unsigned char *title, int codepage) * potential alternative set_window_title() routines might * want to take different precautions. */ for (;;) { - unsigned char *charbegin = scan; + char *charbegin = scan; unicode_val_T unicode = cp_to_unicode(codepage, &scan, end); int charlen = scan - charbegin; @@ -533,14 +533,14 @@ catch_x_error(void) * * @return the string that the caller must free with mem_free(), * or NULL on error. */ -static unsigned char * +static char * xprop_to_string(Display *display, const XTextProperty *text_prop, int to_cp) { int from_cp; char **list = NULL; int count = 0; struct conv_table *convert_table; - unsigned char *ret = NULL; + char *ret = NULL; /* <X11/Xlib.h> defines X_HAVE_UTF8_STRING if * Xutf8TextPropertyToTextList is available. @@ -578,18 +578,18 @@ xprop_to_string(Display *display, const XTextProperty *text_prop, int to_cp) } #endif /* HAVE_X11 */ -unsigned char * +char * get_window_title(int codepage) { #ifdef HAVE_X11 /* Following code is stolen from our beloved vim. */ - unsigned char *winid; + char *winid; Display *display; Window window, root, parent, *children; XTextProperty text_prop; Status status; unsigned int num_children; - unsigned char *ret = NULL; + char *ret = NULL; if (!is_xterm()) return NULL; @@ -641,7 +641,7 @@ resize_window(int width, int height, int old_width, int old_height) { #ifdef HAVE_X11 /* Following code is stolen from our beloved vim. */ - unsigned char *winid; + char *winid; Display *display; Window window; Status status; @@ -920,7 +920,7 @@ elinks_cfmakeraw(struct termios *t) #if !defined(CONFIG_MOUSE) || (!defined(CONFIG_GPM) && !defined(CONFIG_SYSMOUSE) && !defined(OS2_MOUSE)) void * -handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), +handle_mouse(int cons, void (*fn)(void *, char *, int), void *data) { return NULL; @@ -997,7 +997,7 @@ set_highpri(void) #endif -unsigned char * +char * get_system_str(int xwin) { return xwin ? SYSTEM_STR "-xwin" : SYSTEM_STR; diff --git a/src/osdep/osdep.h b/src/osdep/osdep.h index 89763c1f..07d169f4 100644 --- a/src/osdep/osdep.h +++ b/src/osdep/osdep.h @@ -20,7 +20,7 @@ extern "C" { #endif int get_system_env(void); -int get_e(unsigned char *env); +int get_e(char *env); int is_xterm(void); int is_twterm(void); void get_terminal_size(int, int *, int *); @@ -35,18 +35,18 @@ void want_draw(void); void done_draw(void); void init_osdep(void); void terminate_osdep(void); -void *handle_mouse(int, void (*)(void *, unsigned char *, int), void *); +void *handle_mouse(int, void (*)(void *, char *, int), void *); void unhandle_mouse(void *); void suspend_mouse(void *); void resume_mouse(void *); int start_thread(void (*)(void *, int), void *, int); -unsigned char *get_clipboard_text(void); -void set_clipboard_text(unsigned char *); -void set_window_title(unsigned char *, int codepage); -unsigned char *get_window_title(int codepage); +char *get_clipboard_text(void); +void set_clipboard_text(char *); +void set_window_title(char *, int codepage); +char *get_window_title(int codepage); void block_stdin(void); void unblock_stdin(void); -int exe(unsigned char *); +int exe(char *); int resize_window(int, int, int, int); int can_resize_window(int); int can_open_os_shell(int); @@ -59,16 +59,16 @@ void prealloc_truncate(int, off_t); static inline void prealloc_truncate(int x, int y) { } #endif -unsigned char *get_system_str(int); +char *get_system_str(int); int set_nonblocking_fd(int); int set_blocking_fd(int); void set_ip_tos_throughput(int socket); -unsigned char *get_cwd(void); -void set_cwd(unsigned char *); +char *get_cwd(void); +void set_cwd(char *); -unsigned char *get_shell(void); +char *get_shell(void); #ifdef __cplusplus } diff --git a/src/osdep/stub.c b/src/osdep/stub.c index 5dc08057..49a17830 100644 --- a/src/osdep/stub.c +++ b/src/osdep/stub.c @@ -29,7 +29,7 @@ #include "osdep/stub.h" #include "util/conv.h" -/* These stubs are exception to our "Use (unsigned char *)!" rule. This is +/* These stubs are exception to our "Use (char *)!" rule. This is * because the stubbed functions are defined using (char *), and we could get * in trouble with this. Or when you use (foo ? strstr() : strcasestr()) and * one of these is system and another stub, we're in trouble and get "Pointer @@ -250,11 +250,11 @@ elinks_raise(int signal) * Returns `dst' (as a const) * Note: * - uses no statics - * - takes a unsigned char * not an in_addr as input */ + * - takes a char * not an in_addr as input */ static const char * -elinks_inet_ntop4(const unsigned char *src, unsigned char *dst, size_t size) +elinks_inet_ntop4(const char *src, char *dst, size_t size) { - const unsigned char *addr = inet_ntoa(*(struct in_addr*)src); + const char *addr = inet_ntoa(*(struct in_addr*)src); if (strlen(addr) >= size) { SET_ERRNO(ENOSPC); @@ -267,15 +267,15 @@ elinks_inet_ntop4(const unsigned char *src, unsigned char *dst, size_t size) #ifdef CONFIG_IPV6 /* Convert IPv6 binary address into presentation (printable) format. */ static const char * -elinks_inet_ntop6(const unsigned char *src, char *dst, size_t size) +elinks_inet_ntop6(const char *src, char *dst, size_t size) { /* Note that int32_t and int16_t need only be "at least" large enough * to contain a value of the specified size. On some systems, like * Crays, there is no such thing as an integer variable with 16 bits. * Keep this in mind if you think this function should have been coded * to use pointer overlays. All the world's not a VAX. */ - unsigned char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - unsigned char *tp; + char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char *tp; struct { long base; long len; @@ -364,10 +364,10 @@ elinks_inet_ntop(int af, const void *src, char *dst, size_t size) { switch (af) { case AF_INET: - return elinks_inet_ntop4((const unsigned char *) src, dst, size); + return elinks_inet_ntop4((const char *) src, dst, size); #ifdef CONFIG_IPV6 case AF_INET6: - return elinks_inet_ntop6((const unsigned char *) src, dst, size); + return elinks_inet_ntop6((const char *) src, dst, size); #endif default: SET_ERRNO(EAFNOSUPPORT); diff --git a/src/osdep/stub.h b/src/osdep/stub.h index f2f7c580..2f4b8081 100644 --- a/src/osdep/stub.h +++ b/src/osdep/stub.h @@ -33,7 +33,7 @@ extern "C" { #endif /* CONFIG_OWN_LIBC */ -/* These stubs are exception to our "Use (unsigned char *)!" rule. This is +/* These stubs are exception to our "Use (char *)!" rule. This is * because the stubbed functions are defined using (char *), and we could get * in trouble with this. Or when you use (foo ? strstr() : strcasestr()) and * one of these is system and another stub, we're in trouble and get "Pointer diff --git a/src/osdep/sysname.c b/src/osdep/sysname.c index 31d829d7..12e0df79 100644 --- a/src/osdep/sysname.c +++ b/src/osdep/sysname.c @@ -17,14 +17,14 @@ #include "util/string.h" -unsigned char system_name[MAX_STR_LEN]; +char system_name[MAX_STR_LEN]; #ifdef HAVE_POPEN static int got_it_from_uname_command(void) { FILE *f; - unsigned char *p; + char *p; f = popen("uname -srm", "r"); if (!f) return 0; diff --git a/src/osdep/sysname.h b/src/osdep/sysname.h index 1e0883a1..7d4b1047 100644 --- a/src/osdep/sysname.h +++ b/src/osdep/sysname.h @@ -5,7 +5,7 @@ extern "C" { #endif -extern unsigned char system_name[]; +extern char system_name[]; extern void get_system_name(void); diff --git a/src/osdep/unix/bsd.c b/src/osdep/unix/bsd.c index bac3a6cc..93e597cb 100644 --- a/src/osdep/unix/bsd.c +++ b/src/osdep/unix/bsd.c @@ -30,7 +30,7 @@ struct sysmouse_spec { void *itrm; int cheight; int cwidth; - void (*fn)(void *, unsigned char *, int); + void (*fn)(void *, char *, int); }; static void @@ -155,7 +155,7 @@ sysmouse_handler(void *data) prev_buttons = buttons; set_mouse_interlink_event(&ev, mouse.x, mouse.y, mouse.button); - sp->fn(itrm, (unsigned char *)&ev, sizeof(ev)); + sp->fn(itrm, (char *)&ev, sizeof(ev)); } static void @@ -165,7 +165,7 @@ sysmouse_signal_handler(void *data) } void * -handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), +handle_mouse(int cons, void (*fn)(void *, char *, int), void *data) { static struct sysmouse_spec mouse_spec; diff --git a/src/osdep/unix/sysinfo.h b/src/osdep/unix/sysinfo.h index 4a7c390e..55eca3aa 100644 --- a/src/osdep/unix/sysinfo.h +++ b/src/osdep/unix/sysinfo.h @@ -1,4 +1,3 @@ - #ifndef EL__OSDEP_UNIX_SYSINFO_H #define EL__OSDEP_UNIX_SYSINFO_H diff --git a/src/osdep/unix/unix.c b/src/osdep/unix/unix.c index 122d3346..29847e0f 100644 --- a/src/osdep/unix/unix.c +++ b/src/osdep/unix/unix.c @@ -26,7 +26,7 @@ struct gpm_mouse_spec { int h; int cons; - void (*fn)(void *, unsigned char *, int); + void (*fn)(void *, char *, int); void *data; }; @@ -98,7 +98,7 @@ done_mouse(void) } void * -handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), +handle_mouse(int cons, void (*fn)(void *, char *, int), void *data) { int h; diff --git a/src/osdep/win32/win32.c b/src/osdep/win32/win32.c index 4e924520..5ac33962 100644 --- a/src/osdep/win32/win32.c +++ b/src/osdep/win32/win32.c @@ -105,12 +105,12 @@ get_terminal_size(int fd, int *x, int *y) int -exe(unsigned char *path) +exe(char *path) { int rc; - unsigned char *shell = get_shell(); - unsigned char *x = *path != '"' ? " /c start /wait " : " /c start /wait \"\" "; - unsigned char *p = malloc((strlen(shell) + strlen(x) + strlen(path)) * 2 + 1); + char *shell = get_shell(); + char *x = *path != '"' ? " /c start /wait " : " /c start /wait \"\" "; + char *p = malloc((strlen(shell) + strlen(x) + strlen(path)) * 2 + 1); if (!p) return -1; @@ -262,7 +262,7 @@ gettext__parse(void *arg) } #endif -unsigned char * +char * user_appdata_directory(void) { #if _WIN32_WINNT >= 0x0500 diff --git a/src/osdep/win32/win32.h b/src/osdep/win32/win32.h index f634c4c7..af24afc3 100644 --- a/src/osdep/win32/win32.h +++ b/src/osdep/win32/win32.h @@ -15,9 +15,9 @@ extern "C" { struct terminal; -void open_in_new_win32(struct terminal *term, unsigned char *exe_name, - unsigned char *param); -unsigned char *user_appdata_directory(void); +void open_in_new_win32(struct terminal *term, char *exe_name, + char *param); +char *user_appdata_directory(void); #define user_appdata_directory user_appdata_directory diff --git a/src/protocol/about.c b/src/protocol/about.c index 94ea1c61..effe6523 100644 --- a/src/protocol/about.c +++ b/src/protocol/about.c @@ -16,8 +16,8 @@ #ifndef CONFIG_SMALL struct about_page { - unsigned char *name; - unsigned char *string; + char *name; + char *string; }; static const struct about_page about_pages[] = { @@ -100,7 +100,7 @@ about_protocol_handler(struct connection *conn) for (; page->name; page++) { int len; - unsigned char *str; + char *str; if (strcmp(conn->uri->data, page->name)) continue; diff --git a/src/protocol/auth/auth.c b/src/protocol/auth/auth.c index dc1c1643..8a79bdce 100644 --- a/src/protocol/auth/auth.c +++ b/src/protocol/auth/auth.c @@ -33,7 +33,7 @@ static INIT_LIST_OF(struct auth_entry, auth_entry_list); * NULL, it returns the first record found. If realm isn't NULL, it returns * the first record that matches exactly (url and realm) if any. */ static struct auth_entry * -find_auth_entry(struct uri *uri, unsigned char *realm) +find_auth_entry(struct uri *uri, char *realm) { struct auth_entry *match = NULL, *entry; @@ -92,7 +92,7 @@ set_auth_password(struct auth_entry *entry, struct uri *uri) static void done_auth_entry(struct auth_entry *entry); static struct auth_entry * -init_auth_entry(struct uri *uri, unsigned char *realm) +init_auth_entry(struct uri *uri, char *realm) { struct auth_entry *entry; @@ -132,8 +132,8 @@ init_auth_entry(struct uri *uri, unsigned char *realm) /* Returns the new entry or updates an existing one. Sets the @valid member if * updating is required so it can be tested if the user should be queried. */ struct auth_entry * -add_auth_entry(struct uri *uri, unsigned char *realm, unsigned char *nonce, - unsigned char *opaque, unsigned int digest) +add_auth_entry(struct uri *uri, char *realm, char *nonce, + char *opaque, unsigned int digest) { struct auth_entry *entry; diff --git a/src/protocol/auth/auth.h b/src/protocol/auth/auth.h index 123cbbad..f238f7fd 100644 --- a/src/protocol/auth/auth.h +++ b/src/protocol/auth/auth.h @@ -22,14 +22,14 @@ struct auth_entry { * current URI that needs to send authorization. */ struct uri *uri; - unsigned char *realm; - unsigned char *nonce; - unsigned char *opaque; + char *realm; + char *nonce; + char *opaque; struct listbox_item *box_item; - unsigned char user[AUTH_USER_MAXLEN]; - unsigned char password[AUTH_PASSWORD_MAXLEN]; + char user[AUTH_USER_MAXLEN]; + char password[AUTH_PASSWORD_MAXLEN]; unsigned int nc; /* nonce count */ @@ -42,8 +42,8 @@ struct auth_entry { (*(_entry_)->user || *(_entry_)->password) struct auth_entry *find_auth(struct uri *); -struct auth_entry *add_auth_entry(struct uri *, unsigned char *, - unsigned char *, unsigned char *, unsigned int); +struct auth_entry *add_auth_entry(struct uri *, char *, + char *, char *, unsigned int); void del_auth_entry(struct auth_entry *); void free_auth(void); struct auth_entry *get_invalid_auth_entry(void); diff --git a/src/protocol/auth/dialogs.c b/src/protocol/auth/dialogs.c index 7c734f13..1f9a435d 100644 --- a/src/protocol/auth/dialogs.c +++ b/src/protocol/auth/dialogs.c @@ -40,7 +40,7 @@ auth_ok(void *data) #ifdef CONFIG_FORMHIST if (get_opt_bool("document.browse.forms.show_formhist", ses)) { - unsigned char *url = get_uri_string(entry->uri, URI_HTTP_AUTH); + char *url = get_uri_string(entry->uri, URI_HTTP_AUTH); if (url) { struct form form; @@ -105,7 +105,7 @@ do_auth_dialog(struct session *ses, void *data) struct dialog_data *dlg_data; struct terminal *term = ses->tab->term; struct auth_entry *a = get_invalid_auth_entry(); - unsigned char sticker[MAX_STR_LEN], *text; + char sticker[MAX_STR_LEN], *text; int sticker_len; if (!a || a->blocked) return; @@ -115,8 +115,8 @@ do_auth_dialog(struct session *ses, void *data) #ifdef CONFIG_FORMHIST { - unsigned char *user = get_form_history_value(text, "user"); - unsigned char *password = get_form_history_value(text, "password"); + char *user = get_form_history_value(text, "user"); + char *password = get_form_history_value(text, "password"); if (user) { strncpy(a->user, user, AUTH_USER_MAXLEN - 1); @@ -187,7 +187,7 @@ is_auth_entry_used(struct listbox_item *item) return is_object_used((struct auth_entry *) item->udata); } -static unsigned char * +static char * get_auth_entry_text(struct listbox_item *item, struct terminal *term) { struct auth_entry *auth_entry = item->udata; @@ -195,7 +195,7 @@ get_auth_entry_text(struct listbox_item *item, struct terminal *term) return get_uri_string(auth_entry->uri, URI_HTTP_AUTH); } -static unsigned char * +static char * get_auth_entry_info(struct listbox_item *item, struct terminal *term) { struct auth_entry *auth_entry = item->udata; diff --git a/src/protocol/auth/digest.c b/src/protocol/auth/digest.c index 5b3da02d..077ddabb 100644 --- a/src/protocol/auth/digest.c +++ b/src/protocol/auth/digest.c @@ -93,10 +93,10 @@ init_uri_method_digest(md5_digest_hex_T uri_method, struct uri *uri) /* FIXME: Support for also digesting: <nonce-count> ':' <cnonce> ':' <qoup> ':' * before digesting the H(A2) value if the qop Digest header entry parameter is * non-empty. */ -static unsigned char * +static char * hexl(unsigned int nc) { - static unsigned char buf[9]; + static char buf[9]; snprintf(buf, 9, "%08x", nc); return buf; @@ -133,7 +133,7 @@ init_response_digest(md5_digest_hex_T response, struct auth_entry *entry, } -unsigned char * +char * get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri) { struct string string; @@ -167,10 +167,10 @@ get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri) add_to_string(&string, hexl(entry->nc)); add_to_string(&string, ", cnonce=\""); - add_bytes_to_string(&string, cnonce, sizeof(md5_digest_hex_T)); + add_bytes_to_string(&string, (char *)cnonce, sizeof(md5_digest_hex_T)); add_to_string(&string, "\", "); add_to_string(&string, "response=\""); - add_bytes_to_string(&string, response, sizeof(md5_digest_hex_T)); + add_bytes_to_string(&string, (char *)response, sizeof(md5_digest_hex_T)); add_to_string(&string, "\""); if (entry->opaque) { diff --git a/src/protocol/auth/digest.h b/src/protocol/auth/digest.h index d56bfc13..2ea41e6a 100644 --- a/src/protocol/auth/digest.h +++ b/src/protocol/auth/digest.h @@ -9,7 +9,7 @@ extern "C" { struct auth_entry; struct uri; -unsigned char * +char * get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri); #ifdef __cplusplus diff --git a/src/protocol/bittorrent/bencoding.c b/src/protocol/bittorrent/bencoding.c index ca04adc1..3bddba6e 100644 --- a/src/protocol/bittorrent/bencoding.c +++ b/src/protocol/bittorrent/bencoding.c @@ -105,7 +105,7 @@ enum bencoding_token { static inline void scan_bencoding_token(struct scanner *scanner, struct scanner_token *token) { - const unsigned char *string = scanner->position; + const char *string = scanner->position; unsigned char first_char = *string; enum bencoding_token type = BENCODING_TOKEN_NONE; int real_length = -1; @@ -136,7 +136,7 @@ scan_bencoding_token(struct scanner *scanner, struct scanner_token *token) type = BENCODING_TOKEN_END; } else if (is_bencoding_integer(first_char)) { - const unsigned char *integer_start = string; + const char *integer_start = string; /* Signedness. */ if (*string == '-') string++; @@ -241,7 +241,7 @@ struct scanner_info bencoding_scanner_info = { /* ************************************************************************** */ struct bencoding_dictionary_info { - unsigned char *key; + char *key; enum bencoding_token key_type; enum bencoding_token value_type; }; @@ -327,7 +327,7 @@ check_bencoding_dictionary_entry(struct scanner *scanner, static off_t parse_bencoding_integer(struct scanner_token *token) { - const unsigned char *string = token->string; + const char *string = token->string; int pos = 0, length = token->length; off_t integer = 0; int sign = 1; @@ -355,8 +355,8 @@ parse_bencoding_integer(struct scanner_token *token) return integer; } -static unsigned char * -normalize_bencoding_path(const unsigned char *path, int pathlen, +static char * +normalize_bencoding_path(const char *path, int pathlen, int *malicious) { struct string string; @@ -395,7 +395,7 @@ normalize_bencoding_path(const unsigned char *path, int pathlen, * template and will have the given path after it has been normalized and * checked for sanity. */ static enum bittorrent_state -add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path, +add_bittorrent_file(struct bittorrent_meta *meta, char *path, struct bittorrent_file *template_) { struct bittorrent_file *file; @@ -717,7 +717,7 @@ parse_bittorrent_metafile(struct bittorrent_meta *meta, switch (check_bencoding_dictionary_entry(&scanner, &value)) { case BENCODING_TOKEN_ANNOUNCE: { - unsigned char *value_string; + char *value_string; struct uri *uri; value_string = memacpy(value->string, value->length); @@ -741,7 +741,7 @@ parse_bittorrent_metafile(struct bittorrent_meta *meta, case BENCODING_TOKEN_INFO: { - const unsigned char *start = value->string; + const char *start = value->string; struct scanner_token *token; enum bittorrent_state state; @@ -753,8 +753,8 @@ parse_bittorrent_metafile(struct bittorrent_meta *meta, assert(token && token->type == BENCODING_TOKEN_END); /* Digest the dictionary to create the info hash. */ - SHA1(start, token->string + token->length - start, - meta->info_hash); + SHA1((unsigned char *)start, token->string + token->length - start, + (unsigned char *)meta->info_hash); skip_scanner_token(&scanner); break; @@ -887,8 +887,8 @@ parse_bencoding_peers_string(struct bittorrent_connection *bittorrent, struct scanner *scanner) { struct scanner_token *token = get_scanner_token(scanner); - const unsigned char *pos; - const unsigned char *last_peer_info_start + const char *pos; + const char *last_peer_info_start = token->string + token->length - 6; enum bittorrent_state state = BITTORRENT_STATE_OK; @@ -896,7 +896,7 @@ parse_bencoding_peers_string(struct bittorrent_connection *bittorrent, for (pos = token->string; pos <= last_peer_info_start; pos += 6) { /* Only IPv4 strings can occur in this format. */ - unsigned char ip[INET_ADDRSTRLEN]; + char ip[INET_ADDRSTRLEN]; int iplen; uint16_t port; diff --git a/src/protocol/bittorrent/common.c b/src/protocol/bittorrent/common.c index 24ab7555..b29b7ea4 100644 --- a/src/protocol/bittorrent/common.c +++ b/src/protocol/bittorrent/common.c @@ -25,10 +25,10 @@ const bittorrent_id_T BITTORRENT_NULL_ID; /* Debug function which returns printable peer ID. */ -unsigned char * +char * get_peer_id(bittorrent_id_T peer_id) { - static unsigned char hex[41]; + static char hex[41]; int i, j; if (bittorrent_id_is_empty(peer_id)) { @@ -52,12 +52,12 @@ get_peer_id(bittorrent_id_T peer_id) return hex; } -unsigned char * +char * get_peer_message(enum bittorrent_message_id message_id) { static struct { enum bittorrent_message_id message_id; - unsigned char *name; + char *name; } messages[] = { { BITTORRENT_MESSAGE_INCOMPLETE, "incomplete" }, { BITTORRENT_MESSAGE_KEEP_ALIVE, "keep-alive" }, @@ -83,10 +83,10 @@ get_peer_message(enum bittorrent_message_id message_id) } -unsigned char * +char * get_hexed_bittorrent_id(bittorrent_id_T id) { - static unsigned char hex[SHA_DIGEST_LENGTH * 2 + 1]; + static char hex[SHA_DIGEST_LENGTH * 2 + 1]; int i; for (i = 0; i < sizeof(bittorrent_id_T); i++) { @@ -103,14 +103,14 @@ get_hexed_bittorrent_id(bittorrent_id_T id) int bittorrent_piece_is_valid(struct bittorrent_meta *meta, - uint32_t piece, unsigned char *data, uint32_t datalen) + uint32_t piece, char *data, uint32_t datalen) { - unsigned char *piece_hash; + char *piece_hash; bittorrent_id_T data_hash; assert(piece < meta->pieces); - SHA1(data, datalen, data_hash); + SHA1((unsigned char *)data, datalen, (unsigned char *)data_hash); piece_hash = &meta->piece_hash[piece * SHA_DIGEST_LENGTH]; return !memcmp(data_hash, piece_hash, SHA_DIGEST_LENGTH); @@ -143,7 +143,7 @@ done_bittorrent_message(struct bittorrent_message *message) void init_bittorrent_peer_id(bittorrent_id_T peer_id) { - unsigned char *version = VERSION; + char *version = VERSION; int dots = 0; int i = 0; @@ -168,7 +168,7 @@ init_bittorrent_peer_id(bittorrent_id_T peer_id) } /* Hmm, sizeof(peer_id) don't work here. */ - random_nonce(peer_id + i, sizeof(bittorrent_id_T) - i); + random_nonce((unsigned char *)(peer_id + i), sizeof(bittorrent_id_T) - i); while (i < sizeof(bittorrent_id_T)) { peer_id[i] = hx(peer_id[i] & 0xF); i++; @@ -211,7 +211,7 @@ get_peer_from_bittorrent_pool(struct bittorrent_connection *bittorrent, enum bittorrent_state add_peer_to_bittorrent_pool(struct bittorrent_connection *bittorrent, bittorrent_id_T id, int port, - const unsigned char *ip, int iplen) + const char *ip, int iplen) { struct bittorrent_peer *peer; diff --git a/src/protocol/bittorrent/common.h b/src/protocol/bittorrent/common.h index fccb0f4f..c1c84f3a 100644 --- a/src/protocol/bittorrent/common.h +++ b/src/protocol/bittorrent/common.h @@ -73,7 +73,7 @@ struct bittorrent_message { struct uri *uri; struct connection_state state; - unsigned char string[1]; + char string[1]; }; @@ -222,7 +222,7 @@ struct bittorrent_peer { bittorrent_id_T id; /**< Unique peer ID string. */ uint16_t port; /**< The port number to connect to. */ - unsigned char ip[1]; /**< String with a IPv4 or IPv6 address. */ + char ip[1]; /**< String with a IPv4 or IPv6 address. */ }; /** Information about a file in the torrent. */ @@ -232,7 +232,7 @@ struct bittorrent_file { off_t length; /**< Length of the file in bytes. */ md5_digest_hex_T md5sum; /**< Hexadecimal MD5 sum of the file. */ int selected; - unsigned char name[1]; /**< Filename converted from path list. */ + char name[1]; /**< Filename converted from path list. */ }; enum meta_type { @@ -252,7 +252,7 @@ struct bittorrent_meta { time_t creation_date; /** Optional comment in free-form text. */ - unsigned char *comment; + char *comment; /** The announced URI of each available tracker. */ struct uri_list tracker_uris; @@ -266,7 +266,7 @@ struct bittorrent_meta { uint32_t last_piece_length; /** List of concatenated SHA1 hash values for each piece. */ - unsigned char *piece_hash; + char *piece_hash; /** The type of the torrent. */ enum meta_type type; @@ -275,7 +275,7 @@ struct bittorrent_meta { unsigned int malicious_paths:1; /** The name of either the single file or the top-most directory. */ - unsigned char *name; + char *name; /** A list with information about files in the torrent. * The list is a singleton for single-file torrents. */ @@ -355,7 +355,7 @@ struct bittorrent_connection { * this structure. So it is okay to make @c source point to data that * is part of a larger buffer. Also, there is no @c magic member here. */ struct bittorrent_const_string { - const unsigned char *source; + const char *source; int length; }; @@ -366,12 +366,12 @@ get_bittorrent_piece_length(struct bittorrent_meta *meta, uint32_t piece) ? meta->last_piece_length : meta->piece_length; } -unsigned char *get_hexed_bittorrent_id(bittorrent_id_T id); +char *get_hexed_bittorrent_id(bittorrent_id_T id); int bittorrent_piece_is_valid(struct bittorrent_meta *meta, - uint32_t piece, unsigned char *data, uint32_t datalen); + uint32_t piece, char *data, uint32_t datalen); void init_bittorrent_peer_id(bittorrent_id_T peer_id); @@ -382,7 +382,7 @@ bittorrent_id_is_known(struct bittorrent_connection *bittorrent, enum bittorrent_state add_peer_to_bittorrent_pool(struct bittorrent_connection *bittorrent, bittorrent_id_T id, int port, - const unsigned char *ip, int iplen); + const char *ip, int iplen); struct bittorrent_peer * get_peer_from_bittorrent_pool(struct bittorrent_connection *bittorrent, @@ -396,8 +396,8 @@ void done_bittorrent_message(struct bittorrent_message *message); /* Debug 'pretty printing' functions: */ /* ************************************************************************** */ -unsigned char *get_peer_id(bittorrent_id_T peer); -unsigned char *get_peer_message(enum bittorrent_message_id message_id); +char *get_peer_id(bittorrent_id_T peer); +char *get_peer_message(enum bittorrent_message_id message_id); /* ************************************************************************** */ /* Peer request management: */ diff --git a/src/protocol/bittorrent/dialogs.c b/src/protocol/bittorrent/dialogs.c index f181b47b..490a689e 100644 --- a/src/protocol/bittorrent/dialogs.c +++ b/src/protocol/bittorrent/dialogs.c @@ -28,7 +28,7 @@ struct bittorrent_download_info { LIST_OF(struct string_list_item) labels; - unsigned char *name; + char *name; int *selection; size_t size; }; @@ -219,7 +219,7 @@ void notify_bittorrent_download_complete(struct bittorrent_connection *bittorrent) { struct connection *conn = bittorrent->conn; - unsigned char *url = get_uri_string(conn->uri, URI_PUBLIC); + char *url = get_uri_string(conn->uri, URI_PUBLIC); if (!url) return; @@ -268,12 +268,12 @@ dlg_show_bittorrent_info(struct dialog_data *dlg_data, struct widget_data *widge /* Compose and return the status message about current download speed and * BitTorrent swarm info. It is called fairly often so most values used in here * should be easily accessible. */ -unsigned char * +char * get_bittorrent_message(struct download *download, struct terminal *term, - int wide, int full, unsigned char *separator) + int wide, int full, char *separator) { /* Cooresponds to the connection mode enum. */ - static unsigned char *modes_text[] = { + static char *modes_text[] = { N_("downloading (random)"), N_("downloading (rarest first)"), N_("downloading (end game)"), @@ -282,7 +282,7 @@ get_bittorrent_message(struct download *download, struct terminal *term, struct bittorrent_connection *bittorrent; struct bittorrent_peer_connection *peer; struct string string; - unsigned char *msg; + char *msg; uint32_t value; if (!download->conn @@ -449,7 +449,7 @@ get_bittorrent_message(struct download *download, struct terminal *term, void draw_bittorrent_piece_progress(struct download *download, struct terminal *term, - int x, int y, int width, unsigned char *text, + int x, int y, int width, char *text, struct color_pair *color) { struct bittorrent_connection *bittorrent; @@ -533,7 +533,7 @@ draw_bittorrent_piece_progress(struct download *download, struct terminal *term, } if (is_in_state(download->state, S_RESUME)) { - static unsigned char s[] = "????"; /* Reduce or enlarge at will. */ + static char s[] = "????"; /* Reduce or enlarge at will. */ unsigned int slen = 0; int max = int_min(sizeof(s), width) - 1; int percent = 0; @@ -567,7 +567,7 @@ bittorrent_message_dialog(struct session *ses, void *data) { struct bittorrent_message *message = data; struct string string; - unsigned char *uristring; + char *uristring; /* Don't show error dialogs for missing CSS stylesheets */ if (!init_string(&string)) @@ -700,7 +700,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; - unsigned char *text; + char *text; struct dialog *dlg; #define BITTORRENT_QUERY_WIDGETS_COUNT 6 int widgets = BITTORRENT_QUERY_WIDGETS_COUNT; diff --git a/src/protocol/bittorrent/dialogs.h b/src/protocol/bittorrent/dialogs.h index af547af9..d0ddbdc0 100644 --- a/src/protocol/bittorrent/dialogs.h +++ b/src/protocol/bittorrent/dialogs.h @@ -15,13 +15,13 @@ struct session; struct terminal; struct type_query; -unsigned char * +char * get_bittorrent_message(struct download *download, struct terminal *term, - int wide, int full, unsigned char *separator); + int wide, int full, char *separator); void draw_bittorrent_piece_progress(struct download *download, struct terminal *term, - int x, int y, int width, unsigned char *text, + int x, int y, int width, char *text, struct color_pair *meter_color); void set_bittorrent_files_for_deletion(struct download *download); diff --git a/src/protocol/bittorrent/peerconnect.c b/src/protocol/bittorrent/peerconnect.c index a610def3..90da468b 100644 --- a/src/protocol/bittorrent/peerconnect.c +++ b/src/protocol/bittorrent/peerconnect.c @@ -333,7 +333,7 @@ accept_bittorrent_peer_connection(void *____) { struct sockaddr_in addr; int peer_sock; - int addrlen = sizeof(addr); + socklen_t addrlen = sizeof(addr); struct bittorrent_peer_connection *peer; struct read_buffer *buffer; @@ -371,7 +371,7 @@ init_bittorrent_listening_socket(struct connection *conn) struct bittorrent_connection *bittorrent = conn->info; struct sockaddr_in addr, addr2; uint16_t port, max_port; - int len; + socklen_t len; /* XXX: Always add the connection to the list even if we fail so we can * safely assume it is in done_bittorrent_listening_socket(). */ diff --git a/src/protocol/bittorrent/peerwire.c b/src/protocol/bittorrent/peerwire.c index 698fa533..7cc2fa5f 100644 --- a/src/protocol/bittorrent/peerwire.c +++ b/src/protocol/bittorrent/peerwire.c @@ -232,7 +232,7 @@ add_bittorrent_peer_integer(struct string *string, uint32_t integer) { uint32_t data = htonl(integer); - add_bytes_to_string(string, (unsigned char *) &data, sizeof(data)); + add_bytes_to_string(string, (char *) &data, sizeof(data)); } /* Common lowlevel backend for composing a peer message and writing it to the @@ -243,7 +243,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer, { struct bittorrent_connection *bittorrent = peer->bittorrent; struct string string; - unsigned char msgid_str[1] = { (unsigned char) message->id }; + char msgid_str[1] = { (char) message->id }; uint32_t msglen = 0; assert(!bittorrent_peer_is_sending(peer)); @@ -253,7 +253,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer, return BITTORRENT_STATE_OUT_OF_MEM; /* Reserve 4 bytes to the message length and add the message ID byte. */ - add_bytes_to_string(&string, (unsigned char *) &msglen, sizeof(msglen)); + add_bytes_to_string(&string, (char *) &msglen, sizeof(msglen)); /* XXX: Can't use add_char_to_string() here because the message ID * can be zero. */ @@ -275,7 +275,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer, /* Are bitfield messages allowed at this point? */ assert(!peer->local.bitfield); - add_bytes_to_string(&string, bitfield->bits, bytes); + add_bytes_to_string(&string, (char *)bitfield->bits, bytes); assert(string.length == 5 + bytes); break; @@ -296,7 +296,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer, } case BITTORRENT_MESSAGE_PIECE: { - unsigned char *data; + char *data; assert(!peer->remote.choked); assert(test_bitfield_bit(bittorrent->cache->bitfield, message->piece)); @@ -338,7 +338,7 @@ do_send_bittorrent_peer_message(struct bittorrent_peer_connection *peer, /* Insert the real message length. */ msglen = string.length - sizeof(uint32_t); msglen = htonl(msglen); - memcpy(string.source, (unsigned char *) &msglen, sizeof(msglen)); + memcpy(string.source, (char *) &msglen, sizeof(msglen)); /* Any message will cause bitfield messages to become invalid. */ peer->local.bitfield = 1; @@ -471,7 +471,7 @@ read_bittorrent_peer_message(struct bittorrent_peer_connection *peer, struct bittorrent_connection *bittorrent = peer->bittorrent; enum bittorrent_state state; uint32_t piece, offset, length; - unsigned char *data; + char *data; assert(message_id != BITTORRENT_MESSAGE_INCOMPLETE); @@ -726,8 +726,8 @@ send_bittorrent_peer_handshake(struct socket *socket) struct bittorrent_peer_connection *peer = socket->conn; struct bittorrent_connection *bittorrent = peer->bittorrent; struct bittorrent_meta *meta = &bittorrent->meta; - unsigned char reserved[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - unsigned char handshake[BITTORRENT_PEER_HANDSHAKE_SIZE]; + char reserved[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + char handshake[BITTORRENT_PEER_HANDSHAKE_SIZE]; int i = 0; #define add_to_handshake(handshake, i, data) \ @@ -775,7 +775,7 @@ send_bittorrent_peer_handshake(struct socket *socket) /* Checks for the DHT flags used by atleast Brams client to indicate it supports * trackerless BitTorrent. */ static inline int -bittorrent_peer_supports_dht(unsigned char flags[8]) +bittorrent_peer_supports_dht(char flags[8]) { return !!(flags[7] & 1); } diff --git a/src/protocol/bittorrent/piececache.c b/src/protocol/bittorrent/piececache.c index 9cc894a1..c8f501c0 100644 --- a/src/protocol/bittorrent/piececache.c +++ b/src/protocol/bittorrent/piececache.c @@ -585,7 +585,7 @@ remove_bittorrent_peer_from_piece_cache(struct bittorrent_peer_connection *peer) /* Recursively create directories in a path. The last element in the path is * taken to be a filename, and simply ignored */ static enum bittorrent_state -create_bittorrent_path(unsigned char *path) +create_bittorrent_path(char *path) { int ret = mkalldirs(path); @@ -594,9 +594,9 @@ create_bittorrent_path(unsigned char *path) /* Complementary to the above rmdir()s each directory in the path. */ static void -remove_bittorrent_path(struct bittorrent_meta *meta, unsigned char *path) +remove_bittorrent_path(struct bittorrent_meta *meta, char *path) { - unsigned char *root = strstr((const char *)path, (const char *)meta->name); + char *root = strstr((const char *)path, (const char *)meta->name); int pos; assert(meta->type == BITTORRENT_MULTI_FILE); @@ -621,10 +621,10 @@ remove_bittorrent_path(struct bittorrent_meta *meta, unsigned char *path) } } -static unsigned char * +static char * get_bittorrent_file_name(struct bittorrent_meta *meta, struct bittorrent_file *file) { - unsigned char *name; + char *name; name = expand_tilde(get_opt_str("document.download.directory", NULL)); if (!name) return NULL; @@ -650,7 +650,7 @@ static int open_bittorrent_file(struct bittorrent_meta *meta, struct bittorrent_file *file, enum bittorrent_translation trans, off_t offset) { - unsigned char *name = get_bittorrent_file_name(meta, file); + char *name = get_bittorrent_file_name(meta, file); off_t seek_result; int fd; int flags = (trans == BITTORRENT_WRITE ? O_WRONLY : O_RDONLY); @@ -715,7 +715,7 @@ bittorrent_file_piece_translation(struct bittorrent_meta *meta, } foreach (file, meta->files) { - unsigned char *data; + char *data; off_t file_offset, file_length; uint32_t data_length; ssize_t length; @@ -872,7 +872,7 @@ cancel_cloned_bittorrent_peer_requests(struct bittorrent_connection *bittorrent, enum bittorrent_state add_to_bittorrent_piece_cache(struct bittorrent_peer_connection *peer, uint32_t piece, uint32_t offset, - unsigned char *data, uint32_t datalen, + char *data, uint32_t datalen, int *write_errno) { struct bittorrent_connection *bittorrent = peer->bittorrent; @@ -961,7 +961,7 @@ add_to_bittorrent_piece_cache(struct bittorrent_peer_connection *peer, return BITTORRENT_STATE_OK; } -unsigned char * +char * get_bittorrent_piece_cache_data(struct bittorrent_connection *bittorrent, uint32_t piece) { @@ -1081,7 +1081,7 @@ bittorrent_resume_writer(void *data, int fd) uint32_t piece; memcpy(&metafile.length, data, sizeof(metafile.length)); - metafile.source = (const unsigned char *) data + sizeof(metafile.length); + metafile.source = (const char *) data + sizeof(metafile.length); if (parse_bittorrent_metafile(&meta, &metafile) != BITTORRENT_STATE_OK) { done_bittorrent_meta(&meta); @@ -1292,7 +1292,7 @@ delete_bittorrent_files(struct bittorrent_connection *bittorrent) struct bittorrent_file *file; foreach (file, meta->files) { - unsigned char *name; + char *name; if (!file->selected) continue; diff --git a/src/protocol/bittorrent/piececache.h b/src/protocol/bittorrent/piececache.h index 5a1b9cad..07ed3577 100644 --- a/src/protocol/bittorrent/piececache.h +++ b/src/protocol/bittorrent/piececache.h @@ -36,7 +36,7 @@ struct bittorrent_piece_cache_entry { * May be NULL if data has not been downloaded * or the piece has been written to disk. * XXX: This memory is mmaped using the mem_mmap_*() functions. */ - unsigned char *data; + char *data; }; struct bittorrent_piece_cache { @@ -122,10 +122,10 @@ remove_bittorrent_peer_from_piece_cache(struct bittorrent_peer_connection *peer) enum bittorrent_state add_to_bittorrent_piece_cache(struct bittorrent_peer_connection *peer, uint32_t piece, uint32_t offset, - unsigned char *data, uint32_t datalen, + char *data, uint32_t datalen, int *write_errno); -unsigned char * +char * get_bittorrent_piece_cache_data(struct bittorrent_connection *bittorrent, uint32_t piece); diff --git a/src/protocol/bittorrent/tracker.c b/src/protocol/bittorrent/tracker.c index 4e4b6fac..0ae77589 100644 --- a/src/protocol/bittorrent/tracker.c +++ b/src/protocol/bittorrent/tracker.c @@ -144,7 +144,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; + char *ip, *key; struct string request; struct uri *uri = NULL; int numwant, index, min_size; @@ -207,7 +207,7 @@ do_send_bittorrent_tracker_request(struct connection *conn) } if (bittorrent->tracker.event != BITTORRENT_EVENT_REGULAR) { - unsigned char *event; + char *event; switch (bittorrent->tracker.event) { case BITTORRENT_EVENT_STARTED: diff --git a/src/protocol/common.c b/src/protocol/common.c index 7db6862b..9471b56d 100644 --- a/src/protocol/common.c +++ b/src/protocol/common.c @@ -49,7 +49,7 @@ init_directory_listing(struct string *page, struct uri *uri) struct string dirpath = NULL_STRING; struct string decoded = NULL_STRING; struct string location = NULL_STRING; - unsigned char *info; + char *info; int local = (uri->protocol == PROTOCOL_FILE); if (!init_string(page) @@ -118,9 +118,9 @@ init_directory_listing(struct string *page, struct uri *uri) /* Make the directory path with links to each subdir. */ { - const unsigned char *slash = dirpath.source; - const unsigned char *pslash = slash; - const unsigned char sep = local ? CHAR_DIR_SEP : '/'; + const char *slash = dirpath.source; + const char *pslash = slash; + const char sep = local ? CHAR_DIR_SEP : '/'; while ((slash = strchr((const char *)slash, sep)) != NULL) { done_string(&decoded); diff --git a/src/protocol/data.c b/src/protocol/data.c index be280f6f..d01ba6eb 100644 --- a/src/protocol/data.c +++ b/src/protocol/data.c @@ -61,11 +61,11 @@ ((typelen) >= sizeof(";base64") - 1 \ && !memcmp(";base64", (end) - sizeof(";base64") + 1, sizeof(";base64") - 1)) -static unsigned char * +static char * init_data_protocol_header(struct cache_entry *cached, - unsigned char *type, int typelen) + char *type, int typelen) { - unsigned char *head; + char *head; assert(typelen); @@ -74,7 +74,7 @@ init_data_protocol_header(struct cache_entry *cached, /* Set fake content type */ head = straconcat("\r\nContent-Type: ", type, "\r\n", - (unsigned char *) NULL); + (char *) NULL); mem_free(type); if (!head) return NULL; @@ -82,12 +82,12 @@ init_data_protocol_header(struct cache_entry *cached, return head; } -static unsigned char * +static char * parse_data_protocol_header(struct connection *conn, int *base64) { struct uri *uri = conn->uri; - unsigned char *end = memchr(uri->data, ',', uri->datalen); - unsigned char *type = DEFAULT_DATA_MEDIATYPE; + char *end = memchr(uri->data, ',', uri->datalen); + char *type = DEFAULT_DATA_MEDIATYPE; int typelen = sizeof(DEFAULT_DATA_MEDIATYPE) - 1; if (end) { @@ -116,7 +116,7 @@ data_protocol_handler(struct connection *conn) { struct uri *uri = conn->uri; struct cache_entry *cached = get_cache_entry(uri); - unsigned char *data_start, *data = NULL; + char *data_start, *data = NULL; int base64 = 0; int decodedlen = 0; int datalen; @@ -136,7 +136,7 @@ data_protocol_handler(struct connection *conn) datalen = uri->datalen - (data_start - uri->data); if (base64) { - unsigned char *decoded = base64_decode_bin(data_start, datalen, &decodedlen); + char *decoded = base64_decode_bin(data_start, datalen, &decodedlen); if (!decoded) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); diff --git a/src/protocol/date.c b/src/protocol/date.c index f75489ed..408ef2db 100644 --- a/src/protocol/date.c +++ b/src/protocol/date.c @@ -35,9 +35,9 @@ */ int -parse_year(const unsigned char **date_p, unsigned char *end) +parse_year(const char **date_p, char *end) { - const unsigned char *date = *date_p; + const char *date = *date_p; int year; if ((end && date + 1 >= end) @@ -67,9 +67,9 @@ parse_year(const unsigned char **date_p, unsigned char *end) } int -parse_month(const unsigned char **buf, unsigned char *end) +parse_month(const char **buf, char *end) { - const unsigned char *month = *buf; + const char *month = *buf; int monthnum; /* Check that the buffer has atleast 3 chars. */ @@ -88,9 +88,9 @@ parse_month(const unsigned char **buf, unsigned char *end) /* Return day number. */ int -parse_day(const unsigned char **date_p, unsigned char *end) +parse_day(const char **date_p, char *end) { - const unsigned char *date = *date_p; + const char *date = *date_p; int day; if ((end && date >= end) || !isdigit(*date)) @@ -106,10 +106,10 @@ parse_day(const unsigned char **date_p, unsigned char *end) } int -parse_time(const unsigned char **time, struct tm *tm, unsigned char *end) +parse_time(const char **time, struct tm *tm, char *end) { unsigned char h1, h2, m1, m2; - const unsigned char *date = *time; + const char *date = *time; #define check_time(tm) \ ((tm)->tm_hour <= 23 && (tm)->tm_min <= 59 && (tm)->tm_sec <= 59) @@ -185,7 +185,7 @@ my_timegm(struct tm *tm) * to handle GMT. */ /* FIXME: It was reported that it doesn't work somewhere :/. */ { - unsigned char *tz = getenv("TZ"); + char *tz = getenv("TZ"); if (tz && *tz) { /* Temporary disable timezone in-place. */ @@ -237,12 +237,12 @@ my_timegm(struct tm *tm) time_t -parse_date(unsigned char **date_pos, unsigned char *end, +parse_date(char **date_pos, char *end, int update_pos, int skip_week_day) { #define skip_time_sep(date, end) \ do { \ - const unsigned char *start = (date); \ + const char *start = (date); \ while ((!(end) || (date) < (end)) \ && (*(date) == ' ' || *(date) == '-')) \ (date)++; \ @@ -250,7 +250,7 @@ parse_date(unsigned char **date_pos, unsigned char *end, } while (0) struct tm tm; - const unsigned char *date = (const unsigned char *) *date_pos; + const char *date = (const char *) *date_pos; if (!date) return 0; @@ -324,7 +324,7 @@ parse_date(unsigned char **date_pos, unsigned char *end, #undef skip_time_sep if (update_pos) - *date_pos = (unsigned char *) date; + *date_pos = (char *) date; return (time_t) my_timegm(&tm); } diff --git a/src/protocol/date.h b/src/protocol/date.h index a2debe97..d621758b 100644 --- a/src/protocol/date.h +++ b/src/protocol/date.h @@ -9,18 +9,18 @@ extern "C" { /* Parses YY and YYYY style years. Returns year value ready for tm.tm_year and * move @date pointer after the year if successful else returns -1. */ -int parse_year(const unsigned char **date, unsigned char *end); +int parse_year(const char **date, char *end); /* Return 0 for January, 11 for december, -1 for failure. Updates buf pointer on * success. */ -int parse_month(const unsigned char **buf, unsigned char *end); +int parse_month(const char **buf, char *end); /* Return day number. Updates string pointer on success. */ -int parse_day(const unsigned char **date, unsigned char *end); +int parse_day(const char **date, char *end); /* Expects HH:MM[:SS] or HH:MM[P|A]M, with HH <= 23, MM <= 59, SS <= 59. * Updates tm, updates time on success and returns 0 on failure, otherwise 1. */ -int parse_time(const unsigned char **time, struct tm *tm, unsigned char *end); +int parse_time(const char **time, struct tm *tm, char *end); /* Parses the following date formats: * @@ -28,7 +28,7 @@ int parse_time(const unsigned char **time, struct tm *tm, unsigned char *end); * Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 * Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format */ -time_t parse_date(unsigned char **date_pos, unsigned char *end, +time_t parse_date(char **date_pos, char *end, int update_pos, int skip_week_day); #ifdef __cplusplus diff --git a/src/protocol/file/cgi.c b/src/protocol/file/cgi.c index 3fbb41ca..be2a0ee3 100644 --- a/src/protocol/file/cgi.c +++ b/src/protocol/file/cgi.c @@ -92,7 +92,7 @@ send_more_post_data(struct socket *socket) { struct connection *conn = socket->conn; struct http_connection_info *http = conn->info; - unsigned char buffer[POST_BUFFER_SIZE]; + char buffer[POST_BUFFER_SIZE]; int got; struct connection_state error; @@ -113,8 +113,8 @@ static void send_post_data(struct connection *conn) { struct http_connection_info *http = conn->info; - unsigned char *post = conn->uri->post; - unsigned char *postend; + char *post = conn->uri->post; + char *postend; struct connection_state error; postend = strchr((const char *)post, '\n'); @@ -138,11 +138,11 @@ send_request(struct connection *conn) /* This function sets CGI environment variables. */ static int -set_vars(struct connection *conn, unsigned char *script) +set_vars(struct connection *conn, char *script) { - unsigned char *post = conn->uri->post; - unsigned char *query = get_uri_string(conn->uri, URI_QUERY); - unsigned char *str; + char *post = conn->uri->post; + char *query = get_uri_string(conn->uri, URI_QUERY); + char *str; int res = env_set("QUERY_STRING", empty_string_or_(query), -1); mem_free_if(query); @@ -150,8 +150,8 @@ set_vars(struct connection *conn, unsigned char *script) if (post) { struct http_connection_info *http; - unsigned char *postend = strchr((const char *)post, '\n'); - unsigned char buf[16]; + char *postend = strchr((const char *)post, '\n'); + char buf[16]; struct connection_state error; if (postend) { @@ -198,7 +198,7 @@ set_vars(struct connection *conn, unsigned char *script) str = get_opt_str("protocol.http.user_agent", NULL); if (*str && strcmp(str, " ")) { - unsigned char *ustr, ts[64] = ""; + char *ustr, ts[64] = ""; /* TODO: Somehow get the terminal in which the * document will actually be displayed. */ struct terminal *term = get_default_terminal(); @@ -290,11 +290,11 @@ set_vars(struct connection *conn, unsigned char *script) } static int -test_path(unsigned char *path) +test_path(char *path) { - unsigned char *cgi_path = get_opt_str("protocol.file.cgi.path", NULL); - unsigned char **path_ptr; - unsigned char *filename; + char *cgi_path = get_opt_str("protocol.file.cgi.path", NULL); + char **path_ptr; + char *filename; for (path_ptr = &cgi_path; (filename = get_next_path_filename(path_ptr, ':')); @@ -317,8 +317,8 @@ test_path(unsigned char *path) int execute_cgi(struct connection *conn) { - unsigned char *last_slash; - unsigned char *script; + char *last_slash; + char *script; struct stat buf; pid_t pid; struct connection_state state = connection_state(S_OK); diff --git a/src/protocol/file/file.c b/src/protocol/file/file.c index 0adaeff1..233473c4 100644 --- a/src/protocol/file/file.c +++ b/src/protocol/file/file.c @@ -81,9 +81,9 @@ struct module file_protocol_module = struct_module( * fragment. All the strings are in the system charset. */ static inline void add_dir_entry(struct directory_entry *entry, struct string *page, - int pathlen, unsigned char *dircolor) + int pathlen, char *dircolor) { - unsigned char *lnk = NULL; + char *lnk = NULL; struct string html_encoded_name; struct string uri_encoded_name; @@ -108,12 +108,12 @@ add_dir_entry(struct directory_entry *entry, struct string *page, #ifdef FS_UNIX_SOFTLINKS } else if (entry->attrib[0] == 'l') { struct stat st; - unsigned char buf[MAX_STR_LEN]; + char buf[MAX_STR_LEN]; int readlen = readlink(entry->name, buf, MAX_STR_LEN); if (readlen > 0 && readlen != MAX_STR_LEN) { buf[readlen] = '\0'; - lnk = straconcat(" -> ", buf, (unsigned char *) NULL); + lnk = straconcat(" -> ", buf, (char *) NULL); } if (!stat(entry->name, &st) && S_ISDIR(st.st_mode)) @@ -126,7 +126,7 @@ add_dir_entry(struct directory_entry *entry, struct string *page, if (entry->attrib[0] == 'd' && *dircolor) { /* The <b> is for the case when use_document_colors is off. */ string_concat(page, "<font color=\"", dircolor, "\"><b>", - (unsigned char *) NULL); + (char *) NULL); } add_string_to_string(page, &html_encoded_name); @@ -149,17 +149,17 @@ add_dir_entry(struct directory_entry *entry, struct string *page, /* First information such as permissions is gathered for each directory entry. * 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, +add_dir_entries(struct directory_entry *entries, char *dirpath, struct string *page) { - unsigned char dircolor[8]; + char dircolor[8]; int dirpathlen = strlen(dirpath); int i; /* Setup @dircolor so it's easy to check if we should color dirs. */ if (get_opt_bool("document.browse.links.color_dirs", NULL)) { color_to_string(get_opt_color("document.colors.dirs", NULL), - (unsigned char *) &dircolor); + (char *) &dircolor); } else { dircolor[0] = 0; } @@ -178,7 +178,7 @@ add_dir_entries(struct directory_entry *entries, unsigned char *dirpath, * @dirpath. */ /* Returns a connection state. S_OK if all is well. */ static inline struct connection_state -list_directory(struct connection *conn, unsigned char *dirpath, +list_directory(struct connection *conn, char *dirpath, struct string *page) { int show_hidden_files = get_opt_bool("protocol.file.show_hidden_files", @@ -244,7 +244,7 @@ read_from_stdin(struct connection *conn) void file_protocol_handler(struct connection *connection) { - unsigned char *redirect_location = NULL; + char *redirect_location = NULL; struct string page, name; struct connection_state state; int set_dir_content_type = 0; @@ -340,7 +340,7 @@ file_protocol_handler(struct connection *connection) connection->from += page.length; if (!cached->head && set_dir_content_type) { - unsigned char *head; + char *head; /* If the system charset somehow * changes after the directory listing @@ -348,7 +348,7 @@ file_protocol_handler(struct connection *connection) * parsed with the original charset. */ head = straconcat("\r\nContent-Type: text/html; charset=", get_cp_mime_name(get_cp_index("System")), - "\r\n", (unsigned char *) NULL); + "\r\n", (char *) NULL); /* Not so gracefully handle failed memory * allocation. */ diff --git a/src/protocol/file/mailcap.c b/src/protocol/file/mailcap.c index 24b47025..e0201099 100644 --- a/src/protocol/file/mailcap.c +++ b/src/protocol/file/mailcap.c @@ -70,7 +70,7 @@ void mailcap_protocol_handler(struct connection *conn) { #ifdef HAVE_FORK - unsigned char *script, *ref; + char *script, *ref; pid_t pid; struct connection_state state = connection_state(S_OK); int pipe_read[2], check; diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c index 8c69f3e8..877f77a9 100644 --- a/src/protocol/fsp/fsp.c +++ b/src/protocol/fsp/fsp.c @@ -127,7 +127,7 @@ compare(const void *av, const void *bv) } static void -display_entry(const FSP_RDENTRY *fentry, const unsigned char dircolor[]) +display_entry(const FSP_RDENTRY *fentry, const char dircolor[]) { struct string string; @@ -167,7 +167,7 @@ display_entry(const FSP_RDENTRY *fentry, const unsigned char dircolor[]) } static void -sort_and_display_entries(FSP_DIR *dir, const unsigned char dircolor[]) +sort_and_display_entries(FSP_DIR *dir, const char dircolor[]) { /* fsp_readdir_native in fsplib 0.9 and earlier requires * the third parameter to point to a non-null pointer @@ -209,8 +209,8 @@ fsp_directory(FSP_SESSION *ses, struct uri *uri) { struct string buf; FSP_DIR *dir; - unsigned char *data = get_uri_string(uri, URI_DATA); - unsigned char dircolor[8] = ""; + char *data = get_uri_string(uri, URI_DATA); + char dircolor[8] = ""; if (!data) fsp_error(connection_state(S_OUT_OF_MEM)); @@ -247,10 +247,10 @@ do_fsp(struct connection *conn) struct stat sb; struct uri *uri = conn->uri; struct auth_entry *auth; - unsigned char *host = get_uri_string(uri, URI_HOST); - unsigned char *data = get_uri_string(uri, URI_DATA); + char *host = get_uri_string(uri, URI_HOST); + char *data = get_uri_string(uri, URI_DATA); unsigned short port = (unsigned short)get_uri_port(uri); - unsigned char *password = NULL; + char *password = NULL; decode_uri(data); if (uri->passwordlen) { @@ -448,7 +448,7 @@ fsp_got_header(struct socket *socket, struct read_buffer *rb) socket->state = SOCKET_END_ONCLOSE; if (rb->length > 0) { - unsigned char *ctype = memacpy(rb->data, rb->length); + char *ctype = memacpy(rb->data, rb->length); if (ctype && *ctype) { if (!strcmp(ctype, "text/x-error")) { diff --git a/src/protocol/ftp/ftp-parser.c b/src/protocol/ftp/ftp-parser.c index ece4d2f3..732c79c9 100644 --- a/src/protocol/ftp/ftp-parser.c +++ b/src/protocol/ftp/ftp-parser.c @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { struct ftp_file_info ftp_info = INIT_FTP_FILE_INFO; - unsigned char *response = ""; + char *response = ""; int i; for (i = 1; i < argc; i++) { @@ -42,7 +42,7 @@ main(int argc, char *argv[]) die("Usage: %s --response \"string\"", argv[0]); while (*response) { - unsigned char *start = response; + char *start = response; response = strchr((const char *)response, '\n'); if (!response) { diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 61ecf530..e2855915 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -115,8 +115,8 @@ struct ftp_connection_info { #ifdef CONFIG_IPV6 unsigned int use_epsv:1; /* Use EPSV */ #endif - unsigned char ftp_buffer[FTP_BUF_SIZE]; - unsigned char cmd_buffer[1]; /* Must be last field !! */ + char ftp_buffer[FTP_BUF_SIZE]; + char cmd_buffer[1]; /* Must be last field !! */ }; @@ -150,9 +150,9 @@ static void ftp_data_accept(struct connection *conn); * We don't take care about separators. */ static int -parse_psv_resp(unsigned char *data, int *n, int max_value) +parse_psv_resp(char *data, int *n, int max_value) { - unsigned char *p = data; + char *p = data; int i = 5; memset(n, 0, 6 * sizeof(*n)); @@ -192,8 +192,8 @@ static int get_ftp_response(struct connection *conn, struct read_buffer *rb, int part, struct sockaddr_storage *sa, off_t *est_length) { - unsigned char *eol; - unsigned char *num_end; + char *eol; + char *num_end; int response; int pos; @@ -226,7 +226,7 @@ again: if (sa && response == 229) { /* EPSV response parsing. */ /* See RFC 2428 */ struct sockaddr_in6 *s = (struct sockaddr_in6 *) sa; - int sal = sizeof(*s); + socklen_t sal = sizeof(*s); int n[6]; if (parse_psv_resp(num_end, (int *) &n, 65535) != 1) { @@ -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, char *pc) { /* From RFC 959: DATA PORT (PORT) * @@ -569,7 +569,7 @@ add_portcmd_to_string(struct string *string, unsigned char *pc) static void add_eprtcmd_to_string(struct string *string, struct sockaddr_in6 *addr) { - unsigned char addr_str[INET6_ADDRSTRLEN]; + char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &addr->sin6_addr, addr_str, INET6_ADDRSTRLEN); @@ -632,7 +632,7 @@ get_ftp_data_socket(struct connection *conn, struct string *command) } else { struct sockaddr_in sa; - unsigned char pc[6]; + char pc[6]; int data_sock; memset(pc, 0, sizeof(pc)); @@ -831,7 +831,7 @@ static void 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'); + char *nl = strchr((const char *)ftp->cmd_buffer, '\n'); if (!nl) { add_to_string(cmd, ftp->cmd_buffer); @@ -869,7 +869,7 @@ ftp_send_retr_req(struct connection *conn, struct connection_state state) /* Parse RETR response and return file size or -1 on error. */ static off_t -get_filesize_from_RETR(unsigned char *data, int data_len, int *resume) +get_filesize_from_RETR(char *data, int data_len, int *resume) { off_t file_len; int pos; @@ -887,7 +887,7 @@ get_filesize_from_RETR(unsigned char *data, int data_len, int *resume) /* Getting file size from ftp.task.gda.pl */ /* 150 5676.4 kbytes to download */ unsigned char tmp = data[data_len - 1]; - unsigned char *kbytes; + char *kbytes; char *endptr; double size; @@ -1175,7 +1175,7 @@ struct ftp_dir_html_format { /** The color of directories, in "#rrggbb" format. This is * initialized and used only if colorize_dir is nonzero. */ - unsigned char dircolor[8]; + char dircolor[8]; }; /* Display directory entry formatted in HTML. */ @@ -1185,7 +1185,7 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, struct ftp_file_info *ftp_info) { struct string string; - unsigned char permissions[10] = "---------"; + char permissions[10] = "---------"; if (!init_string(&string)) return -1; @@ -1233,11 +1233,11 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, time_t current_time = time(NULL); time_t when = ftp_info->mtime; struct tm *when_tm; - unsigned char *fmt; + char *fmt; /* LC_TIME=fi_FI.UTF_8 can generate "elo___ 31 23:59" * where each _ denotes U+00A0 encoded as 0xC2 0xA0, * thus needing a 19-byte buffer. */ - unsigned char date[80]; + char date[80]; int wr; if (ftp_info->local_time_zone) @@ -1309,10 +1309,10 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, * Return the number of newline characters at the end of the line or -1 * if we must wait for more input. */ static int -ftp_get_line(struct cache_entry *cached, unsigned char *buf, int bufl, +ftp_get_line(struct cache_entry *cached, char *buf, int bufl, int last, int *len) { - unsigned char *newline; + char *newline; if (!bufl) return -1; @@ -1344,7 +1344,7 @@ ftp_get_line(struct cache_entry *cached, unsigned char *buf, int bufl, * @return -1 if out of memory, or 0 if successful. */ static int ftp_add_unparsed_line(struct cache_entry *cached, off_t *pos, int *tries, - const unsigned char *line, int line_length) + const char *line, int line_length) { int our_ret; struct string string; @@ -1373,14 +1373,14 @@ out: * or -1 if out of memory. */ static int ftp_process_dirlist(struct cache_entry *cached, off_t *pos, - unsigned char *buffer, int buflen, int last, + char *buffer, int buflen, int last, int *tries, const struct ftp_dir_html_format *format) { int ret = 0; while (1) { struct ftp_file_info ftp_info = INIT_FTP_FILE_INFO; - unsigned char *buf = buffer + ret; + char *buf = buffer + ret; int bufl = buflen - ret; int line_length, eol; diff --git a/src/protocol/ftp/parse.c b/src/protocol/ftp/parse.c index 00f873d3..06ee068f 100644 --- a/src/protocol/ftp/parse.c +++ b/src/protocol/ftp/parse.c @@ -42,10 +42,10 @@ do { while ((src) < (end) && *(src) != ' ') (src)++; } while (0) static off_t -parse_ftp_number(unsigned char **src, unsigned char *end, off_t from, off_t to) +parse_ftp_number(char **src, char *end, off_t from, off_t to) { off_t number = 0; - unsigned char *pos = *src; + char *pos = *src; for (; pos < end && isdigit(*pos); pos++) number = (*pos - '0') + 10 * number; @@ -74,11 +74,11 @@ enum ftp_eplf { }; static struct ftp_file_info * -parse_ftp_eplf_response(struct ftp_file_info *info, unsigned char *src, int len) +parse_ftp_eplf_response(struct ftp_file_info *info, char *src, int len) { /* Skip the '+'-char which starts the line. */ - unsigned char *end = src + len; - unsigned char *pos = src++; + char *end = src + len; + char *pos = src++; /* Handle the series of facts about the file. */ @@ -137,7 +137,7 @@ enum ftp_unix { * Borrowed from lftp source code by Alexander V. Lukyanov. * On parse error, it returns 0. */ static int -parse_ftp_unix_permissions(const unsigned char *src, int len) +parse_ftp_unix_permissions(const char *src, int len) { mode_t perms = 0; @@ -214,10 +214,10 @@ parse_ftp_unix_permissions(const unsigned char *src, int len) } static struct ftp_file_info * -parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len) +parse_ftp_unix_response(struct ftp_file_info *info, char *src, int len) { - unsigned char *end = src + len; - unsigned char *pos; + char *end = src + len; + char *pos; struct tm mtime; enum ftp_unix fact; @@ -265,7 +265,7 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len) /* Search for the size and month name combo: */ if (info->size != FTP_SIZE_UNKNOWN && pos - src == 3) { - int month = parse_month((const unsigned char **) &src, pos); + int month = parse_month((const char **) &src, pos); if (month != -1) { fact = FTP_UNIX_DAY; @@ -283,7 +283,7 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len) break; case FTP_UNIX_DAY: - mtime.tm_mday = parse_day((const unsigned char **) &src, pos); + mtime.tm_mday = parse_day((const char **) &src, pos); fact = FTP_UNIX_TIME; break; @@ -299,11 +299,11 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len) /* If we have a number x, it's a year. If we have x:y, * it's hours and minutes. */ if (!memchr(src, ':', pos - src)) { - mtime.tm_year = parse_year((const unsigned char **) &src, pos); + mtime.tm_year = parse_year((const char **) &src, pos); break; } - if (!parse_time((const unsigned char **) &src, &mtime, pos)) { + if (!parse_time((const char **) &src, &mtime, pos)) { mtime.tm_hour = mtime.tm_min = mtime.tm_sec = 0; } break; @@ -408,7 +408,7 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len) * RWED,RWE,RE to 755. "D" (delete) is taken to be equal to "W" (write). * Inspired by a patch of Stoyan Lekov <lekov@eda.bg>. */ static int -parse_ftp_vms_permissions(const unsigned char *src, int len) +parse_ftp_vms_permissions(const char *src, int len) { int perms = 0; int pos; @@ -430,10 +430,10 @@ parse_ftp_vms_permissions(const unsigned char *src, int len) } static struct ftp_file_info * -parse_ftp_vms_response(struct ftp_file_info *info, unsigned char *src, int len) +parse_ftp_vms_response(struct ftp_file_info *info, char *src, int len) { - unsigned char *end = src + len; - unsigned char *pos; + char *end = src + len; + char *pos; /* First column: Name. A bit of black magic again. The name maybe either * ABCD.EXT or ABCD.EXT;NUM and it might be on a separate line. @@ -521,10 +521,10 @@ parse_ftp_vms_response(struct ftp_file_info *info, unsigned char *src, int len) /* Parser for the MSDOS-style format: */ struct ftp_file_info * -parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len) +parse_ftp_winnt_response(struct ftp_file_info *info, char *src, int len) { struct tm mtime; - unsigned char *end = src + len; + char *end = src + len; /* Extracting name is a bit of black magic and we have to do it * before `strtok' inserted extra \0 characters in the line @@ -550,13 +550,13 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len src++; - mtime.tm_mday = parse_day((const unsigned char **) &src, end); + mtime.tm_mday = parse_day((const char **) &src, end); if (src + 2 >= end || *src != '-') return NULL; src++; - mtime.tm_year = parse_year((const unsigned char **) &src, end); + mtime.tm_year = parse_year((const char **) &src, end); if (src >= end || mtime.tm_year == -1) return NULL; @@ -567,7 +567,7 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len /* Second column: hh:mm[AP]M, listing does not contain value for * seconds */ - if (!parse_time((const unsigned char **) &src, &mtime, end)) + if (!parse_time((const char **) &src, &mtime, end)) return NULL; /* Store the time-stamp. */ @@ -600,7 +600,7 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len struct ftp_file_info * -parse_ftp_file_info(struct ftp_file_info *info, unsigned char *src, int len) +parse_ftp_file_info(struct ftp_file_info *info, char *src, int len) { assert(info && src && len > 0); if_assert_failed return NULL; diff --git a/src/protocol/ftp/parse.h b/src/protocol/ftp/parse.h index 07478a99..f5f7ab7f 100644 --- a/src/protocol/ftp/parse.h +++ b/src/protocol/ftp/parse.h @@ -40,7 +40,7 @@ struct ftp_file_info { { FTP_FILE_DIRECTORY, INIT_STRING("..", 2), INIT_STRING("", 0), FTP_SIZE_UNKNOWN, 0, 0, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH } struct ftp_file_info * -parse_ftp_file_info(struct ftp_file_info *info, unsigned char *src, int len); +parse_ftp_file_info(struct ftp_file_info *info, char *src, int len); #ifdef __cplusplus } diff --git a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c index 02018dd4..338818f9 100644 --- a/src/protocol/gopher/gopher.c +++ b/src/protocol/gopher/gopher.c @@ -93,8 +93,8 @@ enum gopher_entity { struct gopher_entity_info { enum gopher_entity type; - unsigned char *description; - unsigned char *content_type; + char *description; + char *content_type; }; /* This table provides some hard-coded associations between entity type @@ -150,7 +150,7 @@ get_gopher_entity_info(enum gopher_entity type) return &gopher_entity_info[entry]; } -static unsigned char * +static char * get_gopher_entity_description(enum gopher_entity type) { struct gopher_entity_info *info = get_gopher_entity_info(type); @@ -163,13 +163,13 @@ struct gopher_connection_info { struct gopher_entity_info *entity; int commandlen; - unsigned char command[1]; + char command[1]; }; /* 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, char *string, int length, int replace_plus) { int oldlen = command->length; @@ -202,9 +202,9 @@ static struct connection_state init_gopher_index_cache_entry(struct connection * static struct connection_state add_gopher_command(struct connection *conn, struct string *command, enum gopher_entity entity, - unsigned char *selector, int selectorlen) + char *selector, int selectorlen) { - unsigned char *query; + char *query; int querylen; if (!init_string(command)) @@ -276,7 +276,7 @@ init_gopher_connection_info(struct connection *conn) struct connection_state state; struct string command; enum gopher_entity entity = DEFAULT_GOPHER_ENTITY; - unsigned char *selector = conn->uri->data; + char *selector = conn->uri->data; int selectorlen = conn->uri->datalen; struct gopher_entity_info *entity_info; size_t size; @@ -350,16 +350,16 @@ init_gopher_connection_info(struct connection *conn) */ static void -add_gopher_link(struct string *buffer, const unsigned char *text, - const unsigned char *addr) +add_gopher_link(struct string *buffer, const char *text, + const char *addr) { add_format_to_string(buffer, "<a href=\"%s\">%s</a>", addr, text); } static void -add_gopher_search_field(struct string *buffer, const unsigned char *text, - const unsigned char *addr) +add_gopher_search_field(struct string *buffer, const char *text, + const char *addr) { add_format_to_string(buffer, "<form action=\"%s\">" @@ -376,7 +376,7 @@ add_gopher_search_field(struct string *buffer, const unsigned char *text, static void add_gopher_description(struct string *buffer, enum gopher_entity entity) { - unsigned char *description = get_gopher_entity_description(entity); + char *description = get_gopher_entity_description(entity); if (!description) return; @@ -387,9 +387,9 @@ 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, char *selector) { - unsigned char *slashes; + char *slashes; /* Rather hackishly only convert slashes if there are * two successive ones. */ @@ -405,13 +405,13 @@ 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, char *line) { /* Gopher menu fields */ - unsigned char *name = line; - unsigned char *selector = NULL; - unsigned char *host = NULL; - unsigned char *port = NULL; + char *name = line; + char *selector = NULL; + char *host = NULL; + char *port = NULL; enum gopher_entity entity = *name++; if (!entity) { @@ -442,7 +442,7 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line) port = host ? strchr((const char *)host, ASCII_TAB) : NULL; if (port) { - unsigned char *end; + char *end; int portno; errno = 0; @@ -508,7 +508,7 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line) default: { struct string address; - unsigned char *format = selector && *selector + char *format = selector && *selector ? "%s://%s@%s/" : "%s://%s%s/"; /* If port is defined it means that both @selector and @host @@ -564,8 +564,8 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line) /* Search for line ending \r\n pair */ -static unsigned char * -get_gopher_line_end(unsigned char *data, int datalen) +static char * +get_gopher_line_end(char *data, int datalen) { for (; datalen >= 1; data++, datalen--) { if (data[0] == ASCII_CR && data[1] == ASCII_LF) @@ -578,8 +578,8 @@ get_gopher_line_end(unsigned char *data, int datalen) return NULL; } -static inline unsigned char * -check_gopher_last_line(unsigned char *line, unsigned char *end) +static inline char * +check_gopher_last_line(char *line, char *end) { assert(line < end); @@ -592,7 +592,7 @@ read_gopher_directory_data(struct connection *conn, struct read_buffer *rb) { struct connection_state state = connection_state(S_TRANS); struct string buffer; - unsigned char *end; + char *end; if (conn->from == 0) { struct connection_state state; @@ -606,7 +606,7 @@ read_gopher_directory_data(struct connection *conn, struct read_buffer *rb) } while ((end = get_gopher_line_end(rb->data, rb->length))) { - unsigned char *line = check_gopher_last_line(rb->data, end); + char *line = check_gopher_last_line(rb->data, end); /* Break on line with a dot by itself */ if (!line) { @@ -660,7 +660,7 @@ init_gopher_cache_entry(struct connection *conn) static struct connection_state init_gopher_index_cache_entry(struct connection *conn) { - unsigned char *where; + char *where; struct string buffer; if (!init_gopher_cache_entry(conn) diff --git a/src/protocol/header.c b/src/protocol/header.c index ad5614a1..37bf7a9d 100644 --- a/src/protocol/header.c +++ b/src/protocol/header.c @@ -140,16 +140,16 @@ * * The terms message-header, field-name, start-line, and field-content * are defined in RFC 2616 sections 4.1 and 4.2. */ -unsigned char * -parse_header(unsigned char *head, const unsigned char *item, unsigned char **ptr) +char * +parse_header(char *head, const char *item, char **ptr) { - unsigned char *pos = head; + char *pos = head; if (!pos) return NULL; while (*pos) { - unsigned char *end, *value; - const unsigned char *itempos; + char *end, *value; + const char *itempos; int len; /* Go for a newline. */ @@ -232,9 +232,9 @@ parse_header(unsigned char *head, const unsigned char *item, unsigned char **ptr * and cannot fail with HEADER_PARAM_OUT_OF_MEMORY. Some callers may * rely on this. */ enum parse_header_param -parse_header_param(unsigned char *str, unsigned char *name, unsigned char **ret, int content_disposition) +parse_header_param(char *str, char *name, char **ret, int content_disposition) { - unsigned char *p = str; + char *p = str; int namelen, plen = 0; if (ret) *ret = NULL; /* default in case of early return */ @@ -298,10 +298,10 @@ a: /* Parse string param="value", return value as new string or NULL if any * error. */ -unsigned char * -get_header_param(unsigned char *e, unsigned char *name) +char * +get_header_param(char *e, char *name) { - unsigned char *n, *start; + char *n, *start; again: while (*e && c_toupper(*e++) != c_toupper(*name)); diff --git a/src/protocol/header.h b/src/protocol/header.h index 96f4ebc7..af50c4ad 100644 --- a/src/protocol/header.h +++ b/src/protocol/header.h @@ -13,9 +13,9 @@ enum parse_header_param { * Unknown values should be treated as errors. */ }; -unsigned char *parse_header(unsigned char *, const unsigned char *, unsigned char **); -enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **, int); -unsigned char *get_header_param(unsigned char *, unsigned char *); +char *parse_header(char *, const char *, char **); +enum parse_header_param parse_header_param(char *, char *, char **, int); +char *get_header_param(char *, char *); #ifdef __cplusplus } diff --git a/src/protocol/http/blacklist.c b/src/protocol/http/blacklist.c index ec2a4638..7e565bc9 100644 --- a/src/protocol/http/blacklist.c +++ b/src/protocol/http/blacklist.c @@ -20,7 +20,7 @@ struct blacklist_entry { LIST_HEAD(struct blacklist_entry); enum blacklist_flags flags; - unsigned char host[1]; /* Must be last. */ + char host[1]; /* Must be last. */ }; static INIT_LIST_OF(struct blacklist_entry, blacklist); diff --git a/src/protocol/http/codes.c b/src/protocol/http/codes.c index c4a260fb..2a5d54be 100644 --- a/src/protocol/http/codes.c +++ b/src/protocol/http/codes.c @@ -25,7 +25,7 @@ struct http_code { int num; - const unsigned char *str; + const char *str; }; /* Source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */ @@ -82,7 +82,7 @@ compare_http_codes(const void *key, const void *element) return first - second; } -static const unsigned char * +static const char * http_code_to_string(int code) { const struct http_code *element @@ -98,11 +98,11 @@ http_code_to_string(int code) /* TODO: Some short intermediate document for the 3xx messages? --pasky */ -static unsigned char * +static char * 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); + const char *codestr = http_code_to_string(code); + char *title = asprintfa(_("HTTP error %03d", term), code); struct string string; if (!codestr) codestr = "Unknown error"; @@ -164,7 +164,7 @@ show_http_error_document(struct session *ses, void *data) struct terminal *term = ses->tab->term; struct cache_entry *cached = find_in_cache(info->uri); struct cache_entry *cache = cached ? cached : get_cache_entry(info->uri); - unsigned char *str = NULL; + char *str = NULL; if (cache) str = get_http_error_document(term, info->uri, info->code); @@ -182,7 +182,7 @@ show_http_error_document(struct session *ses, void *data) mem_free_set(&cache->head, straconcat("\r\nContent-Type: text/html; charset=", get_cp_mime_name(gettext_codepage), - "\r\n", (unsigned char *) NULL)); + "\r\n", (char *) NULL)); add_fragment(cache, 0, str, strlen(str)); mem_free(str); diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 19725a31..761dd22c 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -65,7 +65,7 @@ static struct auth_entry proxy_auth; -static unsigned char *accept_charset = NULL; +static char *accept_charset = NULL; static union option_info http_options[] = { @@ -259,7 +259,7 @@ static void init_accept_charset(void) { struct string ac; - unsigned char *cs; + char *cs; int i; if (!init_string(&ac)) return; @@ -283,9 +283,9 @@ init_accept_charset(void) } -unsigned char * -subst_user_agent(unsigned char *fmt, unsigned char *version, - unsigned char *sysname, unsigned char *termsize) +char * +subst_user_agent(char *fmt, char *version, + char *sysname, char *termsize) { struct string agent; @@ -305,7 +305,7 @@ subst_user_agent(unsigned char *fmt, unsigned char *version, switch (*fmt) { case 'b': if (!list_empty(sessions)) { - unsigned char bs[4] = ""; + char bs[4] = ""; int blen = 0; struct session *ses = sessions.prev; int bars = ses->status.show_status_bar @@ -345,8 +345,8 @@ add_url_to_http_string(struct string *header, struct uri *uri, int components) * before. We should probably encode all URLs as early as * possible, and possibly decode them back in protocol * backends. --pasky */ - unsigned char *string = get_uri_string(uri, components); - unsigned char *data = string; + char *string = get_uri_string(uri, components); + char *data = string; if (!string) return; @@ -372,7 +372,7 @@ add_url_to_http_string(struct string *header, struct uri *uri, int components) * It returns -1 if not a number, 0 otherwise. * @end should be > @start. */ static int -revstr2num(unsigned char *start, unsigned char *end, int *value) +revstr2num(char *start, char *end, int *value) { int q = 1, val = 0; @@ -394,8 +394,8 @@ revstr2num(unsigned char *start, unsigned char *end, int *value) static int get_http_code(struct read_buffer *rb, int *code, struct http_version *version) { - unsigned char *head = rb->data; - unsigned char *start; + char *head = rb->data; + char *start; *code = 0; version->major = 0; @@ -450,11 +450,11 @@ get_http_code(struct read_buffer *rb, int *code, struct http_version *version) static int check_http_server_bugs(struct uri *uri, struct http_connection_info *http, - unsigned char *head) + char *head) { - unsigned char *server; - const unsigned char *const *s; - static const unsigned char *const buggy_servers[] = { + char *server; + const char *const *s; + static const char *const buggy_servers[] = { "mod_czech/3.1.0", "Purveyor", "Netscape-Enterprise", @@ -631,7 +631,7 @@ send_more_post_data(struct socket *socket) { struct connection *conn = socket->conn; struct http_connection_info *http = conn->info; - unsigned char buffer[POST_BUFFER_SIZE]; + char buffer[POST_BUFFER_SIZE]; int got; struct connection_state error; @@ -665,10 +665,10 @@ http_send_header(struct socket *socket) struct http_connection_info *http; int trace = get_opt_bool("protocol.http.trace", NULL); struct string header; - unsigned char *post_data = NULL; + char *post_data = NULL; struct auth_entry *entry = NULL; struct uri *uri = conn->proxied_uri; /* Set to the real uri */ - unsigned char *optstr; + char *optstr; int use_connect, talking_to_proxy; /* Sanity check for a host */ @@ -740,11 +740,11 @@ http_send_header(struct socket *socket) /* CONNECT: Proxy-Authorization is intended to be seen by the proxy. */ if (talking_to_proxy) { - unsigned char *user = get_opt_str("protocol.http.proxy.user", NULL); - unsigned char *passwd = get_opt_str("protocol.http.proxy.passwd", NULL); + char *user = get_opt_str("protocol.http.proxy.user", NULL); + char *passwd = get_opt_str("protocol.http.proxy.passwd", NULL); if (proxy_auth.digest) { - unsigned char *response; + char *response; int userlen = int_min(strlen(user), AUTH_USER_MAXLEN - 1); int passwordlen = int_min(strlen(passwd), AUTH_PASSWORD_MAXLEN - 1); @@ -768,11 +768,11 @@ http_send_header(struct socket *socket) } else { if (user[0]) { - unsigned char *proxy_data; + char *proxy_data; - proxy_data = straconcat(user, ":", passwd, (unsigned char *) NULL); + proxy_data = straconcat(user, ":", passwd, (char *) NULL); if (proxy_data) { - unsigned char *proxy_64 = base64_encode(proxy_data); + char *proxy_64 = base64_encode(proxy_data); if (proxy_64) { add_to_string(&header, "Proxy-Authorization: Basic "); @@ -791,7 +791,7 @@ http_send_header(struct socket *socket) * better error messages. */ optstr = get_opt_str("protocol.http.user_agent", NULL); if (*optstr && strcmp(optstr, " ")) { - unsigned char *ustr, ts[64] = ""; + char *ustr, ts[64] = ""; /* TODO: Somehow get the terminal in which the * document will actually be displayed. */ struct terminal *term = get_default_terminal(); @@ -881,7 +881,7 @@ http_send_header(struct socket *socket) } #ifdef CONFIG_NLS else if (get_opt_bool("protocol.http.accept_ui_language", NULL)) { - unsigned char *code = language_to_iso639(current_language); + char *code = language_to_iso639(current_language); if (code) { add_to_string(&header, "Accept-Language: "); @@ -961,7 +961,7 @@ http_send_header(struct socket *socket) if (entry) { if (entry->digest) { - unsigned char *response; + char *response; response = get_http_auth_digest_response(entry, uri); if (response) { @@ -979,13 +979,13 @@ http_send_header(struct socket *socket) * and password, separated by a single colon (":") * character, within a base64 [7] encoded string in the * credentials. */ - unsigned char *id; + char *id; /* Create base64 encoded string. */ id = straconcat(entry->user, ":", entry->password, - (unsigned char *) NULL); + (char *) NULL); if (id) { - unsigned char *base64 = base64_encode(id); + char *base64 = base64_encode(id); mem_free_set(&id, base64); } @@ -1004,7 +1004,7 @@ http_send_header(struct socket *socket) /* We search for first '\n' in uri->post to get content type * as set by get_form_uri(). This '\n' is dropped if any * and replaced by correct '\r\n' termination here. */ - unsigned char *postend = strchr((const char *)uri->post, '\n'); + char *postend = strchr((const char *)uri->post, '\n'); struct connection_state error; if (postend) { @@ -1063,8 +1063,8 @@ http_send_header(struct socket *socket) #undef POST_BUFFER_SIZE -static unsigned char * -decompress_data(struct connection *conn, unsigned char *data, int len, +static char * +decompress_data(struct connection *conn, char *data, int len, int *new_len) { *new_len = 0; /* new_len must be zero if we would ever return NULL */ @@ -1175,7 +1175,7 @@ read_chunked_http_data(struct connection *conn, struct read_buffer *rb) int l = is_line_in_buffer(rb); if (l) { - unsigned char *de; + char *de; int n = 0; if (l != -1) { @@ -1213,7 +1213,7 @@ read_chunked_http_data(struct connection *conn, struct read_buffer *rb) if (add_fragment(conn->cached, conn->from, rb->data, len) == 1) conn->tries = 0; } else { - unsigned char *data = decompress_data(conn, rb->data, len, &data_len); + char *data = decompress_data(conn, rb->data, len, &data_len); if (add_fragment(conn->cached, conn->from, data, data_len) == 1) conn->tries = 0; @@ -1281,7 +1281,7 @@ read_normal_http_data(struct connection *conn, struct read_buffer *rb) if (add_fragment(conn->cached, conn->from, rb->data, data_len) == 1) conn->tries = 0; } else { - unsigned char *data; + char *data; finish: data = decompress_data(conn, rb->data, len, &data_len); @@ -1391,15 +1391,15 @@ get_header(struct read_buffer *rb) /* returns 1 if we need retry the connection (for negotiate-auth only) */ static int check_http_authentication(struct connection *conn, struct uri *uri, - unsigned char *header, unsigned char *header_field) + char *header, char *header_field) { - unsigned char *str, *d; + char *str, *d; int ret = 0; d = parse_header(header, header_field, &str); while (d) { if (!c_strncasecmp(d, "Basic", 5)) { - unsigned char *realm = get_header_param(d, "realm"); + char *realm = get_header_param(d, "realm"); if (realm) { add_auth_entry(uri, realm, NULL, NULL, 0); @@ -1408,9 +1408,9 @@ check_http_authentication(struct connection *conn, struct uri *uri, break; } } else if (!c_strncasecmp(d, "Digest", 6)) { - unsigned char *realm = get_header_param(d, "realm"); - unsigned char *nonce = get_header_param(d, "nonce"); - unsigned char *opaque = get_header_param(d, "opaque"); + char *realm = get_header_param(d, "realm"); + char *nonce = get_header_param(d, "nonce"); + char *opaque = get_header_param(d, "opaque"); add_auth_entry(uri, realm, nonce, opaque, 1); @@ -1446,11 +1446,11 @@ http_got_header(struct socket *socket, struct read_buffer *rb) { struct connection *conn = socket->conn; struct http_connection_info *http = conn->info; - unsigned char *head; + char *head; #ifdef CONFIG_COOKIES - unsigned char *cookie, *ch; + char *cookie, *ch; #endif - unsigned char *d; + char *d; struct uri *uri = conn->proxied_uri; /* Set to the real uri */ struct http_version version = { 0, 9 }; struct connection_state state = (!is_in_state(conn->state, S_PROC) @@ -1622,7 +1622,7 @@ again: cached->expire = 0; } else { - unsigned char *pos = strstr((const char *)d, "max-age="); + char *pos = strstr((const char *)d, "max-age="); assert(cached->cache_mode != CACHE_MODE_NEVER); @@ -1678,13 +1678,13 @@ again: } if (h == 407) { - unsigned char *str; + char *str; int restart = 0; d = parse_header(conn->cached->head, "Proxy-Authenticate", &str); while (d) { if (!c_strncasecmp(d, "Basic", 5)) { - unsigned char *realm = get_header_param(d, "realm"); + char *realm = get_header_param(d, "realm"); if (realm) { mem_free_set(&proxy_auth.realm, realm); @@ -1694,10 +1694,10 @@ again: } } else if (!c_strncasecmp(d, "Digest", 6)) { - unsigned char *realm = get_header_param(d, "realm"); - unsigned char *nonce = get_header_param(d, "nonce"); - unsigned char *opaque = get_header_param(d, "opaque"); - unsigned char *stale = get_header_param(d, "stale"); + char *realm = get_header_param(d, "realm"); + char *nonce = get_header_param(d, "nonce"); + char *opaque = get_header_param(d, "opaque"); + char *stale = get_header_param(d, "stale"); if (stale) { if (strcasecmp(stale, "true")) restart = 1; @@ -1767,7 +1767,7 @@ again: foreach (s, conn->downloads) { fprintf(stderr, "conn %p status %p pri %d st %d er %d :: ce %s", conn, s, s->pri, s->state, s->prev_error, - s->cached ? s->cached->url : (unsigned char *) "N-U-L-L"); + s->cached ? s->cached->url : (char *) "N-U-L-L"); } } #endif @@ -1780,7 +1780,7 @@ again: d = parse_header(conn->cached->head, "Content-Length", NULL); if (d) { - unsigned char *ep; + char *ep; long long l; errno = 0; @@ -1840,8 +1840,8 @@ again: d = parse_header(conn->cached->head, "ETag", NULL); if (d) { if (conn->cached->etag) { - unsigned char *old_tag = conn->cached->etag; - unsigned char *new_tag = d; + char *old_tag = conn->cached->etag; + char *new_tag = d; /* http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19 */ @@ -1871,7 +1871,7 @@ again: d = parse_header(conn->cached->head, "Content-Encoding", NULL); if (d) { #if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || defined(CONFIG_LZMA) || defined(CONFIG_BROTLI) || defined(CONFIG_ZSTD) - unsigned char *extension = get_extension_from_uri(uri); + char *extension = get_extension_from_uri(uri); enum stream_encoding file_encoding; file_encoding = extension ? guess_encoding(extension) : ENCODING_NONE; diff --git a/src/protocol/http/http.h b/src/protocol/http/http.h index dff3ba33..35205fb8 100644 --- a/src/protocol/http/http.h +++ b/src/protocol/http/http.h @@ -49,8 +49,8 @@ extern protocol_handler_T proxy_protocol_handler; struct http_connection_info *init_http_connection_info(struct connection *conn, int major, int minor, int close); void http_got_header(struct socket *, struct read_buffer *); -unsigned char *subst_user_agent(unsigned char *fmt, unsigned char *version, - unsigned char *sysname, unsigned char *termsize); +char *subst_user_agent(char *fmt, char *version, + char *sysname, char *termsize); #ifdef __cplusplus } diff --git a/src/protocol/http/http_negotiate.c b/src/protocol/http/http_negotiate.c index aa0f7559..78140f51 100644 --- a/src/protocol/http/http_negotiate.c +++ b/src/protocol/http/http_negotiate.c @@ -137,11 +137,11 @@ http_negotiate_get_name(struct connection *conn, struct negotiate *neg) } static int -http_negotiate_parse_data(unsigned char *data, int type, +http_negotiate_parse_data(char *data, int type, gss_buffer_desc *token) { int len = 0; - unsigned char *end; + char *end; int bytelen = 0; if (data == NULL || *data == '\0') @@ -215,7 +215,7 @@ http_negotiate_create_context(struct negotiate *neg) */ int http_negotiate_input(struct connection *conn, struct uri *uri, - int type, unsigned char *data) + int type, char *data) { struct negotiate *neg; int ret = 0, isnew = 0; @@ -273,7 +273,7 @@ http_negotiate_output(struct uri *uri, struct string *header) } } - encoded = base64_encode_bin((unsigned char *) neg->output_token.value, + encoded = base64_encode_bin((char *) neg->output_token.value, neg->output_token.length, &len); if (encoded == NULL || len == 0) diff --git a/src/protocol/http/http_negotiate.h b/src/protocol/http/http_negotiate.h index cf9d4237..2cb4a810 100644 --- a/src/protocol/http/http_negotiate.h +++ b/src/protocol/http/http_negotiate.h @@ -16,7 +16,7 @@ extern "C" { #define HTTPNEG_NEG_STRLEN sizeof(HTTPNEG_NEG_STR) int http_negotiate_input(struct connection *conn, struct uri *uri, - int type, unsigned char *data); + int type, char *data); int http_negotiate_output(struct uri *uri, struct string *header); diff --git a/src/protocol/http/post.c b/src/protocol/http/post.c index 8efce03a..39c8176d 100644 --- a/src/protocol/http/post.c +++ b/src/protocol/http/post.c @@ -87,22 +87,22 @@ done_http_post(struct http_post *http_post) * * @relates http_post */ int -open_http_post(struct http_post *http_post, const unsigned char *post_data, +open_http_post(struct http_post *http_post, const char *post_data, struct connection_state *error) { off_t size = 0; size_t length = strlen(post_data); - const unsigned char *end = post_data; + const char *end = post_data; done_http_post(http_post); http_post->post_data = end; while (1) { struct stat sb; - const unsigned char *begin; + const char *begin; int res; struct http_post_file *new_files; - unsigned char *filename; + char *filename; begin = strchr((const char *)end, FILE_CHAR); if (!begin) break; @@ -156,11 +156,11 @@ open_http_post(struct http_post *http_post, const unsigned char *post_data, * @relates http_post */ static int read_http_post_inline(struct http_post *http_post, - unsigned char buffer[], int max, + char buffer[], int max, struct connection_state *error) { - const unsigned char *post = http_post->post_data; - const unsigned char *end = strchr((const char *)post, FILE_CHAR); + const char *post = http_post->post_data; + const char *end = strchr((const char *)post, FILE_CHAR); int total = 0; assert(http_post->post_fd < 0); @@ -214,7 +214,7 @@ read_http_post_inline(struct http_post *http_post, * @relates http_post */ static int read_http_post_fd(struct http_post *http_post, - unsigned char buffer[], int max, + char buffer[], int max, struct connection_state *error) { const struct http_post_file *const file @@ -281,7 +281,7 @@ read_http_post_fd(struct http_post *http_post, * @relates http_post */ int read_http_post(struct http_post *http_post, - unsigned char buffer[], int max, + char buffer[], int max, struct connection_state *error) { int total = 0; diff --git a/src/protocol/http/post.h b/src/protocol/http/post.h index 7c1fe91f..7680ce16 100644 --- a/src/protocol/http/post.h +++ b/src/protocol/http/post.h @@ -15,7 +15,7 @@ extern "C" { * discards it. */ struct http_post_file { /** The name of the file. Must be freed with mem_free(). */ - unsigned char *name; + char *name; /** The size of the file. */ off_t size; @@ -33,7 +33,7 @@ struct http_post { /** Points to the next byte to be read from * connection.uri->post. */ - const unsigned char *post_data; + const char *post_data; /** File descriptor from which data is being read, or -1 if * none. */ @@ -58,10 +58,10 @@ struct http_post { void init_http_post(struct http_post *http_post); void done_http_post(struct http_post *http_post); -int open_http_post(struct http_post *http_post, const unsigned char *post_data, +int open_http_post(struct http_post *http_post, const char *post_data, struct connection_state *error); int read_http_post(struct http_post *http_post, - unsigned char buffer[], int max, + char buffer[], int max, struct connection_state *error); #ifdef __cplusplus diff --git a/src/protocol/nntp/connection.c b/src/protocol/nntp/connection.c index e0f5246d..0d9cbcf2 100644 --- a/src/protocol/nntp/connection.c +++ b/src/protocol/nntp/connection.c @@ -35,7 +35,7 @@ static void nntp_send_command(struct connection *conn); /* Resolves the target by looking at the part of the URI _after_ last '/' */ static enum nntp_target -get_nntp_target(unsigned char *data, int datalen) +get_nntp_target(char *data, int datalen) { enum nntp_target target = NNTP_TARGET_ARTICLE_NUMBER; int pos; @@ -71,10 +71,10 @@ get_nntp_target(unsigned char *data, int datalen) * non empty and valid numbers and that the range is valid. */ static int init_nntp_article_range(struct nntp_connection_info *nntp, - unsigned char *data, int datalen) + char *data, int datalen) { long start_number, end_number; - unsigned char *end; + char *end; errno = 0; start_number = strtol(data, (char **) &end, 10); @@ -99,8 +99,8 @@ init_nntp_connection_info(struct connection *conn) { struct uri *uri = conn->uri; struct nntp_connection_info *nntp; - unsigned char *groupend; - unsigned char *data; + char *groupend; + char *data; int datalen; assert(conn->info == NULL); @@ -578,8 +578,8 @@ nntp_protocol_handler(struct connection *conn) void news_protocol_handler(struct connection *conn) { - unsigned char *protocol; - unsigned char *server = get_nntp_server(); + char *protocol; + char *server = get_nntp_server(); struct string location; if (!*server) server = getenv("NNTPSERVER"); diff --git a/src/protocol/nntp/nntp.c b/src/protocol/nntp/nntp.c index db05ec2f..4583b678 100644 --- a/src/protocol/nntp/nntp.c +++ b/src/protocol/nntp/nntp.c @@ -50,13 +50,13 @@ static union option_info nntp_protocol_options[] = { #define get_opt_nntp(which) nntp_protocol_options[(which)].option -unsigned char * +char * get_nntp_server(void) { return get_opt_nntp(NNTP_PROTOCOL_SERVER).value.string; } -unsigned char * +char * get_nntp_header_entries(void) { return get_opt_nntp(NNTP_PROTOCOL_HEADER_ENTRIES).value.string; diff --git a/src/protocol/nntp/nntp.h b/src/protocol/nntp/nntp.h index a414ee72..6e32d0a6 100644 --- a/src/protocol/nntp/nntp.h +++ b/src/protocol/nntp/nntp.h @@ -9,10 +9,10 @@ extern "C" { #endif /* Returns the server that should be used when expanding news: URIs */ -unsigned char *get_nntp_server(void); +char *get_nntp_server(void); /* Returns the entries the user wants to have shown */ -unsigned char *get_nntp_header_entries(void); +char *get_nntp_header_entries(void); extern struct module nntp_protocol_module; diff --git a/src/protocol/nntp/response.c b/src/protocol/nntp/response.c index 735374ce..f5d71932 100644 --- a/src/protocol/nntp/response.c +++ b/src/protocol/nntp/response.c @@ -28,8 +28,8 @@ /* Search for line ending \r\n pair */ -static unsigned char * -get_nntp_line_end(unsigned char *data, int datalen) +static char * +get_nntp_line_end(char *data, int datalen) { for (; datalen > 1; data++, datalen--) if (data[0] == ASCII_CR && data[1] == ASCII_LF) @@ -50,8 +50,8 @@ get_nntp_line_end(unsigned char *data, int datalen) * with a period, determine either that this is the end of the text or whether * to collapse the doubled period to a single one. */ /* Returns NULL if end-of-text is found else start of collapsed line */ -static inline unsigned char * -check_nntp_line(unsigned char *line, unsigned char *end) +static inline char * +check_nntp_line(char *line, char *end) { assert(line < end); @@ -66,10 +66,10 @@ check_nntp_line(unsigned char *line, unsigned char *end) return line; } -static inline unsigned char * -get_nntp_message_header_end(unsigned char *data, int datalen) +static inline char * +get_nntp_message_header_end(char *data, int datalen) { - unsigned char *end, *prev_end = data; + char *end, *prev_end = data; while ((end = get_nntp_line_end(data, datalen))) { datalen -= end - data; @@ -114,7 +114,7 @@ init_nntp_header(struct connection *conn, struct read_buffer *rb) case NNTP_TARGET_MESSAGE_ID: case NNTP_TARGET_GROUP_MESSAGE_ID: { - unsigned char *end; + char *end; end = get_nntp_message_header_end(rb->data, rb->length); if (!end) { @@ -144,7 +144,7 @@ init_nntp_header(struct connection *conn, struct read_buffer *rb) } -static unsigned char * +static char * get_nntp_title(struct connection *conn) { struct nntp_connection_info *nntp = conn->info; @@ -163,7 +163,7 @@ get_nntp_title(struct connection *conn) case NNTP_TARGET_MESSAGE_ID: case NNTP_TARGET_GROUP_MESSAGE_ID: { - unsigned char *subject; + char *subject; subject = parse_header(conn->cached->head, "Subject", NULL); if (subject) { @@ -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, char *in, 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, char *in, char *end) { /* Decode in..ep, possibly in-place to ot */ int c, pos = 0, acc = 0; @@ -270,13 +270,13 @@ 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, char *header) { - unsigned char *end; + char *end; while ((end = strstr((const char *)header, "=?")) != NULL) { int encoding; - unsigned char *cp, *sp; + char *cp, *sp; if (header != end) { add_html_to_string(str, header, end - header); @@ -320,7 +320,7 @@ static void add_nntp_html_start(struct string *html, struct connection *conn) { struct nntp_connection_info *nntp = conn->info; - unsigned char *title = get_nntp_title(conn); + char *title = get_nntp_title(conn); add_format_to_string(html, "<html>\n" @@ -333,7 +333,7 @@ add_nntp_html_start(struct string *html, struct connection *conn) case NNTP_TARGET_MESSAGE_ID: case NNTP_TARGET_GROUP_MESSAGE_ID: { - unsigned char *header_entries; + char *header_entries; header_entries = get_nntp_header_entries(); if (!*header_entries) break; @@ -341,7 +341,7 @@ add_nntp_html_start(struct string *html, struct connection *conn) add_to_string(html, "<pre>"); while (*header_entries) { - unsigned char *entry, *value; + char *entry, *value; entry = get_next_path_filename(&header_entries, ','); if (!entry) continue; @@ -406,7 +406,7 @@ add_nntp_html_end(struct string *html, struct connection *conn) static void add_nntp_html_line(struct string *html, struct connection *conn, - unsigned char *line) + char *line) { struct nntp_connection_info *nntp = conn->info; @@ -421,7 +421,7 @@ add_nntp_html_line(struct string *html, struct connection *conn, case NNTP_TARGET_GROUP: case NNTP_TARGET_GROUPS: { - unsigned char *field = line; + char *field = line; line = strchr((const char *)line, '\t'); if (!line) @@ -461,7 +461,7 @@ struct connection_state read_nntp_response_data(struct connection *conn, struct read_buffer *rb) { struct string html; - unsigned char *end; + char *end; struct connection_state state = connection_state(S_TRANS); if (conn->from == 0) { @@ -487,7 +487,7 @@ read_nntp_response_data(struct connection *conn, struct read_buffer *rb) add_nntp_html_start(&html, conn); while ((end = get_nntp_line_end(rb->data, rb->length))) { - unsigned char *line = check_nntp_line(rb->data, end); + char *line = check_nntp_line(rb->data, end); if (!line) { state = connection_state(S_OK); @@ -516,7 +516,7 @@ read_nntp_response_data(struct connection *conn, struct read_buffer *rb) /* Returns 1 on success and 0 on failure */ static int parse_nntp_group_parameters(struct nntp_connection_info *nntp, - unsigned char *pos, unsigned char *end) + char *pos, char *end) { errno = 0; @@ -554,8 +554,8 @@ enum nntp_code get_nntp_response_code(struct connection *conn, struct read_buffer *rb) { struct nntp_connection_info *nntp = conn->info; - unsigned char *line = rb->data; - unsigned char *end = get_nntp_line_end(rb->data, rb->length); + char *line = rb->data; + char *end = get_nntp_line_end(rb->data, rb->length); enum nntp_code code; int linelen; diff --git a/src/protocol/protocol.c b/src/protocol/protocol.c index 117311a2..00b43058 100644 --- a/src/protocol/protocol.c +++ b/src/protocol/protocol.c @@ -46,7 +46,7 @@ struct protocol_backend { - unsigned char *name; + char *name; int port; protocol_handler_T *handler; unsigned int need_slashes:1; @@ -94,7 +94,7 @@ static const struct protocol_backend protocol_backends[] = { * links). */ enum protocol -get_protocol(unsigned char *name, int namelen) +get_protocol(char *name, int namelen) { /* These are really enum protocol values but can take on negative * values and since 0 <= -1 for enum values it's better to use clean @@ -113,7 +113,7 @@ get_protocol(unsigned char *name, int namelen) assert(start <= protocol && protocol <= end); while (start <= end) { - unsigned char *pname = protocol_backends[protocol].name; + char *pname = protocol_backends[protocol].name; int pnamelen = strlen(pname); int minlen = int_min(pnamelen, namelen); int compare = c_strncasecmp(pname, name, minlen); @@ -255,7 +255,7 @@ generic_external_protocol_handler(struct session *ses, struct uri *uri) protocol_external_handler_T * get_protocol_external_handler(struct terminal *term, struct uri *uri) { - unsigned char *prog; + char *prog; assert(uri && VALID_PROTOCOL(uri->protocol)); if_assert_failed return NULL; diff --git a/src/protocol/protocol.h b/src/protocol/protocol.h index 170a3f6a..947552b2 100644 --- a/src/protocol/protocol.h +++ b/src/protocol/protocol.h @@ -61,7 +61,7 @@ protocol_external_handler_T *get_protocol_external_handler(struct terminal *, st /* Resolves the given protocol @name with length @namelen to a known protocol, * PROTOCOL_UNKOWN or PROTOCOL_INVALID if no protocol part could be identified. * User defined protocols (configurable via protocol.user) takes precedence. */ -enum protocol get_protocol(unsigned char *name, int namelen); +enum protocol get_protocol(char *name, int namelen); extern struct module protocol_module; diff --git a/src/protocol/proxy.c b/src/protocol/proxy.c index 96e4f0e7..075f7c7c 100644 --- a/src/protocol/proxy.c +++ b/src/protocol/proxy.c @@ -25,14 +25,14 @@ static int -proxy_probe_no_proxy(unsigned char *url, unsigned char *no_proxy) +proxy_probe_no_proxy(char *url, char *no_proxy) { - unsigned char *slash = strchr((const char *)url, '/'); + char *slash = strchr((const char *)url, '/'); if (slash) *slash = '\0'; while (no_proxy && *no_proxy) { - unsigned char *jumper = strchr((const char *)no_proxy, ','); + char *jumper = strchr((const char *)no_proxy, ','); skip_space(no_proxy); if (jumper) *jumper = '\0'; @@ -54,14 +54,14 @@ proxy_probe_no_proxy(unsigned char *url, unsigned char *no_proxy) } static struct uri * -proxy_uri(struct uri *uri, unsigned char *proxy, +proxy_uri(struct uri *uri, char *proxy, struct connection_state *error_state) { struct string string; if (init_string(&string) && string_concat(&string, "proxy://", proxy, "/", - (unsigned char *) NULL) + (char *) NULL) && add_uri_to_string(&string, uri, URI_BASE)) { /* There is no need to use URI_BASE when calling get_uri() * because URI_BASE should not add any fragments in the first @@ -80,9 +80,9 @@ proxy_uri(struct uri *uri, unsigned char *proxy, return uri; } -static unsigned char * -strip_proxy_protocol(unsigned char *proxy, - unsigned char *strip1, unsigned char *strip2) +static char * +strip_proxy_protocol(char *proxy, + char *strip1, char *strip2) { assert(proxy && *proxy); @@ -98,12 +98,12 @@ strip_proxy_protocol(unsigned char *proxy, * autogenerating most of the parameters from protocol name. Having a function * exported by protocol/protocol.* dedicated to that would be nice too. * --pasky */ -static unsigned char * -get_protocol_proxy(unsigned char *opt, - unsigned char *env1, unsigned char *env2, - unsigned char *strip1, unsigned char *strip2) +static char * +get_protocol_proxy(char *opt, + char *env1, char *env2, + char *strip1, char *strip2) { - unsigned char *proxy; + char *proxy; proxy = get_opt_str(opt, NULL); if (!*proxy) proxy = getenv(env1); @@ -117,10 +117,10 @@ get_protocol_proxy(unsigned char *opt, } static struct uri * -get_proxy_worker(struct uri *uri, unsigned char *proxy, +get_proxy_worker(struct uri *uri, char *proxy, struct connection_state *error_state) { - unsigned char *protocol_proxy = NULL; + char *protocol_proxy = NULL; if (proxy) { if (*proxy) { @@ -167,8 +167,8 @@ get_proxy_worker(struct uri *uri, unsigned char *proxy, } if (protocol_proxy && *protocol_proxy) { - unsigned char *no_proxy; - unsigned char *slash = strchr((const char *)protocol_proxy, '/'); + char *no_proxy; + char *slash = strchr((const char *)protocol_proxy, '/'); if (slash) *slash = 0; @@ -190,7 +190,7 @@ get_proxy_uri(struct uri *uri, struct connection_state *error_state) return get_composed_uri(uri, URI_BASE); } else { #ifdef CONFIG_SCRIPTING - unsigned char *tmp = NULL; + char *tmp = NULL; static int get_proxy_event_id = EVENT_NONE; set_event_id(get_proxy_event_id, "get-proxy"); diff --git a/src/protocol/rewrite/rewrite.c b/src/protocol/rewrite/rewrite.c index 0ed2a19c..9ea31a2a 100644 --- a/src/protocol/rewrite/rewrite.c +++ b/src/protocol/rewrite/rewrite.c @@ -203,11 +203,11 @@ get_prefix_tree(enum uri_rewrite_option tree) #define MAX_URI_ARGS 10 -static unsigned char * -rewrite_uri(unsigned char *url, struct uri *current_uri, unsigned char *arg) +static char * +rewrite_uri(char *url, struct uri *current_uri, char *arg) { struct string n = NULL_STRING; - unsigned char *args[MAX_URI_ARGS]; + char *args[MAX_URI_ARGS]; int argslen[MAX_URI_ARGS]; int argc = 0; int i; @@ -279,14 +279,14 @@ rewrite_uri(unsigned char *url, struct uri *current_uri, unsigned char *arg) return n.source; } -static unsigned char * -get_uri_rewrite_prefix(enum uri_rewrite_type type, unsigned char *url) +static char * +get_uri_rewrite_prefix(enum uri_rewrite_type type, char *url) { enum uri_rewrite_option tree = type == URI_REWRITE_DUMB ? URI_REWRITE_DUMB_TREE : URI_REWRITE_SMART_TREE; struct option *prefix_tree = get_prefix_tree(tree); struct option *opt = get_opt_rec_real(prefix_tree, url); - unsigned char *exp = opt ? opt->value.string : NULL; + char *exp = opt ? opt->value.string : NULL; return (exp && *exp) ? exp : NULL; } @@ -294,11 +294,11 @@ get_uri_rewrite_prefix(enum uri_rewrite_type type, unsigned char *url) static enum evhook_status goto_url_hook(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); - unsigned char *uu = NULL; - unsigned char *arg = ""; - unsigned char *argstart = *url + strcspn(*url, " :"); + char *uu = NULL; + char *arg = ""; + char *argstart = *url + strcspn(*url, " :"); if (get_smart_enable() && *argstart) { unsigned char bucket = *argstart; diff --git a/src/protocol/smb/smb2.c b/src/protocol/smb/smb2.c index 7381a6d7..c509caf5 100644 --- a/src/protocol/smb/smb2.c +++ b/src/protocol/smb/smb2.c @@ -131,9 +131,9 @@ get_smb_directory_entries(int dir, struct string *prefix) static void add_smb_dir_entry(struct directory_entry *entry, struct string *page, - int pathlen, unsigned char *dircolor) + int pathlen, char *dircolor) { - unsigned char *lnk = NULL; + char *lnk = NULL; struct string html_encoded_name; struct string uri_encoded_name; @@ -163,7 +163,7 @@ add_smb_dir_entry(struct directory_entry *entry, struct string *page, if (readlen > 0 && readlen != MAX_STR_LEN) { buf[readlen] = '\0'; - lnk = straconcat(" -> ", buf, (unsigned char *) NULL); + lnk = straconcat(" -> ", buf, (char *) NULL); } if (!stat(entry->name, &st) && S_ISDIR(st.st_mode)) @@ -176,7 +176,7 @@ add_smb_dir_entry(struct directory_entry *entry, struct string *page, if (entry->attrib[0] == 'd' && *dircolor) { /* The <b> is for the case when use_document_colors is off. */ string_concat(page, "<font color=\"", dircolor, "\"><b>", - (unsigned char *) NULL); + (char *) NULL); } add_string_to_string(page, &html_encoded_name); @@ -199,7 +199,7 @@ add_smb_dir_entry(struct directory_entry *entry, struct string *page, /* First information such as permissions is gathered for each directory entry. * 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, +add_smb_dir_entries(struct directory_entry *entries, char *dirpath, struct string *page) { unsigned char dircolor[8]; @@ -208,7 +208,7 @@ add_smb_dir_entries(struct directory_entry *entries, unsigned char *dirpath, /* Setup @dircolor so it's easy to check if we should color dirs. */ if (get_opt_bool("document.browse.links.color_dirs", NULL)) { color_to_string(get_opt_color("document.colors.dirs", NULL), - (unsigned char *) &dircolor); + (char *) &dircolor); } else { dircolor[0] = 0; } @@ -260,13 +260,13 @@ do_smb(struct connection *conn) struct uri *uri = conn->uri; struct auth_entry *auth = find_auth(uri); struct string string; - unsigned char *url; + char *url; int dir; if ((uri->userlen && uri->passwordlen) || !auth) { url = get_uri_string(uri, URI_BASE); } else { - unsigned char *uri_string = get_uri_string(uri, URI_HOST | URI_PORT | URI_DATA); + char *uri_string = get_uri_string(uri, URI_HOST | URI_PORT | URI_DATA); if (!uri_string || !init_string(&string)) { smb_error(connection_state(S_OUT_OF_MEM)); @@ -447,7 +447,7 @@ smb_got_header(struct socket *socket, struct read_buffer *rb) socket->state = SOCKET_END_ONCLOSE; if (rb->length > 0) { - unsigned char *ctype = memacpy(rb->data, rb->length); + char *ctype = memacpy(rb->data, rb->length); if (ctype && *ctype) { if (!strcmp(ctype, "text/x-error")) { diff --git a/src/protocol/test/stub.c b/src/protocol/test/stub.c index ce47145b..00585c13 100644 --- a/src/protocol/test/stub.c +++ b/src/protocol/test/stub.c @@ -41,7 +41,7 @@ STUB_MODULE(uri_rewrite_module); STUB_MODULE(user_protocol_module); static void -stub_called(const unsigned char *fun) +stub_called(const char *fun) { die("FAIL: stub %s\n", fun); } @@ -78,8 +78,8 @@ STUB_PROTOCOL_HANDLER(smb_protocol_handler); STUB_PROTOCOL_EXTERNAL_HANDLER(user_protocol_handler); /* declared in "protocol/user.h" */ -unsigned char * -get_user_program(struct terminal *term, unsigned char *progid, int progidlen) +char * +get_user_program(struct terminal *term, char *progid, int progidlen) { stub_called("get_user_program"); return NULL; @@ -94,8 +94,8 @@ print_error_dialog(struct session *ses, struct connection_state state, } /* declared in "bfu/msgbox.h" */ -unsigned char * -msg_text(struct terminal *term, unsigned char *format, ...) +char * +msg_text(struct terminal *term, char *format, ...) { stub_called("msg_text"); return NULL; @@ -104,8 +104,8 @@ msg_text(struct terminal *term, unsigned char *format, ...) /* declared in "bfu/msgbox.h" */ struct dialog_data * msg_box(struct terminal *term, struct memory_list *mem_list, - enum msgbox_flags flags, unsigned char *title, enum format_align align, - unsigned char *text, void *udata, int buttons, ...) + enum msgbox_flags flags, char *title, enum format_align align, + char *text, void *udata, int buttons, ...) { /* mem_list should be freed here but because this is just a * test program it won't matter. */ diff --git a/src/protocol/uri.c b/src/protocol/uri.c index b92d6057..8c4fd764 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -58,7 +58,7 @@ is_uri_dir_sep(const struct uri *uri, unsigned char pos) int -is_in_domain(unsigned char *domain, unsigned char *server, int server_len) +is_in_domain(char *domain, char *server, int server_len) { int domain_len = strlen(domain); int len; @@ -77,11 +77,11 @@ is_in_domain(unsigned char *domain, unsigned char *server, int server_len) } int -is_ip_address(const unsigned char *address, int addresslen) +is_ip_address(const char *address, int addresslen) { /* The @address has well defined limits so it would be a shame to * allocate it. */ - unsigned char buffer[IP_ADDRESS_BUFFER_SIZE]; + char buffer[IP_ADDRESS_BUFFER_SIZE]; if (addresslen >= sizeof(buffer)) return 0; @@ -113,10 +113,10 @@ is_ip_address(const unsigned char *address, int addresslen) int -end_with_known_tld(const unsigned char *s, int slen) +end_with_known_tld(const char *s, int slen) { int i; - static const unsigned char *const tld[] = + static const char *const tld[] = { "com", "edu", "net", "org", "gov", "mil", "int", "biz", "arpa", @@ -140,10 +140,10 @@ end_with_known_tld(const unsigned char *s, int slen) /* XXX: this function writes to @name. */ static int -check_whether_file_exists(unsigned char *name) +check_whether_file_exists(char *name) { /* Check POST_CHAR etc ... */ - static const unsigned char chars[] = POST_CHAR_S "#?"; + static const char chars[] = POST_CHAR_S "#?"; int i; int namelen = strlen(name); @@ -151,7 +151,7 @@ check_whether_file_exists(unsigned char *name) return namelen; for (i = 0; i < sizeof(chars) - 1; i++) { - unsigned char *pos = memchr(name, chars[i], namelen); + char *pos = memchr(name, chars[i], namelen); int exists; if (!pos) continue; @@ -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, char *uristring) { int filenamelen = check_whether_file_exists(uristring); @@ -180,9 +180,9 @@ encode_file_uri_string(struct string *string, unsigned char *uristring) static inline int -get_protocol_length(const unsigned char *url) +get_protocol_length(const char *url) { - unsigned char *end = (unsigned char *) url; + char *end = (char *) url; /* Seek the end of the protocol name if any. */ /* RFC1738: @@ -202,11 +202,11 @@ get_protocol_length(const unsigned char *url) } enum uri_errno -parse_uri(struct uri *uri, unsigned char *uristring) +parse_uri(struct uri *uri, char *uristring) { - unsigned char *prefix_end, *host_end; + char *prefix_end, *host_end; #ifdef CONFIG_IPV6 - unsigned char *lbracket, *rbracket; + char *lbracket, *rbracket; #endif assertm(uristring != NULL, "No uri to parse."); @@ -256,7 +256,7 @@ parse_uri(struct uri *uri, unsigned char *uristring) } else if (uri->protocol == PROTOCOL_FILE) { int datalen = strcspn(prefix_end, "#" POST_CHAR_S); - unsigned char *frag_or_post = prefix_end + datalen; + char *frag_or_post = prefix_end + datalen; /* Extract the fragment part. */ if (datalen >= 0) { @@ -307,7 +307,7 @@ parse_uri(struct uri *uri, unsigned char *uristring) if (prefix_end + strcspn(prefix_end, "/") > host_end && *host_end) { /* we have auth info here */ - unsigned char *user_end; + char *user_end; /* Allow '@' in the password component */ while (strcspn(host_end + 1, "@") < strcspn(host_end + 1, "/?")) @@ -361,7 +361,7 @@ parse_uri(struct uri *uri, unsigned char *uristring) } if (*host_end == ':') { /* we have port here */ - unsigned char *port_end = host_end + 1 + strcspn(host_end + 1, "/"); + char *port_end = host_end + 1 + strcspn(host_end + 1, "/"); host_end++; @@ -427,7 +427,7 @@ int get_uri_port(const struct uri *uri) { if (uri->port && uri->portlen) { - const unsigned char *end = uri->port; + const char *end = uri->port; int port = strtol(uri->port, (char **) &end, 10); if (end != uri->port) { @@ -442,8 +442,8 @@ get_uri_port(const struct uri *uri) #define can_compare_uri_components(comp) !(((comp) & (URI_SPECIAL | URI_IDN))) static inline int -compare_component(const unsigned char *a, int alen, - const unsigned char *b, int blen) +compare_component(const char *a, int alen, + const char *b, int blen) { /* Check that the length and the strings are both set or unset */ if (alen != blen || !!a != !!b) return 0; @@ -541,7 +541,7 @@ add_uri_to_string(struct string *string, const struct uri *uri, * the current locale's character set''. Anyway I don't know * how to convert anything to UTF-8 or Unicode. --jonas */ if (wants(URI_IDN)) { - unsigned char *host = memacpy(uri->host, uri->hostlen); + char *host = memacpy(uri->host, uri->hostlen); if (host) { char *idname; @@ -595,8 +595,8 @@ add_uri_to_string(struct string *string, const struct uri *uri, /* We can not test uri->datalen here since we need to always * add '/'. */ if (wants(URI_PATH) || wants(URI_FILENAME)) { - const unsigned char *filename = uri->data; - const unsigned char *pos; + const char *filename = uri->data; + const char *pos; assertm(!wants(URI_FILENAME) || components == URI_FILENAME, "URI_FILENAME should be used alone %d", components); @@ -631,7 +631,7 @@ add_uri_to_string(struct string *string, const struct uri *uri, } if (wants(URI_QUERY) && uri->datalen) { - const unsigned char *query = memchr(uri->data, '?', uri->datalen); + const char *query = memchr(uri->data, '?', uri->datalen); assertm(URI_QUERY == components, "URI_QUERY should be used alone %d", components); @@ -670,7 +670,7 @@ add_uri_to_string(struct string *string, const struct uri *uri, #undef wants -unsigned char * +char * get_uri_string(const struct uri *uri, enum uri_component components) { struct string string; @@ -685,7 +685,7 @@ get_uri_string(const struct uri *uri, enum uri_component components) struct string * -add_string_uri_to_string(struct string *string, unsigned char *uristring, +add_string_uri_to_string(struct string *string, char *uristring, enum uri_component components) { struct uri uri; @@ -700,11 +700,11 @@ add_string_uri_to_string(struct string *string, unsigned char *uristring, #define normalize_uri_reparse(str) normalize_uri(NULL, str) #define normalize_uri_noparse(uri) normalize_uri(uri, struri(uri)) -unsigned char * -normalize_uri(struct uri *uri, unsigned char *uristring) +char * +normalize_uri(struct uri *uri, char *uristring) { - unsigned char *parse_string = uristring; - unsigned char *src, *dest, *path; + char *parse_string = uristring; + char *src, *dest, *path; int need_slash = 0, keep_dslash = 1; int parse = (uri == NULL); struct uri uri_struct; @@ -819,9 +819,9 @@ normalize_uri(struct uri *uri, unsigned char *uristring) * backend can understand. No host parts etc, that is what this function is * supposed to chew. */ static struct uri * -transform_file_url(struct uri *uri, const unsigned char *cwd) +transform_file_url(struct uri *uri, const char *cwd) { - unsigned char *path = uri->data; + char *path = uri->data; assert(uri->protocol == PROTOCOL_FILE && uri->data); @@ -877,12 +877,12 @@ transform_file_url(struct uri *uri, const unsigned char *cwd) return uri; } -static unsigned char *translate_url(unsigned char *url, unsigned char *cwd); +static char *translate_url(char *url, char *cwd); -unsigned char * -join_urls(struct uri *base, unsigned char *rel) +char * +join_urls(struct uri *base, char *rel) { - unsigned char *uristring, *path; + char *uristring, *path; int add_slash = 0; int translate = 0; int length = 0; @@ -930,7 +930,7 @@ join_urls(struct uri *base, unsigned char *rel) add_to_strn(&uristring, rel); if (translate) { - unsigned char *translated; + char *translated; translated = translate_url(uristring, NULL); mem_free(uristring); @@ -976,7 +976,7 @@ join_urls(struct uri *base, unsigned char *rel) } if (!is_uri_dir_sep(base, rel[0])) { - unsigned char *path_end; + char *path_end; /* The URL is relative. */ @@ -1014,9 +1014,9 @@ join_urls(struct uri *base, unsigned char *rel) /* Tries to figure out what protocol @newurl might be specifying by checking if * it exists as a file locally or by checking parts of the host name. */ static enum protocol -find_uri_protocol(unsigned char *newurl) +find_uri_protocol(char *newurl) { - unsigned char *ch; + char *ch; /* First see if it is a file so filenames that look like hostnames * won't confuse us below. */ @@ -1042,7 +1042,7 @@ find_uri_protocol(unsigned char *newurl) #ifdef CONFIG_IPV6 } else if (*newurl == '[' && *ch == ':') { /* Candidate for IPv6 address */ - unsigned char *bracket2, *colon2; + char *bracket2, *colon2; ch++; bracket2 = strchr((const char *)ch, ']'); @@ -1053,8 +1053,8 @@ find_uri_protocol(unsigned char *newurl) } else if (*newurl != '.' && *ch == '.') { /* Contains domain name? */ - unsigned char *host_end, *domain; - unsigned char *ipscan; + char *host_end, *domain; + char *ipscan; /* Process the hostname */ for (domain = ch + 1; @@ -1082,10 +1082,10 @@ find_uri_protocol(unsigned char *newurl) /* Returns an URI string that can be used internally. Adding protocol prefix, * missing slashes etc. */ -static unsigned char * -translate_url(unsigned char *url, unsigned char *cwd) +static char * +translate_url(char *url, char *cwd) { - unsigned char *newurl; + char *newurl; struct uri uri; enum uri_errno uri_errno, prev_errno = URI_ERRNO_EMPTY; int retries = 0; @@ -1168,7 +1168,7 @@ parse_uri: /* Translate the proxied URI too if proxy:// */ if (uri.protocol == PROTOCOL_PROXY) { - unsigned char *data = translate_url(uri.data, cwd); + char *data = translate_url(uri.data, cwd); int pos = uri.data - struri(&uri); if (!data) break; @@ -1182,7 +1182,7 @@ parse_uri: case URI_ERRNO_TOO_MANY_SLASHES: { - unsigned char *from, *to; + char *from, *to; assert(uri.string[uri.protocollen] == ':' && uri.string[uri.protocollen + 1] == '/' @@ -1210,8 +1210,8 @@ parse_uri: case URI_ERRNO_TRAILING_DOTS: { /* Trim trailing '.'s */ - unsigned char *from = uri.host + uri.hostlen; - unsigned char *to = from; + char *from = uri.host + uri.hostlen; + char *to = from; assert(uri.host < to && to[-1] == '.' && *from != '.'); @@ -1300,7 +1300,7 @@ parse_uri: struct uri * get_composed_uri(struct uri *uri, enum uri_component components) { - unsigned char *string; + char *string; assert(uri); if_assert_failed return NULL; @@ -1315,7 +1315,7 @@ get_composed_uri(struct uri *uri, enum uri_component components) } struct uri * -get_translated_uri(unsigned char *uristring, unsigned char *cwd) +get_translated_uri(char *uristring, char *cwd) { struct uri *uri; @@ -1333,12 +1333,12 @@ get_translated_uri(unsigned char *uristring, unsigned char *cwd) !memcmp(uri->data, type ",", sizeof(type ",") - 1)) \ return stracpy("." ext); -unsigned char * +char * get_extension_from_uri(struct uri *uri) { - unsigned char *extension = NULL; + char *extension = NULL; int afterslash = 1; - unsigned char *pos = uri->data; + char *pos = uri->data; assert(pos); @@ -1378,11 +1378,11 @@ 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 char *name, int namelen, int convert_slashes) { - unsigned char n[4]; - const unsigned char *end; + char n[4]; + const char *end; n[0] = '%'; n[3] = '\0'; @@ -1407,10 +1407,10 @@ 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, char *name, int namelen) { - unsigned char n[4]; - unsigned char *end; + char n[4]; + char *end; n[0] = '%'; n[3] = '\0'; @@ -1433,9 +1433,9 @@ encode_win32_uri_string(struct string *string, unsigned char *name, int namelen) /* XXX: but decoded string is _never_ longer than encoded string so it's an * efficient way to do that, imho. --Zas */ void -decode_uri(unsigned char *src) +decode_uri(char *src) { - unsigned char *dst = src; + char *dst = src; unsigned char c; do { @@ -1478,7 +1478,7 @@ decode_uri_string(struct string *string) } void -decode_uri_for_display(unsigned char *src) +decode_uri_for_display(char *src) { decode_uri(src); @@ -1534,7 +1534,7 @@ free_uri_list(struct uri_list *list) struct uri_cache_entry { struct uri uri; - unsigned char string[1]; + char string[1]; }; struct uri_cache { @@ -1565,7 +1565,7 @@ error: #endif static inline struct uri_cache_entry * -get_uri_cache_entry(unsigned char *string, int length) +get_uri_cache_entry(char *string, int length) { struct uri_cache_entry *entry; struct hash_item *item; @@ -1597,7 +1597,7 @@ get_uri_cache_entry(unsigned char *string, int length) } struct uri * -get_uri(unsigned char *string, enum uri_component components) +get_uri(char *string, enum uri_component components) { struct uri_cache_entry *entry; @@ -1635,7 +1635,7 @@ get_uri(unsigned char *string, enum uri_component components) void done_uri(struct uri *uri) { - unsigned char *string = struri(uri); + char *string = struri(uri); int length = strlen(string); struct hash_item *item; struct uri_cache_entry *entry; diff --git a/src/protocol/uri.h b/src/protocol/uri.h index 7ff69ce8..05f74111 100644 --- a/src/protocol/uri.h +++ b/src/protocol/uri.h @@ -33,7 +33,7 @@ struct uri { * The post_data is not really %part of the URI but ELinks keeps it * in the same %string and can then distinguish between cache entries * for different POST requests. See uri.post for its syntax. */ - unsigned char *string; + char *string; /* The internal type of protocol. Can _never_ be PROTOCOL_UNKNOWN. */ int protocol; /* enum protocol */ @@ -42,14 +42,14 @@ struct uri { * forcing the given IP family. 0 means the IP family is not forced. */ int ip_family; - unsigned char *user; - unsigned char *password; - unsigned char *host; - unsigned char *port; + char *user; + char *password; + char *host; + char *port; /* @data can contain both the path and query uri fields. * It can never be NULL but can have zero length. */ - unsigned char *data; - unsigned char *fragment; + char *data; + char *fragment; /** POST data attached to the URI. If uri.string contains a * ::POST_CHAR, then @c post points to the following @@ -71,7 +71,7 @@ struct uri { * to the server. It is in the charset accepted by open(), * and some characters (especially ::FILE_CHAR) are * percent-encoded. */ - unsigned char *post; + char *post; /* @protocollen should only be usable if @protocol is either * PROTOCOL_USER or an uri string should be composed. */ @@ -110,7 +110,7 @@ enum uri_errno { * If an uri component is recognized both it's length and starting point is * set. */ /* Returns what error was encountered or URI_ERRNO_OK if parsing went well. */ -enum uri_errno parse_uri(struct uri *uri, unsigned char *uristring); +enum uri_errno parse_uri(struct uri *uri, char *uristring); /* Returns the raw zero-terminated URI string the (struct uri) is associated @@ -246,7 +246,7 @@ void free_uri_list(struct uri_list *list); /* Register a new URI in the cache where @components controls which parts are * added to the returned URI. */ -struct uri *get_uri(unsigned char *string, enum uri_component components); +struct uri *get_uri(char *string, enum uri_component components); /* Dereference an URI from the cache */ void done_uri(struct uri *uri); @@ -267,12 +267,12 @@ struct uri *get_composed_uri(struct uri *uri, enum uri_component components); * and get the resulting URI from the cache. * @uristring is the URI to resolve or translate. * @cwd if non NULL @uristring will be translated using this CWD. */ -struct uri *get_translated_uri(unsigned char *uristring, unsigned char *cwd); +struct uri *get_translated_uri(char *uristring, char *cwd); /* Normalizes the directory structure given in uristring. XXX: The function * modifies the uristring and returns it. The uri argument should be NULL * if the uri is not the parsed uristring. */ -unsigned char *normalize_uri(struct uri *uri, unsigned char *uristring); +char *normalize_uri(struct uri *uri, char *uristring); /* Check if two URIs are equal. If @components are 0 simply compare the whole * URI else only compare the specific parts. */ @@ -289,10 +289,10 @@ struct string *add_uri_to_string(struct string *string, const struct uri *uri, /* 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, 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, +char *get_uri_string(const struct uri *uri, enum uri_component components); /* Returns either the uri's port number if available or the protocol's @@ -310,33 +310,33 @@ 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 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, char *name, int namelen); void decode_uri_string(struct string *string); -void decode_uri(unsigned char *uristring); +void decode_uri(char *uristring); /* Decodes and replaces illicit screen chars with '*'. */ void decode_uri_string_for_display(struct string *string); -void decode_uri_for_display(unsigned char *uristring); +void decode_uri_for_display(char *uristring); /* Returns allocated string containing the biggest possible extension. * If url is 'jabadaba.1.foo.gz' the returned extension is '1.foo.gz' */ -unsigned char *get_extension_from_uri(struct uri *uri); +char *get_extension_from_uri(struct uri *uri); /* Resolves a @relative URI to absolute form using @base URI. * Example: if @base is http://elinks.cz/ and @relative is #news * the outcome would be http://elinks.cz/#news */ -unsigned char *join_urls(struct uri *base, unsigned char *relative); +char *join_urls(struct uri *base, char *relative); /* Return position if end of string @s matches a known tld or -1 if not. * If @slen < 0, then string length will be obtained by a strlen() call, * else @slen is used as @s length. */ -int end_with_known_tld(const unsigned char *s, int slen); +int end_with_known_tld(const char *s, int slen); static inline int @@ -346,7 +346,7 @@ get_real_uri_length(struct uri *uri) } /* Checks if @address contains a valid IP address. */ -int is_ip_address(const unsigned char *address, int addresslen); +int is_ip_address(const char *address, int addresslen); /* Check whether domain is matching server * Ie. @@ -355,7 +355,7 @@ int is_ip_address(const unsigned char *address, int addresslen); * example.com doesn't match www.example.comm/ * example.com doesn't match example.co */ -int is_in_domain(unsigned char *domain, unsigned char *server, int server_len); +int is_in_domain(char *domain, char *server, int server_len); #ifdef __cplusplus } diff --git a/src/protocol/user.c b/src/protocol/user.c index fda52704..7a91face 100644 --- a/src/protocol/user.c +++ b/src/protocol/user.c @@ -92,8 +92,8 @@ struct module user_protocol_module = struct_module( ); -unsigned char * -get_user_program(struct terminal *term, unsigned char *progid, int progidlen) +char * +get_user_program(struct terminal *term, char *progid, int progidlen) { struct option *opt; int xwin = term ? term->environment & ENV_XWIN : 0; @@ -113,13 +113,13 @@ get_user_program(struct terminal *term, unsigned char *progid, int progidlen) opt = get_opt_rec_real(config_options, name.source); done_string(&name); - return (unsigned char *) (opt ? opt->value.string : NULL); + return (char *) (opt ? opt->value.string : NULL); } -static unsigned char * -subst_cmd(unsigned char *cmd, struct uri *uri, unsigned char *subj, - unsigned char *formfile) +static char * +subst_cmd(char *cmd, struct uri *uri, char *subj, + char *formfile) { struct string string; @@ -140,7 +140,7 @@ subst_cmd(unsigned char *cmd, struct uri *uri, unsigned char *subj, switch (*cmd) { case 'u': { - unsigned char *url = struri(uri); + char *url = struri(uri); int length = get_real_uri_length(uri); add_shell_safe_to_string(&string, url, length); @@ -197,10 +197,10 @@ subst_cmd(unsigned char *cmd, struct uri *uri, unsigned char *subj, /* Stay silent about complete RFC 2368 support or do it yourself! ;-). * --pasky */ -static unsigned char * -get_subject_from_query(unsigned char *query) +static char * +get_subject_from_query(char *query) { - unsigned char *subject; + char *subject; if (strncmp(query, "subject=", 8)) { subject = strstr((const char *)query, "&subject="); @@ -214,14 +214,14 @@ get_subject_from_query(unsigned char *query) return memacpy(subject, strcspn(subject, "&")); } -static unsigned char * +static char * save_form_data_to_file(struct uri *uri) { - unsigned char *filename = get_tempdir_filename("elinks-XXXXXX"); + char *filename = get_tempdir_filename("elinks-XXXXXX"); int fd; FILE *fp; size_t nmemb, len; - unsigned char *formdata; + char *formdata; if (!filename) return NULL; @@ -264,12 +264,12 @@ error: void user_protocol_handler(struct session *ses, struct uri *uri) { - unsigned char *subj = NULL, *prog; - unsigned char *filename; + char *subj = NULL, *prog; + char *filename; prog = get_user_program(ses->tab->term, struri(uri), uri->protocollen); if (!prog || !*prog) { - unsigned char *protocol = memacpy(struri(uri), uri->protocollen); + char *protocol = memacpy(struri(uri), uri->protocollen); /* Shouldn't ever happen, but be paranoid. */ /* Happens when you're in X11 and you've no handler for it. */ @@ -285,7 +285,7 @@ user_protocol_handler(struct session *ses, struct uri *uri) if (uri->data && uri->datalen) { /* Some mailto specific stuff follows... */ - unsigned char *query = get_uri_string(uri, URI_QUERY); + char *query = get_uri_string(uri, URI_QUERY); if (query) { subj = get_subject_from_query(query); @@ -299,7 +299,7 @@ user_protocol_handler(struct session *ses, struct uri *uri) prog = subst_cmd(prog, uri, subj, filename); mem_free_if(subj); if (prog) { - unsigned char *delete_ = empty_string_or_(filename); + char *delete_ = empty_string_or_(filename); exec_on_terminal(ses->tab->term, prog, delete_, TERM_EXEC_FG); mem_free(prog); diff --git a/src/protocol/user.h b/src/protocol/user.h index 817a8871..8dcde916 100644 --- a/src/protocol/user.h +++ b/src/protocol/user.h @@ -12,7 +12,7 @@ extern "C" { extern struct module user_protocol_module; extern protocol_external_handler_T user_protocol_handler; -unsigned char *get_user_program(struct terminal *, unsigned char *, int); +char *get_user_program(struct terminal *, char *, int); #ifdef __cplusplus } diff --git a/src/scripting/guile/core.c b/src/scripting/guile/core.c index b90721b3..c80b7edb 100644 --- a/src/scripting/guile/core.c +++ b/src/scripting/guile/core.c @@ -45,7 +45,7 @@ init_guile(struct module *module) { SCM user_module; SCM internal_module; - unsigned char *path; + char *path; scm_init_guile(); @@ -55,7 +55,7 @@ init_guile(struct module *module) user_module = scm_current_module(); path = straconcat(elinks_home, GUILE_HOOKS_FILENAME, - (unsigned char *) NULL); + (char *) NULL); if (!path) return; if (file_can_read(path)) { @@ -78,7 +78,7 @@ init_guile(struct module *module) mem_free(path); path = straconcat(elinks_home, GUILE_USERHOOKS_FILENAME, - (unsigned char *) NULL); + (char *) NULL); if (!path) return; if (file_can_read(path)) scm_c_primitive_load_path(path); diff --git a/src/scripting/guile/guile.h b/src/scripting/guile/guile.h index 440790e6..dcf137a1 100644 --- a/src/scripting/guile/guile.h +++ b/src/scripting/guile/guile.h @@ -1,4 +1,3 @@ - #ifndef EL__SCRIPTING_GUILE_GUILE_H #define EL__SCRIPTING_GUILE_GUILE_H diff --git a/src/scripting/guile/hooks.c b/src/scripting/guile/hooks.c index f2e3184e..f481a880 100644 --- a/src/scripting/guile/hooks.c +++ b/src/scripting/guile/hooks.c @@ -36,13 +36,13 @@ error_handler(void *data, SCM tag, SCM throw_args) static SCM get_guile_hook_do(void *data) { - unsigned char *hook = data; + char *hook = data; return scm_c_module_lookup(internal_module(), hook); } static SCM -get_guile_hook(unsigned char *hook) +get_guile_hook(char *hook) { return scm_internal_catch(SCM_BOOL_T, get_guile_hook_do, hook, error_handler, NULL); @@ -55,7 +55,7 @@ get_guile_hook(unsigned char *hook) static enum evhook_status script_hook_goto_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); SCM proc; SCM x; @@ -70,9 +70,9 @@ script_hook_goto_url(va_list ap, void *data) x = scm_call_1(SCM_VARIABLE_REF(proc), scm_from_locale_string(*url)); if (scm_is_string(x)) { - unsigned char *new_url; + char *new_url; - new_url = stracpy((unsigned char *)scm_to_locale_string(x)); + new_url = stracpy((char *)scm_to_locale_string(x)); if (new_url) { mem_free_set(url, new_url); } @@ -86,7 +86,7 @@ script_hook_goto_url(va_list ap, void *data) static enum evhook_status script_hook_follow_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); SCM proc; SCM x; @@ -101,9 +101,9 @@ script_hook_follow_url(va_list ap, void *data) x = scm_call_1(SCM_VARIABLE_REF(proc), scm_from_locale_string(*url)); if (scm_is_string(x)) { - unsigned char *new_url; + char *new_url; - new_url = stracpy((unsigned char *)scm_to_locale_string(x)); + new_url = stracpy((char *)scm_to_locale_string(x)); if (new_url) { mem_free_set(url, new_url); } @@ -120,7 +120,7 @@ script_hook_pre_format_html(va_list ap, void *data) struct session *ses = va_arg(ap, struct session *); struct cache_entry *cached = va_arg(ap, struct cache_entry *); struct fragment *fragment = get_cache_fragment(cached); - unsigned char *url = struri(cached->uri), *frag; + char *url = struri(cached->uri), *frag; size_t len; SCM proc; SCM x; @@ -137,7 +137,7 @@ script_hook_pre_format_html(va_list ap, void *data) if (!scm_is_string(x)) return EVENT_HOOK_STATUS_NEXT; - frag = (unsigned char *)scm_to_locale_stringn(x, &len); + frag = (char *)scm_to_locale_stringn(x, &len); add_fragment(cached, 0, frag, len); normalize_cache_entry(cached, len); @@ -151,8 +151,8 @@ script_hook_pre_format_html(va_list ap, void *data) static enum evhook_status script_hook_get_proxy(va_list ap, void *data) { - unsigned char **retval = va_arg(ap, unsigned char **); - unsigned char *url = va_arg(ap, unsigned char *); + char **retval = va_arg(ap, char **); + char *url = va_arg(ap, char *); SCM proc = get_guile_hook("%get-proxy-hook"); SCM x; diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 02d9e149..7a5b7de5 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -80,9 +80,9 @@ static sigjmp_buf errjmp; #define L lua_state #define LS lua_State *S -static void handle_standard_lua_returns(unsigned char *from); +static void handle_standard_lua_returns(char *from); static void handle_ref(LS, struct session *ses, int func_ref, - unsigned char *from, int num_args, int unref); + char *from, int num_args, int unref); /* @@ -92,7 +92,7 @@ static void handle_ref(LS, struct session *ses, int func_ref, static int l_alert(LS) { - unsigned char *msg = (unsigned char *) lua_tostring(S, 1); + char *msg = (char *) lua_tostring(S, 1); /* Don't crash if a script calls e.g. error(nil) or error(error). */ if (msg == NULL) @@ -107,7 +107,7 @@ l_current_url(LS) { if (lua_ses && have_location(lua_ses)) { struct view_state *vs = &cur_loc(lua_ses)->vs; - unsigned char *url = get_uri_string(vs->uri, URI_ORIGINAL); + char *url = get_uri_string(vs->uri, URI_ORIGINAL); if (url) { lua_pushstring(S, url); @@ -140,7 +140,7 @@ l_current_title(LS) struct document_view *doc_view = current_frame(lua_ses); if (doc_view && doc_view->document->title) { - unsigned char *clean_title = stracpy(doc_view->document->title); + char *clean_title = stracpy(doc_view->document->title); if (clean_title) { sanitize_title(clean_title); @@ -212,7 +212,7 @@ static int l_pipe_read(LS) { FILE *fp; - unsigned char *s = NULL; + char *s = NULL; size_t len = 0; if (!lua_isstring(S, 1)) goto lua_error; @@ -221,11 +221,11 @@ l_pipe_read(LS) if (!fp) goto lua_error; while (!feof(fp)) { - unsigned char buf[1024]; + char buf[1024]; size_t l = fread(buf, 1, sizeof(buf), fp); if (l > 0) { - unsigned char *news = mem_realloc(s, len + l); + char *news = mem_realloc(s, len + l); if (!news) goto lua_error; s = news; @@ -252,7 +252,7 @@ static int l_execute(LS) { if (lua_isstring(S, 1)) { - exec_on_terminal(lua_ses->tab->term, (unsigned char *) lua_tostring(S, 1), "", + exec_on_terminal(lua_ses->tab->term, (char *) lua_tostring(S, 1), "", TERM_EXEC_BG); lua_pushnumber(S, 0); return 1; @@ -265,7 +265,7 @@ l_execute(LS) static int l_tmpname(LS) { - unsigned char *fn = tempnam(NULL, "elinks"); + char *fn = tempnam(NULL, "elinks"); if (fn) { lua_pushstring(S, fn); @@ -304,7 +304,7 @@ l_bind_key(LS) { int ref; int event_id; - unsigned char *err = NULL; + char *err = NULL; struct string event_name = NULL_STRING; if (!lua_isstring(S, 1) || !lua_isstring(S, 2) @@ -329,8 +329,8 @@ l_bind_key(LS) ref = luaL_ref(S, LUA_REGISTRYINDEX); add_format_to_string(&event_name, "lua-run-func %i", ref); - event_id = bind_key_to_event_name((unsigned char *) lua_tostring(S, 1), - (const unsigned char *) lua_tostring(S, 2), + event_id = bind_key_to_event_name((char *) lua_tostring(S, 1), + (const char *) lua_tostring(S, 2), event_name.source, &err); done_string(&event_name); @@ -362,9 +362,9 @@ lua_error: struct lua_dlg_data { lua_State *state; - unsigned char cat[MAX_STR_LEN]; - unsigned char name[MAX_STR_LEN]; - unsigned char url[MAX_STR_LEN]; + char cat[MAX_STR_LEN]; + char name[MAX_STR_LEN]; + char url[MAX_STR_LEN]; int func_ref; }; @@ -401,11 +401,11 @@ l_edit_bookmark_dialog(LS) data = (struct lua_dlg_data *) get_dialog_offset(dlg, L_EDIT_BMK_WIDGETS_COUNT); data->state = S; - safe_strncpy(data->cat, (unsigned char *) lua_tostring(S, 1), + safe_strncpy(data->cat, (char *) lua_tostring(S, 1), MAX_STR_LEN-1); - safe_strncpy(data->name, (unsigned char *) lua_tostring(S, 2), + safe_strncpy(data->name, (char *) lua_tostring(S, 2), MAX_STR_LEN-1); - safe_strncpy(data->url, (unsigned char *) lua_tostring(S, 3), + safe_strncpy(data->url, (char *) lua_tostring(S, 3), MAX_STR_LEN-1); lua_pushvalue(S, 4); data->func_ref = luaL_ref(S, LUA_REGISTRYINDEX); @@ -441,7 +441,7 @@ struct lua_xdialog_data { lua_State *state; int func_ref; int nfields; - unsigned char fields[XDIALOG_MAX_FIELDS][MAX_STR_LEN]; + char fields[XDIALOG_MAX_FIELDS][MAX_STR_LEN]; }; static void @@ -486,7 +486,7 @@ l_xdialog(LS) data->nfields = nfields; for (i = 0; i < nfields; i++) safe_strncpy(data->fields[i], - (unsigned char *) lua_tostring(S, i+1), + (char *) lua_tostring(S, i+1), MAX_STR_LEN-1); lua_pushvalue(S, nargs); data->func_ref = luaL_ref(S, LUA_REGISTRYINDEX); @@ -531,7 +531,7 @@ l_set_option(LS) /* Get option record */ name = lua_tostring(S, 1); - opt = get_opt_rec(config_options, (unsigned char *) name); + opt = get_opt_rec(config_options, (char *) name); if (opt == NULL) goto lua_error; @@ -543,7 +543,7 @@ l_set_option(LS) * saves the value to opt->value.number, which is an int. */ long value = lua_toboolean(S, 2); - option_types[opt->type].set(opt, (unsigned char *) (&value)); + option_types[opt->type].set(opt, (char *) (&value)); break; } case OPT_INT: @@ -554,14 +554,14 @@ l_set_option(LS) * option_types[OPT_LONG].set of course wants a long too. */ long value = lua_tonumber(S, 2); - option_types[opt->type].set(opt, (unsigned char *) (&value)); + option_types[opt->type].set(opt, (char *) (&value)); break; } case OPT_STRING: case OPT_CODEPAGE: case OPT_LANGUAGE: case OPT_COLOR: - option_types[opt->type].set(opt, (unsigned char *) lua_tostring(S, 2)); + option_types[opt->type].set(opt, (char *) lua_tostring(S, 2)); break; default: goto lua_error; @@ -588,7 +588,7 @@ l_get_option(LS) if (nargs != 1) goto lua_error; name = lua_tostring(S, 1); - opt = get_opt_rec(config_options, (unsigned char *) name); + opt = get_opt_rec(config_options, (char *) name); if (opt == NULL) goto lua_error; @@ -608,7 +608,7 @@ l_get_option(LS) break; case OPT_CODEPAGE: { - unsigned char *cp_name; + char *cp_name; cp_name = get_cp_config_name(opt->value.number); lua_pushstring(S, cp_name); @@ -616,7 +616,7 @@ l_get_option(LS) } case OPT_LANGUAGE: { - unsigned char *lang; + char *lang; #ifdef ENABLE_NLS lang = language_to_name(current_language); @@ -629,8 +629,8 @@ l_get_option(LS) case OPT_COLOR: { color_T color; - unsigned char hexcolor[8]; - const unsigned char *strcolor; + char hexcolor[8]; + const char *strcolor; color = opt->value.color; strcolor = get_color_string(color, hexcolor); @@ -658,7 +658,7 @@ eval_function(LS, int num_args, int num_results) err = lua_pcall(S, num_args, num_results, 0); if (err) { - alert_lua_error((unsigned char *) lua_tostring(L, -1)); + alert_lua_error((char *) lua_tostring(L, -1)); lua_pop(L, 1); } @@ -668,10 +668,10 @@ eval_function(LS, int num_args, int num_results) /* Initialisation */ static void -do_hooks_file(LS, unsigned char *prefix, unsigned char *filename) +do_hooks_file(LS, char *prefix, char *filename) { - unsigned char *file = straconcat(prefix, STRING_DIR_SEP, filename, - (unsigned char *) NULL); + char *file = straconcat(prefix, STRING_DIR_SEP, filename, + (char *) NULL); if (!file) return; @@ -713,7 +713,7 @@ init_lua(struct module *module) lua_register(L, "get_option", l_get_option); lua_pushstring(L, elinks_home ? elinks_home - : (unsigned char *) CONFDIR); + : (char *) CONFDIR); lua_setglobal(L, "elinks_home"); do_hooks_file(L, CONFDIR, LUA_HOOKS_FILENAME); @@ -762,7 +762,7 @@ finish_lua(void) /* Error reporting. */ void -alert_lua_error(unsigned char *msg) +alert_lua_error(char *msg) { if (errterm) { info_box(errterm, MSGBOX_NO_TEXT_INTL | MSGBOX_FREE_TEXT, @@ -776,9 +776,9 @@ alert_lua_error(unsigned char *msg) } void -alert_lua_error2(unsigned char *msg, unsigned char *msg2) +alert_lua_error2(char *msg, char *msg2) { - unsigned char *tmp = stracpy(msg); + char *tmp = stracpy(msg); if (!tmp) return; add_to_strn(&tmp, msg2); @@ -794,7 +794,7 @@ alert_lua_error2(unsigned char *msg, unsigned char *msg2) static void handle_ret_eval(struct session *ses) { - const unsigned char *expr = lua_tostring(L, -1); + const char *expr = lua_tostring(L, -1); if (expr) { int oldtop = lua_gettop(L); @@ -813,7 +813,7 @@ handle_ret_eval(struct session *ses) static void handle_ret_run(struct session *ses) { - unsigned char *cmd = (unsigned char *) lua_tostring(L, -1); + char *cmd = (char *) lua_tostring(L, -1); if (cmd) { exec_on_terminal(ses->tab->term, cmd, "", TERM_EXEC_FG); @@ -826,7 +826,7 @@ handle_ret_run(struct session *ses) static void handle_ret_goto_url(struct session *ses) { - unsigned char *url = (unsigned char *) lua_tostring(L, -1); + char *url = (char *) lua_tostring(L, -1); if (url) { goto_url_with_hook(ses, url); @@ -837,9 +837,9 @@ handle_ret_goto_url(struct session *ses) } static void -handle_standard_lua_returns(unsigned char *from) +handle_standard_lua_returns(char *from) { - const unsigned char *act = lua_tostring(L, -2); + const char *act = lua_tostring(L, -2); if (act) { if (!strcmp(act, "eval")) @@ -858,7 +858,7 @@ handle_standard_lua_returns(unsigned char *from) } static void -handle_ref_on_stack(LS, struct session *ses, unsigned char *from, int num_args) +handle_ref_on_stack(LS, struct session *ses, char *from, int num_args) { int err; @@ -870,7 +870,7 @@ handle_ref_on_stack(LS, struct session *ses, unsigned char *from, int num_args) } static void -handle_ref(LS, struct session *ses, int func_ref, unsigned char *from, +handle_ref(LS, struct session *ses, int func_ref, char *from, int num_args, int unref) { lua_rawgeti(S, LUA_REGISTRYINDEX, func_ref); @@ -890,7 +890,7 @@ handle_ref(LS, struct session *ses, int func_ref, unsigned char *from, static INIT_INPUT_HISTORY(lua_console_history); static void -lua_console(struct session *ses, unsigned char *expr) +lua_console(struct session *ses, char *expr) { lua_getglobal(L, "lua_console_hook"); if (lua_isnil(L, -1)) { @@ -919,7 +919,7 @@ dialog_lua_console(va_list ap, void *data) N_("Lua Console"), N_("Enter expression"), ses, &lua_console_history, MAX_STR_LEN, "", 0, 0, NULL, - (void (*)(void *, unsigned char *)) lua_console, NULL); + (void (*)(void *, char *)) lua_console, NULL); return EVENT_HOOK_STATUS_NEXT; } diff --git a/src/scripting/lua/core.h b/src/scripting/lua/core.h index 0dd92e9a..2f2773b6 100644 --- a/src/scripting/lua/core.h +++ b/src/scripting/lua/core.h @@ -22,8 +22,8 @@ extern lua_State *lua_state; int prepare_lua(struct session *); void finish_lua(void); -void alert_lua_error(unsigned char *); -void alert_lua_error2(unsigned char *, unsigned char *); +void alert_lua_error(char *); +void alert_lua_error2(char *, char *); enum evhook_status dialog_lua_console(va_list ap, void *data); enum evhook_status free_lua_console_history(va_list ap, void *data); diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c index f41fa98b..0d2a9a4f 100644 --- a/src/scripting/lua/hooks.c +++ b/src/scripting/lua/hooks.c @@ -47,7 +47,7 @@ static enum evhook_status script_hook_goto_url(va_list ap, void *data) { lua_State *L = lua_state; - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); int err; @@ -75,9 +75,9 @@ script_hook_goto_url(va_list ap, void *data) if (err) return EVENT_HOOK_STATUS_NEXT; if (lua_isstring(L, -1)) { - unsigned char *new_url; + char *new_url; - new_url = stracpy((unsigned char *) lua_tostring(L, -1)); + new_url = stracpy((char *) lua_tostring(L, -1)); if (new_url) { mem_free_set(url, new_url); } @@ -96,7 +96,7 @@ static enum evhook_status script_hook_follow_url(va_list ap, void *data) { lua_State *L = lua_state; - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); int err; @@ -118,9 +118,9 @@ script_hook_follow_url(va_list ap, void *data) if (err) return EVENT_HOOK_STATUS_NEXT; if (lua_isstring(L, -1)) { - unsigned char *new_url; + char *new_url; - new_url = stracpy((unsigned char *) lua_tostring(L, -1)); + new_url = stracpy((char *) lua_tostring(L, -1)); if (new_url) { mem_free_set(url, new_url); } @@ -142,7 +142,7 @@ script_hook_pre_format_html(va_list ap, void *data) struct session *ses = va_arg(ap, struct session *); struct cache_entry *cached = va_arg(ap, struct cache_entry *); struct fragment *fragment = get_cache_fragment(cached); - unsigned char *url = struri(cached->uri); + char *url = struri(cached->uri); int err; if (!cached->length || !*fragment->data) return EVENT_HOOK_STATUS_NEXT; @@ -169,7 +169,7 @@ script_hook_pre_format_html(va_list ap, void *data) #else int len = lua_strlen(L, -1); #endif - add_fragment(cached, 0, (unsigned char *) lua_tostring(L, -1), len); + add_fragment(cached, 0, (char *) lua_tostring(L, -1), len); normalize_cache_entry(cached, len); } else if (!lua_isnil(L, -1)) { alert_lua_error("pre_format_html_hook must return a string or nil"); @@ -188,8 +188,8 @@ static enum evhook_status script_hook_get_proxy(va_list ap, void *data) { lua_State *L = lua_state; - unsigned char **new_proxy_url = va_arg(ap, unsigned char **); - unsigned char *url = va_arg(ap, unsigned char *); + char **new_proxy_url = va_arg(ap, char **); + char *url = va_arg(ap, char *); int err; if (!new_proxy_url || !url) @@ -211,7 +211,7 @@ script_hook_get_proxy(va_list ap, void *data) if (lua_isstring(L, -1)) { mem_free_set(new_proxy_url, - stracpy((unsigned char *) lua_tostring(L, -1))); + stracpy((char *) lua_tostring(L, -1))); } else if (lua_isnil(L, -1)) { mem_free_set(new_proxy_url, NULL); } else { diff --git a/src/scripting/lua/lua.h b/src/scripting/lua/lua.h index 23b5aa80..b1a230b4 100644 --- a/src/scripting/lua/lua.h +++ b/src/scripting/lua/lua.h @@ -1,4 +1,3 @@ - #ifndef EL__SCRIPTING_LUA_LUA_H #define EL__SCRIPTING_LUA_LUA_H diff --git a/src/scripting/perl/hooks.c b/src/scripting/perl/hooks.c index af93ae65..5b52d085 100644 --- a/src/scripting/perl/hooks.c +++ b/src/scripting/perl/hooks.c @@ -21,7 +21,7 @@ * to do is explained in doc/events.txt */ static inline void -do_script_hook_goto_url(struct session *ses, unsigned char **url) +do_script_hook_goto_url(struct session *ses, char **url) { int count; dSP; /* Keep in variables declaration block. */ @@ -34,7 +34,7 @@ do_script_hook_goto_url(struct session *ses, unsigned char **url) if (!ses || !have_location(ses)) { XPUSHs(sv_2mortal(newSV(0))); } else { - unsigned char *uri = struri(cur_loc(ses)->vs.uri); + char *uri = struri(cur_loc(ses)->vs.uri); my_XPUSHs(uri, strlen(uri)); } @@ -47,10 +47,10 @@ do_script_hook_goto_url(struct session *ses, unsigned char **url) #ifndef CONFIG_PERL_POPPX_WITHOUT_N_A STRLEN n_a; /* Used by POPpx macro. */ #endif - unsigned char *new_url = POPpx; + char *new_url = POPpx; if (new_url) { - unsigned char *n = stracpy(new_url); + char *n = stracpy(new_url); if (n) { mem_free_set(url, n); @@ -66,7 +66,7 @@ do_script_hook_goto_url(struct session *ses, unsigned char **url) static enum evhook_status script_hook_goto_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); if (my_perl && *url) @@ -76,7 +76,7 @@ script_hook_goto_url(va_list ap, void *data) } static inline void -do_script_hook_follow_url(unsigned char **url) +do_script_hook_follow_url(char **url) { int count; dSP; /* Keep in variables declaration block. */ @@ -95,10 +95,10 @@ do_script_hook_follow_url(unsigned char **url) #ifndef CONFIG_PERL_POPPX_WITHOUT_N_A STRLEN n_a; /* Used by POPpx macro. */ #endif - unsigned char *new_url = POPpx; + char *new_url = POPpx; if (new_url) { - unsigned char *n = stracpy(new_url); + char *n = stracpy(new_url); if (n) { mem_free_set(url, n); @@ -114,7 +114,7 @@ do_script_hook_follow_url(unsigned char **url) static enum evhook_status script_hook_follow_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); if (my_perl && *url) do_script_hook_follow_url(url); @@ -123,7 +123,7 @@ script_hook_follow_url(va_list ap, void *data) } static inline void -do_script_hook_pre_format_html(unsigned char *url, struct cache_entry *cached, +do_script_hook_pre_format_html(char *url, struct cache_entry *cached, struct fragment *fragment) { int count; @@ -143,7 +143,7 @@ do_script_hook_pre_format_html(unsigned char *url, struct cache_entry *cached, if (count == 1) { SV *new_html_sv = POPs; STRLEN new_html_len; - unsigned char *new_html = SvPV(new_html_sv, new_html_len); + char *new_html = SvPV(new_html_sv, new_html_len); if (new_html) { add_fragment(cached, 0, new_html, new_html_len); @@ -162,7 +162,7 @@ script_hook_pre_format_html(va_list ap, void *data) struct session *ses = va_arg(ap, struct session *); struct cache_entry *cached = va_arg(ap, struct cache_entry *); struct fragment *fragment = get_cache_fragment(cached); - unsigned char *url = struri(cached->uri); + char *url = struri(cached->uri); if (my_perl && ses && url && cached->length && *fragment->data) do_script_hook_pre_format_html(url, cached, fragment); @@ -171,7 +171,7 @@ script_hook_pre_format_html(va_list ap, void *data) } static inline void -do_script_hook_get_proxy(unsigned char **new_proxy_url, unsigned char *url) +do_script_hook_get_proxy(char **new_proxy_url, char *url) { int count; dSP; /* Keep in variables declaration block. */ @@ -194,7 +194,7 @@ do_script_hook_get_proxy(unsigned char **new_proxy_url, unsigned char *url) #ifndef CONFIG_PERL_POPPX_WITHOUT_N_A STRLEN n_a; /* Used by POPpx macro. */ #endif - unsigned char *new_url = POPpx; + char *new_url = POPpx; mem_free_set(new_proxy_url, stracpy(new_url)); } @@ -208,8 +208,8 @@ do_script_hook_get_proxy(unsigned char **new_proxy_url, unsigned char *url) static enum evhook_status script_hook_get_proxy(va_list ap, void *data) { - unsigned char **new_proxy_url = va_arg(ap, unsigned char **); - unsigned char *url = va_arg(ap, unsigned char *); + char **new_proxy_url = va_arg(ap, char **); + char *url = va_arg(ap, char *); if (my_perl && new_proxy_url && url) do_script_hook_get_proxy(new_proxy_url, url); diff --git a/src/scripting/python/core.c b/src/scripting/python/core.c index 1f294ca9..d2196bee 100644 --- a/src/scripting/python/core.c +++ b/src/scripting/python/core.c @@ -37,13 +37,13 @@ PyObject *python_hooks = NULL; void alert_python_error(void) { - unsigned char *msg = "(no traceback available)"; + char *msg = "(no traceback available)"; PyObject *err_type = NULL, *err_value = NULL, *err_traceback = NULL; PyObject *tb_module = NULL; PyObject *msg_list = NULL; PyObject *empty_string = NULL; PyObject *msg_string = NULL; - unsigned char *temp; + char *temp; /* * Retrieve the current error indicator and use the format_exception() @@ -74,7 +74,7 @@ alert_python_error(void) msg_string = PyObject_CallMethod(empty_string, "join", "O", msg_list); if (!msg_string) goto end; - temp = (unsigned char *) PyUnicode_AsUTF8(msg_string); + temp = (char *) PyUnicode_AsUTF8(msg_string); if (temp) msg = temp; end: @@ -98,7 +98,7 @@ static int set_python_search_path(void) { struct string new_python_path; - unsigned char *old_python_path; + char *old_python_path; int result = -1; if (!init_string(&new_python_path)) return result; @@ -110,7 +110,7 @@ set_python_search_path(void) if (!add_to_string(&new_python_path, CONFDIR)) goto end; - old_python_path = (unsigned char *) getenv("PYTHONPATH"); + old_python_path = (char *) getenv("PYTHONPATH"); if (old_python_path && !add_format_to_string(&new_python_path, "%c%s", DELIM, old_python_path)) goto end; diff --git a/src/scripting/python/dialogs.c b/src/scripting/python/dialogs.c index 8c968d9c..d5d89dcf 100644 --- a/src/scripting/python/dialogs.c +++ b/src/scripting/python/dialogs.c @@ -42,9 +42,9 @@ PyObject * python_info_box(PyObject *self, PyObject *args, PyObject *kwargs) { /* [gettext_accelerator_context(python_info_box)] */ - unsigned char *title = N_("Info"); + char *title = N_("Info"); PyObject *object, *string_object; - unsigned char *text; + char *text; static char *kwlist[] = {"text", "title", NULL}; if (!python_ses) { @@ -68,7 +68,7 @@ python_info_box(PyObject *self, PyObject *args, PyObject *kwargs) */ string_object = PyObject_Str(object); if (!string_object) return NULL; - text = (unsigned char *) PyUnicode_AsUTF8(string_object); + text = (char *) PyUnicode_AsUTF8(string_object); if (!text) { Py_DECREF(string_object); return NULL; @@ -110,7 +110,7 @@ struct python_input_callback_hop { */ static void -invoke_input_ok_callback(void *data, unsigned char *text) +invoke_input_ok_callback(void *data, char *text) { struct python_input_callback_hop *hop = data; struct session *saved_python_ses = python_ses; @@ -168,10 +168,10 @@ initial -- A string containing an initial value for the text entry\n\ PyObject * python_input_box(PyObject *self, PyObject *args, PyObject *kwargs) { - unsigned char *prompt; + char *prompt; PyObject *callback; - unsigned char *title = N_("User dialog"); - unsigned char *initial = NULL; + char *title = N_("User dialog"); + char *initial = NULL; struct python_input_callback_hop *hop; static char *kwlist[] = {"prompt", "callback", "title", "initial", NULL}; diff --git a/src/scripting/python/document.c b/src/scripting/python/document.c index 404985ef..d41f4e26 100644 --- a/src/scripting/python/document.c +++ b/src/scripting/python/document.c @@ -71,7 +71,7 @@ If a link is selected, return its URL; otherwise return None.\n"); PyObject * python_current_link_url(PyObject *self, PyObject *args) { - unsigned char url[MAX_STR_LEN]; + char url[MAX_STR_LEN]; if (python_ses && get_current_link_url(python_ses, url, MAX_STR_LEN)) return PyUnicode_FromString(url); @@ -90,7 +90,7 @@ If a document is being viewed, return its title; otherwise return None.\n"); PyObject * python_current_title(PyObject *self, PyObject *args) { - unsigned char title[MAX_STR_LEN]; + char title[MAX_STR_LEN]; if (python_ses && get_current_title(python_ses, title, MAX_STR_LEN)) return PyUnicode_FromString(title); @@ -109,7 +109,7 @@ If a document is being viewed, return its URL; otherwise return None.\n"); PyObject * python_current_url(PyObject *self, PyObject *args) { - unsigned char url[MAX_STR_LEN]; + char url[MAX_STR_LEN]; if (python_ses && get_current_url(python_ses, url, MAX_STR_LEN)) return PyUnicode_FromString(url); diff --git a/src/scripting/python/hooks.c b/src/scripting/python/hooks.c index 4615e188..6e3b76e7 100644 --- a/src/scripting/python/hooks.c +++ b/src/scripting/python/hooks.c @@ -31,15 +31,15 @@ extern PyObject *python_hooks; */ static PyObject * -replace_with_python_string(unsigned char **dest, PyObject *object) +replace_with_python_string(char **dest, PyObject *object) { - unsigned char *str; + char *str; if (object == Py_None) { return object; } - str = (unsigned char *) PyUnicode_AsUTF8(object); + str = (char *) PyUnicode_AsUTF8(object); if (!str) return NULL; @@ -55,7 +55,7 @@ replace_with_python_string(unsigned char **dest, PyObject *object) static enum evhook_status script_hook_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); char *method = data; struct session *saved_python_ses = python_ses; @@ -82,22 +82,22 @@ script_hook_url(va_list ap, void *data) } static int -get_codepage(unsigned char *head) +get_codepage(char *head) { int cp_index = -1; - unsigned char *part = head; + char *part = head; if (!head) { goto none; } while (cp_index == -1) { - unsigned char *ct_charset; + char *ct_charset; /* scan_http_equiv() appends the meta http-equiv directives to * the protocol header before this function is called, but the * HTTP Content-Type header has precedence, so the HTTP header * will be used if it exists and the meta header is only used * as a fallback. See bug 983. */ - unsigned char *a = parse_header(part, "Content-Type", &part); + char *a = parse_header(part, "Content-Type", &part); if (!a) break; @@ -110,7 +110,7 @@ get_codepage(unsigned char *head) } if (cp_index == -1) { - unsigned char *a = parse_header(head, "Content-Charset", NULL); + char *a = parse_header(head, "Content-Charset", NULL); if (a) { cp_index = get_cp_index(a); @@ -119,7 +119,7 @@ get_codepage(unsigned char *head) } if (cp_index == -1) { - unsigned char *a = parse_header(head, "Charset", NULL); + char *a = parse_header(head, "Charset", NULL); if (a) { cp_index = get_cp_index(a); @@ -143,7 +143,7 @@ script_hook_pre_format_html(va_list ap, void *data) struct session *ses = va_arg(ap, struct session *); struct cache_entry *cached = va_arg(ap, struct cache_entry *); struct fragment *fragment = get_cache_fragment(cached); - unsigned char *url = struri(cached->uri); + char *url = struri(cached->uri); int codepage = get_codepage(cached->head); char *method = "pre_format_html_hook"; struct session *saved_python_ses = python_ses; @@ -185,19 +185,21 @@ script_hook_pre_format_html(va_list ap, void *data) goto error; } iconv_close(cd); - result = PyObject_CallMethod(python_hooks, method, "ss#", url, utf8_data, fragment->length * 8 - oleft); mem_free(utf8_data); } else { result = PyObject_CallMethod(python_hooks, method, "ss#", url, fragment->data, fragment->length); } + if (!result) goto error; if (result != Py_None) { - const unsigned char *str; + const char *str; Py_ssize_t len; + str = PyUnicode_AsUTF8AndSize(result, &len); + if (!str) { goto error; } @@ -213,7 +215,9 @@ script_hook_pre_format_html(va_list ap, void *data) if (!dec_data) { goto error; } + cd = iconv_open(get_cp_mime_name(codepage), "utf-8"); + if (cd == (iconv_t)-1) { mem_free(dec_data); goto error; @@ -259,8 +263,8 @@ error: static enum evhook_status script_hook_get_proxy(va_list ap, void *data) { - unsigned char **proxy = va_arg(ap, unsigned char **); - unsigned char *url = va_arg(ap, unsigned char *); + char **proxy = va_arg(ap, char **); + char *url = va_arg(ap, char *); char *method = "proxy_for_hook"; PyObject *result; diff --git a/src/scripting/python/hooks.h b/src/scripting/python/hooks.h index 074ffd79..86f1015e 100644 --- a/src/scripting/python/hooks.h +++ b/src/scripting/python/hooks.h @@ -1,4 +1,3 @@ - #ifndef EL__SCRIPTING_PYTHON_HOOKS_H #define EL__SCRIPTING_PYTHON_HOOKS_H diff --git a/src/scripting/python/keybinding.c b/src/scripting/python/keybinding.c index 8da7ff34..71893443 100644 --- a/src/scripting/python/keybinding.c +++ b/src/scripting/python/keybinding.c @@ -48,7 +48,7 @@ invoke_keybinding_callback(va_list ap, void *data) /* Check that a keymap name is valid. */ static int -keymap_is_valid(const unsigned char *keymap) +keymap_is_valid(const char *keymap) { int keymap_id; @@ -81,14 +81,14 @@ keymap -- A string containing the name of a keymap. Valid keymap\n\ PyObject * python_bind_key(PyObject *self, PyObject *args, PyObject *kwargs) { - const unsigned char *keystroke; + const char *keystroke; PyObject *callback; - unsigned char *keymap = "main"; + char *keymap = "main"; PyObject *key_tuple; PyObject *old_callback; struct string event_name; int event_id; - unsigned char *error_msg; + char *error_msg; static char *kwlist[] = {"keystroke", "callback", "keymap", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO|s:bind_key", kwlist, diff --git a/src/scripting/python/load.c b/src/scripting/python/load.c index 54222b7a..1aceb8ca 100644 --- a/src/scripting/python/load.c +++ b/src/scripting/python/load.c @@ -96,7 +96,7 @@ callback -- A callable object to be called after the document has\n\ PyObject * python_load(PyObject *self, PyObject *args) { - unsigned char *uristring; + char *uristring; PyObject *callback; struct uri *uri; struct download *download; diff --git a/src/scripting/python/menu.c b/src/scripting/python/menu.c index c454c33c..86b64450 100644 --- a/src/scripting/python/menu.c +++ b/src/scripting/python/menu.c @@ -145,7 +145,7 @@ python_menu(PyObject *self, PyObject *args, PyObject *kwargs) for (i = 0; i < length; i++) { PyObject *tuple = PySequence_GetItem(items, i); PyObject *name, *callback; - unsigned char *contents; + char *contents; if (!tuple) goto error; @@ -160,7 +160,7 @@ python_menu(PyObject *self, PyObject *args, PyObject *kwargs) Py_DECREF(tuple); if (!name || !callback) goto error; - contents = (unsigned char *) PyUnicode_AsUTF8(name); + contents = (char *) PyUnicode_AsUTF8(name); if (!contents) goto error; contents = stracpy(contents); diff --git a/src/scripting/python/open.c b/src/scripting/python/open.c index 166b42d0..c20649ac 100644 --- a/src/scripting/python/open.c +++ b/src/scripting/python/open.c @@ -41,7 +41,7 @@ background -- By default a new tab is opened in the foreground. If\n\ PyObject * python_open(PyObject *self, PyObject *args, PyObject *kwargs) { - unsigned char *url; + char *url; int new_tab = 0, background = 0; struct uri *uri; static char *kwlist[] = {"url", "new_tab", "background", NULL}; diff --git a/src/scripting/ruby/core.c b/src/scripting/ruby/core.c index 82be5cf9..652b1124 100644 --- a/src/scripting/ruby/core.c +++ b/src/scripting/ruby/core.c @@ -33,7 +33,7 @@ VALUE erb_module; /* Error reporting. */ void -alert_ruby_error(struct session *ses, unsigned char *msg) +alert_ruby_error(struct session *ses, char *msg) { report_scripting_error(&ruby_scripting_module, ses, msg); } @@ -44,8 +44,8 @@ erb_report_error(struct session *ses, int error) { VALUE eclass; VALUE einfo; - unsigned char buff[MAX_STR_LEN]; - unsigned char *msg; + char buff[MAX_STR_LEN]; + char *msg; /* XXX: Ew. These are from the Ruby internals. */ #define TAG_RETURN 0x1 @@ -84,7 +84,7 @@ erb_report_error(struct session *ses, int error) } else { VALUE epath; - unsigned char *p; + char *p; epath = rb_class_path(eclass); snprintf(buff, MAX_STR_LEN, "%s: %s", @@ -112,7 +112,7 @@ erb_report_error(struct session *ses, int error) static VALUE erb_module_message(VALUE self, VALUE str) { - unsigned char *message, *line_end; + char *message, *line_end; struct terminal *term; str = rb_obj_as_string(str); @@ -153,7 +153,7 @@ erb_stdout_p(int argc, VALUE *argv, VALUE self) for (i = 0; i < argc; i++) { VALUE substr; - unsigned char *ptr; + char *ptr; int len; if (i > 0) @@ -204,12 +204,12 @@ erb_module_method_missing(VALUE self, VALUE arg) static void init_erb_module(void) { - unsigned char *home; + char *home; erb_module = rb_define_module("ELinks"); rb_define_const(erb_module, "VERSION", rb_str_new2(VERSION_STRING)); - home = elinks_home ? elinks_home : (unsigned char *) CONFDIR; + home = elinks_home ? elinks_home : (char *) CONFDIR; rb_define_const(erb_module, "HOME", rb_str_new2(home)); rb_define_module_function(erb_module, "message", erb_module_message, 1); @@ -221,7 +221,7 @@ init_erb_module(void) void init_ruby(struct module *module) { - unsigned char *path; + char *path; /* Set up and initialize the interpreter. This function should be called * before any other Ruby-related functions. */ @@ -238,7 +238,7 @@ init_ruby(struct module *module) if (elinks_home) { path = straconcat(elinks_home, RUBY_HOOKS_FILENAME, - (unsigned char *) NULL); + (char *) NULL); } else { path = stracpy(CONFDIR STRING_DIR_SEP RUBY_HOOKS_FILENAME); diff --git a/src/scripting/ruby/core.h b/src/scripting/ruby/core.h index aceada4c..688cb485 100644 --- a/src/scripting/ruby/core.h +++ b/src/scripting/ruby/core.h @@ -27,7 +27,7 @@ struct session; extern VALUE erb_module; -void alert_ruby_error(struct session *ses, unsigned char *msg); +void alert_ruby_error(struct session *ses, char *msg); void erb_report_error(struct session *ses, int state); void init_ruby(struct module *module); diff --git a/src/scripting/ruby/hooks.c b/src/scripting/ruby/hooks.c index e6bd0041..7c166e3e 100644 --- a/src/scripting/ruby/hooks.c +++ b/src/scripting/ruby/hooks.c @@ -24,7 +24,7 @@ /* We need to catch and handle errors because, otherwise, Ruby will kill us. */ struct erb_protect_info { - unsigned char *name; + char *name; int argc; VALUE *args; }; @@ -43,7 +43,7 @@ do_erb_protected_method_call(VALUE data) } static VALUE -erb_protected_method_call(unsigned char *name, int argc, VALUE *args, int *error) +erb_protected_method_call(char *name, int argc, VALUE *args, int *error) { struct erb_protect_info info = { name, argc, args }; @@ -55,7 +55,7 @@ erb_protected_method_call(unsigned char *name, int argc, VALUE *args, int *error static enum evhook_status script_hook_goto_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); int error; VALUE args[2]; @@ -81,7 +81,7 @@ script_hook_goto_url(va_list ap, void *data) switch (rb_type(result)) { case T_STRING: { - unsigned char *new_url; + char *new_url; new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result)); if (new_url) { @@ -102,7 +102,7 @@ script_hook_goto_url(va_list ap, void *data) static enum evhook_status script_hook_follow_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); int error; VALUE args[1]; @@ -124,7 +124,7 @@ script_hook_follow_url(va_list ap, void *data) switch (rb_type(result)) { case T_STRING: { - unsigned char *new_url; + char *new_url; new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result)); if (new_url) { @@ -148,7 +148,7 @@ script_hook_pre_format_html(va_list ap, void *data) struct session *ses = va_arg(ap, struct session *); struct cache_entry *cached = va_arg(ap, struct cache_entry *); struct fragment *fragment = get_cache_fragment(cached); - unsigned char *url = struri(cached->uri); + char *url = struri(cached->uri); int error; VALUE args[2]; VALUE result; @@ -194,8 +194,8 @@ script_hook_pre_format_html(va_list ap, void *data) static enum evhook_status script_hook_get_proxy(va_list ap, void *data) { - unsigned char **new_proxy_url = va_arg(ap, unsigned char **); - unsigned char *url = va_arg(ap, unsigned char *); + char **new_proxy_url = va_arg(ap, char **); + char *url = va_arg(ap, char *); int error; VALUE args[1]; VALUE result; @@ -214,7 +214,7 @@ script_hook_get_proxy(va_list ap, void *data) switch (rb_type(result)) { case T_STRING: { - unsigned char *proxy; + char *proxy; proxy = memacpy(RSTRING_PTR(result), RSTRING_LEN(result)); if (proxy) { diff --git a/src/scripting/scripting.c b/src/scripting/scripting.c index 6d0b7f69..4519c795 100644 --- a/src/scripting/scripting.c +++ b/src/scripting/scripting.c @@ -34,7 +34,7 @@ #if defined(CONFIG_SCRIPTING_RUBY) || defined(CONFIG_SCRIPTING_SPIDERMONKEY) || defined(CONFIG_SCRIPTING_PYTHON) void report_scripting_error(struct module *module, struct session *ses, - unsigned char *msg) + char *msg) { struct terminal *term; struct string string; diff --git a/src/scripting/scripting.h b/src/scripting/scripting.h index 62d470a2..422441c1 100644 --- a/src/scripting/scripting.h +++ b/src/scripting/scripting.h @@ -12,7 +12,7 @@ struct session; void report_scripting_error(struct module *module, struct session *ses, - unsigned char *msg); + char *msg); extern struct module scripting_module; diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 532d9fab..2e6f3aba 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -127,9 +127,9 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval) static JSObject * -smjs_get_action_fn_object(unsigned char *action_str) +smjs_get_action_fn_object(char *action_str) { - unsigned char *c; + char *c; struct smjs_action_fn_callback_hop *hop; JSObject *obj; @@ -171,7 +171,7 @@ action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: JS::Value val; JS::RootedValue rval(ctx, val); JSObject *action_fn; - unsigned char *action_str; + char *action_str; hvp.setNull(); diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index b1390b4c..7d2fa93d 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -112,7 +112,7 @@ static JSObject *smjs_get_bookmark_folder_object(struct bookmark *bookmark); * @return true if successful. On error, report the error and * return false. */ static bool -bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, JS::Value *vp) +bookmark_string_to_jsval(JSContext *ctx, const char *str, JS::Value *vp) { JSString *jsstr = utf8_to_jsstring(ctx, str, -1); @@ -135,9 +135,9 @@ bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, JS::Value *vp * @return true if successful. On error, report the error to * SpiderMonkey and return false. */ static bool -jsval_to_bookmark_string(JSContext *ctx, JS::HandleValue val, unsigned char **result) +jsval_to_bookmark_string(JSContext *ctx, JS::HandleValue val, char **result) { - unsigned char *str; + char *str; JSString *jsstr = val.toString(); @@ -191,8 +191,8 @@ bookmark_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; - unsigned char *title = NULL; - unsigned char *url = NULL; + char *title = NULL; + char *url = NULL; int ok; /* This can be called if @obj if not itself an instance of the @@ -250,8 +250,8 @@ bookmark_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; - unsigned char *title = NULL; - unsigned char *url = NULL; + char *title = NULL; + char *url = NULL; int ok; /* This can be called if @obj if not itself an instance of the @@ -329,7 +329,7 @@ bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId struct bookmark *folder; JS::Value val; JS::RootedValue title_jsval(ctx, val); - unsigned char *title = NULL; + char *title = NULL; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 162b87f2..5bd11143 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -111,7 +111,7 @@ cache_entry_set_property_content(JSContext *ctx, unsigned int argc, JS::Value *v struct cache_entry *cached; JSString *jsstr; - unsigned char *str; + char *str; size_t len; /* This can be called if @obj if not itself an instance of the @@ -183,7 +183,7 @@ cache_entry_set_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) struct cache_entry *cached; JSString *jsstr; - unsigned char *str; + char *str; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -372,7 +372,7 @@ cache_entry_set_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp) struct cache_entry *cached; JSString *jsstr; - unsigned char *str; + char *str; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index d524f99a..c4b574f7 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -30,7 +30,7 @@ JSObject *smjs_elinks_object; struct session *smjs_ses; void -alert_smjs_error(unsigned char *msg) +alert_smjs_error(char *msg) { report_scripting_error(&smjs_scripting_module, smjs_ses, msg); @@ -119,7 +119,7 @@ PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult, static void error_reporter(JSContext *ctx, JSErrorReport *report) { - unsigned char *strict, *exception, *warning, *error; + char *strict, *exception, *warning, *error; struct string msg; char *prefix = nullptr; @@ -172,7 +172,7 @@ reported: } static int -smjs_do_file(unsigned char *path) +smjs_do_file(char *path) { int ret = 1; struct string script; @@ -206,7 +206,7 @@ smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, JS::Value *rval) JS::CallArgs args = CallArgsFromVp(argc, rval); JSString *jsstr = args[0].toString(); - unsigned char *path = JS_EncodeString(smjs_ctx, jsstr); + char *path = JS_EncodeString(smjs_ctx, jsstr); if (smjs_do_file(path)) return true; @@ -217,13 +217,13 @@ smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, JS::Value *rval) static void smjs_load_hooks(void) { - unsigned char *path; + char *path; assert(smjs_ctx); if (elinks_home) { path = straconcat(elinks_home, SMJS_HOOKS_FILENAME, - (unsigned char *) NULL); + (char *) NULL); } else { path = stracpy(CONFDIR STRING_DIR_SEP SMJS_HOOKS_FILENAME); } @@ -288,10 +288,10 @@ cleanup_smjs(struct module *module) * @return the new string. On error, report the error to SpiderMonkey * and return NULL. */ JSString * -utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) +utf8_to_jsstring(JSContext *ctx, const char *str, int length) { size_t in_bytes; - const unsigned char *in_end; + const char *in_end; size_t utf16_alloc; char16_t *utf16; size_t utf16_used; @@ -328,7 +328,7 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) for (;;) { unicode_val_T unicode; - unicode = utf8_to_unicode((unsigned char **) &str, in_end); + unicode = utf8_to_unicode((char **) &str, in_end); if (unicode == UCS_NO_CHAR) break; @@ -410,7 +410,7 @@ add_jschars_to_utf8_string(struct string *utf8, * @return the new string, which the caller must eventually free * with mem_free(). On error, report the error to SpiderMonkey * and return NULL; *@a length is then undefined. */ -unsigned char * +char * jsstring_to_utf8(JSContext *ctx, JSString *jsstr, int *length) { size_t utf16_len; diff --git a/src/scripting/smjs/core.h b/src/scripting/smjs/core.h index ce99b287..ac360ed2 100644 --- a/src/scripting/smjs/core.h +++ b/src/scripting/smjs/core.h @@ -10,14 +10,14 @@ struct string; extern JSContext *smjs_ctx; extern struct session *smjs_ses; -void alert_smjs_error(unsigned char *msg); +void alert_smjs_error(char *msg); void init_smjs(struct module *module); void cleanup_smjs(struct module *module); -JSString *utf8_to_jsstring(JSContext *ctx, const unsigned char *str, +JSString *utf8_to_jsstring(JSContext *ctx, const char *str, int length); -unsigned char *jsstring_to_utf8(JSContext *ctx, JSString *jsstr, +char *jsstring_to_utf8(JSContext *ctx, JSString *jsstr, int *length); #endif diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index a2cfae0f..08a9fd6e 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -37,7 +37,7 @@ elinks_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); - unsigned char *string; + char *string; struct terminal *term; if (argc != 1) @@ -73,7 +73,7 @@ elinks_execute(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); - unsigned char *string; + char *string; if (argc != 1) return true; @@ -199,7 +199,7 @@ elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: switch (JSID_TO_INT(id)) { case ELINKS_LOCATION: { JSString *jsstr; - unsigned char *url; + char *url; if (!smjs_ses) return false; @@ -258,7 +258,7 @@ smjs_init_elinks_object(void) /* If elinks.<method> is defined, call it with the given arguments, * store the return value in rval, and return true. Else return false. */ bool -smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval) +smjs_invoke_elinks_object_method(char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval) { JS::CallArgs args = CallArgsFromVp(argc, argv); @@ -323,7 +323,7 @@ elinks_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp) JS::RootedObject hobj(ctx, &args.thisv().toObject()); JSString *jsstr; - unsigned char *url; + char *url; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail diff --git a/src/scripting/smjs/elinks_object.h b/src/scripting/smjs/elinks_object.h index da9a6c54..8b2a6c09 100644 --- a/src/scripting/smjs/elinks_object.h +++ b/src/scripting/smjs/elinks_object.h @@ -12,6 +12,6 @@ void smjs_init_elinks_object(void); /* Invoke elinks.<method> with the given arguments and put the return value * into *rval. */ -bool smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval); +bool smjs_invoke_elinks_object_method(char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval); #endif diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index 9c386a02..178d31bd 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -161,7 +161,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl switch (JSID_TO_INT(id)) { case GLOBHIST_TITLE: { JSString *jsstr = hvp.toString(); - unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); + char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->title, stracpy(str)); @@ -169,7 +169,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl } case GLOBHIST_URL: { JSString *jsstr = hvp.toString(); - unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); + char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->url, stracpy(str)); @@ -219,7 +219,7 @@ smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h jsid id = hid.get(); JSObject *jsobj; - unsigned char *uri_string; + char *uri_string; struct global_history_item *history_item; JS::Value tmp; JS::RootedValue r_tmp(ctx, tmp); @@ -321,7 +321,7 @@ smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, JS::Val struct global_history_item *history_item; JSString *jsstr; - unsigned char *str; + char *str; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -375,7 +375,7 @@ smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, JS::Value struct global_history_item *history_item; JSString *jsstr; - unsigned char *str; + char *str; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail diff --git a/src/scripting/smjs/hooks.c b/src/scripting/smjs/hooks.c index 340a0ec8..ec8fc718 100644 --- a/src/scripting/smjs/hooks.c +++ b/src/scripting/smjs/hooks.c @@ -24,7 +24,7 @@ static enum evhook_status script_hook_url(va_list ap, void *data) { - unsigned char **url = va_arg(ap, unsigned char **); + char **url = va_arg(ap, char **); struct session *ses = va_arg(ap, struct session *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; @@ -45,7 +45,7 @@ script_hook_url(va_list ap, void *data) ret = EVENT_HOOK_STATUS_LAST; } else { JSString *jsstr = r_rval.toString(); - unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); + char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(url, stracpy(str)); } diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 5c81c467..3fe27e2f 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -35,8 +35,8 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: { jsid id = hid.get(); - unsigned char *action_str; - const unsigned char *keystroke_str; + char *action_str; + const char *keystroke_str; int *data; JS::Value tmp; JS::RootedValue r_tmp(ctx, tmp); @@ -105,8 +105,8 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: jsid id = hid.get(); int *data; - unsigned char *keymap_str; - const unsigned char *keystroke_str; + char *keymap_str; + const char *keystroke_str; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -131,7 +131,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: if (!keystroke_str) return false; if (hvp.isString()) { - unsigned char *action_str; + char *action_str; action_str = JS_EncodeString(ctx, hvp.toString()); if (!action_str) return false; @@ -149,7 +149,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: return true; } else if (hvp.isObject() || hvp.isNull()) { - unsigned char *err = NULL; + char *err = NULL; int event_id; struct string event_name = NULL_STRING; JSObject *jsobj = &hvp.toObject(); @@ -249,7 +249,7 @@ smjs_get_keymap_hash_object(void) JS::RootedValue r_val(smjs_ctx); for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) { - unsigned char *keymap_str = get_keymap_name(keymap_id); + char *keymap_str = get_keymap_name(keymap_id); JSObject *map = smjs_get_keymap_object(keymap_id); assert(keymap_str); diff --git a/src/scripting/smjs/load_uri.c b/src/scripting/smjs/load_uri.c index 646d6348..60084c84 100644 --- a/src/scripting/smjs/load_uri.c +++ b/src/scripting/smjs/load_uri.c @@ -78,7 +78,7 @@ smjs_load_uri(JSContext *ctx, unsigned int argc, JS::Value *rval) struct download *download; JSString *jsstr; protocol_external_handler_T *external_handler; - unsigned char *uri_string; + char *uri_string; struct uri *uri; if (argc < 2) return false; diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 2973d800..4317ee70 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -675,7 +675,7 @@ session_set_property_search_direction(JSContext *ctx, unsigned int argc, JS::Val (JSClass *) &session_class, NULL); if (!ses) return false; - unsigned char *str; + char *str; JSString *jsstr; jsstr = args[0].toString(); @@ -735,7 +735,7 @@ session_set_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp) (JSClass *) &session_class, NULL); if (!ses) return false; - unsigned char *str; + char *str; JSString *jsstr; jsstr = args[0].toString(); @@ -774,7 +774,7 @@ session_set_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *v (JSClass *) &session_class, NULL); if (!ses) return false; - unsigned char *str; + char *str; JSString *jsstr; jsstr = args[0].toString(); @@ -813,7 +813,7 @@ session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value (JSClass *) &session_class, NULL); if (!ses) return false; - unsigned char *str; + char *str; JSString *jsstr; jsstr = args[0].toString(); @@ -850,7 +850,7 @@ session_set_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *v (JSClass *) &session_class, NULL); if (!ses) return false; - unsigned char *str; + char *str; JSString *jsstr; jsstr = args[0].toString(); @@ -882,7 +882,7 @@ session_set_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Val (JSClass *) &session_class, NULL); if (!ses) return false; - unsigned char *str; + char *str; JSString *jsstr; jsstr = args[0].toString(); @@ -1145,7 +1145,7 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, JS::Value *rval) struct delayed_open *deo; struct uri *uri; JSString *jsstr; - unsigned char *url; + char *url; struct session *ses; if (argc != 1) return false; diff --git a/src/session/download.c b/src/session/download.c index c3ad1d7d..a0f1c4fd 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -91,7 +91,7 @@ static void download_data(struct download *download, struct file_download *file_ /*! @note If this fails, the caller is responsible of freeing @a file * and closing @a fd. */ struct file_download * -init_file_download(struct uri *uri, struct session *ses, unsigned char *file, int fd) +init_file_download(struct uri *uri, struct session *ses, char *file, int fd) { struct file_download *file_download; @@ -162,7 +162,7 @@ abort_download(struct file_download *file_download) static void -kill_downloads_to_file(unsigned char *file) +kill_downloads_to_file(char *file) { struct file_download *file_download; @@ -248,7 +248,7 @@ detach_downloads_from_terminal(struct terminal *term) static void download_error_dialog(struct file_download *file_download, int saved_errno) { - unsigned char *emsg = (unsigned char *) strerror(saved_errno); + char *emsg = (char *) strerror(saved_errno); struct session *ses = file_download->ses; struct terminal *term = file_download->term; @@ -329,8 +329,8 @@ abort_download_and_beep(struct file_download *file_download, struct terminal *te struct exec_mailcap { struct session *ses; - unsigned char *command; - unsigned char *file; + char *command; + char *file; }; static void @@ -393,7 +393,7 @@ exec_mailcap_command(void *data) } static void -exec_later(struct session *ses, unsigned char *handler, unsigned char *file) +exec_later(struct session *ses, char *handler, char *file) { struct exec_mailcap *exec_mailcap = mem_calloc(1, sizeof(*exec_mailcap)); @@ -425,7 +425,7 @@ download_data_store(struct download *download, struct file_download *file_downlo term = get_default_terminal(); /* may be NULL too */ if (!is_in_state(download->state, S_OK)) { - unsigned char *url = get_uri_string(file_download->uri, URI_PUBLIC); + char *url = get_uri_string(file_download->uri, URI_PUBLIC); struct connection_state state = download->state; /* abort_download_and_beep allows term==NULL. */ @@ -473,7 +473,7 @@ download_data_store(struct download *download, struct file_download *file_downlo } if (file_download->notify && term) { - unsigned char *url = get_uri_string(file_download->uri, URI_PUBLIC); + char *url = get_uri_string(file_download->uri, URI_PUBLIC); /* This is apparently a little racy. Deleting the box item will * update the download browser _after_ the notification dialog @@ -569,7 +569,7 @@ download_data(struct download *download, struct file_download *file_download) * what the user chose. * * @relates lun_hop */ -typedef void lun_callback_T(struct terminal *term, unsigned char *file, +typedef void lun_callback_T(struct terminal *term, char *file, void *data, enum download_flags flags); /** The user is being asked what to do when the local file for @@ -586,11 +586,11 @@ struct lun_hop { * exists. In this string, "~" has already been expanded * to the home directory. The string must be freed with * mem_free(). */ - unsigned char *ofile; + char *ofile; /** An alternative file name that the user may choose instead * of #ofile. The string must be freed with mem_free(). */ - unsigned char *file; + char *file; /** This function will be called when the user answers. */ lun_callback_T *callback; @@ -621,7 +621,7 @@ struct cmdw_hop { * given to create_download_file(), which arranges for the * pointer to be set before common_download_do() is called. * The string must be freed with mem_free(). */ - unsigned char *real_file; + char *real_file; }; /** Data saved by continue_download() for the continue_download_do() @@ -634,9 +634,9 @@ struct codw_hop { * given to create_download_file(), which arranges for the * pointer to be set before continue_download_do() is called. * The string must be freed with mem_free(). */ - unsigned char *real_file; + char *real_file; - unsigned char *file; + char *file; }; /** Data saved by create_download_file() for the create_download_file_do() @@ -646,7 +646,7 @@ struct cdf_hop { * opened. One of the arguments of #callback is a file * descriptor for this file. @c real_file can be NULL if * #callback does not care about the name. */ - unsigned char **real_file; + char **real_file; /** This function will be called when the file has been opened, * or when it is known that the file will not be opened. */ @@ -760,13 +760,13 @@ lun_resume(void *lun_hop_) * * @relates lun_hop */ static void -lookup_unique_name(struct terminal *term, unsigned char *ofile, +lookup_unique_name(struct terminal *term, char *ofile, enum download_flags flags, lun_callback_T *callback, void *data) { /* [gettext_accelerator_context(.lookup_unique_name)] */ struct lun_hop *lun_hop = NULL; - unsigned char *file = NULL; + char *file = NULL; struct dialog_data *dialog_data; int overwrite; @@ -859,11 +859,11 @@ error: * * @relates cdf_hop */ static void -create_download_file_do(struct terminal *term, unsigned char *file, +create_download_file_do(struct terminal *term, char *file, void *data, enum download_flags flags) { struct cdf_hop *cdf_hop = data; - unsigned char *wd; + char *wd; int h = -1; int saved_errno; #ifdef NO_FILE_SECURITY @@ -907,7 +907,7 @@ create_download_file_do(struct terminal *term, unsigned char *file, set_bin(h); if (!(flags & DOWNLOAD_EXTERNAL)) { - unsigned char *download_dir = get_opt_str("document.download.directory", NULL); + char *download_dir = get_opt_str("document.download.directory", NULL); int i; safe_strncpy(download_dir, file, MAX_STR_LEN); @@ -965,13 +965,13 @@ finish: * * @relates cdf_hop */ void -create_download_file(struct terminal *term, unsigned char *fi, - unsigned char **real_file, +create_download_file(struct terminal *term, char *fi, + char **real_file, enum download_flags flags, cdf_callback_T *callback, void *data) { struct cdf_hop *cdf_hop = mem_calloc(1, sizeof(*cdf_hop)); - unsigned char *wd; + char *wd; if (!cdf_hop) { callback(term, -1, data, flags & ~DOWNLOAD_RESUME_SELECTED); @@ -996,16 +996,16 @@ create_download_file(struct terminal *term, unsigned char *fi, } -static unsigned char * +static char * get_temp_name(struct uri *uri) { struct string name; - unsigned char *extension; + char *extension; /* FIXME * We use tempnam() here, which is unsafe (race condition), for now. * This should be changed at some time, but it needs an in-depth work * of whole download code. --Zas */ - unsigned char *nm = tempnam(NULL, ELINKS_TEMPNAME_PREFIX); + char *nm = tempnam(NULL, ELINKS_TEMPNAME_PREFIX); if (!nm) return NULL; @@ -1027,8 +1027,8 @@ get_temp_name(struct uri *uri) } -static unsigned char * -subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) +static char * +subst_file(char *prog, char *file, char *uri) { struct string name; /* When there is no %s in the mailcap entry, the handler program reads @@ -1071,9 +1071,9 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) input = 0; #if defined(HAVE_CYGWIN_CONV_TO_FULL_WIN32_PATH) #ifdef MAX_PATH - unsigned char new_path[MAX_PATH]; + char new_path[MAX_PATH]; #else - unsigned char new_path[1024]; + char new_path[1024]; #endif cygwin_conv_to_full_win32_path(replace, new_path); @@ -1121,7 +1121,7 @@ common_download_do(struct terminal *term, int fd, void *data, struct file_download *file_download; struct cmdw_hop *cmdw_hop = data; struct uri *download_uri = cmdw_hop->download_uri; - unsigned char *file = cmdw_hop->real_file; + char *file = cmdw_hop->real_file; struct session *ses = cmdw_hop->ses; struct stat buf; @@ -1158,7 +1158,7 @@ finish: * * @relates cmdw_hop */ static void -common_download(struct session *ses, unsigned char *file, +common_download(struct session *ses, char *file, enum download_flags flags) { struct cmdw_hop *cmdw_hop; @@ -1186,7 +1186,7 @@ common_download(struct session *ses, unsigned char *file, * * @relates cmdw_hop */ void -start_download(void *ses, unsigned char *file) +start_download(void *ses, char *file) { common_download(ses, file, DOWNLOAD_RESUME_ALLOWED); @@ -1201,7 +1201,7 @@ start_download(void *ses, unsigned char *file) * * @relates cmdw_hop */ void -resume_download(void *ses, unsigned char *file) +resume_download(void *ses, char *file) { common_download(ses, file, DOWNLOAD_RESUME_ALLOWED | DOWNLOAD_RESUME_SELECTED); @@ -1310,7 +1310,7 @@ cancel: * * @relates codw_hop */ static void -continue_download(void *data, unsigned char *file) +continue_download(void *data, char *file) { struct type_query *type_query = data; struct codw_hop *codw_hop = mem_calloc(1, sizeof(*codw_hop)); @@ -1476,7 +1476,7 @@ tp_display(struct type_query *type_query) struct view_state *vs; struct session *ses = type_query->ses; struct uri *loading_uri = ses->loading_uri; - unsigned char *target_frame = null_or_stracpy(ses->task.target.frame); + char *target_frame = null_or_stracpy(ses->task.target.frame); ses->loading_uri = type_query->uri; mem_free_set(&ses->task.target.frame, null_or_stracpy(type_query->target_frame)); @@ -1516,8 +1516,8 @@ tp_open(struct type_query *type_query) } if (type_query->uri->protocol == PROTOCOL_FILE && !type_query->cgi) { - unsigned char *file = get_uri_string(type_query->uri, URI_PATH); - unsigned char *handler = NULL; + char *file = get_uri_string(type_query->uri, URI_PATH); + char *handler = NULL; if (file) { decode_uri(file); @@ -1553,13 +1553,13 @@ tp_open(struct type_query *type_query) * * @relates type_query */ static void -do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_handler *handler) +do_type_query(struct type_query *type_query, char *ct, struct mime_handler *handler) { /* [gettext_accelerator_context(.do_type_query)] */ struct string filename; - unsigned char *description; - unsigned char *desc_sep; - unsigned char *format, *text, *title; + char *description; + char *desc_sep; + char *format, *text, *title; struct dialog *dlg; #define TYPE_QUERY_WIDGETS_COUNT 8 int widgets = TYPE_QUERY_WIDGETS_COUNT; @@ -1629,7 +1629,7 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand /* Add input field or text widget with info about the program handler. */ if (!get_cmd_opt_bool("anonymous")) { - unsigned char *field = mem_calloc(1, MAX_STR_LEN); + char *field = mem_calloc(1, MAX_STR_LEN); if (!field) { mem_free(dlg); @@ -1651,7 +1651,7 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand selected_widget = 3; } else if (handler) { - unsigned char *field = text + MAX_STR_LEN; + char *field = text + MAX_STR_LEN; format = _("The file will be opened with the program '%s'.", term); snprintf(field, MAX_STR_LEN, format, handler->program); @@ -1720,7 +1720,7 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand } struct { - unsigned char *type; + char *type; unsigned int plain:1; } static const known_types[] = { { "text/html", 0 }, @@ -1744,7 +1744,7 @@ setup_download_handler(struct session *ses, struct download *loading, struct mime_handler *handler; struct view_state *vs; struct type_query *type_query; - unsigned char *ctype = get_content_type(cached); + char *ctype = get_content_type(cached); int plaintext = 1; int ret = 0; int xwin, i; diff --git a/src/session/download.h b/src/session/download.h index 3d165961..3d3085f7 100644 --- a/src/session/download.h +++ b/src/session/download.h @@ -91,14 +91,14 @@ struct type_query { /** The name of the frame in which the user navigated to #uri. * If the user chooses to display the resource, it goes into * this frame. This string must be freed with mem_free(). */ - unsigned char *target_frame; + char *target_frame; /** Command line for an external handler, to be run when the * download finishes. When ELinks displays the type query, * it copies this from mime_handler.program of the default * handler of the type. The user can then edit the string. * This string must be freed with mem_free(). */ - unsigned char *external_handler; + char *external_handler; /** Whether the external handler is going to use the terminal. * When ELinks displays the type query, it copies this from @@ -124,8 +124,8 @@ struct file_download { OBJECT_HEAD(struct file_download); struct uri *uri; - unsigned char *file; - unsigned char *external_handler; + char *file; + char *external_handler; struct session *ses; /** The terminal in which message boxes about the download @@ -207,9 +207,9 @@ int are_there_downloads(void); typedef void cdf_callback_T(struct terminal *term, int fd, void *data, enum download_flags flags); -void start_download(void *, unsigned char *); -void resume_download(void *, unsigned char *); -void create_download_file(struct terminal *, unsigned char *, unsigned char **, +void start_download(void *, char *); +void resume_download(void *, char *); +void create_download_file(struct terminal *, char *, char **, enum download_flags, cdf_callback_T *, void *); void abort_all_downloads(void); @@ -224,7 +224,7 @@ void done_type_query(struct type_query *type_query); void tp_display(struct type_query *type_query); void tp_save(struct type_query *type_query); void tp_cancel(void *data); -struct file_download *init_file_download(struct uri *uri, struct session *ses, unsigned char *file, int fd); +struct file_download *init_file_download(struct uri *uri, struct session *ses, char *file, int fd); #ifdef __cplusplus } diff --git a/src/session/session.c b/src/session/session.c index b8227509..c667bc4c 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -65,7 +65,7 @@ struct file_to_load { unsigned int req_sent:1; int pri; struct cache_entry *cached; - unsigned char *target_frame; + char *target_frame; struct uri *uri; struct download download; }; @@ -96,7 +96,7 @@ enum remote_session_flags remote_session_flags; static struct file_to_load *request_additional_file(struct session *, - unsigned char *, + char *, struct uri *, int); static window_handler_T tabwin_func; @@ -290,7 +290,7 @@ print_error_dialog(struct session *ses, struct connection_state state, struct uri *uri, enum connection_priority priority) { struct string msg; - unsigned char *uristring; + char *uristring; /* Don't show error dialogs for missing CSS stylesheets */ if (priority == PRI_CSS @@ -378,7 +378,7 @@ free_files(struct session *ses) static void request_frameset(struct session *, struct frameset_desc *, int); static void -request_frame(struct session *ses, unsigned char *name, +request_frame(struct session *ses, char *name, struct uri *uri, int depth) { struct location *loc = cur_loc(ses); @@ -676,7 +676,7 @@ doc_loading_callback(struct download *download, struct session *ses) #ifdef CONFIG_GLOBHIST if (download->pri != PRI_CSS) { - unsigned char *title = ses->doc_view->document->title; + char *title = ses->doc_view->document->title; struct uri *uri; if (download->conn) @@ -708,7 +708,7 @@ file_loading_callback(struct download *download, struct file_to_load *ftl) if (ftl->cached && !ftl->cached->redirect_get && download->pri != PRI_CSS) { struct session *ses = ftl->ses; struct uri *loading_uri = ses->loading_uri; - unsigned char *target_frame = null_or_stracpy(ses->task.target.frame); + char *target_frame = null_or_stracpy(ses->task.target.frame); ses->loading_uri = ftl->uri; mem_free_set(&ses->task.target.frame, null_or_stracpy(ftl->target_frame)); @@ -721,7 +721,7 @@ file_loading_callback(struct download *download, struct file_to_load *ftl) } static struct file_to_load * -request_additional_file(struct session *ses, unsigned char *name, struct uri *uri, int pri) +request_additional_file(struct session *ses, char *name, struct uri *uri, int pri) { struct file_to_load *ftl; @@ -874,7 +874,7 @@ setup_first_session(struct session *ses, struct uri *uri) #ifdef CONFIG_BOOKMARKS } else if (!uri && get_opt_bool("ui.sessions.auto_restore", NULL)) { - unsigned char *folder; /* UTF-8 */ + char *folder; /* UTF-8 */ folder = get_auto_save_bookmark_foldername_utf8(); if (folder) { @@ -1044,7 +1044,7 @@ init_remote_session(struct session *ses, enum remote_session_flags *remote_ptr, #endif } else if (remote & SES_REMOTE_INFO_BOX) { - unsigned char *text; + char *text; if (!uri) return; @@ -1112,7 +1112,7 @@ decode_session_info(struct terminal *term, struct terminal_info *info) int len = info->length; struct session *base_session = NULL; enum remote_session_flags remote = 0; - unsigned char *str; + char *str; switch (info->magic) { case INTERLINK_NORMAL_MAGIC: @@ -1181,10 +1181,10 @@ decode_session_info(struct terminal *term, struct terminal_info *info) /* Extract multiple (possible) NUL terminated URIs */ while (len > 0) { - unsigned char *end = memchr(str, 0, len); + char *end = memchr(str, 0, len); int urilength = end ? end - str : len; struct uri *uri = NULL; - unsigned char *uristring = memacpy(str, urilength); + char *uristring = memacpy(str, urilength); if (uristring) { uri = get_hooked_uri(uristring, base_session, term->cwd); @@ -1294,7 +1294,7 @@ reload(struct session *ses, enum cache_mode cache_mode) } void -reload_frame(struct session *ses, unsigned char *name, +reload_frame(struct session *ses, char *name, enum cache_mode cache_mode) { abort_loading(ses, 0); @@ -1341,7 +1341,7 @@ reload_frame(struct session *ses, unsigned char *name, struct frame * -ses_find_frame(struct session *ses, unsigned char *name) +ses_find_frame(struct session *ses, char *name) { struct location *loc = cur_loc(ses); struct frame *frame; @@ -1404,8 +1404,8 @@ tabwin_func(struct window *tab, struct term_event *ev) * A maximum of @a str_size bytes (including null) will be written. * @relates session */ -unsigned char * -get_current_url(struct session *ses, unsigned char *str, size_t str_size) +char * +get_current_url(struct session *ses, char *str, size_t str_size) { struct uri *uri; int length; @@ -1430,8 +1430,8 @@ get_current_url(struct session *ses, unsigned char *str, size_t str_size) * @a str. A maximum of @a str_size bytes (including null) will be written. * @relates session */ -unsigned char * -get_current_title(struct session *ses, unsigned char *str, size_t str_size) +char * +get_current_title(struct session *ses, char *str, size_t str_size) { struct document_view *doc_view = current_frame(ses); @@ -1450,8 +1450,8 @@ get_current_title(struct session *ses, unsigned char *str, size_t str_size) * A maximum of @a str_size bytes (including null) will be written. * @relates session */ -unsigned char * -get_current_link_url(struct session *ses, unsigned char *str, size_t str_size) +char * +get_current_link_url(struct session *ses, char *str, size_t str_size) { struct link *link = get_current_session_link(ses); @@ -1466,11 +1466,11 @@ get_current_link_url(struct session *ses, unsigned char *str, size_t str_size) * (the text between @<A> and @</A>), @a str is a preallocated string, * @a str_size includes the null char. * @relates session */ -unsigned char * -get_current_link_name(struct session *ses, unsigned char *str, size_t str_size) +char * +get_current_link_name(struct session *ses, char *str, size_t str_size) { struct link *link = get_current_session_link(ses); - unsigned char *where, *name = NULL; + char *where, *name = NULL; assert(str && str_size > 0); diff --git a/src/session/session.h b/src/session/session.h index c4743fa3..accec013 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -28,7 +28,7 @@ struct window; struct delayed_open { struct session *ses; struct uri *uri; - unsigned char *target; + char *target; }; enum remote_session_flags { @@ -47,7 +47,7 @@ enum remote_session_flags { struct frame { LIST_HEAD(struct frame); - unsigned char *name; + char *name; int redirect_cnt; struct view_state vs; @@ -85,7 +85,7 @@ struct session_task { enum task_type type; /* TODO: union --pasky */ struct { - unsigned char *frame; + char *frame; struct location *location; } target; }; @@ -99,9 +99,9 @@ struct session_status { int force_show_title_bar:2; unsigned int set_window_title:1; - unsigned char *last_title; + char *last_title; #ifdef CONFIG_ECMASCRIPT - unsigned char *window_status; + char *window_status; #endif #ifdef CONFIG_LEDS @@ -224,8 +224,8 @@ struct session { enum navigate_mode navigate_mode; - unsigned char *search_word; - unsigned char *last_search_word; + char *search_word; + char *last_search_word; /** The possibly running type queries (what-to-do-with-that-file?) */ @@ -282,11 +282,11 @@ struct session *init_session(struct session *ses, struct terminal *term, void doc_loading_callback(struct download *, struct session *); void abort_loading(struct session *, int); -void reload_frame(struct session *, unsigned char *, enum cache_mode); +void reload_frame(struct session *, char *, enum cache_mode); void reload(struct session *, enum cache_mode); void load_frames(struct session *, struct document_view *); -struct frame *ses_find_frame(struct session *, unsigned char *); +struct frame *ses_find_frame(struct session *, char *); void free_files(struct session *); void display_timer(struct session *ses); @@ -298,19 +298,19 @@ int session_is_loading(struct session *ses); struct download *get_current_download(struct session *ses); /** Information about the current document */ -unsigned char *get_current_url(struct session *, unsigned char *, size_t); -unsigned char *get_current_title(struct session *, unsigned char *, size_t); +char *get_current_url(struct session *, char *, size_t); +char *get_current_title(struct session *, char *, size_t); struct link *get_current_session_link(struct session *ses); struct link *get_current_link_in_view(struct document_view *doc_view); -unsigned char *get_current_link_url(struct session *, unsigned char *, size_t); -unsigned char *get_current_link_name(struct session *, unsigned char *, size_t); +char *get_current_link_url(struct session *, char *, size_t); +char *get_current_link_name(struct session *, char *, size_t); extern LIST_OF(struct questions_entry) questions_queue; void add_questions_entry(void (*callback)(struct session *, void *), void *data); void check_questions_queue(struct session *ses); -unsigned char *get_homepage_url(void); +char *get_homepage_url(void); /** Returns current keyboard repeat count and reset it. */ int eat_kbd_repeat_count(struct session *ses); diff --git a/src/session/task.c b/src/session/task.c index a9964ce6..dd2e6ea6 100644 --- a/src/session/task.c +++ b/src/session/task.c @@ -82,7 +82,7 @@ struct task { }; void -ses_load(struct session *ses, struct uri *uri, unsigned char *target_frame, +ses_load(struct session *ses, struct uri *uri, char *target_frame, struct location *target_location, enum cache_mode cache_mode, enum task_type task_type) { @@ -133,7 +133,7 @@ post_no(void *task_) static int check_malicious_uri(struct uri *uri) { - unsigned char *user, *pos; + char *user, *pos; int warn = 0; assert(uri->user && uri->userlen); @@ -174,7 +174,7 @@ check_malicious_uri(struct uri *uri) } void -ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame, +ses_goto(struct session *ses, struct uri *uri, char *target_frame, struct location *target_location, enum cache_mode cache_mode, enum task_type task_type, int redir) { @@ -184,7 +184,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame, int malicious_uri = 0; int confirm_submit = uri->form && get_opt_bool("document.browse.forms" ".confirm_submit", ses); - unsigned char *m1 = NULL, *message = NULL; + char *m1 = NULL, *message = NULL; struct memory_list *mlist = NULL; if (ses->doc_view @@ -249,9 +249,9 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame, task->session_task.target.location = target_location; if (malicious_uri) { - unsigned char *host = memacpy(uri->host, uri->hostlen); - unsigned char *user = memacpy(uri->user, uri->userlen); - unsigned char *uristring = get_uri_string(uri, URI_PUBLIC); + char *host = memacpy(uri->host, uri->hostlen); + char *user = memacpy(uri->user, uri->userlen); + char *uristring = get_uri_string(uri, URI_PUBLIC); message = msg_text(ses->tab->term, N_("The URL you are about to follow might be maliciously " @@ -279,7 +279,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame, } if (!message && m1) { - unsigned char *uristring = get_uri_string(uri, URI_PUBLIC); + char *uristring = get_uri_string(uri, URI_PUBLIC); message = msg_text(ses->tab->term, m1, uristring); mem_free_if(uristring); @@ -578,7 +578,7 @@ end: static void -do_follow_url(struct session *ses, struct uri *uri, unsigned char *target, +do_follow_url(struct session *ses, struct uri *uri, char *target, enum task_type task, enum cache_mode cache_mode, int do_referrer) { struct uri *referrer = NULL; @@ -643,12 +643,12 @@ do_follow_url(struct session *ses, struct uri *uri, unsigned char *target, } static void -follow_url(struct session *ses, struct uri *uri, unsigned char *target, +follow_url(struct session *ses, struct uri *uri, char *target, enum task_type task, enum cache_mode cache_mode, int referrer) { #ifdef CONFIG_SCRIPTING static int follow_url_event_id = EVENT_NONE; - unsigned char *uristring; + char *uristring; uristring = uri && !uri->post ? get_uri_string(uri, URI_BASE | URI_FRAGMENT) : NULL; @@ -692,7 +692,7 @@ goto_uri(struct session *ses, struct uri *uri) void goto_uri_frame(struct session *ses, struct uri *uri, - unsigned char *target, enum cache_mode cache_mode) + char *target, enum cache_mode cache_mode) { follow_url(ses, uri, target, TASK_FORWARD, cache_mode, 1); } @@ -729,7 +729,7 @@ map_selected(struct terminal *term, void *ld_, void *ses_) void -goto_url(struct session *ses, unsigned char *url) +goto_url(struct session *ses, char *url) { struct uri *uri = get_uri(url, 0); @@ -738,7 +738,7 @@ goto_url(struct session *ses, unsigned char *url) } struct uri * -get_hooked_uri(unsigned char *uristring, struct session *ses, unsigned char *cwd) +get_hooked_uri(char *uristring, struct session *ses, char *cwd) { struct uri *uri; @@ -762,9 +762,9 @@ get_hooked_uri(unsigned char *uristring, struct session *ses, unsigned char *cwd } void -goto_url_with_hook(struct session *ses, unsigned char *url) +goto_url_with_hook(struct session *ses, char *url) { - unsigned char *cwd = ses->tab->term->cwd; + char *cwd = ses->tab->term->cwd; struct uri *uri; /* Bail out if passed empty string from goto-url dialog */ @@ -781,7 +781,7 @@ goto_url_with_hook(struct session *ses, unsigned char *url) int goto_url_home(struct session *ses) { - unsigned char *homepage = get_opt_str("ui.sessions.homepage", ses); + char *homepage = get_opt_str("ui.sessions.homepage", ses); if (!*homepage) homepage = getenv("WWW_HOME"); if (!homepage || !*homepage) homepage = WWW_HOME_URL; @@ -795,7 +795,7 @@ goto_url_home(struct session *ses) /* TODO: Should there be goto_imgmap_reload() ? */ void -goto_imgmap(struct session *ses, struct uri *uri, unsigned char *target) +goto_imgmap(struct session *ses, struct uri *uri, char *target) { follow_url(ses, uri, target, TASK_IMGMAP, CACHE_MODE_NORMAL, 1); } diff --git a/src/session/task.h b/src/session/task.h index 0288776e..a882ddbe 100644 --- a/src/session/task.h +++ b/src/session/task.h @@ -17,29 +17,29 @@ struct uri; /** This is for map_selected(), it is used to pass around information * about in-imagemap links. */ struct link_def { - unsigned char *link; - unsigned char *target; + char *link; + char *target; }; void abort_preloading(struct session *, int); -void ses_load(struct session *ses, struct uri *uri, unsigned char *target_frame, +void ses_load(struct session *ses, struct uri *uri, char *target_frame, struct location *target_location, enum cache_mode cache_mode, enum task_type task_type); -void ses_goto(struct session *, struct uri *, unsigned char *, +void ses_goto(struct session *, struct uri *, char *, struct location *, enum cache_mode, enum task_type, int); struct view_state *ses_forward(struct session *, int); -struct uri *get_hooked_uri(unsigned char *uristring, struct session *ses, unsigned char *cwd); +struct uri *get_hooked_uri(char *uristring, struct session *ses, char *cwd); void goto_uri(struct session *ses, struct uri *uri); -void goto_uri_frame(struct session *, struct uri *, unsigned char *, enum cache_mode); +void goto_uri_frame(struct session *, struct uri *, char *, enum cache_mode); void delayed_goto_uri_frame(void *); -void goto_url(struct session *, unsigned char *); -void goto_url_with_hook(struct session *, unsigned char *); +void goto_url(struct session *, char *); +void goto_url_with_hook(struct session *, char *); int goto_url_home(struct session *ses); -void goto_imgmap(struct session *, struct uri *, unsigned char *); +void goto_imgmap(struct session *, struct uri *, char *); void map_selected(struct terminal *term, void *ld, void *ses); #ifdef __cplusplus diff --git a/src/terminal/color.c b/src/terminal/color.c index 13c0def6..9e23b5ca 100644 --- a/src/terminal/color.c +++ b/src/terminal/color.c @@ -199,7 +199,7 @@ typedef int assert_enough_color_modes[ * * This table is based mostly on wild guesses of mine. Feel free to * correct it. --pasky */ -static const unsigned char fg_color[16][8] = { +static const char fg_color[16][8] = { /* bk r gr br bl m c w */ /* 0 (black) */ diff --git a/src/terminal/draw.c b/src/terminal/draw.c index f98591cb..2f66ad08 100644 --- a/src/terminal/draw.c +++ b/src/terminal/draw.c @@ -422,11 +422,11 @@ draw_shadow(struct terminal *term, struct el_box *box, #ifdef CONFIG_UTF8 static void draw_text_utf8(struct terminal *term, int x, int y, - unsigned char *text, int length, + char *text, int length, enum screen_char_attr attr, struct color_pair *color) { struct screen_char *start, *pos; - unsigned char *end = text + length; + char *end = text + length; unicode_val_T data; assert(text && length >= 0); @@ -495,7 +495,7 @@ draw_text_utf8(struct terminal *term, int x, int y, void draw_text(struct terminal *term, int x, int y, - unsigned char *text, int length, + char *text, int length, enum screen_char_attr attr, struct color_pair *color) { int end_pos; @@ -561,7 +561,7 @@ draw_text(struct terminal *term, int x, int y, void draw_dlg_text(struct dialog_data *dlg_data, int x, int y, - unsigned char *text, int length, + char *text, int length, enum screen_char_attr attr, struct color_pair *color) { struct terminal *term = dlg_data->win->term; diff --git a/src/terminal/draw.h b/src/terminal/draw.h index c8ab9c9c..8078db0e 100644 --- a/src/terminal/draw.h +++ b/src/terminal/draw.h @@ -285,13 +285,13 @@ void fix_dwchar_around_box(struct terminal *term, struct el_box *box, int border /** Draws @a length chars from @a text. */ void draw_text(struct terminal *term, int x, int y, - unsigned char *text, int length, + char *text, int length, enum screen_char_attr attr, struct color_pair *color); /** Draws text for dialogs. */ void draw_dlg_text(struct dialog_data *dlg_data, int x, int y, - unsigned char *text, int length, + char *text, int length, enum screen_char_attr attr, struct color_pair *color); diff --git a/src/terminal/event.c b/src/terminal/event.c index 428add7d..a75da56e 100644 --- a/src/terminal/event.c +++ b/src/terminal/event.c @@ -57,7 +57,7 @@ struct terminal_interlink { /** This is the queue of events as coming from the other * ELinks instance owning the hosting terminal. */ - unsigned char input_queue[1]; + char input_queue[1]; }; @@ -146,7 +146,7 @@ term_send_ucs(struct terminal *term, unicode_val_T u, term_send_event(term, &ev); #else /* !CONFIG_UTF8 */ struct term_event ev; - const unsigned char *recoded; + const char *recoded; set_kbd_term_event(&ev, KBD_UNDEF, modifier); recoded = u2cp_no_nbsp(u, get_terminal_codepage(term)); @@ -162,7 +162,7 @@ term_send_ucs(struct terminal *term, unicode_val_T u, static void check_terminal_name(struct terminal *term, struct terminal_info *info) { - unsigned char name[MAX_TERM_LEN + 10]; + char name[MAX_TERM_LEN + 10]; int i; /* We check TERM env. var for sanity, and fallback to _template_ if @@ -457,7 +457,7 @@ in_term(struct terminal *term) { struct terminal_interlink *interlink = term->interlink; ssize_t r; - unsigned char *iq; + char *iq; /* Mark this as the most recently used terminal. */ move_to_top_of_list(terminals, term); @@ -488,7 +488,7 @@ in_term(struct terminal *term) if (r <= 0) { if (r == -1 && errno != ECONNRESET) ERROR(gettext("Could not read event: %d (%s)"), - errno, (unsigned char *) strerror(errno)); + errno, (char *) strerror(errno)); destroy_terminal(term); return; diff --git a/src/terminal/event.h b/src/terminal/event.h index b098a001..c241a6bd 100644 --- a/src/terminal/event.h +++ b/src/terminal/event.h @@ -152,8 +152,8 @@ set_wh_interlink_event(struct interlink_event *ev, enum term_event_type type, in * distinguish them when decoding the terminal info. */ struct terminal_info { struct interlink_event event; /**< The ::EVENT_INIT event */ - unsigned char name[MAX_TERM_LEN]; /**< $TERM environment name */ - unsigned char cwd[MAX_CWD_LEN]; /**< Current working directory */ + char name[MAX_TERM_LEN]; /**< $TERM environment name */ + char cwd[MAX_CWD_LEN]; /**< Current working directory */ int system_env; /**< System info (X, screen) */ int length; /**< Length of #data member */ int session_info; /**< Value depends on #magic */ @@ -161,7 +161,7 @@ struct terminal_info { /** In the master that is connected to all bytes after @c data * will be interpreted as URI string information. */ - unsigned char data[1]; + char data[1]; }; /** The terminal_info.data member has to have size of one for diff --git a/src/terminal/hardio.c b/src/terminal/hardio.c index e3f039e3..1c645f04 100644 --- a/src/terminal/hardio.c +++ b/src/terminal/hardio.c @@ -28,7 +28,7 @@ #ifdef DEBUG_HARDIO static void -hw_debug_open(unsigned char *name, int fd, unsigned char *data, int datalen) +hw_debug_open(char *name, int fd, char *data, int datalen) { fprintf(stderr, "[%s (fd=%d, data=%p, datalen=%d)]\n", name, fd, data, datalen); @@ -42,7 +42,7 @@ hw_debug_flush() } static void -hw_debug_write(unsigned char *data, int w) +hw_debug_write(char *data, int w) { int hex = 0; int i = 0; @@ -95,7 +95,7 @@ hw_debug_write(unsigned char *data, int w) ssize_t -hard_write(int fd, unsigned char *data, size_t datalen) +hard_write(int fd, char *data, size_t datalen) { ssize_t total = datalen; @@ -125,7 +125,7 @@ hard_write(int fd, unsigned char *data, size_t datalen) } ssize_t -hard_read(int fd, unsigned char *data, size_t datalen) +hard_read(int fd, char *data, size_t datalen) { ssize_t total = datalen; diff --git a/src/terminal/hardio.h b/src/terminal/hardio.h index 29629200..e6ef37fc 100644 --- a/src/terminal/hardio.h +++ b/src/terminal/hardio.h @@ -5,8 +5,8 @@ extern "C" { #endif -ssize_t hard_write(int fd, unsigned char *data, size_t datalen); -ssize_t hard_read(int fd, unsigned char *data, size_t datalen); +ssize_t hard_write(int fd, char *data, size_t datalen); +ssize_t hard_read(int fd, char *data, size_t datalen); #ifdef __cplusplus } diff --git a/src/terminal/itrm.h b/src/terminal/itrm.h index d8a175e2..5c69d034 100644 --- a/src/terminal/itrm.h +++ b/src/terminal/itrm.h @@ -16,7 +16,7 @@ extern "C" { #define ITRM_IN_QUEUE_SIZE 64 struct itrm_queue { - unsigned char *data; + char *data; /** The amount of data in the queue, in bytes. This may be * less than the amount of memory allocated for the buffer; @@ -101,7 +101,7 @@ struct itrm { timer_id_T timer; /**< ESC timeout timer */ struct termios t; /**< For restoring original attributes */ void *mouse_h; /**< Mouse handle */ - unsigned char *orig_title; /**< For restoring window title */ + char *orig_title; /**< For restoring window title */ int verase; /**< Byte to map to KBD_BS, or -1 */ int title_codepage; /**< Codepage of terminal title */ diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c index 75718c3e..bfb3c4b5 100644 --- a/src/terminal/kbd.c +++ b/src/terminal/kbd.c @@ -108,7 +108,7 @@ itrm_queue_write(struct itrm *itrm) void -itrm_queue_event(struct itrm *itrm, unsigned char *data, int len) +itrm_queue_event(struct itrm *itrm, char *data, int len) { int w = 0; @@ -124,7 +124,7 @@ itrm_queue_event(struct itrm *itrm, unsigned char *data, int len) if (w < len) { int left = len - w; - unsigned char *c = mem_realloc(itrm->out.queue.data, + char *c = mem_realloc(itrm->out.queue.data, itrm->out.queue.len + left); if (!c) { @@ -153,7 +153,7 @@ kbd_ctrl_c(void) * pending from the terminal, so do not reset * ditrm->bracketed_pasting. */ set_kbd_interlink_event(&ev, KBD_CTRL_C, KBD_MOD_NONE); - itrm_queue_event(ditrm, (unsigned char *) &ev, sizeof(ev)); + itrm_queue_event(ditrm, (char *) &ev, sizeof(ev)); } #define write_sequence(fd, seq) \ @@ -218,9 +218,9 @@ resize_terminal(void) } void -get_terminal_name(unsigned char name[MAX_TERM_LEN]) +get_terminal_name(char name[MAX_TERM_LEN]) { - unsigned char *term = getenv("TERM"); + char *term = getenv("TERM"); int i; memset(name, 0, MAX_TERM_LEN); @@ -304,7 +304,7 @@ handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in, struct itrm *itrm; struct terminal_info info; struct interlink_event_size *size = &info.event.info.size; - unsigned char *ts; + char *ts; memset(&info, 0, sizeof(info)); @@ -443,7 +443,7 @@ free_itrm(struct itrm *itrm) /* Set the window title to the value of $TERM if X11 * wasn't compiled in. Should hopefully make at least * half the users happy. (debian bug #312955) */ - unsigned char title[MAX_TERM_LEN]; + char title[MAX_TERM_LEN]; get_terminal_name(title); if (*title) @@ -482,7 +482,7 @@ free_itrm(struct itrm *itrm) * @a text should look like "width,height,old-width,old-height" * where width and height are integers. */ static inline void -resize_terminal_from_str(unsigned char *text) +resize_terminal_from_str(char *text) { enum { NEW_WIDTH = 0, NEW_HEIGHT, OLD_WIDTH, OLD_HEIGHT, NUMBERS }; int numbers[NUMBERS]; @@ -492,7 +492,7 @@ resize_terminal_from_str(unsigned char *text) if_assert_failed return; for (i = 0; i < NUMBERS; i++) { - unsigned char *p = strchr((const char *)text, ','); + char *p = strchr((const char *)text, ','); if (p) { *p++ = '\0'; @@ -512,7 +512,7 @@ resize_terminal_from_str(unsigned char *text) } void -dispatch_special(unsigned char *text) +dispatch_special(char *text) { switch (text[0]) { case TERM_FN_TITLE: @@ -557,7 +557,7 @@ dispatch_special(unsigned char *text) } static void inline -safe_hard_write(int fd, unsigned char *buf, int len) +safe_hard_write(int fd, char *buf, int len) { if (is_blocked()) return; @@ -577,7 +577,7 @@ in_sock(struct itrm *itrm) char ch; int fg; /* enum term_exec */ ssize_t bytes_read, i, p; - unsigned char buf[ITRM_OUT_QUEUE_SIZE]; + char buf[ITRM_OUT_QUEUE_SIZE]; bytes_read = safe_read(itrm->in.sock, buf, ITRM_OUT_QUEUE_SIZE); if (bytes_read <= 0) goto free_and_return; @@ -600,7 +600,7 @@ has_nul_byte: p = 0; #define RD(xx) { \ - unsigned char cc; \ + char cc; \ \ if (p < bytes_read) \ cc = buf[p++]; \ @@ -637,7 +637,7 @@ has_nul_byte: } else { int blockh; - unsigned char *param; + char *param; int path_len, del_len, param_len; /* TODO: Should this be changed to allow TERM_EXEC_NEWWIN @@ -710,7 +710,7 @@ free_and_return: * - 0 if the control sequence does not comply with ECMA-48. * - The length of the control sequence otherwise. */ static inline int -get_esc_code(unsigned char *str, int len, unsigned char *final_byte, +get_esc_code(char *str, int len, char *final_byte, int *first_param_value) { const int parameter_pos = 2; @@ -785,7 +785,7 @@ static int decode_terminal_escape_sequence(struct itrm *itrm, struct interlink_event *ev) { struct term_event_keyboard kbd = { KBD_UNDEF, KBD_MOD_NONE }; - unsigned char c; + char c; int v; int el; @@ -1173,8 +1173,8 @@ process_queue(struct itrm *itrm) else { el = 2; set_kbd_interlink_event(&ev, - os2xtd[itrm->in.queue.data[1]].key, - os2xtd[itrm->in.queue.data[1]].modifier); + os2xtd[(unsigned char)itrm->in.queue.data[1]].key, + os2xtd[(unsigned char)itrm->in.queue.data[1]].modifier); } } diff --git a/src/terminal/kbd.h b/src/terminal/kbd.h index d80b8b86..51708cac 100644 --- a/src/terminal/kbd.h +++ b/src/terminal/kbd.h @@ -127,15 +127,15 @@ void handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in, void *init_string, int init_len, int remote); -void itrm_queue_event(struct itrm *itrm, unsigned char *data, int len); +void itrm_queue_event(struct itrm *itrm, char *data, int len); void block_itrm(void); int unblock_itrm(void); void free_all_itrms(void); void resize_terminal(void); -void dispatch_special(unsigned char *); +void dispatch_special(char *); void kbd_ctrl_c(void); int is_blocked(void); -void get_terminal_name(unsigned char *); +void get_terminal_name(char *); #define kbd_get_key(kbd_) ((kbd_)->key) #define kbd_key_is(kbd_, key) (kbd_get_key(kbd_) == (key)) diff --git a/src/terminal/mouse.c b/src/terminal/mouse.c index 9caa497a..2843c530 100644 --- a/src/terminal/mouse.c +++ b/src/terminal/mouse.c @@ -91,7 +91,7 @@ enable_mouse(void) if (mouse_enabled) return; if (is_xterm()) send_mouse_init_sequence(get_output_handle()); - ditrm->mouse_h = handle_mouse(0, (void (*)(void *, unsigned char *, int)) itrm_queue_event, ditrm); + ditrm->mouse_h = handle_mouse(0, (void (*)(void *, char *, int)) itrm_queue_event, ditrm); mouse_enabled = 1; } diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 5ea0b3ee..b3889a38 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -118,7 +118,7 @@ static const unsigned char frame_freebsd[48] = { /** Mapping from (enum ::border_char - 0xB0) to obsolete FreeBSD ACS * graphics encoded in CP437. * When UTF-8 I/O is enabled, ELinks uses this array instead of - * ::frame_freebsd[], and converts the characters from CP437 to UTF-8. + * ::frame_freebsd[], and converts the characters from CP437 to UTF-8. * * Derived from ::frame_freebsd[] by converting the characters to * Unicode and back to CP437. frame_freebsd[1] = 138 = 0x8a = U+240B @@ -272,7 +272,7 @@ struct screen_driver { struct screen_driver_opt opt; /* The terminal._template_ name. */ - unsigned char name[1]; /* XXX: Keep last! */ + char name[1]; /* XXX: Keep last! */ }; /** Default options for ::TERM_DUMB. */ @@ -578,7 +578,7 @@ screen_driver_change_hook(struct session *ses, struct option *term_spec, { enum term_mode_type type = get_opt_int_tree(term_spec, "type", NULL); struct screen_driver *driver; - unsigned char *name = term_spec->name; + char *name = term_spec->name; foreach (driver, active_screen_drivers) if (driver->type == type && !strcmp(driver->name, name)) { @@ -618,7 +618,7 @@ static inline struct screen_driver * get_screen_driver(struct terminal *term) { enum term_mode_type type = get_opt_int_tree(term->spec, "type", NULL); - unsigned char *name = term->spec->name; + char *name = term->spec->name; int len = strlen(name); struct screen_driver *driver; @@ -658,7 +658,7 @@ add_cursor_move_to_string(struct string *screen, int y, int x) } else #endif #define CURSOR_NUM_LEN 10 /* 10 chars for @y and @x numbers should be more than enough. */ -{ unsigned char code[4 + 2 * CURSOR_NUM_LEN + 1]; +{ char code[4 + 2 * CURSOR_NUM_LEN + 1]; unsigned int length = 2; code[0] = '\033'; @@ -963,7 +963,7 @@ add_char16(struct string *screen, struct screen_driver *driver, * - COLOR_MODE_16. Use 16 colors. * - An unsupported color mode. Use 16 colors. */ if (driver->opt.color_mode != COLOR_MODE_MONO) { - unsigned char code[6] = ";30;40"; + char code[6] = ";30;40"; unsigned char bgcolor = TERM_COLOR_BACKGROUND_16(ch->c.color); code[2] += TERM_COLOR_FOREGROUND_16(ch->c.color); @@ -1005,8 +1005,8 @@ add_char16(struct string *screen, struct screen_driver *driver, static inline void add_char_color(struct string *screen, const struct string *seq, unsigned char color) { - unsigned char color_buf[3]; - unsigned char *color_pos = color_buf; + char color_buf[3]; + char *color_pos = color_buf; int seq_pos = 0; int color_len = 1; @@ -1172,13 +1172,13 @@ static const struct string color_true_seqs[] = { static inline void add_char_true_color(struct string *screen, const struct string *seq, unsigned char *colors) { - unsigned char color_buf[3]; + char color_buf[3]; int i; check_string_magic(seq); add_string_to_string(screen, seq); for (i = 0; i < 3; i++) { - unsigned char *color_pos = color_buf; + char *color_pos = color_buf; int color_len = 1; unsigned char color = colors[i]; diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index a333baeb..05647a21 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -90,7 +90,7 @@ get_default_terminal(void) struct terminal * init_term(int fdin, int fdout) { - unsigned char name[MAX_TERM_LEN + 9] = "terminal."; + char name[MAX_TERM_LEN + 9] = "terminal."; struct terminal *term = mem_calloc(1, sizeof(*term)); if (!term) { @@ -223,7 +223,7 @@ check_if_no_terminal(void) } void -exec_thread(unsigned char *path, int p) +exec_thread(char *path, int p) { int plen = strlen(path + 1) + 2; @@ -274,13 +274,13 @@ assert_terminal_ptr_not_dangling(const struct terminal *suspect) static void exec_on_master_terminal(struct terminal *term, - unsigned char *path, int plen, - unsigned char *delete_, int dlen, + char *path, int plen, + char *delete_, int dlen, enum term_exec fg) { int blockh; int param_size = plen + dlen + 2 /* 2 null char */ + 1 /* fg */; - unsigned char *param = fmem_alloc(param_size); + char *param = fmem_alloc(param_size); if (!param) return; @@ -317,12 +317,12 @@ exec_on_master_terminal(struct terminal *term, static void exec_on_slave_terminal( struct terminal *term, - unsigned char *path, int plen, - unsigned char *delete_, int dlen, + char *path, int plen, + char *delete_, int dlen, enum term_exec fg) { int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */; - unsigned char *data = fmem_alloc(data_size); + char *data = fmem_alloc(data_size); if (!data) return; @@ -335,8 +335,8 @@ exec_on_slave_terminal( struct terminal *term, } void -exec_on_terminal(struct terminal *term, unsigned char *path, - unsigned char *delete_, enum term_exec fg) +exec_on_terminal(struct terminal *term, char *path, + char *delete_, enum term_exec fg) { if (path) { if (!*path) return; @@ -377,7 +377,7 @@ exec_on_terminal(struct terminal *term, unsigned char *path, void exec_shell(struct terminal *term) { - unsigned char *sh; + char *sh; if (!can_open_os_shell(term->environment)) return; @@ -389,10 +389,10 @@ exec_shell(struct terminal *term) void do_terminal_function(struct terminal *term, unsigned char code, - unsigned char *data) + char *data) { int data_len = strlen(data); - unsigned char *x_data = fmem_alloc(data_len + 1 /* code */ + 1 /* null char */); + char *x_data = fmem_alloc(data_len + 1 /* code */ + 1 /* null char */); if (!x_data) return; x_data[0] = code; @@ -403,11 +403,11 @@ do_terminal_function(struct terminal *term, unsigned char code, /** @return negative on error; zero or positive on success. */ int -set_terminal_title(struct terminal *term, unsigned char *title) +set_terminal_title(struct terminal *term, char *title) { int from_cp; int to_cp; - unsigned char *converted = NULL; + char *converted = NULL; if (term->title && !strcmp(title, term->title)) return 0; diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index 16548254..35f253c2 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -108,7 +108,7 @@ struct terminal { /** This is the terminal's current title, as perhaps displayed * somewhere in the X window frame or so. */ - unsigned char *title; + char *title; /** This is the screen. See terminal/screen.h */ struct terminal_screen *screen; @@ -160,7 +160,7 @@ struct terminal { enum term_env_type environment; /** The current working directory for this terminal / ELinks instance. */ - unsigned char cwd[MAX_CWD_LEN]; + char cwd[MAX_CWD_LEN]; /** For communication between instances */ struct terminal_interlink *interlink; @@ -193,7 +193,7 @@ int get_terminal_codepage(const struct terminal *); void redraw_all_terminals(void); void destroy_all_terminals(void); -void exec_thread(unsigned char *, int); +void exec_thread(char *, int); void close_handle(void *); #ifdef CONFIG_FASTMEM @@ -227,11 +227,11 @@ enum term_exec { TERM_EXEC_NEWWIN = 2 }; -void exec_on_terminal(struct terminal *, unsigned char *, unsigned char *, enum term_exec); +void exec_on_terminal(struct terminal *, char *, char *, enum term_exec); void exec_shell(struct terminal *term); -int set_terminal_title(struct terminal *, unsigned char *); -void do_terminal_function(struct terminal *, unsigned char, unsigned char *); +int set_terminal_title(struct terminal *, char *); +void do_terminal_function(struct terminal *, unsigned char, char *); int check_terminal_pipes(void); void close_terminal_pipes(void); diff --git a/src/util/base64.c b/src/util/base64.c index 1fe34b81..a5ecfbf3 100644 --- a/src/util/base64.c +++ b/src/util/base64.c @@ -15,8 +15,8 @@ static unsigned char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -unsigned char * -base64_encode(register unsigned char *in) +char * +base64_encode(register char *in) { assert(in && *in); if_assert_failed return NULL; @@ -24,11 +24,11 @@ base64_encode(register unsigned char *in) return base64_encode_bin(in, strlen(in), NULL); } -unsigned char * -base64_encode_bin(register unsigned char *in, int inlen, int *outlen) +char * +base64_encode_bin(register char *in, int inlen, int *outlen) { - unsigned char *out; - unsigned char *outstr; + char *out; + char *outstr; assert(in && *in); if_assert_failed return NULL; @@ -63,8 +63,8 @@ base64_encode_bin(register unsigned char *in, int inlen, int *outlen) return outstr; } -unsigned char * -base64_decode(register unsigned char *in) +char * +base64_decode(register char *in) { assert(in && *in); if_assert_failed return NULL; @@ -79,13 +79,13 @@ base64_decode(register unsigned char *in) * * @returns the string decoded (must be freed by the caller) * or NULL if an error occurred (syntax error or out of memory) */ -unsigned char * -base64_decode_bin(register unsigned char *in, int inlen, int *outlen) +char * +base64_decode_bin(register char *in, int inlen, int *outlen) { static unsigned char is_base64_char[256]; /* static to force initialization at zero */ static unsigned char decode[256]; - unsigned char *out; - unsigned char *outstr; + char *out; + char *outstr; int count = 0; unsigned int bits = 0; static int once = 0; @@ -109,10 +109,10 @@ base64_decode_bin(register unsigned char *in, int inlen, int *outlen) while (*in) { if (*in == '=') break; - if (!is_base64_char[*in]) + if (!is_base64_char[(unsigned char)*in]) goto decode_error; - bits += decode[*in]; + bits += decode[(unsigned char)*in]; count++; if (count == 4) { *out++ = bits >> 16; diff --git a/src/util/base64.h b/src/util/base64.h index 9e3e71bf..3428108f 100644 --- a/src/util/base64.h +++ b/src/util/base64.h @@ -5,11 +5,11 @@ extern "C" { #endif -unsigned char *base64_encode(unsigned char *); -unsigned char *base64_decode(unsigned char *); +char *base64_encode(char *); +char *base64_decode(char *); -unsigned char *base64_encode_bin(unsigned char *, int, int *); -unsigned char *base64_decode_bin(unsigned char *, int, int *); +char *base64_encode_bin(char *, int, int *); +char *base64_decode_bin(char *, int, int *); #ifdef __cplusplus } diff --git a/src/util/bitfield.h b/src/util/bitfield.h index 31fbe26f..e79cd1c5 100644 --- a/src/util/bitfield.h +++ b/src/util/bitfield.h @@ -57,7 +57,7 @@ init_bitfield(size_t bits) * @relates bitfield */ static inline void copy_bitfield(struct bitfield *bitfield, - const unsigned char *bits, unsigned int bytesize) + const char *bits, unsigned int bytesize) { /* Only for exact size? */ if (bytesize <= get_bitfield_byte_size(bitfield->bitsize)) diff --git a/src/util/color.c b/src/util/color.c index ef440b3b..8846a55c 100644 --- a/src/util/color.c +++ b/src/util/color.c @@ -52,7 +52,7 @@ colors_list_next(void) if (!internal_pointer->name) return NULL; - kv.key = (unsigned char *) internal_pointer->name; + kv.key = (char *) internal_pointer->name; kv.data = (void *) internal_pointer; /* cast away const */ internal_pointer++; @@ -82,11 +82,11 @@ free_colors_lookup(void) } int -decode_color(const unsigned char *str, int slen, color_T *color) +decode_color(const char *str, int slen, color_T *color) { if (*str == '#' && (slen == 7 || slen == 4)) { - unsigned char buffer[7]; - unsigned char *end; + char buffer[7]; + char *end; color_T string_color; str++; @@ -136,8 +136,8 @@ decode_hex_color: return -1; /* Not found */ } -const unsigned char * -get_color_string(color_T color, unsigned char hexcolor[8]) +const char * +get_color_string(color_T color, char hexcolor[8]) { const struct color_spec *cs; @@ -150,7 +150,7 @@ get_color_string(color_T color, unsigned char hexcolor[8]) } void -color_to_string(color_T color, unsigned char str[8]) +color_to_string(color_T color, char str[8]) { str[0]='#'; elinks_ulongcat(&str[1], NULL, (unsigned long) color, 6, '0', 16, 0); diff --git a/src/util/color.h b/src/util/color.h index 9ebfe2bc..537fdb66 100644 --- a/src/util/color.h +++ b/src/util/color.h @@ -17,15 +17,15 @@ struct color_pair { /** Decode the color string. * The color string can either contain '@#FF0044' style declarations or * color names. */ -int decode_color(const unsigned char *str, int slen, color_T *color); +int decode_color(const char *str, int slen, color_T *color); /** Returns a string containing the color info. If no 'English' name can be * found the hex color (@#rrggbb) is returned in the given buffer. */ -const unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]); +const char *get_color_string(color_T color, char hexcolor[8]); /** Translate rgb color to string in @#rrggbb format. * @a str should be a pointer to an 8 bytes memory space. */ -void color_to_string(color_T color, unsigned char str[8]); +void color_to_string(color_T color, char str[8]); /** @name Fastfind lookup management. * @{ */ diff --git a/src/util/conv.c b/src/util/conv.c index b11dbb0d..9b7f6ef0 100644 --- a/src/util/conv.c +++ b/src/util/conv.c @@ -51,14 +51,14 @@ * @returns 0 if OK or width needed for the whole number to fit there, * if it had to be truncated. A negative value signs an error. */ NONSTATIC_INLINE int -elinks_ulongcat(unsigned char *s, unsigned int *slen, +elinks_ulongcat(char *s, unsigned int *slen, unsigned long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper) { - static const unsigned char unum[]= "0123456789ABCDEF"; - static const unsigned char lnum[]= "0123456789abcdef"; - const unsigned char *to_num = (upper ? unum : lnum); + static const char unum[]= "0123456789ABCDEF"; + static const char lnum[]= "0123456789abcdef"; + const char *to_num = (upper ? unum : lnum); unsigned int start = slen ? *slen : 0; unsigned int nlen = 1; /* '0' is one char, we can't have less. */ unsigned int pos = start; /* starting position of the number */ @@ -109,12 +109,12 @@ elinks_ulongcat(unsigned char *s, unsigned int *slen, /** Similar to elinks_ulongcat() but for @c long number. */ NONSTATIC_INLINE int -elinks_longcat(unsigned char *s, unsigned int *slen, +elinks_longcat(char *s, unsigned int *slen, long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper) { - unsigned char *p = s; + char *p = s; if (number < 0 && width > 0) { if (slen) p[(*slen)++] = '-'; @@ -131,7 +131,7 @@ elinks_longcat(unsigned char *s, unsigned int *slen, struct string * add_long_to_string(struct string *string, long long number) { - unsigned char buffer[64]; + char buffer[64]; int length = 0; int width; @@ -149,7 +149,7 @@ struct string * add_knum_to_string(struct string *string, long long num) { int ret; - unsigned char t[64]; + char t[64]; int tlen = 0; if (num && (num / (1024 * 1024)) * (1024 * 1024) == num) { @@ -175,7 +175,7 @@ add_knum_to_string(struct string *string, long long num) struct string * add_xnum_to_string(struct string *string, long long xnum) { - unsigned char suff[3] = "\0i"; + char suff[3] = "\0i"; off_t d = -1; /* XXX: I don't completely like the computation of d here. --pasky */ @@ -208,7 +208,7 @@ add_xnum_to_string(struct string *string, long long xnum) struct string * add_duration_to_string(struct string *string, long seconds) { - unsigned char q[64]; + char q[64]; int qlen = 0; if (seconds < 0) seconds = 0; @@ -248,10 +248,10 @@ add_timeval_to_string(struct string *string, timeval_T *timeval) #ifdef HAVE_STRFTIME struct string * -add_date_to_string(struct string *string, const unsigned char *fmt, +add_date_to_string(struct string *string, const char *fmt, const time_t *date) { - unsigned char buffer[MAX_STR_LEN]; + char buffer[MAX_STR_LEN]; time_t when_time = date ? *date : time(NULL); struct tm *when_local = localtime(&when_time); @@ -268,7 +268,7 @@ 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, +add_string_replace(struct string *string, char *src, int len, unsigned char replaceable, unsigned char replacement) { int oldlength = string->length; @@ -284,8 +284,10 @@ add_string_replace(struct string *string, unsigned char *src, int len, } struct string * -add_html_to_string(struct string *string, const unsigned char *src, int len) +add_html_to_string(struct string *string, const char *src2, int len) { + const unsigned char *src = (const unsigned char *)src2; + for (; len; len--, src++) { if (*src < 0x20 || *src == '<' || *src == '>' || *src == '&' @@ -310,14 +312,14 @@ add_html_to_string(struct string *string, const unsigned char *src, int len) struct string * add_cp_html_to_string(struct string *string, int src_codepage, - const unsigned char *src, int len) + const char *src, int len) { - const unsigned char *const end = src + len; + const char *const end = src + len; unicode_val_T unicode; for (;;) { unicode = cp_to_unicode(src_codepage, - (unsigned char **) &src, end); + (char **) &src, end); if (unicode == UCS_NO_CHAR) break; @@ -344,7 +346,7 @@ 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) +add_quoted_to_string(struct string *string, const char *src, int len) { for (; len; len--, src++) { if (isquote(*src) || *src == '\\') @@ -356,7 +358,7 @@ add_quoted_to_string(struct string *string, const unsigned char *src, int len) } struct string * -add_shell_quoted_to_string(struct string *string, unsigned char *src, int len) +add_shell_quoted_to_string(struct string *string, char *src, int len) { add_char_to_string(string, '\''); for (; len; len--, ++src) @@ -370,7 +372,7 @@ add_shell_quoted_to_string(struct string *string, unsigned char *src, int len) } struct string * -add_shell_safe_to_string(struct string *string, unsigned char *cmd, int cmdlen) +add_shell_safe_to_string(struct string *string, char *cmd, int cmdlen) { int prev_safe = 0; @@ -393,7 +395,7 @@ add_shell_safe_to_string(struct string *string, unsigned char *cmd, int cmdlen) long -strtolx(unsigned char *str, unsigned char **end) +strtolx(char *str, char **end) { long num; unsigned char postfix; @@ -422,9 +424,9 @@ strtolx(unsigned char *str, unsigned char **end) } int -month2num(const unsigned char *str) +month2num(const char *str) { - unsigned char month[3] = { str[0]|32, str[1]|32, str[2]|32 }; + char month[3] = { str[0]|32, str[1]|32, str[2]|32 }; switch (month[0]) { case 'j': /* jan, jun, jul */ @@ -473,9 +475,10 @@ month2num(const unsigned char *str) /** This function drops control chars, nbsp char and limit the number * of consecutive space chars to one. It modifies its argument. */ void -clr_spaces(unsigned char *str) +clr_spaces(char *str2) { unsigned char *s; + unsigned char *str = (unsigned char *)str2; unsigned char *dest = str; assert(str); @@ -499,7 +502,7 @@ clr_spaces(unsigned char *str) * update_bookmark() assumes this function does not switch translation * tables. */ void -sanitize_title(unsigned char *title) +sanitize_title(char *title) { int len = strlen(title); @@ -515,7 +518,7 @@ sanitize_title(unsigned char *title) /** Returns 0 if @a url contains invalid chars, 1 if ok. * It trims starting/ending spaces. */ int -sanitize_url(unsigned char *url) +sanitize_url(char *url) { int len = strlen(url); diff --git a/src/util/conv.h b/src/util/conv.h index 5c243c10..4207c052 100644 --- a/src/util/conv.h +++ b/src/util/conv.h @@ -19,7 +19,7 @@ is_safe_in_shell(unsigned char c) } -long strtolx(unsigned char *, unsigned char **); +long strtolx(char *, char **); /** Convert a decimal number to hexadecimal (lowercase) (0 <= @a a <= 15). */ static inline unsigned char @@ -60,7 +60,7 @@ struct string *add_timeval_to_string(struct string *string, timeval_T *timeval); * used. * @relates string */ struct string *add_date_to_string(struct string *string, - const unsigned char *format, + const char *format, const time_t *time); #endif @@ -75,7 +75,7 @@ struct string *add_date_to_string(struct string *string, * 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, +add_string_replace(struct string *string, char *src, int len, unsigned char replaceable, unsigned char replacement); /** @relates string */ @@ -95,45 +95,45 @@ 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 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, - const unsigned char *html, int htmllen); + const 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 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, - unsigned char *src, int len); + 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, char *cmd, int cmdlen); /** @} */ /* These are fast functions to convert integers to string, or to hexadecimal string. */ -int elinks_ulongcat(unsigned char *s, unsigned int *slen, unsigned long long number, +int elinks_ulongcat(char *s, unsigned int *slen, unsigned long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper); -int elinks_longcat(unsigned char *s, unsigned int *slen, long long number, +int elinks_longcat(char *s, unsigned int *slen, long long number, unsigned int width, unsigned char fillchar, unsigned int base, unsigned int upper); /* Type casting is enforced, to shorten calls. --Zas */ /** unsigned long to decimal string */ #define ulongcat(s, slen, number, width, fillchar) \ - elinks_ulongcat((unsigned char *) (s), \ + elinks_ulongcat((char *) (s), \ (unsigned int *) (slen), \ (unsigned long long) (number), \ (unsigned int) (width), \ @@ -143,7 +143,7 @@ int elinks_longcat(unsigned char *s, unsigned int *slen, long long number, /** signed long to decimal string */ #define longcat(s, slen, number, width, fillchar) \ - elinks_longcat((unsigned char *) (s), \ + elinks_longcat((char *) (s), \ (unsigned int *) (slen), \ (long long) (number), \ (unsigned int) (width), \ @@ -153,7 +153,7 @@ int elinks_longcat(unsigned char *s, unsigned int *slen, long long number, /** unsigned long to hexadecimal string */ #define ulonghexcat(s, slen, number, width, fillchar, upper) \ - elinks_ulongcat((unsigned char *) (s), \ + elinks_ulongcat((char *) (s), \ (unsigned int *) (slen), \ (unsigned long long) (number), \ (unsigned int) (width), \ @@ -164,18 +164,18 @@ int elinks_longcat(unsigned char *s, unsigned int *slen, long long number, /** Return 0 if starting with jan, 11 for dec, -1 for failure. * @a month must be a lowercased string. */ -int month2num(const unsigned char *month); +int month2num(const char *month); #include <string.h> /** Trim starting and ending chars equal to @a c in string @a s. * If @a len != NULL, it stores new string length in pointed integer. * It returns @a s for convenience. */ -static inline unsigned char * -trim_chars(unsigned char *s, unsigned char c, int *len) +static inline char * +trim_chars(char *s, unsigned char c, int *len) { int l = strlen(s); - unsigned char *p = s; + char *p = s; while (*p == c) p++, l--; while (l && p[l - 1] == c) p[--l] = '\0'; @@ -199,7 +199,7 @@ int c_isupper(int c); /** Convert uppercase letters in @a string with the given @a length to * lowercase. */ static inline void -convert_to_lowercase(unsigned char *string, int length) +convert_to_lowercase(char *string, int length) { for (length--; length >= 0; length--) if (isupper(string[length])) @@ -209,7 +209,7 @@ convert_to_lowercase(unsigned char *string, int length) /* Convert uppercase letters in @string with the given @length to lowercase * using the ASCII character set (as if in the C locale) */ static inline void -convert_to_lowercase_locale_indep(unsigned char *string, int length) +convert_to_lowercase_locale_indep(char *string, int length) { for (length--; length >= 0; length--) if (c_isupper(string[length])) @@ -218,15 +218,15 @@ convert_to_lowercase_locale_indep(unsigned char *string, int length) /** This function drops control chars, nbsp char and limit the number * of consecutive space chars to one. It modifies its argument. */ -void clr_spaces(unsigned char *str); +void clr_spaces(char *str); /** Replace invalid chars in @a title with ' ' and trim all starting/ending * spaces. */ -void sanitize_title(unsigned char *title); +void sanitize_title(char *title); /** Returns 0 if @a url contains invalid chars, 1 if ok. * It trims starting/ending spaces. */ -int sanitize_url(unsigned char *url); +int sanitize_url(char *url); #ifdef __cplusplus } diff --git a/src/util/env.c b/src/util/env.c index d9bc42c8..4b753ab8 100644 --- a/src/util/env.c +++ b/src/util/env.c @@ -24,7 +24,7 @@ * set @a name to specified substring of @a value. */ int -env_set(unsigned char *name, unsigned char *value, int length) +env_set(char *name, char *value, int length) { int true_length, substring = 0; diff --git a/src/util/env.h b/src/util/env.h index bb49fa19..a607ed44 100644 --- a/src/util/env.h +++ b/src/util/env.h @@ -5,7 +5,7 @@ extern "C" { #endif -int env_set(unsigned char *name, unsigned char *value, int len); +int env_set(char *name, char *value, int len); #ifdef __cplusplus } diff --git a/src/util/error.c b/src/util/error.c index fc83d0eb..05e42a2c 100644 --- a/src/util/error.c +++ b/src/util/error.c @@ -35,10 +35,10 @@ #include "util/string.h" -unsigned char full_static_version[1024] = "ELinks " VERSION_STRING; +char full_static_version[1024] = "ELinks " VERSION_STRING; static void -er(int bell, int shall_sleep, unsigned char *fmt, va_list params) +er(int bell, int shall_sleep, char *fmt, va_list params) { if (bell) #ifdef CONFIG_OS_WIN32 @@ -53,12 +53,12 @@ er(int bell, int shall_sleep, unsigned char *fmt, va_list params) } int errline; -const unsigned char *errfile; +const char *errfile; void -elinks_debug(unsigned char *fmt, ...) +elinks_debug(char *fmt, ...) { - unsigned char errbuf[4096]; + char errbuf[4096]; va_list params; va_start(params, fmt); @@ -72,9 +72,9 @@ elinks_debug(unsigned char *fmt, ...) } void -elinks_wdebug(unsigned char *fmt, ...) +elinks_wdebug(char *fmt, ...) { - unsigned char errbuf[4096]; + char errbuf[4096]; va_list params; va_start(params, fmt); @@ -88,9 +88,9 @@ elinks_wdebug(unsigned char *fmt, ...) } void -elinks_error(unsigned char *fmt, ...) +elinks_error(char *fmt, ...) { - unsigned char errbuf[4096]; + char errbuf[4096]; va_list params; va_start(params, fmt); @@ -104,9 +104,9 @@ elinks_error(unsigned char *fmt, ...) } void -elinks_internal(unsigned char *fmt, ...) +elinks_internal(char *fmt, ...) { - unsigned char errbuf[4096]; + char errbuf[4096]; va_list params; va_start(params, fmt); @@ -125,7 +125,7 @@ elinks_internal(unsigned char *fmt, ...) void -usrerror(unsigned char *fmt, ...) +usrerror(char *fmt, ...) { va_list params; @@ -143,9 +143,9 @@ usrerror(unsigned char *fmt, ...) int assert_failed = 0; void -elinks_assertm(int x, unsigned char *fmt, ...) +elinks_assertm(int x, char *fmt, ...) { - unsigned char *buf = NULL; + char *buf = NULL; va_list params; if (assert_failed) return; @@ -184,7 +184,7 @@ static FILE *log_file = NULL; static void done_log(void) { - unsigned char errbuf[4096]; + char errbuf[4096]; time_t curtime = time(NULL); struct tm *loctime = localtime(&curtime); int len; @@ -200,16 +200,16 @@ done_log(void) } void -elinks_log(unsigned char *msg, unsigned char *file, int line, - unsigned char *fmt, ...) +elinks_log(char *msg, char *file, int line, + char *fmt, ...) { - static unsigned char *log_files = NULL; - static unsigned char *log_msg = NULL; - unsigned char errbuf[4096]; + static char *log_files = NULL; + static char *log_msg = NULL; + char errbuf[4096]; va_list params; if (!log_file) { - unsigned char *log_name; + char *log_name; time_t curtime = time(NULL); struct tm *loctime = localtime(&curtime); int len; diff --git a/src/util/error.h b/src/util/error.h index 4db5de3e..0c2c3a00 100644 --- a/src/util/error.h +++ b/src/util/error.h @@ -16,14 +16,14 @@ extern "C" { /* This errfile thing is needed, as we don't have var-arg macros in standart, * only as gcc extension :(. */ extern int errline; -extern const unsigned char *errfile; +extern const char *errfile; /** @c DBG(format_string) is used for printing of debugging information. It * should not be used anywhere in the official codebase (although it is often * lying there commented out, as it may get handy). */ #undef DBG #define DBG errfile = __FILE__, errline = __LINE__, elinks_debug -void elinks_debug(unsigned char *fmt, ...); +void elinks_debug(char *fmt, ...); /** @c WDBG(format_string) is used for printing of debugging information, akin * to DBG(). However, it sleep(1)s, therefore being useful when it is going @@ -32,7 +32,7 @@ void elinks_debug(unsigned char *fmt, ...); * handy). */ #undef WDBG #define WDBG errfile = __FILE__, errline = __LINE__, elinks_wdebug -void elinks_wdebug(unsigned char *fmt, ...); +void elinks_wdebug(char *fmt, ...); /** @c ERROR(format_string) is used to report non-fatal unexpected errors during * the ELinks run. It tries to (not that agressively) draw user's attention to @@ -42,20 +42,20 @@ void elinks_wdebug(unsigned char *fmt, ...); * this kind of stuff, and there's nothing naughty about using that. */ #undef ERROR #define ERROR errfile = __FILE__, errline = __LINE__, elinks_error -void elinks_error(unsigned char *fmt, ...); +void elinks_error(char *fmt, ...); /** @c INTERNAL(format_string) is used to report fatal errors during the ELinks * run. It tries to draw user's attention to the error and dumps core if ELinks * is running in the CONFIG_DEBUG mode. */ #undef INTERNAL #define INTERNAL errfile = __FILE__, errline = __LINE__, elinks_internal -void elinks_internal(unsigned char *fmt, ...); +void elinks_internal(char *fmt, ...); /** @c usrerror(format_string) is used to report user errors during a peaceful * ELinks run. It does not belong to the family above - it doesn't print code * location, beep nor sleep, it just wraps around fprintf(stderr, "...\n");. */ -void usrerror(unsigned char *fmt, ...); +void usrerror(char *fmt, ...); #ifdef HAVE_VARIADIC_MACROS @@ -74,8 +74,8 @@ void usrerror(unsigned char *fmt, ...); * </dl> */ void -elinks_log(unsigned char *msg, unsigned char *file, int line, - unsigned char *fmt, ...); +elinks_log(char *msg, char *file, int line, + char *fmt, ...); #undef LOG_ERR #define LOG_ERR(args...) \ @@ -147,7 +147,7 @@ do { if (!assert_failed && (assert_failed = !(x))) { \ #ifdef CONFIG_FASTMEM static inline #endif -void elinks_assertm(int x, unsigned char *fmt, ...) +void elinks_assertm(int x, char *fmt, ...) #ifdef CONFIG_FASTMEM { /* We don't do anything in CONFIG_FASTMEM mode. Let's hope that the compiler @@ -256,6 +256,6 @@ void dump_backtrace(FILE *f, int trouble); #endif /** This is needed for providing info about features when dumping core */ -extern unsigned char full_static_version[1024]; +extern char full_static_version[1024]; #endif diff --git a/src/util/fastfind.c b/src/util/fastfind.c index af22ec04..bab59c5a 100644 --- a/src/util/fastfind.c +++ b/src/util/fastfind.c @@ -173,7 +173,7 @@ struct fastfind_info { unsigned int compress:1; int idxtab[FF_MAX_CHARS]; - unsigned char uniq_chars[FF_MAX_CHARS]; + char uniq_chars[FF_MAX_CHARS]; #ifdef DEBUG_FASTFIND struct { @@ -190,7 +190,7 @@ struct fastfind_info { unsigned long memory_usage; unsigned long total_key_len; unsigned int compressed_nodes; - unsigned char *comment; + char *comment; } debug; #endif }; @@ -366,7 +366,7 @@ alloc_leafset(struct fastfind_info *info) static inline int char2idx(unsigned char c, struct fastfind_info *info) { - unsigned char *idx = memchr(info->uniq_chars, c, info->uniq_chars_count); + char *idx = memchr(info->uniq_chars, c, info->uniq_chars_count); if (idx) return (idx - info->uniq_chars); @@ -594,7 +594,7 @@ return_error: void * fastfind_search(struct fastfind_index *index, - const unsigned char *key, int key_len) + const char *key, int key_len) { struct ff_node *current; struct fastfind_info *info; @@ -664,7 +664,7 @@ fastfind_done(struct fastfind_index *index) #if 0 struct list { - unsigned char *tag; + char *tag; int val; }; @@ -772,7 +772,7 @@ static struct fastfind_index ff_index int main(int argc, char **argv) { - unsigned char *key = argv[1]; + char *key = argv[1]; struct list *result; if (!key || !*key) { diff --git a/src/util/fastfind.h b/src/util/fastfind.h index 6cde7435..9f4d7e4e 100644 --- a/src/util/fastfind.h +++ b/src/util/fastfind.h @@ -15,7 +15,7 @@ extern "C" { #ifdef USE_FASTFIND struct fastfind_key_value { - unsigned char *key; + char *key; void *data; }; @@ -29,7 +29,7 @@ enum fastfind_flags { struct fastfind_index { /** Description useful for debugging mode. */ - unsigned char *comment; + char *comment; /** Start over. */ void (*reset)(void); /** Get next struct fastfind_key_value in line. */ @@ -56,7 +56,7 @@ struct fastfind_index *fastfind_index(struct fastfind_index *index, enum fastfin * @a index' handle created with fastfind_index(). * @relates fastfind_index */ void *fastfind_search(struct fastfind_index *index, - const unsigned char *key, int key_len); + const char *key, int key_len); /** Fastfind cleanup. It frees the given @a index. * Must be called once per list. diff --git a/src/util/file.c b/src/util/file.c index 90882eed..92022e83 100644 --- a/src/util/file.c +++ b/src/util/file.c @@ -54,7 +54,7 @@ * they encapsulate the lowlevel stuff (need for <unistd.h>) nicely. */ int -file_exists(const unsigned char *filename) +file_exists(const char *filename) { #ifdef HAVE_ACCESS return access(filename, F_OK) >= 0; @@ -66,7 +66,7 @@ file_exists(const unsigned char *filename) } int -file_can_read(const unsigned char *filename) +file_can_read(const char *filename) { #ifdef HAVE_ACCESS return access(filename, R_OK) >= 0; @@ -80,7 +80,7 @@ file_can_read(const unsigned char *filename) } int -file_is_dir(const unsigned char *filename) +file_is_dir(const char *filename) { struct stat st; @@ -90,10 +90,10 @@ file_is_dir(const unsigned char *filename) return S_ISDIR(st.st_mode); } -unsigned char * -get_filename_position(unsigned char *filename) +char * +get_filename_position(char *filename) { - unsigned char *pos; + char *pos; assert(filename); if_assert_failed return NULL; @@ -104,8 +104,8 @@ get_filename_position(unsigned char *filename) return filename; } -unsigned char * -expand_tilde(unsigned char *filename) +char * +expand_tilde(char *filename) { struct string file; @@ -113,7 +113,7 @@ expand_tilde(unsigned char *filename) if (filename[0] == '~') { if (!filename[1] || dir_sep(filename[1])) { - unsigned char *home = getenv("HOME"); + char *home = getenv("HOME"); if (home) { add_to_string(&file, home); @@ -122,7 +122,7 @@ expand_tilde(unsigned char *filename) #ifdef HAVE_GETPWNAM } else { struct passwd *passwd = NULL; - unsigned char *user = filename + 1; + char *user = filename + 1; int userlen = 0; while (user[userlen] && !dir_sep(user[userlen])) @@ -147,10 +147,10 @@ expand_tilde(unsigned char *filename) return file.source; } -unsigned char * -get_unique_name(unsigned char *fileprefix) +char * +get_unique_name(char *fileprefix) { - unsigned char *file = fileprefix; + char *file = fileprefix; int fileprefixlen = strlen(fileprefix); int memtrigger = 1; int suffix = 1; @@ -178,21 +178,21 @@ get_unique_name(unsigned char *fileprefix) return file; } -unsigned char * -get_tempdir_filename(unsigned char *name) +char * +get_tempdir_filename(char *name) { - unsigned char *tmpdir = getenv("TMPDIR"); + char *tmpdir = getenv("TMPDIR"); if (!tmpdir || !*tmpdir) tmpdir = getenv("TMP"); if (!tmpdir || !*tmpdir) tmpdir = getenv("TEMPDIR"); if (!tmpdir || !*tmpdir) tmpdir = getenv("TEMP"); if (!tmpdir || !*tmpdir) tmpdir = "/tmp"; - return straconcat(tmpdir, "/", name, (unsigned char *) NULL); + return straconcat(tmpdir, "/", name, (char *) NULL); } -unsigned char * -file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno) +char * +file_read_line(char *line, size_t *size, FILE *file, int *lineno) { size_t offset = 0; @@ -205,12 +205,12 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno) } while (fgets(line + offset, *size - offset, file)) { - unsigned char *linepos = strchr((const char *)(line + offset), '\n'); + char *linepos = strchr((const char *)(line + offset), '\n'); if (!linepos) { /* Test if the line buffer should be increase because * it was continued and could not fit. */ - unsigned char *newline; + char *newline; int next = getc(file); if (next == EOF) { @@ -271,7 +271,7 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno) * set appropriately before calling mkstemp. */ int -safe_mkstemp(unsigned char *template_) +safe_mkstemp(char *template_) { #ifndef CONFIG_OS_WIN32 mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); @@ -300,7 +300,7 @@ compare_dir_entries(const void *v1, const void *v2) /** This function decides whether a file should be shown in directory * listing or not. @returns according boolean value. */ static inline int -file_visible(unsigned char *name, int get_hidden_files, int is_root_directory) +file_visible(char *name, int get_hidden_files, int is_root_directory) { /* Always show everything not beginning with a dot. */ if (name[0] != '.') @@ -322,7 +322,7 @@ file_visible(unsigned char *name, int get_hidden_files, int is_root_directory) /** First information such as permissions is gathered for each directory entry. * All entries are then sorted. */ struct directory_entry * -get_directory_entries(unsigned char *dirname, int get_hidden) +get_directory_entries(char *dirname, int get_hidden) { struct directory_entry *entries = NULL; DIR *directory; @@ -336,7 +336,7 @@ get_directory_entries(unsigned char *dirname, int get_hidden) while ((entry = readdir(directory))) { struct stat st, *stp; struct directory_entry *new_entries; - unsigned char *name; + char *name; struct string attrib; if (!file_visible(entry->d_name, get_hidden, is_root_directory)) @@ -350,7 +350,7 @@ get_directory_entries(unsigned char *dirname, int get_hidden) * which means less allocation although a bit more short term * memory usage. */ name = straconcat(dirname, entry->d_name, - (unsigned char *) NULL); + (char *) NULL); if (!name) continue; if (!init_string(&attrib)) { @@ -395,10 +395,10 @@ get_directory_entries(unsigned char *dirname, int get_hidden) /** Recursively create directories in @a path. The last element in the path is * taken to be a filename, and simply ignored */ int -mkalldirs(const unsigned char *path) +mkalldirs(const char *path) { int pos, len, ret = 0; - unsigned char *p; + char *p; if (!*path) return -1; diff --git a/src/util/file.h b/src/util/file.h index b93ea76c..0f20bf3c 100644 --- a/src/util/file.h +++ b/src/util/file.h @@ -16,55 +16,55 @@ extern "C" { * charset (i.e. LC_CTYPE) and must be freed with mem_free(). */ struct directory_entry { /** The various attribute info collected with the @c stat_* functions. */ - unsigned char *attrib; + char *attrib; /** The full path of the dir entry. */ - unsigned char *name; + char *name; }; /** First information such as permissions is gathered for each directory entry. * All entries are then sorted. */ struct directory_entry * -get_directory_entries(unsigned char *dirname, int get_hidden_files); +get_directory_entries(char *dirname, int get_hidden_files); -int file_exists(const unsigned char *filename); -int file_can_read(const unsigned char *filename); -int file_is_dir(const unsigned char *filename); +int file_exists(const char *filename); +int file_can_read(const char *filename); +int file_is_dir(const char *filename); /** Strips all directory stuff from @a filename and returns the * position of where the actual filename starts */ -unsigned char *get_filename_position(unsigned char *filename); +char *get_filename_position(char *filename); /** Tilde is only expanded for the current users homedir (~/). * The returned file name is allocated. */ -unsigned char *expand_tilde(unsigned char *filename); +char *expand_tilde(char *filename); /*! @brief Generate a unique file name by trial and error based on the * @a fileprefix by adding suffix counter (e.g. '.42'). * * The returned file name is allocated if @a fileprefix is not unique. */ -unsigned char *get_unique_name(unsigned char *fileprefix); +char *get_unique_name(char *fileprefix); /** Checks various environment variables to get the name of the temp dir. * Returns a filename by concatenating "<tmpdir>/<name>". */ -unsigned char *get_tempdir_filename(unsigned char *name); +char *get_tempdir_filename(char *name); /** Read a line from @a file into the dynamically allocated @a line, * increasing @a line if necessary. Ending whitespace is trimmed. * If a line ends with "\" the next line is read too. * If @a line is NULL the returned line is allocated and if file * reading fails @a line is free()d. */ -unsigned char *file_read_line(unsigned char *line, size_t *linesize, +char *file_read_line(char *line, size_t *linesize, FILE *file, int *linenumber); /** Safe wrapper for mkstemp(). * It enforces permissions by calling umask(0177), call mkstemp(), then * restore previous umask(). */ -int safe_mkstemp(unsigned char *template_); +int safe_mkstemp(char *template_); /** Recursively create directories in @a path. The last element in the path is * taken to be a filename, and simply ignored */ -int mkalldirs(const unsigned char *path); +int mkalldirs(const char *path); /* comparison function for qsort() */ int compare_dir_entries(const void *v1, const void *v2); @@ -108,7 +108,7 @@ static inline void stat_mode(struct string *string, struct stat *stp) { #ifdef FS_UNIX_RIGHTS - unsigned char rwx[10] = "---------"; + char rwx[10] = "---------"; if (stp) { mode_t mode = stp->st_mode; @@ -148,7 +148,7 @@ stat_links(struct string *string, struct stat *stp) if (!stp) { add_to_string(string, " "); } else { - unsigned char lnk[64]; + char lnk[64]; ulongcat(lnk, NULL, stp->st_nlink, 3, ' '); add_to_string(string, lnk); @@ -161,7 +161,7 @@ static inline void stat_user(struct string *string, struct stat *stp) { #ifdef FS_UNIX_USERS - static unsigned char last_user[64]; + static char last_user[64]; static int last_uid = -1; if (!stp) { @@ -190,7 +190,7 @@ static inline void stat_group(struct string *string, struct stat *stp) { #ifdef FS_UNIX_USERS - static unsigned char last_group[64]; + static char last_group[64]; static int last_gid = -1; if (!stp) { @@ -224,7 +224,7 @@ stat_size(struct string *string, struct stat *stp) add_to_string(string, " "); } else { - unsigned char size[64]; + char size[64]; int width = 9; /* First try to fit the file size into 8 digits ... */ @@ -248,7 +248,7 @@ stat_date(struct string *string, struct stat *stp) if (stp) { time_t current_time = time(NULL); time_t when = stp->st_mtime; - unsigned char *fmt; + char *fmt; if (current_time > when + 6L * 30L * 24L * 60L * 60L || current_time < when - 60L * 60L) diff --git a/src/util/hash.c b/src/util/hash.c index a52f87e5..b3428636 100644 --- a/src/util/hash.c +++ b/src/util/hash.c @@ -25,7 +25,7 @@ #define hash_mask(n) (hash_size(n) - 1) #define hash_size(n) (1 << (n)) -static hash_value_T strhash(unsigned char *k, unsigned int length, hash_value_T initval); +static hash_value_T strhash(char *k, unsigned int length, hash_value_T initval); static inline struct hash * init_hash(unsigned int width, hash_func_T func) @@ -82,7 +82,7 @@ free_hash(struct hash **hashp) /** @returns hash_item if ok, NULL if error. * @relates hash */ struct hash_item * -add_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen, +add_hash_item(struct hash *hash, char *key, unsigned int keylen, void *value) { hash_value_T hashval; @@ -103,7 +103,7 @@ add_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen, /** @relates hash */ struct hash_item * -get_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen) +get_hash_item(struct hash *hash, char *key, unsigned int keylen) { struct list_head *list; struct hash_item *item; @@ -151,11 +151,11 @@ del_hash_item(struct hash *hash, struct hash_item *item) * @param length the length of the key * @param initval the previous hash, or an arbitrary value */ static hash_value_T -strhash(unsigned char *k, +strhash(char *k, unsigned int length, hash_value_T initval) { - const unsigned char *p = (const unsigned char *) k; + const char *p = (const char *) k; hash_value_T h = initval; unsigned int i = 0; @@ -276,7 +276,7 @@ strhash(unsigned char *k, * @param length the length of the key * @param initval the previous hash, or an arbitrary value */ static hash_value_T -strhash(unsigned char *k, +strhash(char *k, unsigned int length, hash_value_T initval) { diff --git a/src/util/hash.h b/src/util/hash.h index 45225f4c..9f11444d 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -11,12 +11,12 @@ extern "C" { * happen when this will be of other length, but it should still work ok. * --pasky */ typedef unsigned long hash_value_T; -typedef hash_value_T (* hash_func_T)(unsigned char *key, unsigned int keylen, hash_value_T magic); +typedef hash_value_T (* hash_func_T)(char *key, unsigned int keylen, hash_value_T magic); struct hash_item { LIST_HEAD(struct hash_item); - unsigned char *key; + char *key; unsigned int keylen; void *value; }; @@ -31,8 +31,8 @@ struct hash *init_hash8(void); void free_hash(struct hash **hashp); -struct hash_item *add_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen, void *value); -struct hash_item *get_hash_item(struct hash *hash, unsigned char *key, unsigned int keylen); +struct hash_item *add_hash_item(struct hash *hash, char *key, unsigned int keylen, void *value); +struct hash_item *get_hash_item(struct hash *hash, char *key, unsigned int keylen); void del_hash_item(struct hash *hash, struct hash_item *item); /** @relates hash */ diff --git a/src/util/md5.c b/src/util/md5.c index 20a8a6ed..cb8f2e39 100644 --- a/src/util/md5.c +++ b/src/util/md5.c @@ -31,7 +31,7 @@ static void transform_md5(uint32_t buf[4], uint32_t const in[16]); * This code is harmless on little-endian machines. * @todo FIXME: Optimize it away on little-endian machines. */ static void -reverse_md5_bytes(unsigned char *buf, unsigned int longs) +reverse_md5_bytes(char *buf, unsigned int longs) { uint32_t t; @@ -62,7 +62,7 @@ init_md5(struct md5_context *ctx) * of bytes. * @relates md5_context */ void -update_md5(struct md5_context *ctx, const unsigned char *buf, unsigned long len) +update_md5(struct md5_context *ctx, const char *buf, unsigned long len) { register uint32_t t; @@ -78,7 +78,7 @@ update_md5(struct md5_context *ctx, const unsigned char *buf, unsigned long len) /* Handle any leading odd-sized chunks */ if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; + char *p = (char *) ctx->in + t; t = 64 - t; if (len < t) { @@ -114,7 +114,7 @@ void done_md5(struct md5_context *ctx, md5_digest_bin_T digest) { unsigned int count; - unsigned char *p; + char *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; @@ -148,13 +148,13 @@ done_md5(struct md5_context *ctx, md5_digest_bin_T digest) ((uint32_t *) ctx->in)[15] = ctx->bits[1]; transform_md5(ctx->buf, (uint32_t *) ctx->in); - reverse_md5_bytes((unsigned char *) ctx->buf, 4); + reverse_md5_bytes((char *) ctx->buf, 4); memmove(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } -unsigned char * -digest_md5(const unsigned char *data, unsigned long length, +char * +digest_md5(const char *data, unsigned long length, md5_digest_bin_T digest) { struct md5_context ctx; diff --git a/src/util/md5.h b/src/util/md5.h index 61e371a4..318dc98b 100644 --- a/src/util/md5.h +++ b/src/util/md5.h @@ -39,13 +39,13 @@ struct md5_context { * init_md5(), call update_md5() as needed on buffers full of bytes, and then * call done_md5(), which will fill a supplied 16-byte array with the digest. */ void init_md5(struct md5_context *context); -void update_md5(struct md5_context *context, const unsigned char *data, unsigned long length); +void update_md5(struct md5_context *context, const char *data, unsigned long length); void done_md5(struct md5_context *context, md5_digest_bin_T digest); /** Digest the passed @a data with the given length and stores the MD5 * digest in the @a digest parameter. */ -unsigned char * -digest_md5(const unsigned char *data, unsigned long length, md5_digest_bin_T digest); +char * +digest_md5(const char *data, unsigned long length, md5_digest_bin_T digest); #ifdef CONFIG_MD5 /** @name Provide compatibility with the OpenSSL interface: diff --git a/src/util/memdebug.c b/src/util/memdebug.c index 1a9c3541..0f89b3b7 100644 --- a/src/util/memdebug.c +++ b/src/util/memdebug.c @@ -115,8 +115,8 @@ struct alloc_header { #endif int size; int line; - const unsigned char *file; - unsigned char *comment; + const char *file; + char *comment; #ifdef CHECK_XFLOWS /** This is a little magic. We want to keep the main pointer aligned, @@ -168,8 +168,8 @@ INIT_LIST_OF(struct alloc_header, memory_list); #ifdef LOG_MEMORY_ALLOC static void -dump_short_info(struct alloc_header *ah, const unsigned char *file, int line, - const unsigned char *type) +dump_short_info(struct alloc_header *ah, const char *file, int line, + const char *type) { fprintf(stderr, "%p", PTR_AH2BASE(ah)), fflush(stderr); fprintf(stderr, ":%d", ah->size), fflush(stderr); @@ -185,8 +185,8 @@ dump_short_info(struct alloc_header *ah, const unsigned char *file, int line, #endif static void -dump_info(struct alloc_header *ah, const unsigned char *info, - const unsigned char *file, int line, const unsigned char *type) +dump_info(struct alloc_header *ah, const char *info, + const char *file, int line, const char *type) { fprintf(stderr, "%p", PTR_AH2BASE(ah)); fflush(stderr); /* In some extreme cases, we may core here, as 'ah' can no longer point @@ -214,8 +214,8 @@ dump_info(struct alloc_header *ah, const unsigned char *info, #ifdef CHECK_AH_SANITY static inline int -bad_ah_sanity(struct alloc_header *ah, const unsigned char *info, - const unsigned char *file, int line) +bad_ah_sanity(struct alloc_header *ah, const char *info, + const char *file, int line) { if (!ah) return 1; if (ah->magic != AH_SANITY_MAGIC) { @@ -229,8 +229,8 @@ bad_ah_sanity(struct alloc_header *ah, const unsigned char *info, #ifdef CHECK_XFLOWS static inline int -bad_xflow_magic(struct alloc_header *ah, const unsigned char *info, - const unsigned char *file, int line) +bad_xflow_magic(struct alloc_header *ah, const char *info, + const char *file, int line) { if (!ah) return 1; @@ -283,7 +283,7 @@ check_memory_leaks(void) static int alloc_try = 0; static int -patience(const unsigned char *file, int line, const unsigned char *of) +patience(const char *file, int line, const char *of) { errfile = file; errline = line; @@ -311,7 +311,7 @@ patience(const unsigned char *file, int line, const unsigned char *of) } void * -debug_mem_alloc(const unsigned char *file, int line, size_t size) +debug_mem_alloc(const char *file, int line, size_t size) { struct alloc_header *ah; size_t true_size; @@ -351,7 +351,7 @@ debug_mem_alloc(const unsigned char *file, int line, size_t size) } void * -debug_mem_calloc(const unsigned char *file, int line, size_t eltcount, size_t eltsize) +debug_mem_calloc(const char *file, int line, size_t eltcount, size_t eltsize) { struct alloc_header *ah; size_t size = eltcount * eltsize; @@ -398,7 +398,7 @@ debug_mem_calloc(const unsigned char *file, int line, size_t eltcount, size_t el } void -debug_mem_free(const unsigned char *file, int line, void *ptr) +debug_mem_free(const char *file, int line, void *ptr) { struct alloc_header *ah; int ok = 1; @@ -469,7 +469,7 @@ debug_mem_free(const unsigned char *file, int line, void *ptr) } void * -debug_mem_realloc(const unsigned char *file, int line, void *ptr, size_t size) +debug_mem_realloc(const char *file, int line, void *ptr, size_t size) { struct alloc_header *ah, *ah2; size_t true_size; @@ -538,7 +538,7 @@ debug_mem_realloc(const unsigned char *file, int line, void *ptr, size_t size) } void -set_mem_comment(void *ptr, const unsigned char *str, int len) +set_mem_comment(void *ptr, const char *str, int len) { struct alloc_header *ah; diff --git a/src/util/memdebug.h b/src/util/memdebug.h index 553a1f1f..fae9d6d9 100644 --- a/src/util/memdebug.h +++ b/src/util/memdebug.h @@ -16,11 +16,11 @@ struct mem_stats { extern struct mem_stats mem_stats; -void *debug_mem_alloc(const unsigned char *, int, size_t); -void *debug_mem_calloc(const unsigned char *, int, size_t, size_t); -void debug_mem_free(const unsigned char *, int, void *); -void *debug_mem_realloc(const unsigned char *, int, void *, size_t); -void set_mem_comment(void *, const unsigned char *, int); +void *debug_mem_alloc(const char *, int, size_t); +void *debug_mem_calloc(const char *, int, size_t, size_t); +void debug_mem_free(const char *, int, void *); +void *debug_mem_realloc(const char *, int, void *, size_t); +void set_mem_comment(void *, const char *, int); void check_memory_leaks(void); diff --git a/src/util/memlist.c b/src/util/memlist.c index 8a7c10b9..fad65dab 100644 --- a/src/util/memlist.c +++ b/src/util/memlist.c @@ -31,7 +31,7 @@ * @relates memory_list */ #if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS) struct memory_list * -debug_getml(unsigned char *file, int line, void *p, ...) +debug_getml(char *file, int line, void *p, ...) #else struct memory_list * getml(void *p, ...) @@ -75,7 +75,7 @@ getml(void *p, ...) * @relates memory_list */ #if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS) void -debug_add_to_ml(unsigned char *file, int line, struct memory_list **ml, ...) +debug_add_to_ml(char *file, int line, struct memory_list **ml, ...) #else void add_to_ml(struct memory_list **ml, ...) @@ -129,7 +129,7 @@ add_to_ml(struct memory_list **ml, ...) /** @relates memory_list */ #ifdef DEBUG_MEMLIST void -debug_add_one_to_ml(unsigned char *file, int line, struct memory_list **ml, void *p) +debug_add_one_to_ml(char *file, int line, struct memory_list **ml, void *p) #else void add_one_to_ml(struct memory_list **ml, void *p) diff --git a/src/util/memlist.h b/src/util/memlist.h index 0c1dd785..145340ef 100644 --- a/src/util/memlist.h +++ b/src/util/memlist.h @@ -16,8 +16,8 @@ struct memory_list { #endif #if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS) -struct memory_list *debug_getml(unsigned char *file, int line, void *p, ...); -void debug_add_to_ml(unsigned char *file, int line, struct memory_list **ml, ...); +struct memory_list *debug_getml(char *file, int line, void *p, ...); +void debug_add_to_ml(char *file, int line, struct memory_list **ml, ...); #define getml(...) debug_getml(__FILE__, __LINE__, __VA_ARGS__) #define add_to_ml(...) debug_add_to_ml(__FILE__, __LINE__, __VA_ARGS__) #else @@ -26,7 +26,7 @@ void add_to_ml(struct memory_list **ml, ...); #endif #ifdef DEBUG_MEMLIST -void debug_add_one_to_ml(unsigned char *file, int line, struct memory_list **ml, void *p); +void debug_add_one_to_ml(char *file, int line, struct memory_list **ml, void *p); #define add_one_to_ml(ml, p) debug_add_one_to_ml(__FILE__, __LINE__, ml, p) #else void add_one_to_ml(struct memory_list **ml, void *p); diff --git a/src/util/memory.c b/src/util/memory.c index 5c1a03d2..6a881cec 100644 --- a/src/util/memory.c +++ b/src/util/memory.c @@ -27,7 +27,7 @@ static int alloc_try = 0; static int -patience(unsigned char *of) +patience(char *of) { ++alloc_try; if (alloc_try < ALLOC_MAXTRIES) { diff --git a/src/util/memory.h b/src/util/memory.h index e41eee1b..54f6e76c 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -114,7 +114,7 @@ void *mem_realloc(void *, size_t); static inline void * mem_align_alloc__( #ifdef DEBUG_MEMLEAK - const unsigned char *file, int line, + const char *file, int line, #endif void **ptr, size_t old, size_t new_, size_t objsize, size_t mask) { @@ -122,7 +122,7 @@ mem_align_alloc__( size_t oldsize = ALIGN_MEMORY_SIZE(old, mask); if (newsize > oldsize) { - unsigned char *data; + char *data; newsize *= objsize; oldsize *= objsize; @@ -180,7 +180,7 @@ mem_align_alloc__( static inline int * intdup__( #ifdef DEBUG_MEMLEAK - unsigned char *file, int line, + char *file, int line, #endif int i) { diff --git a/src/util/scanner.c b/src/util/scanner.c index c0840099..f986d8e1 100644 --- a/src/util/scanner.c +++ b/src/util/scanner.c @@ -17,7 +17,7 @@ int map_scanner_string(struct scanner *scanner, - const unsigned char *ident, const unsigned char *end, + const char *ident, const char *end, int base_type) { const struct scanner_string_mapping *mappings = scanner->info->mappings; @@ -58,7 +58,7 @@ dump_scanner(struct scanner *scanner) unsigned char buffer[MAX_STR_LEN]; struct scanner_token *token = scanner->current; struct scanner_token *table_end = scanner->table + scanner->tokens; - unsigned char *srcpos = token->string, *bufpos = buffer; + char *srcpos = token->string, *bufpos = buffer; int src_lookahead = 50; int token_lookahead = 4; int srclen; @@ -144,20 +144,20 @@ init_scanner_info(struct scanner_info *scanner_info) scan_table[index] |= info[i].bits; } else { - unsigned char *string = info[i].data.string.source; + char *string = info[i].data.string.source; int pos = info[i].data.string.length - 1; assert(info[i].type == SCAN_STRING && pos >= 0); for (; pos >= 0; pos--) - scan_table[string[pos]] |= info[i].bits; + scan_table[(unsigned char)string[pos]] |= info[i].bits; } } } void init_scanner(struct scanner *scanner, struct scanner_info *scanner_info, - const unsigned char *string, const unsigned char *end) + const char *string, const char *end) { if (!scanner_info->initialized) { init_scanner_info(scanner_info); diff --git a/src/util/scanner.h b/src/util/scanner.h index 51fa8fcd..69cda123 100644 --- a/src/util/scanner.h +++ b/src/util/scanner.h @@ -24,7 +24,7 @@ struct scanner_token { int precedence; /** The start of the token string and the token length */ - const unsigned char *string; + const char *string; int length; }; @@ -42,7 +42,7 @@ struct scanner_token { enum scan_type { SCAN_RANGE, SCAN_STRING, SCAN_END }; union scan_table_data { - struct { unsigned char *source; long length; } string; + struct { char *source; long length; } string; struct { unsigned char *start; long end; } range; }; @@ -62,7 +62,7 @@ struct scan_table_info { #define SCAN_TABLE_END SCAN_TABLE_INFO(SCAN_END, 0, 0, 0) struct scanner_string_mapping { - unsigned char *name; + char *name; int type; int base_type; }; @@ -94,7 +94,7 @@ struct scanner_info { /** Initializes the scanner. * @relates scanner */ void init_scanner(struct scanner *scanner, struct scanner_info *scanner_info, - const unsigned char *string, const unsigned char *end); + const char *string, const char *end); /** The number of tokens in the scanners token table: * At best it should be big enough to contain properties with space separated @@ -108,7 +108,7 @@ struct scanner { /** The very start of the scanned string, the position in the string * where to scan next and the end of the string. If #position is NULL * it means that no more tokens can be retrieved from the string. */ - const unsigned char *string, *position, *end; + const char *string, *position, *end; /** The current token and number of scanned tokens in the table. * If the number of scanned tokens is less than ::SCANNER_TOKENS @@ -122,7 +122,7 @@ struct scanner { #ifdef DEBUG_SCANNER /** @name Debug info about the caller. * @{ */ - unsigned char *file; + char *file; int line; /** @} */ #endif @@ -197,7 +197,7 @@ skip_scanner_tokens(struct scanner *scanner, int skipto, int precedence); * @relates scanner */ int map_scanner_string(struct scanner *scanner, - const unsigned char *ident, const unsigned char *end, + const char *ident, const char *end, int base_type); #ifdef DEBUG_SCANNER diff --git a/src/util/secsave.c b/src/util/secsave.c index 10bd2ee0..669fd497 100644 --- a/src/util/secsave.c +++ b/src/util/secsave.c @@ -71,7 +71,7 @@ enum secsave_errno secsave_errno = SS_ERR_NONE; /** Open a file for writing in a secure way. @returns a pointer to a * structure secure_save_info on success, or NULL on failure. */ static struct secure_save_info * -secure_open_umask(unsigned char *file_name) +secure_open_umask(char *file_name) { struct stat st; struct secure_save_info *ssi; @@ -151,9 +151,9 @@ secure_open_umask(unsigned char *file_name) * then converted to FILE * using fdopen(). */ int fd; - unsigned char *randname = straconcat(ssi->file_name, + char *randname = straconcat(ssi->file_name, ".tmp_XXXXXX", - (unsigned char *) NULL); + (char *) NULL); if (!randname) { secsave_errno = SS_ERR_OUT_OF_MEM; @@ -203,7 +203,7 @@ end: /* @relates secure_save_info */ struct secure_save_info * -secure_open(unsigned char *file_name) +secure_open(char *file_name) { struct secure_save_info *ssi; mode_t saved_mask; @@ -359,7 +359,7 @@ secure_fprintf(struct secure_save_info *ssi, const char *format, ...) return ret; } -unsigned char * +char * secsave_strerror(enum secsave_errno secsave_error, struct terminal *term) { switch (secsave_error) { diff --git a/src/util/secsave.h b/src/util/secsave.h index d606c641..248ec221 100644 --- a/src/util/secsave.h +++ b/src/util/secsave.h @@ -32,13 +32,13 @@ extern enum secsave_errno secsave_errno; /**< internal secsave error number */ struct secure_save_info { FILE *fp; /**< file stream pointer */ - unsigned char *file_name; /**< final file name */ - unsigned char *tmp_file_name; /**< temporary file name */ + char *file_name; /**< final file name */ + char *tmp_file_name; /**< temporary file name */ int err; /**< set to non-zero value in case of error */ int secure_save; /**< use secure save for this file */ }; -struct secure_save_info *secure_open(unsigned char *); +struct secure_save_info *secure_open(char *); int secure_close(struct secure_save_info *); @@ -47,7 +47,7 @@ int secure_fputc(struct secure_save_info *, int); int secure_fprintf(struct secure_save_info *, const char *, ...); -unsigned char *secsave_strerror(enum secsave_errno, struct terminal *); +char *secsave_strerror(enum secsave_errno, struct terminal *); #ifdef __cplusplus } diff --git a/src/util/sha1.c b/src/util/sha1.c index 517e5c19..52fc3c8e 100644 --- a/src/util/sha1.c +++ b/src/util/sha1.c @@ -58,7 +58,7 @@ init_sha1(struct sha1_context *ctx) void -update_sha1(struct sha1_context *ctx, const unsigned char *dataIn, +update_sha1(struct sha1_context *ctx, const char *dataIn, unsigned long len) { int i; @@ -112,8 +112,8 @@ done_sha1(struct sha1_context *ctx, sha1_digest_bin_T digest) init_sha1(ctx); } -unsigned char * -digest_sha1(const unsigned char *data, unsigned long length, +char * +digest_sha1(const char *data, unsigned long length, sha1_digest_bin_T digest) { struct sha1_context ctx; diff --git a/src/util/sha1.h b/src/util/sha1.h index f1de5ad0..4e6d2654 100644 --- a/src/util/sha1.h +++ b/src/util/sha1.h @@ -55,8 +55,8 @@ extern "C" { #define SHA_HEX_DIGEST_LENGTH (SHA_DIGEST_LENGTH * 2) -typedef unsigned char sha1_digest_bin_T[SHA_DIGEST_LENGTH]; -typedef unsigned char sha1_digest_hex_T[SHA_HEX_DIGEST_LENGTH]; +typedef char sha1_digest_bin_T[SHA_DIGEST_LENGTH]; +typedef char sha1_digest_hex_T[SHA_HEX_DIGEST_LENGTH]; struct sha1_context { unsigned int H[5]; @@ -66,11 +66,11 @@ struct sha1_context { }; void init_sha1(struct sha1_context *context); -void update_sha1(struct sha1_context *context, const unsigned char *data, unsigned long length); +void update_sha1(struct sha1_context *context, const char *data, unsigned long length); void done_sha1(struct sha1_context *context, sha1_digest_bin_T digest); -unsigned char * -digest_sha1(const unsigned char *data, unsigned long length, sha1_digest_bin_T digest); +char * +digest_sha1(const char *data, unsigned long length, sha1_digest_bin_T digest); #ifdef CONFIG_SHA1 /* Provide compatibility with the OpenSSL interface: */ diff --git a/src/util/snprintf.c b/src/util/snprintf.c index d2a4bcb1..120b0f15 100644 --- a/src/util/snprintf.c +++ b/src/util/snprintf.c @@ -865,10 +865,10 @@ elinks_asprintf(char **ptr, const char *format, ...) } #endif -unsigned char * +char * asprintfa(const char *fmt, ...) { - unsigned char *str; + char *str; va_list ap; va_start(ap, fmt); diff --git a/src/util/snprintf.h b/src/util/snprintf.h index 116160cd..9c72a2a0 100644 --- a/src/util/snprintf.h +++ b/src/util/snprintf.h @@ -81,10 +81,10 @@ extern "C" { int vasprintf(char **ptr, const char *fmt, va_list ap); -static inline unsigned char * +static inline char * vasprintfa(const char *fmt, va_list ap) { char *str1; - unsigned char *str2; + char *str2; int size; if (vasprintf(&str1, fmt, ap) < 0) @@ -98,7 +98,7 @@ vasprintfa(const char *fmt, va_list ap) { return str2; } -unsigned char *asprintfa(const char *fmt, ...); +char *asprintfa(const char *fmt, ...); #ifdef __cplusplus } diff --git a/src/util/string.c b/src/util/string.c index c8ee7d77..054407e9 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -41,10 +41,10 @@ #ifdef DEBUG_MEMLEAK -unsigned char * -debug_memacpy(const unsigned char *f, int l, const unsigned char *src, int len) +char * +debug_memacpy(const char *f, int l, const char *src, int len) { - unsigned char *m; + char *m; string_assert(f, l, len >= 0, "memacpy"); if_assert_failed len = 0; @@ -58,8 +58,8 @@ debug_memacpy(const unsigned char *f, int l, const unsigned char *src, int len) return m; } -unsigned char * -debug_stracpy(const unsigned char *f, int l, const unsigned char *src) +char * +debug_stracpy(const char *f, int l, const char *src) { string_assert(f, l, src, "stracpy"); if_assert_failed return NULL; @@ -69,10 +69,10 @@ debug_stracpy(const unsigned char *f, int l, const unsigned char *src) #else /* DEBUG_MEMLEAK */ -unsigned char * -memacpy(const unsigned char *src, int len) +char * +memacpy(const char *src, int len) { - unsigned char *m; + char *m; assertm(len >= 0, "[memacpy]"); if_assert_failed { len = 0; } @@ -86,8 +86,8 @@ memacpy(const unsigned char *src, int len) return m; } -unsigned char * -stracpy(const unsigned char *src) +char * +stracpy(const char *src) { assertm(src, "[stracpy]"); if_assert_failed return NULL; @@ -99,9 +99,9 @@ stracpy(const unsigned char *src) void -add_to_strn(unsigned char **dst, const unsigned char *src) +add_to_strn(char **dst, const char *src) { - unsigned char *newdst; + char *newdst; int dstlen; int srclen; @@ -117,12 +117,12 @@ add_to_strn(unsigned char **dst, const unsigned char *src) *dst = newdst; } -unsigned char * -insert_in_string(unsigned char **dst, int pos, - const unsigned char *seq, int seqlen) +char * +insert_in_string(char **dst, int pos, + const char *seq, int seqlen) { int dstlen = strlen(*dst); - unsigned char *string = mem_realloc(*dst, dstlen + seqlen + 1); + char *string = mem_realloc(*dst, dstlen + seqlen + 1); if (!string) return NULL; @@ -133,12 +133,12 @@ insert_in_string(unsigned char **dst, int pos, return string; } -unsigned char * -straconcat(const unsigned char *str, ...) +char * +straconcat(const char *str, ...) { va_list ap; - const unsigned char *a; - unsigned char *s; + const char *a; + char *s; unsigned int len; assertm(str != NULL, "[straconcat]"); @@ -151,9 +151,9 @@ straconcat(const unsigned char *str, ...) if (len) memcpy(s, str, len); va_start(ap, str); - while ((a = va_arg(ap, const unsigned char *))) { + while ((a = va_arg(ap, const char *))) { unsigned int l = strlen(a); - unsigned char *ns; + char *ns; if (!l) continue; @@ -175,15 +175,15 @@ straconcat(const unsigned char *str, ...) } int -xstrcmp(const unsigned char *s1, const unsigned char *s2) +xstrcmp(const char *s1, const char *s2) { if (!s1) return -!!s2; if (!s2) return 1; return strcmp(s1, s2); } -unsigned char * -safe_strncpy(unsigned char *dst, const unsigned char *src, size_t dst_size) +char * +safe_strncpy(char *dst, const char *src, size_t dst_size) { assertm(dst && src && dst_size > 0, "[safe_strncpy]"); if_assert_failed return NULL; @@ -226,15 +226,15 @@ safe_strncpy(unsigned char *dst, const unsigned char *src, size_t dst_size) } int -elinks_strlcmp(const unsigned char *s1, size_t n1, - const unsigned char *s2, size_t n2) +elinks_strlcmp(const char *s1, size_t n1, + const char *s2, size_t n2) { strlcmp_device("strlcmp", s1, n1, s2, n2, s1[p], s2[p]); } int -elinks_strlcasecmp(const unsigned char *s1, size_t n1, - const unsigned char *s2, size_t n2, +elinks_strlcasecmp(const char *s1, size_t n1, + const char *s2, size_t n2, const int locale_indep) { if (locale_indep) { @@ -270,8 +270,8 @@ int c_strcasecmp(const char *s1, const char *s2) { for (;; s1++, s2++) { - unsigned char c1 = c_tolower(*(const unsigned char *) s1); - unsigned char c2 = c_tolower(*(const unsigned char *) s2); + unsigned char c1 = c_tolower(*(const char *) s1); + unsigned char c2 = c_tolower(*(const char *) s2); if (c1 != c2) return (c1 < c2) ? -1: +1; @@ -283,8 +283,8 @@ c_strcasecmp(const char *s1, const char *s2) int c_strncasecmp(const char *s1, const char *s2, size_t n) { for (; n > 0; n--, s1++, s2++) { - unsigned char c1 = c_tolower(*(const unsigned char *) s1); - unsigned char c2 = c_tolower(*(const unsigned char *) s2); + unsigned char c1 = c_tolower(*(const char *) s1); + unsigned char c2 = c_tolower(*(const char *) s2); if (c1 != c2) return (c1 < c2) ? -1: +1; @@ -320,7 +320,7 @@ char * c_strcasestr(const char *haystack, const char *needle) NONSTATIC_INLINE struct string * #ifdef DEBUG_MEMLEAK -init_string__(const unsigned char *file, int line, struct string *string) +init_string__(const char *file, int line, struct string *string) #else init_string(struct string *string) #endif @@ -363,7 +363,7 @@ done_string(struct string *string) /** @relates string */ NONSTATIC_INLINE struct string * -add_to_string(struct string *string, const unsigned char *source) +add_to_string(struct string *string, const char *source) { assertm(string && source, "[add_to_string]"); if_assert_failed { return NULL; } @@ -411,7 +411,7 @@ 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) +add_file_to_string(struct string *string, const char *filename) { FILE *file; off_t filelen; @@ -454,7 +454,7 @@ struct string * string_concat(struct string *string, ...) { va_list ap; - const unsigned char *source; + const char *source; assertm(string != NULL, "[string_concat]"); if_assert_failed { return NULL; } @@ -462,7 +462,7 @@ string_concat(struct string *string, ...) check_string_magic(string); va_start(ap, string); - while ((source = va_arg(ap, const unsigned char *))) + while ((source = va_arg(ap, const char *))) if (*source) add_to_string(string, source); @@ -514,7 +514,7 @@ 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, ...) +add_format_to_string(struct string *string, const char *format, ...) { int newlength; int width; @@ -546,7 +546,7 @@ add_format_to_string(struct string *string, const unsigned char *format, ...) struct string * add_to_string_list(LIST_OF(struct string_list_item) *list, - const unsigned char *source, int length) + const char *source, int length) { struct string_list_item *item; struct string *string; diff --git a/src/util/string.h b/src/util/string.h index 4f3cef53..213a00c3 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -29,19 +29,19 @@ extern "C" { /** Allocates NUL terminated string with @a len bytes from @a src. * If @a src == NULL or @a len < 0 only one byte is allocated and set it to 0. * @returns the string or NULL on allocation failure. */ -unsigned char *memacpy(const unsigned char *src, int len); +char *memacpy(const char *src, int len); /** Allocated NUL terminated string with the content of @a src. */ -unsigned char *stracpy(const unsigned char *src); +char *stracpy(const char *src); /** @} */ #else /* DEBUG_MEMLEAK */ -unsigned char *debug_memacpy(const unsigned char *, int, const unsigned char *, int); +char *debug_memacpy(const char *, int, const char *, int); #define memacpy(s, l) debug_memacpy(__FILE__, __LINE__, s, l) -unsigned char *debug_stracpy(const unsigned char *, int, const unsigned char *); +char *debug_stracpy(const char *, int, const char *); #define stracpy(s) debug_stracpy(__FILE__, __LINE__, s) #endif /* DEBUG_MEMLEAK */ @@ -49,36 +49,36 @@ unsigned char *debug_stracpy(const unsigned char *, int, const unsigned char *); /** Concatenates @a src to @a str. * If reallocation of @a str fails @a str is not touched. */ -void add_to_strn(unsigned char **str, const unsigned char *src); +void add_to_strn(char **str, const char *src); /** Inserts @a seqlen chars from @a seq at position @a pos in the @a * dst string. * If reallocation of @a dst fails it is not touched and NULL is returned. */ -unsigned char *insert_in_string(unsigned char **dst, int pos, - const unsigned char *seq, int seqlen); +char *insert_in_string(char **dst, int pos, + const char *seq, int seqlen); /** Takes a list of strings where the last parameter _must_ be - * (unsigned char *) NULL and concatenates them. + * (char *) NULL and concatenates them. * * @returns the allocated string or NULL on allocation failure. * * Example: @code - * unsigned char *abc = straconcat("A", "B", "C", (unsigned char *) NULL); + * char *abc = straconcat("A", "B", "C", (char *) NULL); * if (abc) return; * printf("%s", abc); -> print "ABC" * mem_free(abc); -> free memory used by @abc * @endcode */ -unsigned char *straconcat(const unsigned char *str, ...); +char *straconcat(const char *str, ...); /** @name Misc. utility string functions. * @{ */ /** Compare two strings, handling correctly @a s1 or @a s2 being NULL. */ -int xstrcmp(const unsigned char *s1, const unsigned char *s2); +int xstrcmp(const char *s1, const char *s2); /** Copies at most @a len chars into @a dst. Ensures null termination of @a dst. */ -unsigned char *safe_strncpy(unsigned char *dst, const unsigned char *src, size_t len); +char *safe_strncpy(char *dst, const char *src, size_t len); /* strlcmp() is the middle child of history, everyone is using it differently. * On some weird *systems* it seems to be defined (equivalent to strcasecmp()), @@ -100,14 +100,14 @@ unsigned char *safe_strncpy(unsigned char *dst, const unsigned char *src, size_t * differ. (The non-zero return value is _not_ same as for the standard * strcmp() family.) */ #define strlcmp(a,b,c,d) (errfile = __FILE__, errline = __LINE__, elinks_strlcmp(a,b,c,d)) -int elinks_strlcmp(const unsigned char *s1, size_t n1, - const unsigned char *s2, size_t n2); +int elinks_strlcmp(const char *s1, size_t n1, + const char *s2, size_t n2); /** Acts identically to strlcmp(), except for being case insensitive. */ #define strlcasecmp(a,b,c,d) (errfile = __FILE__, errline = __LINE__, elinks_strlcasecmp(a,b,c,d,0)) #define c_strlcasecmp(a,b,c,d) (errfile = __FILE__, errline = __LINE__, elinks_strlcasecmp(a,b,c,d,1)) -int elinks_strlcasecmp(const unsigned char *s1, size_t n1, - const unsigned char *s2, size_t n2, +int elinks_strlcasecmp(const char *s1, size_t n1, + const char *s2, size_t n2, const int locale_indep); #define strlcasestr(a,b,c,d) (errfile = __FILE__, errline = __LINE__, elinks_strlcasestr(a,b,c,d)) @@ -156,7 +156,7 @@ struct string { #ifdef DEBUG_STRING int magic; #endif - unsigned char *source; + char *source; int length; }; @@ -183,7 +183,7 @@ 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 char *file, int line, struct string *string); #define init_string(string) init_string__(__FILE__, __LINE__, string) #else struct string *init_string(struct string *string); @@ -195,14 +195,14 @@ void done_string(struct string *string); struct string *add_to_string(struct string *string, - const unsigned char *source); + const 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_file_to_string(struct string *string, const 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. + * (char *) NULL is met. * @relates string */ struct string *string_concat(struct string *string, ...); @@ -212,14 +212,14 @@ struct string *add_xchar_to_string(struct string *string, unsigned char characte /** 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 char *format, ...); /** Get a regular newly allocated stream of bytes from @a string. * @relates string */ -static unsigned char *squeezastring(struct string *string); +static char *squeezastring(struct string *string); -static inline unsigned char * +static inline char * squeezastring(struct string *string) { return memacpy(string->source, string->length); @@ -253,9 +253,9 @@ squeezastring(struct string *string) static inline struct string * add_bytes_to_string__( #ifdef DEBUG_MEMLEAK - const unsigned char *file, int line, + const char *file, int line, #endif - struct string *string, const unsigned char *bytes, + struct string *string, const char *bytes, int length) { int newlength; @@ -290,13 +290,13 @@ struct string_list_item { * @relates string_list_item */ struct string * add_to_string_list(LIST_OF(struct string_list_item) *list, - const unsigned char *string, int length); + const char *string, int length); void free_string_list(LIST_OF(struct string_list_item) *list); /** Returns an empty C string or @a str if different from NULL. */ -#define empty_string_or_(str) ((str) ? (unsigned char *) (str) : (unsigned char *) "") +#define empty_string_or_(str) ((str) ? (char *) (str) : (char *) "") /** Allocated copy if not NULL or returns NULL. */ #define null_or_stracpy(str) ((str) ? stracpy(str) : NULL) diff --git a/src/vernum.c b/src/vernum.c index 5fc70367..9b19149c 100644 --- a/src/vernum.c +++ b/src/vernum.c @@ -8,6 +8,6 @@ #include "vernum.h" -unsigned char *build_date = __DATE__; -unsigned char *build_time = __TIME__; -unsigned char *build_id = BUILD_ID; +char *build_date = __DATE__; +char *build_time = __TIME__; +char *build_id = BUILD_ID; diff --git a/src/vernum.h b/src/vernum.h index ba1a639b..098bc34a 100644 --- a/src/vernum.h +++ b/src/vernum.h @@ -2,6 +2,6 @@ #ifndef EL__VERNUM_H #define EL__VERNUM_H -extern unsigned char *build_date, *build_time, *build_id; +extern char *build_date, *build_time, *build_id; #endif /* EL__VERNUM_H */ diff --git a/src/viewer/action.c b/src/viewer/action.c index 734f8166..0a7df2c9 100644 --- a/src/viewer/action.c +++ b/src/viewer/action.c @@ -46,9 +46,9 @@ static void goto_url_action(struct session *ses, - unsigned char *(*get_url)(struct session *, unsigned char *, size_t)) + char *(*get_url)(struct session *, char *, size_t)) { - unsigned char url[MAX_STR_LEN]; + char url[MAX_STR_LEN]; if (!get_url || !get_url(ses, url, sizeof(url))) url[0] = 0; diff --git a/src/viewer/dump/dump-specialized.h b/src/viewer/dump/dump-specialized.h index 668542a6..097f35af 100644 --- a/src/viewer/dump/dump-specialized.h +++ b/src/viewer/dump/dump-specialized.h @@ -64,7 +64,7 @@ DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out) for (x = 0; x < document->data[y].length; x++) { #ifdef DUMP_CHARSET_UTF8 unicode_val_T c; - const unsigned char *utf8_buf; + const char *utf8_buf; #else /* !DUMP_CHARSET_UTF8 */ unsigned char c; #endif /* !DUMP_CHARSET_UTF8 */ diff --git a/src/viewer/dump/dump.c b/src/viewer/dump/dump.c index 2a04dc24..57918d9b 100644 --- a/src/viewer/dump/dump.c +++ b/src/viewer/dump/dump.c @@ -77,11 +77,11 @@ struct dump_output { #ifdef CONFIG_UTF8 unicode_val_T frame[FRAME_CHARS_END - FRAME_CHARS_BEGIN]; #else - unsigned char frame[FRAME_CHARS_END - FRAME_CHARS_BEGIN]; + char frame[FRAME_CHARS_END - FRAME_CHARS_BEGIN]; #endif /** Bytes waiting to be flushed. */ - unsigned char buf[D_BUF]; + char buf[D_BUF]; }; /** Mapping from CP437 box-drawing characters to simpler CP437 characters. @@ -131,7 +131,7 @@ dump_output_prepare_frame(struct dump_output *out, int to_cp) subst >= FRAME_CHARS_BEGIN && subst < FRAME_CHARS_END; subst = frame_simplify[subst - FRAME_CHARS_BEGIN]) { unicode_val_T ucs = cp2u(cp437, subst); - const unsigned char *result = u2cp_no_nbsp(ucs, to_cp); + const char *result = u2cp_no_nbsp(ucs, to_cp); if (result && cp2u(to_cp, result[0]) == ucs && !result[1]) { @@ -222,8 +222,8 @@ write_char(unsigned char c, struct dump_output *out) static int write_color_16(unsigned char color, struct dump_output *out) { - unsigned char bufor[] = "\033[0;30;40m"; - unsigned char *data = bufor; + char bufor[] = "\033[0;30;40m"; + char *data = bufor; int background = (color >> 4) & 7; int foreground = color & 7; @@ -255,11 +255,11 @@ write_color_16(unsigned char color, struct dump_output *out) #if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) static int -write_color_256(const unsigned char *str, unsigned char color, +write_color_256(const char *str, unsigned char color, struct dump_output *out) { - unsigned char bufor[16]; - unsigned char *data = bufor; + char bufor[16]; + char *data = bufor; snprintf(bufor, 16, "\033[%s;5;%dm", str, color); while(*data) { @@ -283,11 +283,11 @@ write_color_256(const unsigned char *str, unsigned char color, #ifdef CONFIG_TRUE_COLOR static int -write_true_color(const unsigned char *str, const unsigned char *color, +write_true_color(const char *str, const unsigned char *color, struct dump_output *out) { - unsigned char bufor[24]; - unsigned char *data = bufor; + char bufor[24]; + char *data = bufor; snprintf(bufor, 24, "\033[%s;2;%d;%d;%dm", str, color[0], color[1], color[2]); while(*data) { @@ -320,14 +320,14 @@ write_true_color(const unsigned char *str, const unsigned char *color, /*! @return 0 on success, -1 on error */ static int -dump_references(struct document *document, int fd, unsigned char buf[D_BUF]) +dump_references(struct document *document, int fd, char buf[D_BUF]) { if (document->nlinks && get_opt_bool("document.dump.references", NULL)) { - unsigned char key_sym[64] = {0}; + char key_sym[64] = {0}; int x; - unsigned char *header = "\nReferences\n\n Visible links\n"; - const unsigned char *label_key = get_opt_str("document.browse.links.label_key", NULL); + char *header = "\nReferences\n\n Visible links\n"; + const char *label_key = get_opt_str("document.browse.links.label_key", NULL); int headlen = strlen(header); int base = strlen(label_key); @@ -336,7 +336,7 @@ dump_references(struct document *document, int fd, unsigned char buf[D_BUF]) for (x = 0; x < document->nlinks; x++) { struct link *link = &document->links[x]; - unsigned char *where = link->where; + char *where = link->where; size_t reflen; if (!where) continue; @@ -488,7 +488,7 @@ nextfrag: if (w < 0) ERROR(gettext("Can't write to stdout: %s"), - (unsigned char *) strerror(errno)); + (char *) strerror(errno)); else ERROR(gettext("Can't write to stdout.")); @@ -504,8 +504,8 @@ nextfrag: return 0; } -static unsigned char * -subst_url(unsigned char *str, struct string *url) +static char * +subst_url(char *str, struct string *url) { struct string string; @@ -560,12 +560,12 @@ subst_url(unsigned char *str, struct string *url) } static void -dump_print(unsigned char *option, struct string *url) +dump_print(char *option, struct string *url) { - unsigned char *str = get_opt_str(option, NULL); + char *str = get_opt_str(option, NULL); if (str) { - unsigned char *realstr = subst_url(str, url); + char *realstr = subst_url(str, url); if (realstr) { printf("%s", realstr); @@ -620,9 +620,9 @@ terminate: } static void -dump_start(unsigned char *url) +dump_start(char *url) { - unsigned char *wd = get_cwd(); + char *wd = get_cwd(); struct uri *uri = get_translated_uri(url, wd); mem_free_if(wd); diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c index 8e77a321..e82fec99 100644 --- a/src/viewer/text/form.c +++ b/src/viewer/text/form.c @@ -74,7 +74,7 @@ struct files_offset { /** @relates submitted_value */ struct submitted_value * -init_submitted_value(unsigned char *name, unsigned char *value, enum form_type type, +init_submitted_value(char *name, char *value, enum form_type type, struct el_form_control *fc, int position) { struct submitted_value *sv; @@ -128,7 +128,7 @@ fixup_select_state(struct el_form_control *fc, struct form_state *fs) mem_free_set(&fs->value, stracpy(fc->nvalues ? fc->values[0] - : (unsigned char *) "")); + : (char *) "")); } /* menu_func_T */ @@ -418,9 +418,9 @@ draw_form_entry(struct terminal *term, struct document_view *doc_view, dx = box->x - vs->x; dy = box->y - vs->y; switch (fc->type) { - unsigned char *s; + char *s; #ifdef CONFIG_UTF8 - unsigned char *text, *end, *last_in_view; + char *text, *end, *last_in_view; #endif /* CONFIG_UTF8 */ int len; int i, x, y; @@ -471,7 +471,7 @@ retry_after_scroll: for (i = 0; i < fc->size; ) { unicode_val_T data; int cells, cell; - unsigned char *maybe_in_view = text; + char *maybe_in_view = text; data = utf8_to_unicode(&text, end); if (data == UCS_NO_CHAR) /* end of string */ @@ -543,7 +543,7 @@ drew_char: * to be scrolled. */ if (fs->value && last_in_view && last_in_view < fs->value + fs->state) { - unsigned char *ptr = fs->value + fs->state; + char *ptr = fs->value + fs->state; int cells = fc->size; enum utf8_step how = (fc->type == FC_PASSWORD) ? UTF8_STEP_CHARACTERS @@ -708,7 +708,7 @@ add_submitted_value_to_list(struct el_form_control *fc, LIST_OF(struct submitted_value) *list) { struct submitted_value *sub; - unsigned char *name; + char *name; enum form_type type; int position; @@ -750,13 +750,13 @@ add_submitted_value_to_list(struct el_form_control *fc, break; case FC_IMAGE: - name = straconcat(fc->name, ".x", (unsigned char *) NULL); + name = straconcat(fc->name, ".x", (char *) NULL); if (!name) break; sub = init_submitted_value(name, "0", type, fc, position); mem_free(name); if (sub) add_to_list(*list, sub); - name = straconcat(fc->name, ".y", (unsigned char *) NULL); + name = straconcat(fc->name, ".y", (char *) NULL); if (!name) break; sub = init_submitted_value(name, "0", type, fc, position); mem_free(name); @@ -824,7 +824,7 @@ get_successful_controls(struct document_view *doc_view, sort_submitted_values(list); } -unsigned char * +char * encode_crlf(struct submitted_value *sv) { struct string newtext; @@ -860,7 +860,7 @@ encode_controls(LIST_OF(struct submitted_value) *l, struct string *data, if_assert_failed return; foreach (sv, *l) { - unsigned char *p2 = NULL; + char *p2 = NULL; if (lst) add_char_to_string(data, '&'); @@ -873,7 +873,7 @@ encode_controls(LIST_OF(struct submitted_value) *l, struct string *data, /* Convert back to original encoding (see html_form_control() * for the original recoding). */ if (sv->type == FC_TEXTAREA) { - unsigned char *p; + char *p; p = encode_textarea(sv); if (p) { @@ -913,16 +913,16 @@ encode_controls(LIST_OF(struct submitted_value) *l, struct string *data, struct boundary_info { int count; int *offsets; - unsigned char string[BOUNDARY_LENGTH]; + char string[BOUNDARY_LENGTH]; }; /** @relates boundary_info */ static void -randomize_boundary(unsigned char *data, int length) +randomize_boundary(char *data, int length) { int i; - random_nonce(data, length); + random_nonce((unsigned char *)data, length); for (i = 0; i < length; i++) { /* Only [0-9A-Za-z]. */ data[i] = data[i] & 63; @@ -1017,7 +1017,7 @@ encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l, add_char_to_string(data, '"'); if (sv->type == FC_FILE) { - unsigned char *extension; + char *extension; add_to_string(data, "; filename=\""); add_to_string(data, get_filename_position(sv->value)); @@ -1031,7 +1031,7 @@ encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l, /* Add a Content-Type header if the type is configured */ extension = strrchr((const char *)sv->value, '.'); if (extension) { - unsigned char *type = get_extension_content_type(extension); + char *type = get_extension_content_type(extension); if (type) { add_crlf_to_string(data); @@ -1045,7 +1045,7 @@ encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l, add_crlf_to_string(data); if (*sv->value) { - unsigned char *filename; + char *filename; struct files_offset *bfs_new; if (get_cmd_opt_bool("anonymous")) { @@ -1083,7 +1083,7 @@ encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l, * recoding). */ if (sv->type == FC_TEXT || sv->type == FC_PASSWORD || sv->type == FC_TEXTAREA) { - unsigned char *p; + char *p; if (!convert_table) convert_table = get_translation_table(cp_from, @@ -1124,11 +1124,11 @@ encode_error: } static void -encode_newlines(struct string *string, unsigned char *data) +encode_newlines(struct string *string, char *data) { for (; *data; data++) { if (*data == '\n' || *data == '\r') { - unsigned char buffer[3]; + char buffer[3]; /* Hex it. */ buffer[0] = '%'; @@ -1152,8 +1152,8 @@ encode_text_plain(LIST_OF(struct submitted_value) *l, struct string *data, if_assert_failed return; foreach (sv, *l) { - unsigned char *area51 = NULL; - unsigned char *value = sv->value; + char *area51 = NULL; + char *value = sv->value; add_to_string(data, sv->name); add_char_to_string(data, '='); @@ -1290,7 +1290,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view, switch (form->method) { case FORM_METHOD_GET: { - unsigned char *pos = strchr((const char *)form->action, '#'); + char *pos = strchr((const char *)form->action, '#'); if (pos) { add_bytes_to_string(&go, form->action, pos - form->action); @@ -1337,7 +1337,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view, int i; for (i = 0; i < data.length; i++) { - unsigned char p[3]; + char p[3]; ulonghexcat(p, NULL, (int) data.source[i], 2, '0', 0); add_to_string(&go, p); @@ -1348,7 +1348,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view, foreach (b, bfs) { for (; i < b->begin; i++) { - unsigned char p[3]; + char p[3]; ulonghexcat(p, NULL, (int) data.source[i], 2, '0', 0); add_to_string(&go, p); @@ -1364,7 +1364,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view, i = b->end; } for (; i < data.length; i++) { - unsigned char p[3]; + char p[3]; ulonghexcat(p, NULL, (int) data.source[i], 2, '0', 0); add_to_string(&go, p); @@ -1444,7 +1444,7 @@ auto_submit_form(struct session *ses) static void set_file_form_state(struct terminal *term, void *filename_, void *fs_) { - unsigned char *filename = filename_; + char *filename = filename_; struct form_state *fs = fs_; /* The menu code doesn't free the filename data */ @@ -1457,7 +1457,7 @@ set_file_form_state(struct terminal *term, void *filename_, void *fs_) static void file_form_menu(struct terminal *term, void *path_, void *fs_) { - unsigned char *path = path_; + char *path = path_; struct form_state *fs = fs_; /* FIXME: It doesn't work for ../../ */ @@ -1490,11 +1490,11 @@ field_op(struct session *ses, struct document_view *doc_view, struct el_form_control *fc; struct form_state *fs; enum edit_action action_id; - unsigned char *text; + char *text; int length; enum frame_event_status status = FRAME_EVENT_REFRESH; #ifdef CONFIG_UTF8 - const unsigned char *ctext; + const char *ctext; int utf8 = ses->tab->term->utf8_cp; #endif /* CONFIG_UTF8 */ @@ -1523,7 +1523,7 @@ field_op(struct session *ses, struct document_view *doc_view, break; } if (utf8) { - unsigned char *new_value; + char *new_value; new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value); fs->state = new_value - fs->value; @@ -1538,8 +1538,8 @@ field_op(struct session *ses, struct document_view *doc_view, break; } if (utf8) { - unsigned char *text = fs->value + fs->state; - unsigned char *end = strchr((const char *)text, '\0'); + char *text = fs->value + fs->state; + char *end = strchr((const char *)text, '\0'); utf8_to_unicode(&text, end); fs->state = (int)(text - fs->value); @@ -1645,7 +1645,7 @@ field_op(struct session *ses, struct document_view *doc_view, length = strlen(text); if (length <= fc->maxlength) { - unsigned char *v = mem_realloc(fs->value, length + 1); + char *v = mem_realloc(fs->value, length + 1); if (v) { fs->value = v; @@ -1693,7 +1693,7 @@ field_op(struct session *ses, struct document_view *doc_view, #ifdef CONFIG_UTF8 if (utf8) { int old_state = fs->state; - unsigned char *new_value; + char *new_value; new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value); fs->state = new_value - fs->value; @@ -1727,9 +1727,9 @@ field_op(struct session *ses, struct document_view *doc_view, } #ifdef CONFIG_UTF8 if (utf8) { - unsigned char *end = fs->value + length; - unsigned char *text = fs->value + fs->state; - unsigned char *old = text; + char *end = fs->value + length; + char *text = fs->value + fs->state; + char *old = text; utf8_to_unicode(&text, end); if (old != text) { @@ -1906,7 +1906,7 @@ field_op(struct session *ses, struct document_view *doc_view, return status; } -static unsigned char * +static char * get_form_label(struct el_form_control *fc) { assert(fc->form); @@ -1945,7 +1945,7 @@ get_form_label(struct el_form_control *fc) static inline void add_form_attr_to_string(struct string *string, struct terminal *term, - unsigned char *name, unsigned char *value) + char *name, char *value) { add_to_string(string, ", "); add_to_string(string, _(name, term)); @@ -1955,13 +1955,13 @@ add_form_attr_to_string(struct string *string, struct terminal *term, } } -unsigned char * +char * get_form_info(struct session *ses, struct document_view *doc_view) { struct terminal *term = ses->tab->term; struct link *link = get_current_link(doc_view); struct el_form_control *fc; - unsigned char *label, *key; + char *label, *key; struct string str; assert(link); @@ -1997,7 +1997,7 @@ get_form_info(struct session *ses, struct document_view *doc_view) case FC_TEXTAREA: { struct uri *uri; - unsigned char *uristring; + char *uristring; if (form_field_is_readonly(fc)) { add_form_attr_to_string(&str, term, N_("read only"), NULL); @@ -2142,8 +2142,8 @@ link_form_menu(struct session *ses) if (!mi) return; foreach (fc, form->items) { - unsigned char *text; - unsigned char *rtext; + char *text; + char *rtext; int link_number; struct string str; diff --git a/src/viewer/text/form.h b/src/viewer/text/form.h index 7ea6859f..ace7b5ed 100644 --- a/src/viewer/text/form.h +++ b/src/viewer/text/form.h @@ -56,7 +56,7 @@ struct form_state { * UTF-8 only if CONFIG_UTF8 is defined, and is assumed to * be unibyte otherwise). The charset of the document and * the UTF-8 I/O option have no effect here. */ - unsigned char *value; + char *value; /** Position in #value, or an editable integer. * - For ::FC_TEXT, ::FC_PASSWORD, and ::FC_FILE, @c state is * the byte position of the insertion point in #value. @@ -91,8 +91,8 @@ struct form_state { struct submitted_value { LIST_HEAD(struct submitted_value); - unsigned char *name; - unsigned char *value; + char *name; + char *value; struct el_form_control *form_control; @@ -100,14 +100,14 @@ struct submitted_value { int position; }; -struct submitted_value *init_submitted_value(unsigned char *name, unsigned char *value, enum form_type type, struct el_form_control *fc, int position); +struct submitted_value *init_submitted_value(char *name, char *value, enum form_type type, struct el_form_control *fc, int position); void done_submitted_value(struct submitted_value *sv); void done_submitted_value_list(LIST_OF(struct submitted_value) *list); -unsigned char *encode_crlf(struct submitted_value *sv); +char *encode_crlf(struct submitted_value *sv); struct uri *get_form_uri(struct session *ses, struct document_view *doc_view, struct el_form_control *fc); -unsigned char *get_form_info(struct session *ses, struct document_view *doc_view); +char *get_form_info(struct session *ses, struct document_view *doc_view); void selected_item(struct terminal *term, void *item_, void *ses_); int get_current_state(struct session *ses); diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index e7af384f..49de5fe9 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -64,7 +64,7 @@ current_link_evhook(struct document_view *doc_view, enum script_event_hook_type if (!doc_view->vs->ecmascript) return -1; foreach (evhook, *link->event_hooks) { - unsigned char *ret; + char *ret; if (evhook->type != type) continue; ret = evhook->src; @@ -134,8 +134,8 @@ get_link_cursor_offset(struct document_view *doc_view, struct link *link) return 0; #ifdef CONFIG_UTF8 else if (utf8) { - unsigned char *scroll = fs->value + fs->vpos; - unsigned char *point = fs->value + fs->state; + char *scroll = fs->value + fs->vpos; + char *point = fs->value + fs->state; if (fs->type == FC_PASSWORD) return utf8_ptr2chars(scroll, point); @@ -1220,7 +1220,7 @@ goto_link_number_do(struct session *ses, struct document_view *doc_view, int n) } void -goto_link_number(struct session *ses, unsigned char *num) +goto_link_number(struct session *ses, char *num) { struct document_view *doc_view; @@ -1233,7 +1233,7 @@ goto_link_number(struct session *ses, unsigned char *num) } void -goto_link_symbol(struct session *ses, unsigned char *sym) +goto_link_symbol(struct session *ses, char *sym) { char *symkey = get_opt_str("document.browse.links.label_key", ses); struct document_view *doc_view; @@ -1443,7 +1443,7 @@ end: } /** Return current link's title. */ -unsigned char * +char * get_current_link_title(struct document_view *doc_view) { struct link *link; @@ -1457,7 +1457,7 @@ get_current_link_title(struct document_view *doc_view) link = get_current_link(doc_view); if (link && link->title && *link->title) { - unsigned char *link_title, *src; + char *link_title, *src; struct conv_table *convert_table; convert_table = get_translation_table(doc_view->document->cp, @@ -1483,7 +1483,7 @@ get_current_link_title(struct document_view *doc_view) return NULL; } -unsigned char * +char * get_current_link_info(struct session *ses, struct document_view *doc_view) { struct link *link; @@ -1502,7 +1502,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; - unsigned char *uristring = link->where; + char *uristring = link->where; if (!init_string(&str)) return NULL; diff --git a/src/viewer/text/link.h b/src/viewer/text/link.h index 50ce4a11..352c36ab 100644 --- a/src/viewer/text/link.h +++ b/src/viewer/text/link.h @@ -32,8 +32,8 @@ struct link *get_last_link(struct document_view *doc_view); struct link *get_link_at_coordinates(struct document_view *doc_view, int x, int y); -unsigned char *get_current_link_title(struct document_view *doc_view); -unsigned char *get_current_link_info(struct session *ses, struct document_view *doc_view); +char *get_current_link_title(struct document_view *doc_view); +char *get_current_link_info(struct session *ses, struct document_view *doc_view); void set_pos_x(struct document_view *doc_view, struct link *link); void set_pos_y(struct document_view *doc_view, struct link *link); @@ -52,8 +52,8 @@ void jump_to_link_number(struct session *ses, struct document_view *doc_view, in struct link *goto_current_link(struct session *ses, struct document_view *, int); struct link *goto_link(struct session *ses, struct document_view *, struct link *, int); -void goto_link_number(struct session *ses, unsigned char *num); -void goto_link_symbol(struct session *ses, unsigned char *sym); +void goto_link_number(struct session *ses, char *num); +void goto_link_symbol(struct session *ses, char *sym); void get_link_x_bounds(struct link *link, int y, int *min_x, int *max_x); diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index b80c469e..0ab2677d 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -64,7 +64,7 @@ static INIT_INPUT_HISTORY(search_history); #define Regexec tre_regexec #endif -static UCHAR *memacpy_u(unsigned char *text, int textlen, int utf8); +static UCHAR *memacpy_u(char *text, int textlen, int utf8); static enum frame_event_status move_search_do(struct session *ses, struct document_view *doc_view, int direction); static inline void add_srch_chr(struct document *document, UCHAR c, int x, int y, int nn) @@ -450,7 +450,7 @@ is_in_range_regex_match(struct regex_match_context *common_ctx, void *data) static int is_in_range_regex(struct document *document, int y, int height, - unsigned char *text, int textlen, + char *text, int textlen, int *min, int *max, struct search *s1, struct search *s2, int utf8) { @@ -480,7 +480,7 @@ is_in_range_regex(struct document *document, int y, int height, #endif /* CONFIG_TRE */ static UCHAR * -memacpy_u(unsigned char *text, int textlen, int utf8) +memacpy_u(char *text, int textlen, int utf8) { #ifdef CONFIG_UTF8 UCHAR *mem = mem_alloc((textlen + 1) * sizeof(UCHAR)); @@ -505,7 +505,7 @@ memacpy_u(unsigned char *text, int textlen, int utf8) } static int -strlen_u(unsigned char *text, int utf8) +strlen_u(char *text, int utf8) { #ifdef CONFIG_UTF8 if (utf8) @@ -517,7 +517,7 @@ strlen_u(unsigned char *text, int utf8) /** Returns an allocated string which is a lowered copy of passed one. */ static UCHAR * -lowered_string(unsigned char *text, int textlen, int utf8) +lowered_string(char *text, int textlen, int utf8) { UCHAR *ret; @@ -539,7 +539,7 @@ lowered_string(unsigned char *text, int textlen, int utf8) static int is_in_range_plain(struct document *document, int y, int height, - unsigned char *text, int textlen, + char *text, int textlen, int *min, int *max, struct search *s1, struct search *s2, int utf8) { @@ -596,7 +596,7 @@ srch_failed: static int is_in_range(struct document *document, int y, int height, - unsigned char *text, int *min, int *max) + char *text, int *min, int *max) { struct search *s1, *s2; int textlen; @@ -987,7 +987,7 @@ get_searched_all(struct session *ses, struct document_view *doc_view, struct poi } static enum find_error -search_for_do(struct session *ses, unsigned char *str, int direction, +search_for_do(struct session *ses, char *str, int direction, int report_errors) { struct document_view *doc_view; @@ -1031,7 +1031,7 @@ search_for_do(struct session *ses, unsigned char *str, int direction, } static void -search_for_back(struct session *ses, unsigned char *str) +search_for_back(struct session *ses, char *str) { assert(ses && str); if_assert_failed return; @@ -1040,7 +1040,7 @@ search_for_back(struct session *ses, unsigned char *str) } void -search_for(struct session *ses, unsigned char *str) +search_for(struct session *ses, char *str) { assert(ses && str); if_assert_failed return; @@ -1211,8 +1211,8 @@ find_next_do(struct session *ses, struct document_view *doc_view, int direction) } static void -print_find_error_not_found(struct session *ses, unsigned char *title, - unsigned char *message, unsigned char *search_string) +print_find_error_not_found(struct session *ses, char *title, + char *message, char *search_string) { switch (get_opt_int("document.browse.search.show_not_found", NULL)) { case 2: @@ -1234,7 +1234,7 @@ static void print_find_error(struct session *ses, enum find_error find_error) { int hit_top = 0; - unsigned char *message = NULL; + char *message = NULL; switch (find_error) { case FIND_ERROR_HIT_TOP: @@ -1403,9 +1403,9 @@ enum typeahead_code { }; static void -typeahead_error(struct session *ses, unsigned char *typeahead, int no_further) +typeahead_error(struct session *ses, char *typeahead, int no_further) { - unsigned char *message; + char *message; if (no_further) message = N_("No further matches for '%s'."); @@ -1415,10 +1415,10 @@ typeahead_error(struct session *ses, unsigned char *typeahead, int no_further) print_find_error_not_found(ses, N_("Typeahead"), message, typeahead); } -static inline unsigned char * +static inline char * get_link_typeahead_text(struct link *link) { - unsigned char *name = get_link_name(link); + char *name = get_link_name(link); if (name) return name; if (link->where) return link->where; @@ -1428,11 +1428,11 @@ get_link_typeahead_text(struct link *link) } static int -match_link_text(struct link *link, unsigned char *text, int textlen, +match_link_text(struct link *link, char *text, int textlen, int case_sensitive) { - unsigned char *match = get_link_typeahead_text(link); - unsigned char *matchpos; + char *match = get_link_typeahead_text(link); + char *matchpos; if (link_is_form(link) || textlen > strlen(match)) return -1; @@ -1452,7 +1452,7 @@ match_link_text(struct link *link, unsigned char *text, int textlen, * direction to search (1 is forward, -1 is back). */ static inline int search_link_text(struct document *document, int current_link, int i, - unsigned char *text, int direction, int *offset) + char *text, int direction, int *offset) { int upper_link, lower_link; int case_sensitive = get_opt_bool("document.browse.search.case", NULL); @@ -1532,7 +1532,7 @@ draw_typeahead_match(struct terminal *term, struct document_view *doc_view, int xoffset = doc_view->box.x - doc_view->vs->x; int yoffset = doc_view->box.y - doc_view->vs->y; struct link *link = get_current_link(doc_view); - unsigned char *text = get_link_typeahead_text(link); + char *text = get_link_typeahead_text(link); int end = offset + chars; int i, j; @@ -1560,7 +1560,7 @@ draw_typeahead_match(struct terminal *term, struct document_view *doc_view, static enum typeahead_code do_typeahead(struct session *ses, struct document_view *doc_view, - unsigned char *text, int action_id, int *offset) + char *text, int action_id, int *offset) { int current = int_max(doc_view->vs->current_link, 0); int direction, match, i = current; @@ -1636,9 +1636,9 @@ static enum input_line_code text_typeahead_handler(struct input_line *line, int action_id) { struct session *ses = line->ses; - unsigned char *buffer = line->buffer; + char *buffer = line->buffer; struct document_view *doc_view = current_frame(ses); - int direction = ((unsigned char *) line->data)[0] == '/' ? 1 : -1; + int direction = ((char *) line->data)[0] == '/' ? 1 : -1; int report_errors = action_id == -1; enum find_error error; @@ -1705,7 +1705,7 @@ static enum input_line_code link_typeahead_handler(struct input_line *line, int action_id) { struct session *ses = line->ses; - unsigned char *buffer = line->buffer; + char *buffer = line->buffer; struct document_view *doc_view = current_frame(ses); int offset = 0; @@ -1796,8 +1796,8 @@ enum frame_event_status search_typeahead(struct session *ses, struct document_view *doc_view, action_id_T action_id) { - unsigned char *prompt = "#"; - unsigned char *data = NULL; + char *prompt = "#"; + char *data = NULL; input_line_handler_T handler = text_typeahead_handler; struct input_history *history = &search_history; @@ -1875,10 +1875,10 @@ search_dlg_cancel(struct dialog_data *dlg_data, struct widget_data *widget_data) static widget_handler_status_T search_dlg_ok(struct dialog_data *dlg_data, struct widget_data *widget_data) { - void (*fn)(void *, unsigned char *) = widget_data->widget->data; + void (*fn)(void *, char *) = widget_data->widget->data; struct search_dlg_hop *hop = dlg_data->dlg->udata2; void *data = hop->data; - unsigned char *text = dlg_data->widgets_data->cdata; + char *text = dlg_data->widgets_data->cdata; update_dialog_data(dlg_data); @@ -1898,15 +1898,15 @@ search_dlg_ok(struct dialog_data *dlg_data, struct widget_data *widget_data) /* XXX: @data is ignored. */ static void search_dlg_do(struct terminal *term, struct memory_list *ml, - unsigned char *title, void *data, + char *title, void *data, struct input_history *history, - void (*fn)(void *, unsigned char *)) + void (*fn)(void *, char *)) { /* [gettext_accelerator_context(.search_dlg_do)] */ struct dialog *dlg; - unsigned char *field; + char *field; struct search_dlg_hop *hop; - unsigned char *text = _("Search for text", term); + char *text = _("Search for text", term); struct option *search_options; hop = mem_calloc(1, sizeof(*hop)); @@ -1961,7 +1961,7 @@ search_dlg_do(struct terminal *term, struct memory_list *ml, enum frame_event_status search_dlg(struct session *ses, struct document_view *doc_view, int direction) { - unsigned char *title; + char *title; void *search_function; assert(direction); diff --git a/src/viewer/text/search.h b/src/viewer/text/search.h index 54d8327d..b0c93297 100644 --- a/src/viewer/text/search.h +++ b/src/viewer/text/search.h @@ -22,7 +22,7 @@ enum frame_event_status find_next(struct session *ses, struct document_view *doc enum frame_event_status move_search_next(struct session *ses, struct document_view *doc_view); enum frame_event_status move_search_prev(struct session *ses, struct document_view *doc_view); -void search_for(struct session *ses, unsigned char *str); +void search_for(struct session *ses, char *str); enum frame_event_status search_dlg(struct session *ses, struct document_view *doc_view, int direction); enum frame_event_status search_typeahead(struct session *ses, struct document_view *doc_view, action_id_T action_id); diff --git a/src/viewer/text/textarea.c b/src/viewer/text/textarea.c index 3df211fb..8cc7ba83 100644 --- a/src/viewer/text/textarea.c +++ b/src/viewer/text/textarea.c @@ -62,15 +62,15 @@ struct line_info { * suitable for encoding it for form posting */ static struct line_info * -format_textutf8(unsigned char *text, int width, enum form_wrap wrap, int format) +format_textutf8(char *text, int width, enum form_wrap wrap, int format) { struct line_info *line = NULL; int line_number = 0; int begin = 0; int pos = 0; - unsigned char *text_end; + char *text_end; int skip; - unsigned char *wrappos=NULL; + char *wrappos=NULL; int chars_cells=0; /* Number of console chars on line */ assert(text); @@ -149,7 +149,7 @@ format_textutf8(unsigned char *text, int width, enum form_wrap wrap, int format) * suitable for encoding it for form posting */ static struct line_info * -format_text(unsigned char *text, int width, enum form_wrap wrap, int format) +format_text(char *text, int width, enum form_wrap wrap, int format) { struct line_info *line = NULL; int line_number = 0; @@ -173,7 +173,7 @@ format_text(unsigned char *text, int width, enum form_wrap wrap, int format) continue; } else { - unsigned char *wrappos; + char *wrappos; /* Find a place to wrap the text */ wrappos = memrchr(&text[begin], ' ', pos - begin); @@ -354,7 +354,7 @@ draw_textarea_utf8(struct terminal *term, struct form_state *fs, for (; line->start != -1 && y < ye; line++, y++) { int i; - unsigned char *text, *end; + char *text, *end; text = fs->value + line->start; end = fs->value + line->end; @@ -484,7 +484,7 @@ draw_textarea(struct terminal *term, struct form_state *fs, } -unsigned char * +char * encode_textarea(struct submitted_value *sv) { struct el_form_control *fc; @@ -518,10 +518,10 @@ encode_textarea(struct submitted_value *sv) * of 'delete' etc) and I'm not going to do that now. Inter-links communication * *NEEDS* rewrite, as it looks just like quick messy hack now. --pasky */ -static unsigned char * -save_textarea_file(unsigned char *value) +static char * +save_textarea_file(char *value) { - unsigned char *filename; + char *filename; FILE *fp = NULL; int fd; size_t nmemb, len; @@ -567,7 +567,7 @@ struct textarea_data { struct terminal *term; struct document_view *doc_view; struct link *link; - unsigned char *fn; + char *fn; }; static struct textarea_data * @@ -633,8 +633,8 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_, } if (op == 0) { - unsigned char *ed; - unsigned char *ex; + char *ed; + char *ex; assert(fs_ && doc_view_ && link_ && term_); @@ -649,7 +649,7 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_, if (!ed || !*ed) ed = "vi"; } - ex = straconcat(ed, " ", td->fn, (unsigned char *) NULL); + ex = straconcat(ed, " ", td->fn, (char *) NULL); if (!ex) { unlink(td->fn); done_textarea_data(td); @@ -803,8 +803,8 @@ textarea_op(struct form_state *fs, struct el_form_control *fc, void new_pos(struct form_state *fs, struct line_info *line, int current, int max_cells) { - unsigned char *text = fs->value + line[current].start; - unsigned char *end = fs->value + line[current].end; + char *text = fs->value + line[current].start; + char *end = fs->value + line[current].end; int cells = 0; while(cells < max_cells) { @@ -866,7 +866,7 @@ do_op_up(struct form_state *fs, struct line_info *line, int current, int utf8) if (old_state != fs->state ) { if (fs->state_cell && fs->state == line[current - 1].start) { - unsigned char *new_value; + char *new_value; new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value); fs->state_cell = new_value - fs->value; @@ -921,7 +921,7 @@ do_op_down(struct form_state *fs, struct line_info *line, int current, int utf8) } if (old_state != fs->state ) { if (fs->state_cell && fs->state == line[current+1].start) { - unsigned char *new_value; + char *new_value; new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value); fs->state_cell = new_value - fs->value; @@ -965,7 +965,7 @@ do_op_end(struct form_state *fs, struct line_info *line, int current, int utf8) current -= !!fs->state_cell; fs->state = line[current].end; if (line[current].split_next) { - unsigned char *new_value; + char *new_value; new_value = utf8_prevchar(fs->value + fs->state, 1, fs->value); fs->state_cell = new_value - fs->value; @@ -1143,7 +1143,7 @@ do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8) { int old_state; int new_state; - unsigned char *new_value; + char *new_value; if (!utf8) { fs->state = int_max(fs->state - 1, 0); @@ -1172,7 +1172,7 @@ do_op_left(struct form_state *fs, struct line_info *line, int current, int utf8) static int do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8) { - unsigned char *text, *end; + char *text, *end; int old_state; if (!utf8) { diff --git a/src/viewer/text/textarea.h b/src/viewer/text/textarea.h index c70faf11..ada53813 100644 --- a/src/viewer/text/textarea.h +++ b/src/viewer/text/textarea.h @@ -23,7 +23,7 @@ int area_cursor(struct el_form_control *fc, struct form_state *fs, int utf8); int area_cursor(struct el_form_control *fc, struct form_state *fs); #endif /* CONFIG_UTF8 */ void draw_textarea(struct terminal *term, struct form_state *fs, struct document_view *doc_view, struct link *link); -unsigned char *encode_textarea(struct submitted_value *sv); +char *encode_textarea(struct submitted_value *sv); void free_textarea_data(struct terminal *term); void textarea_edit(int, struct terminal *, struct form_state *, struct document_view *, struct link *); diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index cda02fbf..6ff5ab24 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -1110,7 +1110,7 @@ copy_current_link_to_clipboard(struct session *ses, { struct link *link; struct uri *uri; - unsigned char *uristring; + char *uristring; link = get_current_link(doc_view); if (!link) return FRAME_EVENT_OK; @@ -1205,7 +1205,7 @@ open_link_dialog(struct session *ses) input_dialog(ses->tab->term, NULL, N_("Go to link"), N_("Enter link number"), ses, NULL, MAX_STR_LEN, "", 0, 0, NULL, - (void (*)(void *, unsigned char *)) goto_link_symbol, NULL); + (void (*)(void *, char *)) goto_link_symbol, NULL); } static enum frame_event_status @@ -1246,7 +1246,7 @@ try_prefix_key(struct session *ses, struct document_view *doc_view, if (digit >= 1 && get_kbd_modifier(ev) == KBD_MOD_NONE) { int nlinks = document->nlinks, length; - unsigned char d[2] = { get_kbd_key(ev), 0 }; + char d[2] = { get_kbd_key(ev), 0 }; set_kbd_repeat_count(ses, 0); @@ -1259,7 +1259,7 @@ try_prefix_key(struct session *ses, struct document_view *doc_view, N_("Go to link"), N_("Enter link number"), ses, NULL, length, d, 1, document->nlinks, check_number, - (void (*)(void *, unsigned char *)) goto_link_number, NULL); + (void (*)(void *, char *)) goto_link_number, NULL); return FRAME_EVENT_OK; } @@ -1757,7 +1757,7 @@ download_link(struct session *ses, struct document_view *doc_view, action_id_T action_id) { struct link *link = get_current_link(doc_view); - void (*download)(void *ses, unsigned char *file) = start_download; + void (*download)(void *ses, char *file) = start_download; if (!link) return FRAME_EVENT_OK; @@ -1842,7 +1842,7 @@ save_formatted_finish(struct terminal *term, int h, } static void -save_formatted(void *data, unsigned char *file) +save_formatted(void *data, char *file) { struct session *ses = data; struct document_view *doc_view;