1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-12 23:10:51 +00:00

[cflags] Removed -Wno-pointer-sign

Likely some new bugs were introduced by this change.
The long term goal is clean compilation by g++.
This commit is contained in:
Witold Filipczyk 2021-01-02 16:20:27 +01:00
parent d05f781792
commit 0fea79cc8f
408 changed files with 4300 additions and 4472 deletions

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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 \

View File

@ -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)

View File

@ -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 *);

View File

@ -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;

View File

@ -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;

View File

@ -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 *);

View File

@ -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;

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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,