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