1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-30 01:55:30 +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" CFLAGS="$CFLAGS -fno-strict-aliasing"
;; ;;
4.5*) 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.*) 4.*|5.*|6.*|7.*|8|8.*|9|9.*)
# Do not show warnings related to (char * | unsigned char *) type # Do not show warnings related to (char * | unsigned char *) type
# difference. # difference.
CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign" CFLAGS="$CFLAGS -fno-strict-aliasing"
;; ;;
10|10.*) 10|10.*)
# gettext # 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 # These should be ok using -Werror

View File

@ -36,13 +36,13 @@
#ifdef DEBUG_BUTTON_HOTKEY #ifdef DEBUG_BUTTON_HOTKEY
void void
add_dlg_button_do(const unsigned char *file, int line, add_dlg_button_do(const char *file, int line,
struct dialog *dlg, unsigned char *text, int flags, struct dialog *dlg, char *text, int flags,
widget_handler_T *handler, void *data, widget_handler_T *handler, void *data,
done_handler_T *done, void *done_data) done_handler_T *done, void *done_data)
#else #else
void 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, widget_handler_T *handler, void *data,
done_handler_T *done, void *done_data) done_handler_T *done, void *done_data)
#endif #endif
@ -63,7 +63,7 @@ add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags,
widget->info.button.truetextlen = textlen; widget->info.button.truetextlen = textlen;
if (textlen > 1) { if (textlen > 1) {
unsigned char *pos = memchr(text, '~', textlen - 1); char *pos = memchr(text, '~', textlen - 1);
if (pos) { if (pos) {
widget->info.button.hotkey_pos = pos - text; 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); draw_dlg_text(dlg_data, pos->x, pos->y, BUTTON_LEFT, BUTTON_LEFT_LEN, 0, color);
if (len > 0) { 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 hk_pos = widget_data->widget->info.button.hotkey_pos;
int attr; int attr;

View File

@ -36,7 +36,7 @@ struct widget_info_button {
/** @def add_dlg_ok_button /** @def add_dlg_ok_button
* Add a button that will close the dialog if pressed. * 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); * ::done_handler_T *done, void *data);
* *
* @param dlg * @param dlg
@ -61,7 +61,7 @@ struct widget_info_button {
/** @def add_dlg_button /** @def add_dlg_button
* Add a button that need not close the dialog if pressed. * 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); * ::widget_handler_T *handler, void *data);
* *
* @param handler * @param handler
@ -76,7 +76,7 @@ struct widget_info_button {
* The other parameters are as in ::add_dlg_ok_button. */ * The other parameters are as in ::add_dlg_ok_button. */
#ifdef DEBUG_BUTTON_HOTKEY #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) \ #define add_dlg_ok_button(dlg, text, flags, done, data) \
add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, 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) add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, handler, data, NULL, NULL)
#else #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) \ #define add_dlg_ok_button(dlg, text, flags, done, data) \
add_dlg_button_do(dlg, text, flags, ok_dialog, NULL, 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] " */ #define CHECKBOX_LS (CHECKBOX_LEN + CHECKBOX_SPACING) /* "[X] " */
void 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) int groupid, int groupnum, int *data)
{ {
struct widget *widget = &dlg->widgets[dlg->number_of_widgets++]; 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) enum format_align align, int format_only)
{ {
struct terminal *term = dlg_data->win->term; 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); 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 terminal *term = dlg_data->win->term;
struct color_pair *color; struct color_pair *color;
unsigned char *text; char *text;
struct el_box *pos = &widget_data->box; struct el_box *pos = &widget_data->box;
int selected = is_selected_widget(dlg_data, widget_data); 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) \ #define add_dlg_radio(dlg, text, groupid, groupnum, data) \
add_dlg_radio_do(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"); title_color = get_bfu_color(term, "dialog.title");
if (title_color && dlg_data->real_box.width > 2) { 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 titlelen = strlen(title);
int titlecells = titlelen; int titlecells = titlelen;
int x, y; int x, y;
@ -333,7 +333,7 @@ select_button_by_key(struct dialog_data *dlg_data)
foreach_widget(dlg_data, widget_data) { foreach_widget(dlg_data, widget_data) {
int hk_pos; int hk_pos;
unsigned char *hk_ptr; char *hk_ptr;
term_event_char_T hk_char; term_event_char_T hk_char;
if (widget_data->widget->type != WIDGET_BUTTON) if (widget_data->widget->type != WIDGET_BUTTON)

View File

@ -49,7 +49,7 @@ struct dialog_refresh {
}; };
struct dialog { struct dialog {
unsigned char *title; char *title;
void *udata; void *udata;
void *udata2; void *udata2;
struct dialog_refresh *refresh; struct dialog_refresh *refresh;
@ -123,7 +123,7 @@ struct dialog {
* @return * @return
* The address of the additional data. */ * The address of the additional data. */
#define get_dialog_offset(dlg, n) \ #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) \ #define dialog_has_refresh(dlg_data) \
((dlg_data)->dlg->refresh && (dlg_data)->dlg->refresh->timer != TIMER_ID_UNDEF) ((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--) { while (n--) {
int widget_width; int widget_width;
int width; int width;
unsigned char *text = widget_data->widget->text; char *text = widget_data->widget->text;
int label_length; int label_length;
int label_padding; 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 listbox_item *item = box->sel;
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
struct listbox_context *context; struct listbox_context *context;
unsigned char *msg; char *msg;
if (!item) return EVENT_PROCESSED; 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) const struct listbox_ops *ops, enum delete_error err)
{ {
struct string msg; struct string msg;
unsigned char *errmsg; char *errmsg;
unsigned char *text; char *text;
switch (err) { switch (err) {
case DELETE_IMPOSSIBLE: case DELETE_IMPOSSIBLE:
@ -631,7 +631,7 @@ print_delete_error(struct listbox_item *item, struct terminal *term,
mem_free(text); mem_free(text);
if (item->type == BI_LEAF) { if (item->type == BI_LEAF) {
unsigned char *info = ops->get_info(item, term); char *info = ops->get_info(item, term);
if (info) { if (info) {
add_format_to_string(&msg, "\n\n%s", 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; struct listbox_data *box = oldcontext->box;
const struct listbox_ops *ops = box->ops; const struct listbox_ops *ops = box->ops;
struct listbox_item *item = box->sel; struct listbox_item *item = box->sel;
unsigned char *text; char *text;
enum delete_error delete_; enum delete_error delete_;
assert(item); 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_("~Yes"), push_ok_delete_button, B_ENTER),
MSG_BOX_BUTTON(N_("~No"), done_listbox_context, B_ESC)); MSG_BOX_BUTTON(N_("~No"), done_listbox_context, B_ESC));
} else { } else {
unsigned char *msg = ops->get_info(item, term); char *msg = ops->get_info(item, term);
ops->lock(item); ops->lock(item);
@ -888,7 +888,7 @@ static int
scan_for_matches(struct listbox_item *item, void *info_, int *offset) scan_for_matches(struct listbox_item *item, void *info_, int *offset)
{ {
struct listbox_context *context = info_; struct listbox_context *context = info_;
unsigned char *text = (unsigned char *) context->widget_data; char *text = (char *) context->widget_data;
if (!*text) { if (!*text) {
item->visible = 1; item->visible = 1;
@ -922,7 +922,7 @@ mark_visible(struct listbox_item *item, void *xxx, int *offset)
static void static void
search_hierbox_browser(void *data, unsigned char *text) search_hierbox_browser(void *data, char *text)
{ {
struct dialog_data *dlg_data = data; struct dialog_data *dlg_data = data;
struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct listbox_data *box = get_dlg_listbox_data(dlg_data);

View File

@ -15,7 +15,7 @@ struct session;
struct hierbox_browser_button { struct hierbox_browser_button {
/** The button label text /** The button label text
* It is automatically localized. */ * It is automatically localized. */
unsigned char *label; char *label;
/** The button handler /** The button handler
* The handler gets called when the button is activated */ * The handler gets called when the button is activated */
@ -39,7 +39,7 @@ struct hierbox_browser_button {
struct hierbox_browser { struct hierbox_browser {
/** The title of the browser /** The title of the browser
* Note, it is automatically localized. */ * Note, it is automatically localized. */
unsigned char *title; char *title;
/** Callback for (un)expansion of the listboxes /** Callback for (un)expansion of the listboxes
* Can be used by subsystems to install a handler to be called * 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, /* Return position (starting at 1) of the first tilde in text,
* or 0 if not found. */ * or 0 if not found. */
static inline int static inline int
find_hotkey_pos(unsigned char *text) find_hotkey_pos(char *text)
{ {
if (text && *text) { if (text && *text) {
unsigned char *p = strchr((const char *)text, '~'); char *p = strchr((const char *)text, '~');
if (p) return (int) (p - text) + 1; 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)); memset(used_hotkeys, 0, sizeof(used_hotkeys));
foreach_menu_item(mi, menu->items) { foreach_menu_item(mi, menu->items) {
unsigned char *text = mi->text; char *text = mi->text;
if (!mi_has_left_text(mi)) continue; if (!mi_has_left_text(mi)) continue;
if (mi_text_translate(mi)) text = _(text, term); 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; mi->hotkey_state = HKS_IGNORE;
} else if (mi->hotkey_state != HKS_CACHED } else if (mi->hotkey_state != HKS_CACHED
&& !mi->hotkey_pos) { && !mi->hotkey_pos) {
unsigned char *text = mi->text; char *text = mi->text;
if (!mi_has_left_text(mi)) continue; if (!mi_has_left_text(mi)) continue;
if (mi_text_translate(mi)) text = _(text, term); 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; start = i;
do { do {
struct menu_item *item; struct menu_item *item;
unsigned char *text; char *text;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
unicode_val_T items_hotkey; unicode_val_T items_hotkey;
#endif #endif

View File

@ -12,7 +12,7 @@ extern "C" {
struct menu; struct menu;
struct terminal; struct terminal;
/* int find_hotkey_pos(unsigned char *text); */ /* int find_hotkey_pos(char *text); */
void init_hotkeys(struct terminal *term, struct menu *menu); void init_hotkeys(struct terminal *term, struct menu *menu);
#ifdef CONFIG_NLS #ifdef CONFIG_NLS
void clear_hotkeys_cache(struct menu *menu); void clear_hotkeys_cache(struct menu *menu);

View File

@ -38,7 +38,7 @@
#define INPUTFIELD_FLOAT_SEPARATOR_LEN 1 #define INPUTFIELD_FLOAT_SEPARATOR_LEN 1
void 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 min, int max, widget_handler_T *handler,
int datalen, void *data, int datalen, void *data,
struct input_history *history, enum inpfield_flags flags) 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 widget_handler_status_T
check_nonempty(struct dialog_data *dlg_data, struct widget_data *widget_data) check_nonempty(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
unsigned char *p; char *p;
for (p = widget_data->cdata; *p; p++) for (p = widget_data->cdata; *p; p++)
if (*p > ' ') if (*p > ' ')
@ -110,7 +110,7 @@ dlg_format_field(struct dialog_data *dlg_data,
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
static int max_label_width; static int max_label_width;
static int *prev_y; /* Assert the uniqueness of y */ /* TODO: get rid of this !! --Zas */ 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; struct color_pair *text_color = NULL;
int label_width = 0; int label_width = 0;
int float_label = widget_data->widget->info.field.flags & (INPFIELD_FLOAT|INPFIELD_FLOAT2); 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 static widget_handler_status_T
input_field_ok(struct dialog_data *dlg_data, struct widget_data *widget_data) 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; 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; 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 void
input_field(struct terminal *term, struct memory_list *ml, int intl, input_field(struct terminal *term, struct memory_list *ml, int intl,
unsigned char *title, char *title,
unsigned char *text, char *text,
unsigned char *okbutton, char *okbutton,
unsigned char *cancelbutton, char *cancelbutton,
void *data, struct input_history *history, int l, 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, widget_handler_T *check,
void (*fn)(void *, unsigned char *), void (*fn)(void *, char *),
void (*cancelfn)(void *)) void (*cancelfn)(void *))
{ {
struct dialog *dlg; struct dialog *dlg;
unsigned char *field; char *field;
if (intl) { if (intl) {
title = _(title, term); title = _(title, term);
@ -245,12 +245,12 @@ input_field(struct terminal *term, struct memory_list *ml, int intl,
void void
input_dialog(struct terminal *term, struct memory_list *ml, input_dialog(struct terminal *term, struct memory_list *ml,
unsigned char *title, char *title,
unsigned char *text, char *text,
void *data, struct input_history *history, int l, 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, widget_handler_T *check,
void (*fn)(void *, unsigned char *), void (*fn)(void *, char *),
void (*cancelfn)(void *)) void (*cancelfn)(void *))
{ {
/* [gettext_accelerator_context(input_dialog)] */ /* [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 #ifdef CONFIG_UTF8
if (term->utf8_cp) { if (term->utf8_cp) {
unsigned char *t = widget_data->cdata; char *t = widget_data->cdata;
int p = widget_data->info.field.cpos; int p = widget_data->info.field.cpos;
len = utf8_ptr2cells(t, &t[p]); 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"); color = get_bfu_color(term, "dialog.field-text");
if (color) { 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; int len, w;
#ifdef CONFIG_UTF8 #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)) { if (widget_data->info.field.cpos < strlen(widget_data->cdata)) {
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
if (term->utf8_cp) { if (term->utf8_cp) {
unsigned char *next = widget_data->cdata + widget_data->info.field.cpos; char *next = widget_data->cdata + widget_data->info.field.cpos;
unsigned char *end = strchr((const char *)next, '\0'); char *end = strchr((const char *)next, '\0');
utf8_to_unicode(&next, end); utf8_to_unicode(&next, end);
widget_data->info.field.cpos = (int)(next - widget_data->cdata); 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--; widget_data->info.field.cpos--;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
if (widget_data->info.field.cpos && term->utf8_cp) { if (widget_data->info.field.cpos && term->utf8_cp) {
unsigned char *t = widget_data->cdata; char *t = widget_data->cdata;
unsigned char *t2 = t; char *t2 = t;
int p = widget_data->info.field.cpos; int p = widget_data->info.field.cpos;
unsigned char tmp = t[p]; 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 /* FIXME: This isn't nice. We remove last byte
* from UTF-8 character to detect * from UTF-8 character to detect
* character before it. */ * character before it. */
unsigned char *text = widget_data->cdata; char *text = widget_data->cdata;
unsigned char *end = widget_data->cdata + widget_data->info.field.cpos - 1; char *end = widget_data->cdata + widget_data->info.field.cpos - 1;
unicode_val_T data; unicode_val_T data;
int old = widget_data->info.field.cpos; 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 #ifdef CONFIG_UTF8
if (term->utf8_cp) { if (term->utf8_cp) {
unsigned char *end = widget_data->cdata + cdata_len; char *end = widget_data->cdata + cdata_len;
unsigned char *text = widget_data->cdata + widget_data->info.field.cpos; char *text = widget_data->cdata + widget_data->info.field.cpos;
unsigned char *old = text; char *old = text;
utf8_to_unicode(&text, end); utf8_to_unicode(&text, end);
if (old != text) { if (old != text) {
@ -642,7 +642,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
case ACT_EDIT_PASTE_CLIPBOARD: case ACT_EDIT_PASTE_CLIPBOARD:
{ {
/* Paste from clipboard */ /* Paste from clipboard */
unsigned char *clipboard = get_clipboard_text(); char *clipboard = get_clipboard_text();
if (!clipboard) goto display_field; if (!clipboard) goto display_field;
@ -679,14 +679,14 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
default: default:
if (check_kbd_textinput_key(ev)) { if (check_kbd_textinput_key(ev)) {
unsigned char *text = widget_data->cdata; char *text = widget_data->cdata;
int textlen = strlen(text); int textlen = strlen(text);
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
/* Both get_kbd_key(ev) and @text /* Both get_kbd_key(ev) and @text
* are in the terminal's charset. */ * are in the terminal's charset. */
const int inslen = 1; const int inslen = 1;
#else /* CONFIG_UTF8 */ #else /* CONFIG_UTF8 */
const unsigned char *ins; const char *ins;
int inslen; int inslen;
/* get_kbd_key(ev) is UCS-4, and @text /* get_kbd_key(ev) is UCS-4, and @text
@ -874,11 +874,11 @@ cancel_input_line:
} }
void 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 input_history *history, input_line_handler_T handler)
{ {
struct dialog *dlg; struct dialog *dlg;
unsigned char *buffer; char *buffer;
struct input_line *input_line; struct input_line *input_line;
assert(ses); assert(ses);

View File

@ -38,7 +38,7 @@ struct widget_data_info_field {
}; };
void 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 min, int max, widget_handler_T *handler,
int data_len, void *data, int data_len, void *data,
struct input_history *history, enum inpfield_flags flags); 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 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 *, void input_field(struct terminal *, struct memory_list *, int, char *,
unsigned char *, unsigned char *, unsigned char *, void *, char *, char *, char *, void *,
struct input_history *, int, unsigned char *, int, int, struct input_history *, int, char *, int, int,
widget_handler_T *check, widget_handler_T *check,
void (*)(void *, unsigned char *), void (*)(void *, char *),
void (*)(void *)); void (*)(void *));
void void
input_dialog(struct terminal *term, struct memory_list *ml, input_dialog(struct terminal *term, struct memory_list *ml,
unsigned char *title, char *title,
unsigned char *text, char *text,
void *data, struct input_history *history, int l, 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, widget_handler_T *check,
void (*fn)(void *, unsigned char *), void (*fn)(void *, char *),
void (*cancelfn)(void *)); void (*cancelfn)(void *));
@ -105,11 +105,11 @@ struct input_line {
struct session *ses; struct session *ses;
input_line_handler_T handler; input_line_handler_T handler;
void *data; void *data;
unsigned char buffer[INPUT_LINE_BUFFER_SIZE]; char buffer[INPUT_LINE_BUFFER_SIZE];
}; };
void 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 input_history *history, input_line_handler_T handler);
#define widget_has_history(widget_data) ((widget_data)->widget->type == WIDGET_FIELD \ #define widget_has_history(widget_data) ((widget_data)->widget->type == WIDGET_FIELD \

View File

@ -24,7 +24,7 @@
static void 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); 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 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)); tab_compl_n(dlg_data, item, strlen(item));
} }
@ -49,7 +49,7 @@ tab_compl(struct dialog_data *dlg_data, unsigned char *item)
static void static void
menu_tab_compl(struct terminal *term, void *item_, void *dlg_data_) 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_; struct dialog_data *dlg_data = dlg_data_;
tab_compl_n(dlg_data, item, strlen(item)); 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 /* Return the length of the common substring from the starts
* of the two strings a and b. */ * of the two strings a and b. */
static inline int 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) while (*a && *a == *b)
++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 /* Maximum number of characters in a match. Characters after this
* position are varying in other matches. */ * position are varying in other matches. */
int longest_common_match = 0; int longest_common_match = 0;
unsigned char *match = NULL; char *match = NULL;
struct input_history_entry *entry; struct input_history_entry *entry;
foreach (entry, *history) { foreach (entry, *history) {
unsigned char *cur = entry->data; char *cur = entry->data;
int cur_len = strcommonlen(cur, match ? match int cur_len = strcommonlen(cur, match ? match
: widget_data->cdata); : 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 dialog_data *dlg_data = dlg_data_;
struct widget_data *widget_data = selected_widget(dlg_data); struct widget_data *widget_data = selected_widget(dlg_data);
unsigned char *filename = filename_; char *filename = filename_;
int filenamelen; int filenamelen;
assert(widget_is_textfield(widget_data)); assert(widget_is_textfield(widget_data));
@ -182,7 +182,7 @@ static void
tab_complete_file_menu(struct terminal *term, void *path_, void *dlg_data_) tab_complete_file_menu(struct terminal *term, void *path_, void *dlg_data_)
{ {
struct dialog_data *dlg_data = dlg_data_; struct dialog_data *dlg_data = dlg_data_;
unsigned char *path = path_; char *path = path_;
auto_complete_file(term, 0 /* no_elevator */, path, auto_complete_file(term, 0 /* no_elevator */, path,
set_complete_file_menu, tab_complete_file_menu, 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 /* Search for duplicate entries in history list, save first one and remove
* older ones. */ * older ones. */
static struct input_history_entry * 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; 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 /* Add a new entry in inputbox history list, take care of duplicate if
* check_duplicate and respect history size limit. */ * check_duplicate and respect history size limit. */
void 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) int check_duplicate)
{ {
struct input_history_entry *entry; struct input_history_entry *entry;
@ -284,16 +284,16 @@ add_to_input_history(struct input_history *history, unsigned char *data,
/* Load history file */ /* Load history file */
int 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; char *history_file = filename;
unsigned char line[MAX_STR_LEN]; char line[MAX_STR_LEN];
FILE *file; FILE *file;
if (get_cmd_opt_bool("anonymous")) return 0; if (get_cmd_opt_bool("anonymous")) return 0;
if (elinks_home) { if (elinks_home) {
history_file = straconcat(elinks_home, filename, history_file = straconcat(elinks_home, filename,
(unsigned char *) NULL); (char *) NULL);
if (!history_file) return 0; 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 /* Write history list to file. It returns a value different from 0 in case of
* failure, 0 on success. */ * failure, 0 on success. */
int 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 input_history_entry *entry;
struct secure_save_info *ssi; struct secure_save_info *ssi;
unsigned char *history_file; char *history_file;
int i = 0; int i = 0;
if (!history->dirty if (!history->dirty
@ -332,7 +332,7 @@ save_input_history(struct input_history *history, unsigned char *filename)
return 0; return 0;
history_file = straconcat(elinks_home, filename, history_file = straconcat(elinks_home, filename,
(unsigned char *) NULL); (char *) NULL);
if (!history_file) return -1; if (!history_file) return -1;
ssi = secure_open(history_file); ssi = secure_open(history_file);
@ -358,7 +358,7 @@ dlg_set_history(struct widget_data *widget_data)
assert(widget_data->widget->datalen > 0); assert(widget_data->widget->datalen > 0);
if ((void *) widget_data->info.field.cur_hist != &widget_data->info.field.history) { 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); widget_data->info.field.cpos = int_min(strlen(s), widget_data->widget->datalen - 1);
if (widget_data->info.field.cpos) if (widget_data->info.field.cpos)

View File

@ -12,7 +12,7 @@ struct dialog_data;
struct input_history_entry { struct input_history_entry {
LIST_HEAD(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 { struct input_history {
@ -44,7 +44,7 @@ struct input_history {
if (!(history)->nosave) (history)->dirty = 1; \ if (!(history)->nosave) (history)->dirty = 1; \
} while (0) } 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 *, void do_tab_compl(struct dialog_data *,
LIST_OF(struct input_history_entry) *); LIST_OF(struct input_history_entry) *);
@ -54,11 +54,11 @@ void do_tab_compl_unambiguous(struct dialog_data *,
LIST_OF(struct input_history_entry) *); LIST_OF(struct input_history_entry) *);
/* Load history file from elinks home. */ /* 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 /* Write history list to @filebane in elinks home. It returns a value different
* from 0 in case of failure, 0 on success. */ * 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 *); void dlg_set_history(struct widget_data *);

View File

@ -165,7 +165,7 @@ init_led_panel(struct led_panel *leds)
static int static int
draw_timer(struct terminal *term, int xpos, int ypos, struct color_pair *color) draw_timer(struct terminal *term, int xpos, int ypos, struct color_pair *color)
{ {
unsigned char s[64]; char s[64];
int i, length; int i, length;
snprintf(s, sizeof(s), "[%d]", get_timer_duration()); 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) { if (ses->doc_view && ses->doc_view->document && ses->doc_view->document->ip) {
struct terminal *term = ses->tab->term; 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 length = strlen(s);
int i; int i;
@ -200,7 +200,7 @@ draw_show_ip(struct session *ses, int xpos, int ypos, struct color_pair *color)
static int static int
draw_clock(struct terminal *term, int xpos, int ypos, struct color_pair *color) 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); time_t curtime = time(NULL);
struct tm *loctime = localtime(&curtime); struct tm *loctime = localtime(&curtime);
int i, length; 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); data->box->ops->draw(item, data, x, y, width);
} else { } else {
unsigned char *text; char *text;
const struct listbox_ops *ops = data->box->ops; const struct listbox_ops *ops = data->box->ops;
int len_bytes; int len_bytes;

View File

@ -49,18 +49,18 @@ struct listbox_context {
}; };
struct listbox_ops_messages { struct listbox_ops_messages {
unsigned char *cant_delete_item; /* %s = text of item */ char *cant_delete_item; /* %s = text of item */
unsigned char *cant_delete_used_item; /* %s = text of item */ char *cant_delete_used_item; /* %s = text of item */
unsigned char *cant_delete_folder; /* %s = text of item */ char *cant_delete_folder; /* %s = text of item */
unsigned char *cant_delete_used_folder; /* %s = text of item */ char *cant_delete_used_folder; /* %s = text of item */
unsigned char *delete_marked_items_title; /* not a format string */ char *delete_marked_items_title; /* not a format string */
unsigned char *delete_marked_items; /* not a format string */ char *delete_marked_items; /* not a format string */
unsigned char *delete_folder_title; /* not a format string */ char *delete_folder_title; /* not a format string */
unsigned char *delete_folder; /* %s = text of item */ char *delete_folder; /* %s = text of item */
unsigned char *delete_item_title; /* not a format string */ char *delete_item_title; /* not a format string */
unsigned char *delete_item; /* %s = text of item */ char *delete_item; /* %s = text of item */
unsigned char *clear_all_items_title; /* not a format string */ char *clear_all_items_title; /* not a format string */
unsigned char *clear_all_items; /* 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 /* 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 *); void (*unlock)(struct listbox_item *);
int (*is_used)(struct listbox_item *); int (*is_used)(struct listbox_item *);
unsigned char *(*get_text)(struct listbox_item *, struct terminal *); char *(*get_text)(struct listbox_item *, struct terminal *);
unsigned char *(*get_info)(struct listbox_item *, struct terminal *); char *(*get_info)(struct listbox_item *, struct terminal *);
struct uri *(*get_uri)(struct listbox_item *); struct uri *(*get_uri)(struct listbox_item *);
@ -81,7 +81,7 @@ struct listbox_ops {
/* Do a search on the item. */ /* Do a search on the item. */
enum listbox_match (*match)(struct listbox_item *, struct terminal *, enum listbox_match (*match)(struct listbox_item *, struct terminal *,
unsigned char *text); char *text);
/* Before calling delete() thou shall call can_delete(). */ /* Before calling delete() thou shall call can_delete(). */
int (*can_delete)(struct listbox_item *); int (*can_delete)(struct listbox_item *);

View File

@ -57,7 +57,7 @@ do_select_submenu(struct terminal *term, void *menu_, void *ses_)
} }
void 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 */ /* name == NULL - up; data == -1 - down */
{ {
struct menu_item *new_menu_item = NULL; /* no uninitialized warnings */ struct menu_item *new_menu_item = NULL; /* no uninitialized warnings */
@ -169,15 +169,15 @@ destroy_menu(struct list_menu *menu)
} }
void 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; struct menu_item *item;
unsigned char *bs; char *bs;
foreach_menu_item (item, items) { foreach_menu_item (item, items) {
bs = (item->flags & MENU_FULLNAME) ? (unsigned char *) "" bs = (item->flags & MENU_FULLNAME) ? (char *) ""
: base; : base;
bs = straconcat(bs, item->text, (unsigned char *) NULL); bs = straconcat(bs, item->text, (char *) NULL);
if (!bs) continue; if (!bs) continue;
if (item->func == do_select_submenu) { if (item->func == do_select_submenu) {
@ -193,7 +193,7 @@ menu_labels(struct menu_item *items, unsigned char *base, unsigned char **lbls)
void void
add_select_item(struct list_menu *menu, struct string *string, 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 order, int dont_add)
{ {
int pos = order - 1; int pos = order - 1;

View File

@ -17,10 +17,10 @@ struct list_menu {
void init_menu(struct list_menu *menu); void init_menu(struct list_menu *menu);
void destroy_menu(struct list_menu *menu); void destroy_menu(struct list_menu *menu);
void add_select_item(struct list_menu *menu, struct string *string, struct string *orig_string, unsigned char **value, int order, int dont_add); void add_select_item(struct list_menu *menu, struct string *string, struct string *orig_string, char **value, int order, int dont_add);
void new_menu_item(struct list_menu *menu, unsigned char *name, int data, int fullname); void new_menu_item(struct list_menu *menu, char *name, int data, int fullname);
struct menu_item *detach_menu(struct list_menu *menu); 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 do_select_submenu(struct terminal *term, void *menu_, void *ses_);
void free_menu(struct menu_item *m); void free_menu(struct menu_item *m);

View File

@ -54,7 +54,7 @@
/* Types and structures */ /* Types and structures */
/* Submenu indicator, displayed at right. */ /* Submenu indicator, displayed at right. */
static unsigned char m_submenu[] = ">>"; static char m_submenu[] = ">>";
static int m_submenu_len = sizeof(m_submenu) - 1; static int m_submenu_len = sizeof(m_submenu) - 1;
/* Prototypes */ /* Prototypes */
@ -190,7 +190,7 @@ select_menu(struct terminal *term, struct menu *menu)
static int static int
get_menuitem_text_width(struct terminal *term, struct menu_item *mi) get_menuitem_text_width(struct terminal *term, struct menu_item *mi)
{ {
unsigned char *text; char *text;
if (!mi_has_left_text(mi)) return 0; 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)) { } else if (mi_has_right_text(mi)) {
unsigned char *rtext = mi->rtext; char *rtext = mi->rtext;
if (mi_rtext_translate(mi)) if (mi_rtext_translate(mi))
rtext = _(rtext, term); rtext = _(rtext, term);
@ -371,7 +371,7 @@ set_menu_selection(struct menu *menu, int pos)
* separators). For double-width glyph width == 2. * separators). For double-width glyph width == 2.
* len - length of text in bytes */ * len - length of text in bytes */
static inline void 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 x, int y, int width, struct color_pair *color)
{ {
int w = width - (L_TEXT_SPACE + R_TEXT_SPACE); 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 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, int hotkey_pos, int x, int y, int width,
struct color_pair *color, int selected) 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 w = width - (L_TEXT_SPACE + R_TEXT_SPACE);
int hk_state = 0; int hk_state = 0;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
unsigned char *text2, *end; char *text2, *end;
#endif #endif
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
@ -521,7 +521,7 @@ utf8:
} }
static inline void 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 x, int y, int width, struct color_pair *color)
{ {
int w = width - (L_RTEXT_SPACE + R_RTEXT_SPACE); 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)) { if (mi_has_left_text(mi)) {
int l = mi->hotkey_pos; int l = mi->hotkey_pos;
unsigned char *text = mi->text; char *text = mi->text;
if (mi_text_translate(mi)) if (mi_text_translate(mi))
text = _(text, term); text = _(text, term);
@ -658,7 +658,7 @@ display_menu(struct terminal *term, struct menu *menu)
} }
} else if (mi_has_right_text(mi)) { } else if (mi_has_right_text(mi)) {
unsigned char *rtext = mi->rtext; char *rtext = mi->rtext;
if (mi_rtext_translate(mi)) if (mi_rtext_translate(mi))
rtext = _(rtext, term); rtext = _(rtext, term);
@ -781,10 +781,10 @@ menu_page_down(struct menu *menu)
#undef DIST #undef DIST
static inline int 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) struct terminal *term)
{ {
unsigned char *text, *match; char *text, *match;
/* set_menu_selection asserts selectability. */ /* set_menu_selection asserts selectability. */
if (!mi_has_left_text(item) || !mi_is_selectable(item)) return 0; 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 menu *menu = line->data;
struct terminal *term = menu->win->term; struct terminal *term = menu->win->term;
unsigned char *buffer = line->buffer; char *buffer = line->buffer;
struct window *win; struct window *win;
int pos = menu->selected; int pos = menu->selected;
int start; int start;
@ -871,7 +871,7 @@ search_menu(struct menu *menu)
struct terminal *term = menu->win->term; struct terminal *term = menu->win->term;
struct window *current_tab = get_current_tab(term); struct window *current_tab = get_current_tab(term);
struct session *ses = current_tab ? current_tab->data : NULL; 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; 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++) { for (i = menu->first; i < menu->size; i++) {
struct menu_item *mi = &menu->items[i]; struct menu_item *mi = &menu->items[i];
struct color_pair *color = normal_color; struct color_pair *color = normal_color;
unsigned char *text = mi->text; char *text = mi->text;
int l = mi->hotkey_pos; int l = mi->hotkey_pos;
int textlen; int textlen;
int selected = (i == menu->selected); 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 /* We don't initialize to menu->first here, since it breaks
* horizontal scrolling using mouse in some cases. --Zas */ * horizontal scrolling using mouse in some cases. --Zas */
foreach_menu_item (item, menu->items) { foreach_menu_item (item, menu->items) {
unsigned char *text = item->text; char *text = item->text;
if (!mi_has_left_text(item)) continue; if (!mi_has_left_text(item)) continue;
@ -1386,7 +1386,7 @@ new_menu(enum menu_item_flags flags)
} }
void 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 main_action action_id, menu_func_T func, void *data,
enum menu_item_flags flags) 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 /* XXX: keep order of fields, there's some hard initializations for it. --Zas
*/ */
struct menu_item { struct menu_item {
unsigned char *text; /* The item label */ char *text; /* The item label */
/* The following three members are tightly coupled: /* 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 * - A few places however there is no associated keybinding and no
* ``default'' handler defined in which case @rtext (if non NULL) * ``default'' handler defined in which case @rtext (if non NULL)
* will be drawn and @func will be called when selecting the item. */ * 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 */ enum main_action action_id; /* Default item handlers */
menu_func_T func; /* Called when selecting the item */ 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) \ #define INIT_MENU_ITEM(text, rtext, action_id, func, data, flags) \
{ \ { \
(unsigned char *) (text), \ (char *) (text), \
(unsigned char *) (rtext), \ (char *) (rtext), \
(action_id), \ (action_id), \
(func), \ (func), \
(void *) (data), \ (void *) (data), \
@ -128,8 +128,8 @@ struct menu_item {
#define SET_MENU_ITEM(e_, text_, rtext_, action_id_, func_, data_, \ #define SET_MENU_ITEM(e_, text_, rtext_, action_id_, func_, data_, \
flags_, hotkey_state_, hotkey_pos_) \ flags_, hotkey_state_, hotkey_pos_) \
do { \ do { \
(e_)->text = (unsigned char *) (text_); \ (e_)->text = (char *) (text_); \
(e_)->rtext = (unsigned char *) (rtext_); \ (e_)->rtext = (char *) (rtext_); \
(e_)->action_id = (action_id_); \ (e_)->action_id = (action_id_); \
(e_)->func = (func_); \ (e_)->func = (func_); \
(e_)->data = (void *) (data_); \ (e_)->data = (void *) (data_); \
@ -165,7 +165,7 @@ struct menu {
struct menu_item *new_menu(enum menu_item_flags); struct menu_item *new_menu(enum menu_item_flags);
void 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 main_action action_id, menu_func_T func, void *data,
enum menu_item_flags flags); enum menu_item_flags flags);

View File

@ -23,8 +23,8 @@
struct dialog_data * struct dialog_data *
msg_box(struct terminal *term, struct memory_list *ml, enum msgbox_flags flags, msg_box(struct terminal *term, struct memory_list *ml, enum msgbox_flags flags,
unsigned char *title, enum format_align align, char *title, enum format_align align,
unsigned char *text, void *udata, int buttons, ...) char *text, void *udata, int buttons, ...)
{ {
struct dialog *dlg; struct dialog *dlg;
va_list ap; va_list ap;
@ -66,11 +66,11 @@ msg_box(struct terminal *term, struct memory_list *ml, enum msgbox_flags flags,
va_start(ap, buttons); va_start(ap, buttons);
while (dlg->number_of_widgets < buttons + 1) { while (dlg->number_of_widgets < buttons + 1) {
unsigned char *label; char *label;
done_handler_T *done; done_handler_T *done;
int bflags; int bflags;
label = va_arg(ap, unsigned char *); label = va_arg(ap, char *);
done = va_arg(ap, done_handler_T *); done = va_arg(ap, done_handler_T *);
bflags = va_arg(ap, int); 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); return do_dialog(term, dlg, ml);
} }
static inline unsigned char * static inline char *
msg_text_do(unsigned char *format, va_list ap) msg_text_do(char *format, va_list ap)
{ {
unsigned char *info; char *info;
int infolen, len; int infolen, len;
va_list ap2; va_list ap2;
@ -117,10 +117,10 @@ msg_text_do(unsigned char *format, va_list ap)
return info; return info;
} }
unsigned char * char *
msg_text(struct terminal *term, unsigned char *format, ...) msg_text(struct terminal *term, char *format, ...)
{ {
unsigned char *info; char *info;
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
@ -142,9 +142,9 @@ abort_refreshed_msg_box_handler(struct dialog_data *dlg_data)
static enum dlg_refresh_code static enum dlg_refresh_code
refresh_msg_box(struct dialog_data *dlg_data, void *data) 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; 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; if (!info) return REFRESH_CANCEL;
@ -156,13 +156,13 @@ refresh_msg_box(struct dialog_data *dlg_data, void *data)
void void
refreshed_msg_box(struct terminal *term, enum msgbox_flags flags, refreshed_msg_box(struct terminal *term, enum msgbox_flags flags,
unsigned char *title, enum format_align align, char *title, enum format_align align,
unsigned char *(get_info)(struct terminal *, void *), char *(get_info)(struct terminal *, void *),
void *data) void *data)
{ {
/* [gettext_accelerator_context(refreshed_msg_box)] */ /* [gettext_accelerator_context(refreshed_msg_box)] */
struct dialog_data *dlg_data; struct dialog_data *dlg_data;
unsigned char *info = get_info(term, data); char *info = get_info(term, data);
if (!info) return; if (!info) return;
@ -183,8 +183,8 @@ refreshed_msg_box(struct terminal *term, enum msgbox_flags flags,
struct dialog_data * struct dialog_data *
info_box(struct terminal *term, enum msgbox_flags flags, info_box(struct terminal *term, enum msgbox_flags flags,
unsigned char *title, enum format_align align, char *title, enum format_align align,
unsigned char *text) char *text)
{ {
/* [gettext_accelerator_context(info_box)] */ /* [gettext_accelerator_context(info_box)] */
return msg_box(term, NULL, flags, return msg_box(term, NULL, flags,

View File

@ -94,8 +94,8 @@ enum msgbox_flags {
* ...no matter that it could fit on one line in case of a tiny message box. */ * ...no matter that it could fit on one line in case of a tiny message box. */
struct dialog_data * struct dialog_data *
msg_box(struct terminal *term, struct memory_list *mem_list, msg_box(struct terminal *term, struct memory_list *mem_list,
enum msgbox_flags flags, unsigned char *title, enum format_align align, enum msgbox_flags flags, char *title, enum format_align align,
unsigned char *text, void *udata, int buttons, ...); char *text, void *udata, int buttons, ...);
/* Cast @value to @type and warn if the conversion is suspicious. /* Cast @value to @type and warn if the conversion is suspicious.
* If @value has side effects, this does them only once. * 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(). /* A button in the variadic arguments of msg_box().
* This macro expands into three arguments. */ * This macro expands into three arguments. */
#define MSG_BOX_BUTTON(label, handler, flags) \ #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(done_handler_T *, handler), \
MSG_BOX_CAST(int, flags) 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 * This one automagically localizes the format string. The possible
* additional parameters still need to be localized manually at the user's * additional parameters still need to be localized manually at the user's
* side. */ * 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 /* 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 * message box is updated using the get_info() function. If get_info() returns
* NULL the message box is closed. */ * NULL the message box is closed. */
void void
refreshed_msg_box(struct terminal *term, enum msgbox_flags flags, refreshed_msg_box(struct terminal *term, enum msgbox_flags flags,
unsigned char *title, enum format_align align, char *title, enum format_align align,
unsigned char *(get_info)(struct terminal *, void *), char *(get_info)(struct terminal *, void *),
void *data); void *data);
struct dialog_data * struct dialog_data *
info_box(struct terminal *term, enum msgbox_flags flags, info_box(struct terminal *term, enum msgbox_flags flags,
unsigned char *title, enum format_align align, char *title, enum format_align align,
unsigned char *text); char *text);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -28,7 +28,7 @@ struct bfu_color_entry {
static struct hash *bfu_colors = NULL; static struct hash *bfu_colors = NULL;
struct color_pair * 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; static enum color_mode last_color_mode;
struct bfu_color_entry *entry; struct bfu_color_entry *entry;

View File

@ -23,7 +23,7 @@ struct terminal;
* @return A color pair matching the stylename or NULL. * @return A color pair matching the stylename or NULL.
*/ */
struct color_pair * 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 /** Cleanup after the BFU style cache
* *

View File

@ -23,7 +23,7 @@
#define is_unsplitable(pos) (*(pos) && *(pos) != '\n' && !isspace(*(pos))) #define is_unsplitable(pos) (*(pos) && *(pos) != '\n' && !isspace(*(pos)))
void 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) enum format_align align, int bottom_pad)
{ {
struct widget *widget = &dlg->widgets[dlg->number_of_widgets++]; 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. */ /* Returns length of substring (from start of @text) before a split. */
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
static inline int 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 #else
static inline int 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 */ #endif /* CONFIG_UTF8 */
{ {
unsigned char *split = text; char *split = text;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
unsigned char *text_end = split + strlen(split); char *text_end = split + strlen(split);
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
int cells_save = *cells; int cells_save = *cells;
if (max_width <= 0) return 0; if (max_width <= 0) return 0;
while (*split && *split != '\n') { while (*split && *split != '\n') {
unsigned char *next_split; char *next_split;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
if (utf8) { if (utf8) {
unsigned char *next_char_begin = split char *next_char_begin = split
+ utf8charlen(split); + utf8charlen(split);
next_split = 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 */ /* Find the start of each line with the current max width */
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
static unsigned char ** static char **
split_lines(struct widget_data *widget_data, int max_width, int utf8) split_lines(struct widget_data *widget_data, int max_width, int utf8)
#else #else
static unsigned char ** static char **
split_lines(struct widget_data *widget_data, int max_width) split_lines(struct widget_data *widget_data, int max_width)
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
{ {
unsigned char *text = widget_data->widget->text; char *text = widget_data->widget->text;
unsigned char **lines = (unsigned char **) widget_data->cdata; char **lines = (char **) widget_data->cdata;
int line = 0; int line = 0;
if (widget_data->info.text.max_width == max_width) return lines; 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 /* Yes it might be a bit ugly on the other hand it will be autofreed
* for us. */ * for us. */
widget_data->cdata = (unsigned char *) lines; widget_data->cdata = (char *) lines;
widget_data->info.text.lines = line; widget_data->info.text.lines = line;
widget_data->info.text.max_width = max_width; 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. */ /* Format text according to dialog box and alignment. */
void void
dlg_format_text_do(struct dialog_data *dlg_data, dlg_format_text_do(struct dialog_data *dlg_data,
unsigned char *text, char *text,
int x, int *y, int width, int *real_width, int x, int *y, int width, int *real_width,
struct color_pair *color, enum format_align align, struct color_pair *color, enum format_align align,
int format_only) int format_only)
@ -270,9 +270,9 @@ dlg_format_text(struct dialog_data *dlg_data,
int format_only) int format_only)
{ {
struct terminal *term = dlg_data->win->term; 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 = 0;
unsigned char *saved_pos = NULL; char *saved_pos = NULL;
int height; int height;
height = int_max(0, max_height - 3); 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 && (widget_data->info.text.max_width != width
|| height < widget_data->info.text.lines)) || height < widget_data->info.text.lines))
{ {
unsigned char **lines; char **lines;
int current; int current;
int visible; int visible;
@ -304,7 +304,7 @@ dlg_format_text(struct dialog_data *dlg_data,
return; return;
#endif #endif
lines = (unsigned char **) widget_data->cdata; lines = (char **) widget_data->cdata;
/* Make maximum number of lines available */ /* Make maximum number of lines available */
visible = int_max(widget_data->info.text.lines - height, visible = int_max(widget_data->info.text.lines - height,

View File

@ -46,12 +46,12 @@ struct widget_data_info_text {
#endif #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); enum format_align align, int bottom_pad);
extern const struct widget_ops text_ops; extern const struct widget_ops text_ops;
void dlg_format_text_do(struct dialog_data *dlg_data, 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); struct color_pair *scolor, enum format_align align, int format_only);
void void

View File

@ -36,7 +36,7 @@ struct widget_ops {
struct widget { struct widget {
const struct widget_ops *ops; const struct widget_ops *ops;
unsigned char *text; char *text;
widget_handler_T *handler; widget_handler_T *handler;
@ -61,14 +61,14 @@ struct widget_data {
* and is assumed to be unibyte otherwise.) The UTF-8 I/O * and is assumed to be unibyte otherwise.) The UTF-8 I/O
* option has no effect here. * 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 * that points to the first element of an array. Each element
* in this array corresponds to one line of text, and is an * 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. * line. The array has @widget_data.info.text.lines elements.
* *
* For WIDGET_LISTBOX: @cdata points to struct listbox_data. */ * For WIDGET_LISTBOX: @cdata points to struct listbox_data. */
unsigned char *cdata; char *cdata;
struct el_box box; struct el_box box;

View File

@ -47,7 +47,7 @@ bookmarks_read(void)
{ {
int backend_num = get_opt_int("bookmarks.file_format", NULL); int backend_num = get_opt_int("bookmarks.file_format", NULL);
struct bookmarks_backend *backend = bookmarks_backends[backend_num]; struct bookmarks_backend *backend = bookmarks_backends[backend_num];
unsigned char *file_name; char *file_name;
FILE *f; FILE *f;
if (!backend if (!backend
@ -58,7 +58,7 @@ bookmarks_read(void)
if (!file_name) return; if (!file_name) return;
if (elinks_home) { if (elinks_home) {
file_name = straconcat(elinks_home, file_name, file_name = straconcat(elinks_home, file_name,
(unsigned char *) NULL); (char *) NULL);
if (!file_name) return; 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); int backend_num = get_opt_int("bookmarks.file_format", NULL);
struct bookmarks_backend *backend = bookmarks_backends[backend_num]; struct bookmarks_backend *backend = bookmarks_backends[backend_num];
struct secure_save_info *ssi; struct secure_save_info *ssi;
unsigned char *file_name; char *file_name;
if (!bookmarks_are_dirty() && backend_num == loaded_backend_num) return; if (!bookmarks_are_dirty() && backend_num == loaded_backend_num) return;
if (!backend if (!backend
@ -92,7 +92,7 @@ bookmarks_write(LIST_OF(struct bookmark) *bookmarks_list)
* they would be just truncated to zero by secure_open()). */ * they would be just truncated to zero by secure_open()). */
file_name = backend->filename(1); file_name = backend->filename(1);
if (!file_name) return; 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; if (!file_name) return;
ssi = secure_open(file_name); ssi = secure_open(file_name);

View File

@ -12,7 +12,7 @@ extern "C" {
struct bookmarks_backend { struct bookmarks_backend {
/* Order matters here. --Zas. */ /* Order matters here. --Zas. */
unsigned char *(*filename)(int); char *(*filename)(int);
void (*read)(FILE *); void (*read)(FILE *);
void (*write)(struct secure_save_info *, LIST_OF(struct bookmark) *); void (*write)(struct secure_save_info *, LIST_OF(struct bookmark) *);
}; };

View File

@ -31,19 +31,19 @@ read_bookmarks_default(FILE *f)
* + 1 byte for end of line + 1 byte for null char + reserve */ * + 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 \ #define INBUF_SIZE ((MAX_STR_LEN - 1) + 1 + (MAX_STR_LEN - 1) + 1 + 5 + 1 + 1 \
+ MAX_STR_LEN) + MAX_STR_LEN)
unsigned char in_buffer[INBUF_SIZE]; /* read buffer */ char in_buffer[INBUF_SIZE]; /* read buffer */
struct bookmark *last_bm = NULL; struct bookmark *last_bm = NULL;
int last_depth = 0; int last_depth = 0;
const int file_cp = get_cp_index("System"); const int file_cp = get_cp_index("System");
/* TODO: Ignore lines with bad chars in title or url (?). -- Zas */ /* TODO: Ignore lines with bad chars in title or url (?). -- Zas */
while (fgets(in_buffer, INBUF_SIZE, f)) { while (fgets(in_buffer, INBUF_SIZE, f)) {
unsigned char *title = in_buffer; char *title = in_buffer;
unsigned char *url; char *url;
unsigned char *depth_str; char *depth_str;
int depth = 0; int depth = 0;
unsigned char *flags = NULL; char *flags = NULL;
unsigned char *line_end; char *line_end;
/* Load URL. */ /* Load URL. */
@ -143,7 +143,7 @@ write_bookmarks_default_inner(const struct write_bookmarks_default *out,
struct bookmark *bm; struct bookmark *bm;
foreach (bm, *bookmarks_list) { foreach (bm, *bookmarks_list) {
unsigned char *title, *url; char *title, *url;
title = convert_string(out->conv_table, bm->title, title = convert_string(out->conv_table, bm->title,
strlen(bm->title), out->codepage, strlen(bm->title), out->codepage,
@ -189,7 +189,7 @@ write_bookmarks_default(struct secure_save_info *ssi,
write_bookmarks_default_inner(&out, bookmarks_list); write_bookmarks_default_inner(&out, bookmarks_list);
} }
static unsigned char * static char *
filename_bookmarks_default(int writing) filename_bookmarks_default(int writing)
{ {
return BOOKMARKS_FILENAME; return BOOKMARKS_FILENAME;

View File

@ -38,8 +38,8 @@
struct attributes { struct attributes {
LIST_HEAD(struct attributes); LIST_HEAD(struct attributes);
unsigned char *name; char *name;
unsigned char *value; char *value;
}; };
/* Prototypes */ /* 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 struct tree_node *new_node(struct tree_node *parent);
static void free_node(struct tree_node *node); static void free_node(struct tree_node *node);
static void free_xbeltree(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 struct tree_node *get_child(struct tree_node *node, char *name);
static unsigned char *get_attribute_value(struct tree_node *node, static char *get_attribute_value(struct tree_node *node,
unsigned char *name); char *name);
struct read_bookmarks_xbel { struct read_bookmarks_xbel {
@ -60,7 +60,7 @@ struct read_bookmarks_xbel {
}; };
static void read_bookmarks_xbel(FILE *f); 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, static int xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload,
struct tree_node *root, struct tree_node *root,
struct bookmark *current_parent); struct bookmark *current_parent);
@ -72,8 +72,8 @@ static void write_bookmarks_xbel(struct secure_save_info *ssi,
/* Element */ /* Element */
struct tree_node { struct tree_node {
unsigned char *name; /* Name of the element */ char *name; /* Name of the element */
unsigned char *text; /* Text inside the element */ char *text; /* Text inside the element */
LIST_OF(struct attributes) attrs; LIST_OF(struct attributes) attrs;
struct tree_node *parent; struct tree_node *parent;
struct tree_node *children; struct tree_node *children;
@ -92,7 +92,7 @@ static int readok = 1;
static void static void
read_bookmarks_xbel(FILE *f) read_bookmarks_xbel(FILE *f)
{ {
unsigned char in_buffer[BUFSIZ]; char in_buffer[BUFSIZ];
XML_Parser p; XML_Parser p;
int done = 0; int done = 0;
int err = 0; int err = 0;
@ -165,7 +165,7 @@ write_bookmarks_xbel(struct secure_save_info *ssi,
secure_fputs(ssi, "\n</xbel>\n"); secure_fputs(ssi, "\n</xbel>\n");
} }
static unsigned char * static char *
filename_bookmarks_xbel(int writing) filename_bookmarks_xbel(int writing)
{ {
if (writing && !readok) return NULL; if (writing && !readok) return NULL;
@ -182,7 +182,7 @@ indentation(struct secure_save_info *ssi, int num)
} }
static void 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; 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 = node;
current_node->name = stracpy((unsigned char *) name); current_node->name = stracpy((char *) name);
if (!current_node->name) { if (!current_node->name) {
mem_free(current_node); mem_free(current_node);
return; return;
@ -276,8 +276,8 @@ on_element_open(void *data, const char *name, const char **attr)
for (; *attr; attr += 2) { for (; *attr; attr += 2) {
struct attributes *attribute = mem_calloc(1, sizeof(*attribute)); struct attributes *attribute = mem_calloc(1, sizeof(*attribute));
unsigned char *name = stracpy((unsigned char *) attr[0]); char *name = stracpy((char *) attr[0]);
unsigned char *value = stracpy((unsigned char *) attr[1]); char *value = stracpy((char *) attr[1]);
if (!attribute || !name || !value) { if (!attribute || !name || !value) {
mem_free_if(attribute); mem_free_if(attribute);
@ -301,10 +301,10 @@ on_element_close(void *data, const char *name)
current_node = current_node->parent; current_node = current_node->parent;
} }
static unsigned char * static char *
delete_whites(const unsigned char *s) delete_whites(const char *s)
{ {
unsigned char *r; char *r;
int last_was_space = 0, c = 0, i; int last_was_space = 0, c = 0, i;
int len = strlen(s); int len = strlen(s);
@ -376,7 +376,7 @@ xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload,
while (node) { while (node) {
if (!strcmp(node->name, "bookmark")) { if (!strcmp(node->name, "bookmark")) {
unsigned char *href; char *href;
title = get_child(node, "title"); title = get_child(node, "title");
href = get_attribute_value(node, "href"); 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, tmp = add_bookmark(current_parent, 0,
/* The <title> element is optional */ /* The <title> element is optional */
title && title->text ? title->text title && title->text ? title->text
: (unsigned char *) gettext("No title"), : (char *) gettext("No title"),
/* XXX: The href attribute isn't optional but /* XXX: The href attribute isn't optional but
* we don't validate the source XML yet, so * we don't validate the source XML yet, so
* we can't always assume a non NULL value for * we can't always assume a non NULL value for
* get_attribute_value() */ * get_attribute_value() */
href ? href href ? href
: (unsigned char *) gettext("No URL")); : (char *) gettext("No URL"));
/* Out of memory */ /* Out of memory */
if (!tmp) return 0; if (!tmp) return 0;
@ -400,14 +400,14 @@ xbeltree_to_bookmarks_list(const struct read_bookmarks_xbel *preload,
lastbm = tmp; lastbm = tmp;
} else if (!strcmp(node->name, "folder")) { } else if (!strcmp(node->name, "folder")) {
unsigned char *folded; char *folded;
title = get_child(node, "title"); title = get_child(node, "title");
intl_set_charset_by_index(preload->utf8_cp); intl_set_charset_by_index(preload->utf8_cp);
tmp = add_bookmark(current_parent, 0, tmp = add_bookmark(current_parent, 0,
title && title->text ? title->text title && title->text ? title->text
: (unsigned char *) gettext("No title"), : (char *) gettext("No title"),
NULL); NULL);
/* Out of memory */ /* Out of memory */
@ -471,7 +471,7 @@ free_xbeltree(struct tree_node *node)
} }
static struct tree_node * static struct tree_node *
get_child(struct tree_node *node, unsigned char *name) get_child(struct tree_node *node, char *name)
{ {
struct tree_node *ret; struct tree_node *ret;
@ -489,8 +489,8 @@ get_child(struct tree_node *node, unsigned char *name)
return NULL; return NULL;
} }
static unsigned char * static char *
get_attribute_value(struct tree_node *node, unsigned char *name) get_attribute_value(struct tree_node *node, char *name)
{ {
struct attributes *attribute; struct attributes *attribute;

View File

@ -276,7 +276,7 @@ delete_bookmark(struct bookmark *bm)
* @param foldername * @param foldername
* The title of the folder, in UTF-8. */ * The title of the folder, in UTF-8. */
static void static void
delete_folder_by_name(const unsigned char *foldername) delete_folder_by_name(const char *foldername)
{ {
struct bookmark *bookmark, *next; struct bookmark *bookmark, *next;
@ -305,7 +305,7 @@ delete_folder_by_name(const unsigned char *foldername)
* *
* @return the new bookmark, or NULL on error. */ * @return the new bookmark, or NULL on error. */
static struct bookmark * static struct bookmark *
init_bookmark(struct bookmark *root, unsigned char *title, unsigned char *url) init_bookmark(struct bookmark *root, char *title, char *url)
{ {
struct bookmark *bm; struct bookmark *bm;
@ -379,8 +379,8 @@ add_bookmark_item_to_bookmarks(struct bookmark *bm, struct bookmark *root, int p
* *
* @see add_bookmark_cp() */ * @see add_bookmark_cp() */
struct bookmark * struct bookmark *
add_bookmark(struct bookmark *root, int place, unsigned char *title, add_bookmark(struct bookmark *root, int place, char *title,
unsigned char *url) char *url)
{ {
enum listbox_item_type type; enum listbox_item_type type;
struct bookmark *bm; struct bookmark *bm;
@ -435,12 +435,12 @@ add_bookmark(struct bookmark *root, int place, unsigned char *title,
* @see add_bookmark() */ * @see add_bookmark() */
struct bookmark * struct bookmark *
add_bookmark_cp(struct bookmark *root, int place, int codepage, add_bookmark_cp(struct bookmark *root, int place, int codepage,
unsigned char *title, unsigned char *url) char *title, char *url)
{ {
const int utf8_cp = get_cp_index("UTF-8"); const int utf8_cp = get_cp_index("UTF-8");
struct conv_table *table; struct conv_table *table;
unsigned char *utf8_title = NULL; char *utf8_title = NULL;
unsigned char *utf8_url = NULL; char *utf8_url = NULL;
struct bookmark *bookmark = NULL; struct bookmark *bookmark = NULL;
if (!url) if (!url)
@ -471,13 +471,13 @@ add_bookmark_cp(struct bookmark *root, int place, int codepage,
* If any of the fields are NULL, the value is left unchanged. */ * If any of the fields are NULL, the value is left unchanged. */
int int
update_bookmark(struct bookmark *bm, int codepage, update_bookmark(struct bookmark *bm, int codepage,
unsigned char *title, unsigned char *url) char *title, char *url)
{ {
static int update_bookmark_event_id = EVENT_NONE; static int update_bookmark_event_id = EVENT_NONE;
const int utf8_cp = get_cp_index("UTF-8"); const int utf8_cp = get_cp_index("UTF-8");
struct conv_table *table; struct conv_table *table;
unsigned char *title2 = NULL; char *title2 = NULL;
unsigned char *url2 = NULL; char *url2 = NULL;
table = get_translation_table(codepage, utf8_cp); table = get_translation_table(codepage, utf8_cp);
if (!table) if (!table)
@ -541,7 +541,7 @@ update_bookmark(struct bookmark *bm, int codepage,
* *
* @return The bookmark, or NULL if not found. */ * @return The bookmark, or NULL if not found. */
struct bookmark * struct bookmark *
get_bookmark_by_name(struct bookmark *folder, unsigned char *title) get_bookmark_by_name(struct bookmark *folder, char *title)
{ {
struct bookmark *bookmark; struct bookmark *bookmark;
LIST_OF(struct bookmark) *lh; LIST_OF(struct bookmark) *lh;
@ -556,7 +556,7 @@ get_bookmark_by_name(struct bookmark *folder, unsigned char *title)
/* Search bookmark cache for item matching url. */ /* Search bookmark cache for item matching url. */
struct bookmark * struct bookmark *
get_bookmark(unsigned char *url) get_bookmark(char *url)
{ {
struct hash_item *item; struct hash_item *item;
@ -574,7 +574,7 @@ get_bookmark(unsigned char *url)
static void static void
bookmark_terminal(struct terminal *term, struct bookmark *folder) bookmark_terminal(struct terminal *term, struct bookmark *folder)
{ {
unsigned char title[MAX_STR_LEN], url[MAX_STR_LEN]; char title[MAX_STR_LEN], url[MAX_STR_LEN];
struct window *tab; struct window *tab;
int term_cp = get_terminal_codepage(term); int term_cp = get_terminal_codepage(term);
@ -600,7 +600,7 @@ bookmark_terminal(struct terminal *term, struct bookmark *folder)
* @param foldername * @param foldername
* The name of the new bookmark folder, in UTF-8. */ * The name of the new bookmark folder, in UTF-8. */
void void
bookmark_terminal_tabs(struct terminal *term, unsigned char *foldername) bookmark_terminal_tabs(struct terminal *term, char *foldername)
{ {
struct bookmark *folder = add_bookmark(NULL, 1, foldername, NULL); struct bookmark *folder = add_bookmark(NULL, 1, foldername, NULL);
@ -624,7 +624,7 @@ bookmark_all_terminals(struct bookmark *folder)
} }
foreach (term, terminals) { foreach (term, terminals) {
unsigned char subfoldername[4]; char subfoldername[4];
struct bookmark *subfolder; struct bookmark *subfolder;
if (ulongcat(subfoldername, NULL, n, sizeof(subfoldername), 0) if (ulongcat(subfoldername, NULL, n, sizeof(subfoldername), 0)
@ -643,10 +643,10 @@ bookmark_all_terminals(struct bookmark *folder)
} }
unsigned char * char *
get_auto_save_bookmark_foldername_utf8(void) get_auto_save_bookmark_foldername_utf8(void)
{ {
unsigned char *foldername; char *foldername;
int from_cp, to_cp; int from_cp, to_cp;
struct conv_table *convert_table; struct conv_table *convert_table;
@ -670,7 +670,7 @@ get_auto_save_bookmark_foldername_utf8(void)
void void
bookmark_auto_save_tabs(struct terminal *term) bookmark_auto_save_tabs(struct terminal *term)
{ {
unsigned char *foldername; /* UTF-8 */ char *foldername; /* UTF-8 */
if (get_cmd_opt_bool("anonymous") if (get_cmd_opt_bool("anonymous")
|| !get_opt_bool("ui.sessions.auto_save", NULL)) || !get_opt_bool("ui.sessions.auto_save", NULL))
@ -726,7 +726,7 @@ bookmark_snapshot(void)
* @param foldername * @param foldername
* The name of the bookmark folder, in UTF-8. */ * The name of the bookmark folder, in UTF-8. */
void void
open_bookmark_folder(struct session *ses, unsigned char *foldername) open_bookmark_folder(struct session *ses, char *foldername)
{ {
struct bookmark *bookmark; struct bookmark *bookmark;
struct bookmark *folder = NULL; struct bookmark *folder = NULL;

View File

@ -23,8 +23,8 @@ struct bookmark {
/** @todo Bug 1066: The bookmark::url string should be in UTF-8 too, /** @todo Bug 1066: The bookmark::url string should be in UTF-8 too,
* but this has not yet been fully implemented. */ * but this has not yet been fully implemented. */
unsigned char *title; /* UTF-8 title of bookmark */ char *title; /* UTF-8 title of bookmark */
unsigned char *url; /* Location of bookmarked item */ char *url; /* Location of bookmarked item */
LIST_OF(struct bookmark) child; LIST_OF(struct bookmark) child;
}; };
@ -48,18 +48,18 @@ void bookmarks_unset_dirty(void);
int bookmarks_are_dirty(void); int bookmarks_are_dirty(void);
void delete_bookmark(struct bookmark *); void delete_bookmark(struct bookmark *);
struct bookmark *add_bookmark(struct bookmark *, int, unsigned char *, unsigned char *); struct bookmark *add_bookmark(struct bookmark *, int, char *, char *);
struct bookmark *add_bookmark_cp(struct bookmark *, int, int, struct bookmark *add_bookmark_cp(struct bookmark *, int, int,
unsigned char *, unsigned char *); char *, char *);
struct bookmark *get_bookmark_by_name(struct bookmark *folder, struct bookmark *get_bookmark_by_name(struct bookmark *folder,
unsigned char *title); char *title);
struct bookmark *get_bookmark(unsigned char *url); struct bookmark *get_bookmark(char *url);
void bookmark_terminal_tabs(struct terminal *term, unsigned char *foldername); void bookmark_terminal_tabs(struct terminal *term, char *foldername);
unsigned char *get_auto_save_bookmark_foldername_utf8(void); char *get_auto_save_bookmark_foldername_utf8(void);
void bookmark_auto_save_tabs(struct terminal *term); void bookmark_auto_save_tabs(struct terminal *term);
int update_bookmark(struct bookmark *, int, int update_bookmark(struct bookmark *, int,
unsigned char *, unsigned char *); char *, char *);
void open_bookmark_folder(struct session *ses, unsigned char *foldername); void open_bookmark_folder(struct session *ses, char *foldername);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -52,7 +52,7 @@ is_bookmark_used(struct listbox_item *item)
return is_object_used((struct bookmark *) item->udata); return is_object_used((struct bookmark *) item->udata);
} }
static unsigned char * static char *
get_bookmark_text(struct listbox_item *item, struct terminal *term) get_bookmark_text(struct listbox_item *item, struct terminal *term)
{ {
struct bookmark *bookmark = item->udata; struct bookmark *bookmark = item->udata;
@ -73,14 +73,14 @@ get_bookmark_text(struct listbox_item *item, struct terminal *term)
* resulting string may be displayed in the UI but should not be saved * resulting string may be displayed in the UI but should not be saved
* to a file or given to another program. */ * to a file or given to another program. */
static void static void
add_converted_bytes_to_string(void *data, unsigned char *buf, int buflen) add_converted_bytes_to_string(void *data, char *buf, int buflen)
{ {
struct string *string = data; struct string *string = data;
add_bytes_to_string(string, buf, buflen); /* ignore errors */ add_bytes_to_string(string, buf, buflen); /* ignore errors */
} }
static unsigned char * static char *
get_bookmark_info(struct listbox_item *item, struct terminal *term) get_bookmark_info(struct listbox_item *item, struct terminal *term)
{ {
struct bookmark *bookmark = item->udata; struct bookmark *bookmark = item->udata;
@ -255,7 +255,7 @@ move_bookmark_after_selected(struct bookmark *bookmark, struct bookmark *selecte
* or "" means add a bookmark folder, unless @a title is "-". */ * or "" means add a bookmark folder, unless @a title is "-". */
static void static void
do_add_bookmark(struct terminal *term, struct dialog_data *dlg_data, do_add_bookmark(struct terminal *term, struct dialog_data *dlg_data,
unsigned char *title, unsigned char *url) char *title, char *url)
{ {
int term_cp = get_terminal_codepage(term); int term_cp = get_terminal_codepage(term);
struct bookmark *bm = NULL; struct bookmark *bm = NULL;
@ -307,7 +307,7 @@ do_add_bookmark(struct terminal *term, struct dialog_data *dlg_data,
* The folder name that the user typed in the input dialog. * The folder name that the user typed in the input dialog.
* This is in the charset of the terminal. */ * This is in the charset of the terminal. */
static void static void
do_add_folder(struct dialog_data *dlg_data, unsigned char *foldername) do_add_folder(struct dialog_data *dlg_data, char *foldername)
{ {
do_add_bookmark(dlg_data->win->term, dlg_data, foldername, NULL); do_add_bookmark(dlg_data->win->term, dlg_data, foldername, NULL);
} }
@ -327,7 +327,7 @@ push_add_folder_button(struct dialog_data *dlg_data, struct widget_data *widget_
N_("Add folder"), N_("Folder name"), N_("Add folder"), N_("Folder name"),
dlg_data, NULL, dlg_data, NULL,
MAX_STR_LEN, NULL, 0, 0, NULL, MAX_STR_LEN, NULL, 0, 0, NULL,
(void (*)(void *, unsigned char *)) do_add_folder, (void (*)(void *, char *)) do_add_folder,
NULL); NULL);
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
@ -393,8 +393,8 @@ push_edit_button(struct dialog_data *dlg_data, struct widget_data *edit_btn)
convert_table = get_translation_table(utf8_cp, term_cp); convert_table = get_translation_table(utf8_cp, term_cp);
if (convert_table) { if (convert_table) {
unsigned char *title; char *title;
unsigned char *url; char *url;
title = convert_string(convert_table, title = convert_string(convert_table,
bm->title, strlen(bm->title), bm->title, strlen(bm->title),
@ -641,8 +641,8 @@ bookmark_manager(struct session *ses)
* rapid search of an already existing bookmark. --Zas */ * rapid search of an already existing bookmark. --Zas */
struct bookmark_search_ctx { struct bookmark_search_ctx {
unsigned char *url; /* UTF-8 */ char *url; /* UTF-8 */
unsigned char *title; /* system charset */ char *title; /* system charset */
int found; int found;
int offset; int offset;
int utf8_cp; int utf8_cp;
@ -673,7 +673,7 @@ test_search(struct listbox_item *item, void *data_, int *offset)
* charset. So convert bm->title to that. * charset. So convert bm->title to that.
* (ctx->title has already been converted.) */ * (ctx->title has already been converted.) */
struct conv_table *convert_table; struct conv_table *convert_table;
unsigned char *title = NULL; char *title = NULL;
convert_table = get_translation_table(ctx->utf8_cp, convert_table = get_translation_table(ctx->utf8_cp,
ctx->system_cp); ctx->system_cp);
@ -705,8 +705,8 @@ test_search(struct listbox_item *item, void *data_, int *offset)
/* Last searched values. Both are in UTF-8. (The title could be kept /* Last searched values. Both are in UTF-8. (The title could be kept
* in the system charset, but that would be a bit risky, because * in the system charset, but that would be a bit risky, because
* setlocale calls from Lua scripts can change the system charset.) */ * setlocale calls from Lua scripts can change the system charset.) */
static unsigned char *bm_last_searched_title = NULL; static char *bm_last_searched_title = NULL;
static unsigned char *bm_last_searched_url = NULL; static char *bm_last_searched_url = NULL;
void void
free_last_searched_bookmark(void) free_last_searched_bookmark(void)
@ -716,8 +716,8 @@ free_last_searched_bookmark(void)
} }
static int static int
memorize_last_searched_bookmark(const unsigned char *title, memorize_last_searched_bookmark(const char *title,
const unsigned char *url) const char *url)
{ {
/* Memorize last searched title */ /* Memorize last searched title */
mem_free_set(&bm_last_searched_title, stracpy(title)); mem_free_set(&bm_last_searched_title, stracpy(title));
@ -743,9 +743,9 @@ bookmark_search_do(void *data)
struct dialog_data *dlg_data; struct dialog_data *dlg_data;
struct conv_table *convert_table; struct conv_table *convert_table;
int term_cp; int term_cp;
unsigned char *url_term; char *url_term;
unsigned char *title_term; char *title_term;
unsigned char *title_utf8 = NULL; char *title_utf8 = NULL;
assertm(dlg->udata != NULL, "Bookmark search with NULL udata in dialog"); assertm(dlg->udata != NULL, "Bookmark search with NULL udata in dialog");
if_assert_failed return; if_assert_failed return;
@ -797,8 +797,8 @@ launch_bm_search_doc_dialog(struct terminal *term,
struct dialog_data *parent, struct dialog_data *parent,
struct session *ses) struct session *ses)
{ {
unsigned char *title = NULL; char *title = NULL;
unsigned char *url = NULL; char *url = NULL;
if (bm_last_searched_title && bm_last_searched_url) { if (bm_last_searched_title && bm_last_searched_url) {
int utf8_cp, term_cp; int utf8_cp, term_cp;
@ -872,8 +872,8 @@ void
launch_bm_add_dialog(struct terminal *term, launch_bm_add_dialog(struct terminal *term,
struct dialog_data *parent, struct dialog_data *parent,
struct session *ses, struct session *ses,
unsigned char *title, char *title,
unsigned char *url) char *url)
{ {
/* When the user eventually pushes the OK button, BFU calls /* When the user eventually pushes the OK button, BFU calls
* bookmark_add_add() and gives it the struct dialog * as the * bookmark_add_add() and gives it the struct dialog * as the
@ -906,7 +906,7 @@ launch_bm_add_link_dialog(struct terminal *term,
struct dialog_data *parent, struct dialog_data *parent,
struct session *ses) struct session *ses)
{ {
unsigned char title[MAX_STR_LEN], url[MAX_STR_LEN]; char title[MAX_STR_LEN], url[MAX_STR_LEN];
launch_bm_add_dialog(term, parent, ses, launch_bm_add_dialog(term, parent, ses,
get_current_link_name(ses, title, MAX_STR_LEN), get_current_link_name(ses, title, MAX_STR_LEN),
@ -919,13 +919,13 @@ launch_bm_add_link_dialog(struct terminal *term,
\****************************************************************************/ \****************************************************************************/
static void static void
bookmark_terminal_tabs_ok(void *term_void, unsigned char *foldername) bookmark_terminal_tabs_ok(void *term_void, char *foldername)
{ {
struct terminal *const term = term_void; struct terminal *const term = term_void;
int from_cp = get_terminal_codepage(term); int from_cp = get_terminal_codepage(term);
int to_cp = get_cp_index("UTF-8"); int to_cp = get_cp_index("UTF-8");
struct conv_table *convert_table; struct conv_table *convert_table;
unsigned char *converted; char *converted;
convert_table = get_translation_table(from_cp, to_cp); convert_table = get_translation_table(from_cp, to_cp);
if (convert_table == NULL) return; /** @todo Report the error */ if (convert_table == NULL) return; /** @todo Report the error */

View File

@ -21,8 +21,8 @@ void bookmark_manager(struct session *ses);
void launch_bm_add_dialog(struct terminal *term, void launch_bm_add_dialog(struct terminal *term,
struct dialog_data *parent, struct dialog_data *parent,
struct session *ses, struct session *ses,
unsigned char *title, char *title,
unsigned char *url); char *url);
/* ...with the current document's title and URL */ /* ...with the current document's title and URL */
void launch_bm_add_doc_dialog(struct terminal *term, void launch_bm_add_doc_dialog(struct terminal *term,

6
src/cache/cache.c vendored
View File

@ -374,7 +374,7 @@ remove_overlaps(struct cache_entry *cached, struct fragment *f, int *trunc)
* unhappy from that. */ * unhappy from that. */
int int
add_fragment(struct cache_entry *cached, off_t offset, add_fragment(struct cache_entry *cached, off_t offset,
const unsigned char *data, ssize_t length) const char *data, ssize_t length)
{ {
struct fragment *f, *nf; struct fragment *f, *nf;
int trunc = 0; int trunc = 0;
@ -700,10 +700,10 @@ normalize_cache_entry(struct cache_entry *cached, off_t truncate_length)
struct uri * struct uri *
redirect_cache(struct cache_entry *cached, unsigned char *location, redirect_cache(struct cache_entry *cached, char *location,
int get, int incomplete) int get, int incomplete)
{ {
unsigned char *uristring; char *uristring;
/* XXX: I am a little puzzled whether we should only use the cache /* XXX: I am a little puzzled whether we should only use the cache
* entry's URI if it is valid. Hopefully always using it won't hurt. * entry's URI if it is valid. Hopefully always using it won't hurt.

18
src/cache/cache.h vendored
View File

@ -39,12 +39,12 @@ struct cache_entry {
struct uri *proxy_uri; /* Proxy identifier or same as @uri */ struct uri *proxy_uri; /* Proxy identifier or same as @uri */
struct uri *redirect; /* Location we were redirected to */ struct uri *redirect; /* Location we were redirected to */
unsigned char *head; /* The protocol header */ char *head; /* The protocol header */
unsigned char *content_type; /* MIME type: <type> "/" <subtype> */ char *content_type; /* MIME type: <type> "/" <subtype> */
unsigned char *last_modified; /* Latest modification date */ char *last_modified; /* Latest modification date */
unsigned char *etag; /* ETag value from the HTTP header */ char *etag; /* ETag value from the HTTP header */
unsigned char *ssl_info; /* SSL ciphers used during transfer */ char *ssl_info; /* SSL ciphers used during transfer */
unsigned char *encoding_info; /* Encoding used during transfer */ char *encoding_info; /* Encoding used during transfer */
unsigned int cache_id; /* Change each time entry is modified. */ unsigned int cache_id; /* Change each time entry is modified. */
@ -81,7 +81,7 @@ struct fragment {
off_t offset; off_t offset;
off_t length; off_t length;
off_t real_length; off_t real_length;
unsigned char data[1]; /* Must be last */ char data[1]; /* Must be last */
}; };
@ -114,7 +114,7 @@ struct cache_entry *get_redirected_cache_entry(struct uri *uri);
* 1 if cache entry was enlarged, * 1 if cache entry was enlarged,
* 0 if only old data were overwritten. */ * 0 if only old data were overwritten. */
int add_fragment(struct cache_entry *cached, off_t offset, int add_fragment(struct cache_entry *cached, off_t offset,
const unsigned char *data, ssize_t length); const char *data, ssize_t length);
/* Defragments the cache entry and returns the resulting fragment containing the /* Defragments the cache entry and returns the resulting fragment containing the
* complete source of all currently downloaded fragments. Returns NULL if * complete source of all currently downloaded fragments. Returns NULL if
@ -138,7 +138,7 @@ void delete_cache_entry(struct cache_entry *cached);
* Returns the URI being redirected to or NULL if allocation failed. * Returns the URI being redirected to or NULL if allocation failed.
*/ */
struct uri * struct uri *
redirect_cache(struct cache_entry *cached, unsigned char *location, redirect_cache(struct cache_entry *cached, char *location,
int get, int incomplete); int get, int incomplete);
/* The garbage collector trigger. If @whole is zero, remove unused cache /* The garbage collector trigger. If @whole is zero, remove unused cache

8
src/cache/dialogs.c vendored
View File

@ -45,7 +45,7 @@ is_cache_entry_used(struct listbox_item *item)
return is_object_used((struct cache_entry *) item->udata); return is_object_used((struct cache_entry *) item->udata);
} }
static unsigned char * static char *
get_cache_entry_text(struct listbox_item *item, struct terminal *term) get_cache_entry_text(struct listbox_item *item, struct terminal *term)
{ {
struct cache_entry *cached = item->udata; struct cache_entry *cached = item->udata;
@ -53,7 +53,7 @@ get_cache_entry_text(struct listbox_item *item, struct terminal *term)
return get_uri_string(cached->uri, URI_PUBLIC); return get_uri_string(cached->uri, URI_PUBLIC);
} }
static unsigned char * static char *
get_cache_entry_info(struct listbox_item *item, struct terminal *term) get_cache_entry_info(struct listbox_item *item, struct terminal *term)
{ {
struct cache_entry *cached = item->udata; struct cache_entry *cached = item->udata;
@ -189,7 +189,7 @@ delete_cache_entry_item(struct listbox_item *item, int last)
static enum listbox_match static enum listbox_match
match_cache_entry(struct listbox_item *item, struct terminal *term, match_cache_entry(struct listbox_item *item, struct terminal *term,
unsigned char *text) char *text)
{ {
struct cache_entry *cached = item->udata; struct cache_entry *cached = item->udata;
@ -202,7 +202,7 @@ match_cache_entry(struct listbox_item *item, struct terminal *term,
static enum listbox_match static enum listbox_match
match_cache_entry_contents(struct listbox_item *item, struct terminal *term, match_cache_entry_contents(struct listbox_item *item, struct terminal *term,
unsigned char *text) char *text)
{ {
struct cache_entry *cached = item->udata; struct cache_entry *cached = item->udata;
struct fragment *fragment = get_cache_fragment(cached); struct fragment *fragment = get_cache_fragment(cached);

View File

@ -41,10 +41,10 @@
/* Hack to handle URL extraction for -remote commands */ /* Hack to handle URL extraction for -remote commands */
static unsigned char *remote_url; static char *remote_url;
static enum retval static enum retval
parse_options_(int argc, unsigned char *argv[], struct option *opt, parse_options_(int argc, char *argv[], struct option *opt,
LIST_OF(struct string_list_item) *url_list) LIST_OF(struct string_list_item) *url_list)
{ {
while (argc) { while (argc) {
@ -52,9 +52,9 @@ parse_options_(int argc, unsigned char *argv[], struct option *opt,
if (argv[-1][0] == '-' && argv[-1][1]) { if (argv[-1][0] == '-' && argv[-1][1]) {
struct option *option; struct option *option;
unsigned char *argname = &argv[-1][1]; char *argname = &argv[-1][1];
unsigned char *oname = stracpy(argname); char *oname = stracpy(argname);
unsigned char *err; char *err;
if (!oname) continue; if (!oname) continue;
@ -64,7 +64,7 @@ parse_options_(int argc, unsigned char *argv[], struct option *opt,
option = get_opt_rec(opt, argname); option = get_opt_rec(opt, argname);
if (!option) option = get_opt_rec(opt, oname); if (!option) option = get_opt_rec(opt, oname);
if (!option) { if (!option) {
unsigned char *pos; char *pos;
oname++; /* the '-' */ oname++; /* the '-' */
/* Substitute '-' by '_'. This helps /* Substitute '-' by '_'. This helps
@ -116,7 +116,7 @@ unknown_option:
} }
enum retval enum retval
parse_options(int argc, unsigned char *argv[], parse_options(int argc, char *argv[],
LIST_OF(struct string_list_item) *url_list) LIST_OF(struct string_list_item) *url_list)
{ {
return parse_options_(argc, argv, cmdline_options, url_list); return parse_options_(argc, argv, cmdline_options, url_list);
@ -127,8 +127,8 @@ parse_options(int argc, unsigned char *argv[],
Options handlers Options handlers
**********************************************************************/ **********************************************************************/
static unsigned char * static char *
eval_cmd(struct option *o, unsigned char ***argv, int *argc) eval_cmd(struct option *o, char ***argv, int *argc)
{ {
if (*argc < 1) return gettext("Parameter expected"); if (*argc < 1) return gettext("Parameter expected");
@ -141,15 +141,15 @@ eval_cmd(struct option *o, unsigned char ***argv, int *argc)
return NULL; return NULL;
} }
static unsigned char * static char *
forcehtml_cmd(struct option *o, unsigned char ***argv, int *argc) forcehtml_cmd(struct option *o, char ***argv, int *argc)
{ {
safe_strncpy(get_opt_str("mime.default_type", NULL), "text/html", MAX_STR_LEN); safe_strncpy(get_opt_str("mime.default_type", NULL), "text/html", MAX_STR_LEN);
return NULL; return NULL;
} }
static unsigned char * static char *
lookup_cmd(struct option *o, unsigned char ***argv, int *argc) lookup_cmd(struct option *o, char ***argv, int *argc)
{ {
struct sockaddr_storage *addrs = NULL; struct sockaddr_storage *addrs = NULL;
int addrno, i; int addrno, i;
@ -170,7 +170,7 @@ lookup_cmd(struct option *o, unsigned char ***argv, int *argc)
for (i = 0; i < addrno; i++) { for (i = 0; i < addrno; i++) {
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
struct sockaddr_in6 addr = *((struct sockaddr_in6 *) &(addrs)[i]); struct sockaddr_in6 addr = *((struct sockaddr_in6 *) &(addrs)[i]);
unsigned char p[INET6_ADDRSTRLEN]; char p[INET6_ADDRSTRLEN];
if (! inet_ntop(addr.sin6_family, if (! inet_ntop(addr.sin6_family,
(addr.sin6_family == AF_INET6 ? (void *) &addr.sin6_addr (addr.sin6_family == AF_INET6 ? (void *) &addr.sin6_addr
@ -181,7 +181,7 @@ lookup_cmd(struct option *o, unsigned char ***argv, int *argc)
printf("%s\n", p); printf("%s\n", p);
#else #else
struct sockaddr_in addr = *((struct sockaddr_in *) &(addrs)[i]); struct sockaddr_in addr = *((struct sockaddr_in *) &(addrs)[i]);
unsigned char *p = (unsigned char *) &addr.sin_addr.s_addr; char *p = (char *) &addr.sin_addr.s_addr;
printf("%d.%d.%d.%d\n", (int) p[0], (int) p[1], printf("%d.%d.%d.%d\n", (int) p[0], (int) p[1],
(int) p[2], (int) p[3]); (int) p[2], (int) p[3]);
@ -210,12 +210,12 @@ enum remote_method_enum {
}; };
struct remote_method { struct remote_method {
unsigned char *name; char *name;
enum remote_method_enum type; enum remote_method_enum type;
}; };
static unsigned char * static char *
remote_cmd(struct option *o, unsigned char ***argv, int *argc) remote_cmd(struct option *o, char ***argv, int *argc)
{ {
struct remote_method remote_methods[] = { struct remote_method remote_methods[] = {
{ "openURL", REMOTE_METHOD_OPENURL }, { "openURL", REMOTE_METHOD_OPENURL },
@ -227,9 +227,9 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
{ "search", REMOTE_METHOD_SEARCH }, { "search", REMOTE_METHOD_SEARCH },
{ NULL, REMOTE_METHOD_NOT_SUPPORTED }, { NULL, REMOTE_METHOD_NOT_SUPPORTED },
}; };
unsigned char *command, *arg, *argend, *argstring; char *command, *arg, *argend, *argstring;
int method, len = 0; int method, len = 0;
unsigned char *remote_argv[10]; char *remote_argv[10];
int remote_argc; int remote_argc;
if (*argc < 1) return gettext("Parameter expected"); if (*argc < 1) return gettext("Parameter expected");
@ -265,7 +265,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
remote_argc = 0; remote_argc = 0;
do { do {
unsigned char *start, *end; char *start, *end;
if (remote_argc > sizeof_array(remote_argv)) { if (remote_argc > sizeof_array(remote_argv)) {
mem_free(argstring); mem_free(argstring);
@ -325,7 +325,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
} while (*arg); } while (*arg);
for (method = 0; remote_methods[method].name; method++) { for (method = 0; remote_methods[method].name; method++) {
unsigned char *name = remote_methods[method].name; char *name = remote_methods[method].name;
if (!c_strlcasecmp(command, len, name, -1)) if (!c_strlcasecmp(command, len, name, -1))
break; break;
@ -340,7 +340,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
} }
if (remote_argc == 2) { if (remote_argc == 2) {
unsigned char *where = remote_argv[1]; char *where = remote_argv[1];
if (strstr((const char *)where, "new-window")) { if (strstr((const char *)where, "new-window")) {
remote_session_flags |= SES_REMOTE_NEW_WINDOW; remote_session_flags |= SES_REMOTE_NEW_WINDOW;
@ -423,8 +423,8 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
return NULL; return NULL;
} }
static unsigned char * static char *
version_cmd(struct option *o, unsigned char ***argv, int *argc) version_cmd(struct option *o, char ***argv, int *argc)
{ {
printf("%s\n", full_static_version); printf("%s\n", full_static_version);
fflush(stdout); fflush(stdout);
@ -444,7 +444,7 @@ version_cmd(struct option *o, unsigned char ***argv, int *argc)
#define gettext_nonempty(x) (*(x) ? gettext(x) : (x)) #define gettext_nonempty(x) (*(x) ? gettext(x) : (x))
static void print_option_desc(const unsigned char *desc) static void print_option_desc(const char *desc)
{ {
struct string wrapped; struct string wrapped;
static const struct string indent = INIT_STRING(" ", 12); static const struct string indent = INIT_STRING(" ", 12);
@ -466,25 +466,25 @@ static void print_option_desc(const unsigned char *desc)
done_string(&wrapped); done_string(&wrapped);
} }
static void print_full_help_outer(struct option *tree, unsigned char *path); static void print_full_help_outer(struct option *tree, char *path);
static void static void
print_full_help_inner(struct option *tree, unsigned char *path, print_full_help_inner(struct option *tree, char *path,
int trees) int trees)
{ {
struct option *option; struct option *option;
unsigned char saved[MAX_STR_LEN]; char saved[MAX_STR_LEN];
unsigned char *savedpos = saved; char *savedpos = saved;
*savedpos = 0; *savedpos = 0;
foreach (option, *tree->value.tree) { foreach (option, *tree->value.tree) {
enum option_type type = option->type; enum option_type type = option->type;
unsigned char *help; char *help;
unsigned char *capt = option->capt; char *capt = option->capt;
unsigned char *desc = (option->desc && *option->desc) char *desc = (option->desc && *option->desc)
? (unsigned char *) gettext(option->desc) ? (char *) gettext(option->desc)
: (unsigned char *) "N/A"; : (char *) "N/A";
if (trees != (type == OPT_TREE)) if (trees != (type == OPT_TREE))
continue; continue;
@ -496,7 +496,7 @@ print_full_help_inner(struct option *tree, unsigned char *path,
continue; continue;
if (!capt && !c_strncasecmp(option->name, "_template_", 10)) if (!capt && !c_strncasecmp(option->name, "_template_", 10))
capt = (unsigned char *) N_("Template option folder"); capt = (char *) N_("Template option folder");
if (!capt) { if (!capt) {
int len = strlen(option->name); int len = strlen(option->name);
@ -543,7 +543,7 @@ print_full_help_inner(struct option *tree, unsigned char *path,
case OPT_COLOR: case OPT_COLOR:
{ {
color_T color = option->value.color; color_T color = option->value.color;
unsigned char hexcolor[8]; char hexcolor[8];
printf(gettext("(default: %s)"), printf(gettext("(default: %s)"),
get_color_string(color, hexcolor)); get_color_string(color, hexcolor));
@ -599,7 +599,7 @@ print_full_help_inner(struct option *tree, unsigned char *path,
} }
static void static void
print_full_help_outer(struct option *tree, unsigned char *path) print_full_help_outer(struct option *tree, char *path)
{ {
print_full_help_inner(tree, path, 0); print_full_help_inner(tree, path, 0);
print_full_help_inner(tree, path, 1); print_full_help_inner(tree, path, 1);
@ -612,17 +612,17 @@ print_short_help(void)
struct option *option; struct option *option;
struct string string = NULL_STRING; struct string string = NULL_STRING;
struct string *saved = NULL; struct string *saved = NULL;
unsigned char align[ALIGN_WIDTH]; char align[ALIGN_WIDTH];
/* Initialize @space used to align captions. */ /* Initialize @space used to align captions. */
memset(align, ' ', sizeof(align) - 1); memset(align, ' ', sizeof(align) - 1);
align[sizeof(align) - 1] = 0; align[sizeof(align) - 1] = 0;
foreach (option, *cmdline_options->value.tree) { foreach (option, *cmdline_options->value.tree) {
unsigned char *capt; char *capt;
unsigned char *help; char *help;
unsigned char *info = saved ? saved->source char *info = saved ? saved->source
: (unsigned char *) ""; : (char *) "";
int len = strlen(option->name); int len = strlen(option->name);
/* Avoid printing compatibility options */ /* Avoid printing compatibility options */
@ -666,10 +666,10 @@ print_short_help(void)
#undef gettext_nonempty #undef gettext_nonempty
static unsigned char * static char *
printhelp_cmd(struct option *option, unsigned char ***argv, int *argc) printhelp_cmd(struct option *option, char ***argv, int *argc)
{ {
unsigned char *lineend = strchr((const char *)full_static_version, '\n'); char *lineend = strchr((const char *)full_static_version, '\n');
if (lineend) *lineend = '\0'; if (lineend) *lineend = '\0';
@ -693,10 +693,10 @@ printhelp_cmd(struct option *option, unsigned char ***argv, int *argc)
return ""; return "";
} }
static unsigned char * static char *
redir_cmd(struct option *option, unsigned char ***argv, int *argc) redir_cmd(struct option *option, char ***argv, int *argc)
{ {
unsigned char *target; char *target;
/* I can't get any dirtier. --pasky */ /* I can't get any dirtier. --pasky */
@ -732,10 +732,10 @@ redir_cmd(struct option *option, unsigned char ***argv, int *argc)
return NULL; return NULL;
} }
static unsigned char * static char *
printconfigdump_cmd(struct option *option, unsigned char ***argv, int *argc) printconfigdump_cmd(struct option *option, char ***argv, int *argc)
{ {
unsigned char *config_string; char *config_string;
/* Print all. */ /* Print all. */
get_opt_int("config.saving_style", NULL) = 2; get_opt_int("config.saving_style", NULL) = 2;

View File

@ -8,7 +8,7 @@
extern "C" { extern "C" {
#endif #endif
enum retval parse_options(int, unsigned char *[], enum retval parse_options(int, char *[],
LIST_OF(struct string_list_item) *); LIST_OF(struct string_list_item) *);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -60,7 +60,7 @@
struct conf_parsing_pos { struct conf_parsing_pos {
/** Points to the next character to be parsed from the /** Points to the next character to be parsed from the
* configuration file. */ * configuration file. */
unsigned char *look; char *look;
/** The line number corresponding to #look. This is /** The line number corresponding to #look. This is
* shown in error messages. */ * shown in error messages. */
@ -78,11 +78,11 @@ struct conf_parsing_state {
* to the mirror string. Otherwise, @c mirrored is not used. * to the mirror string. Otherwise, @c mirrored is not used.
* *
* @invariant @c mirrored @<= @c pos.look */ * @invariant @c mirrored @<= @c pos.look */
unsigned char *mirrored; char *mirrored;
/** File name for error messages. If NULL then do not display /** File name for error messages. If NULL then do not display
* error messages. */ * error messages. */
const unsigned char *filename; const char *filename;
}; };
/** Tell the user about an error in the configuration file. /** Tell the user about an error in the configuration file.
@ -90,7 +90,7 @@ struct conf_parsing_state {
static enum parse_error static enum parse_error
show_parse_error(const struct conf_parsing_state *state, enum parse_error err) show_parse_error(const struct conf_parsing_state *state, enum parse_error err)
{ {
static const unsigned char error_msg[][40] = { static const char error_msg[][40] = {
"no error", /* ERROR_NONE */ "no error", /* ERROR_NONE */
"unknown command", /* ERROR_COMMAND */ "unknown command", /* ERROR_COMMAND */
"parse error", /* ERROR_PARSE */ "parse error", /* ERROR_PARSE */
@ -110,7 +110,7 @@ show_parse_error(const struct conf_parsing_state *state, enum parse_error err)
static void static void
skip_white(struct conf_parsing_pos *pos) skip_white(struct conf_parsing_pos *pos)
{ {
unsigned char *start = pos->look; char *start = pos->look;
while (*start) { while (*start) {
while (isspace(*start)) { while (isspace(*start)) {
@ -202,12 +202,12 @@ static enum parse_error
parse_set_common(struct option *opt_tree, struct conf_parsing_state *state, parse_set_common(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf, int want_domain) struct string *mirror, int is_system_conf, int want_domain)
{ {
const unsigned char *domain_orig = NULL; const char *domain_orig = NULL;
size_t domain_len = 0; size_t domain_len = 0;
unsigned char *domain_copy = NULL; char *domain_copy = NULL;
const unsigned char *optname_orig; const char *optname_orig;
size_t optname_len; size_t optname_len;
unsigned char *optname_copy; char *optname_copy;
skip_white(&state->pos); skip_white(&state->pos);
if (!*state->pos.look) return show_parse_error(state, ERROR_PARSE); if (!*state->pos.look) return show_parse_error(state, ERROR_PARSE);
@ -252,7 +252,7 @@ parse_set_common(struct option *opt_tree, struct conf_parsing_state *state,
/* Option value */ /* Option value */
{ {
struct option *opt; struct option *opt;
unsigned char *val; char *val;
const struct conf_parsing_pos pos_before_value = state->pos; const struct conf_parsing_pos pos_before_value = state->pos;
if (want_domain && *domain_copy) { if (want_domain && *domain_copy) {
@ -403,9 +403,9 @@ static enum parse_error
parse_unset(struct option *opt_tree, struct conf_parsing_state *state, parse_unset(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf) struct string *mirror, int is_system_conf)
{ {
const unsigned char *optname_orig; const char *optname_orig;
size_t optname_len; size_t optname_len;
unsigned char *optname_copy; char *optname_copy;
skip_white(&state->pos); skip_white(&state->pos);
if (!*state->pos.look) return show_parse_error(state, ERROR_PARSE); if (!*state->pos.look) return show_parse_error(state, ERROR_PARSE);
@ -480,7 +480,7 @@ static enum parse_error
parse_bind(struct option *opt_tree, struct conf_parsing_state *state, parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf) struct string *mirror, int is_system_conf)
{ {
unsigned char *keymap, *keystroke, *action; char *keymap, *keystroke, *action;
enum parse_error err = ERROR_NONE; enum parse_error err = ERROR_NONE;
struct conf_parsing_pos before_error; struct conf_parsing_pos before_error;
@ -550,7 +550,7 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
/* Mirror what we already have. If the keystroke has /* Mirror what we already have. If the keystroke has
* been unbound, then act_str is simply "none" and * been unbound, then act_str is simply "none" and
* this does not require special handling. */ * this does not require special handling. */
unsigned char *act_str = bind_act(keymap, keystroke); char *act_str = bind_act(keymap, keystroke);
if (act_str) { if (act_str) {
add_bytes_to_string(mirror, state->mirrored, add_bytes_to_string(mirror, state->mirrored,
@ -566,14 +566,14 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
return err; return err;
} }
static int load_config_file(unsigned char *, unsigned char *, struct option *, static int load_config_file(char *, char *, struct option *,
struct string *, int); struct string *, int);
static enum parse_error static enum parse_error
parse_include(struct option *opt_tree, struct conf_parsing_state *state, parse_include(struct option *opt_tree, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf) struct string *mirror, int is_system_conf)
{ {
unsigned char *fname; char *fname;
struct string dumbstring; struct string dumbstring;
struct conf_parsing_pos before_error; struct conf_parsing_pos before_error;
@ -603,7 +603,7 @@ parse_include(struct option *opt_tree, struct conf_parsing_state *state,
* rarely-used option ;). */ * rarely-used option ;). */
/* XXX: We should try CONFDIR/<file> when proceeding /* XXX: We should try CONFDIR/<file> when proceeding
* CONFDIR/<otherfile> ;). --pasky */ * CONFDIR/<otherfile> ;). --pasky */
if (load_config_file(fname[0] == '/' ? (unsigned char *) "" if (load_config_file(fname[0] == '/' ? (char *) ""
: elinks_home, : elinks_home,
fname, opt_tree, fname, opt_tree,
mirror ? &dumbstring : NULL, 1)) { mirror ? &dumbstring : NULL, 1)) {
@ -619,7 +619,7 @@ parse_include(struct option *opt_tree, struct conf_parsing_state *state,
struct parse_handler { struct parse_handler {
const unsigned char *command; const char *command;
enum parse_error (*handler)(struct option *opt_tree, enum parse_error (*handler)(struct option *opt_tree,
struct conf_parsing_state *state, struct conf_parsing_state *state,
struct string *mirror, int is_system_conf); struct string *mirror, int is_system_conf);
@ -673,7 +673,7 @@ parse_config_command(struct option *options, struct conf_parsing_state *state,
#ifdef CONFIG_EXMODE #ifdef CONFIG_EXMODE
enum parse_error enum parse_error
parse_config_exmode_command(unsigned char *cmd) parse_config_exmode_command(char *cmd)
{ {
struct conf_parsing_state state = {{ 0 }}; struct conf_parsing_state state = {{ 0 }};
@ -687,8 +687,8 @@ parse_config_exmode_command(unsigned char *cmd)
#endif /* CONFIG_EXMODE */ #endif /* CONFIG_EXMODE */
void void
parse_config_file(struct option *options, unsigned char *name, parse_config_file(struct option *options, char *name,
unsigned char *file, struct string *mirror, char *file, struct string *mirror,
int is_system_conf) int is_system_conf)
{ {
struct conf_parsing_state state = {{ 0 }}; struct conf_parsing_state state = {{ 0 }};
@ -761,11 +761,11 @@ parse_config_file(struct option *options, unsigned char *name,
static unsigned char * static char *
read_config_file(unsigned char *name) read_config_file(char *name)
{ {
#define FILE_BUF 1024 #define FILE_BUF 1024
unsigned char cfg_buffer[FILE_BUF]; char cfg_buffer[FILE_BUF];
struct string string; struct string string;
int fd; int fd;
ssize_t r; ssize_t r;
@ -796,21 +796,21 @@ read_config_file(unsigned char *name)
/* Return 0 on success. */ /* Return 0 on success. */
static int static int
load_config_file(unsigned char *prefix, unsigned char *name, load_config_file(char *prefix, char *name,
struct option *options, struct string *mirror, struct option *options, struct string *mirror,
int is_system_conf) int is_system_conf)
{ {
unsigned char *config_str, *config_file; char *config_str, *config_file;
config_file = straconcat(prefix, STRING_DIR_SEP, name, config_file = straconcat(prefix, STRING_DIR_SEP, name,
(unsigned char *) NULL); (char *) NULL);
if (!config_file) return 1; if (!config_file) return 1;
config_str = read_config_file(config_file); config_str = read_config_file(config_file);
if (!config_str) { if (!config_str) {
mem_free(config_file); mem_free(config_file);
config_file = straconcat(prefix, STRING_DIR_SEP, ".", name, config_file = straconcat(prefix, STRING_DIR_SEP, ".", name,
(unsigned char *) NULL); (char *) NULL);
if (!config_file) return 2; if (!config_file) return 2;
config_str = read_config_file(config_file); config_str = read_config_file(config_file);
@ -830,7 +830,7 @@ load_config_file(unsigned char *prefix, unsigned char *name,
} }
static void static void
load_config_from(unsigned char *file, struct option *tree) load_config_from(char *file, struct option *tree)
{ {
load_config_file(CONFDIR, file, tree, NULL, 1); load_config_file(CONFDIR, file, tree, NULL, 1);
load_config_file(empty_string_or_(elinks_home), file, tree, NULL, 0); load_config_file(empty_string_or_(elinks_home), file, tree, NULL, 0);
@ -848,8 +848,8 @@ static int indentation = 2;
/* 0 -> none, 1 -> only option full name+type, 2 -> only desc, 3 -> both */ /* 0 -> none, 1 -> only option full name+type, 2 -> only desc, 3 -> both */
static int comments = 3; static int comments = 3;
static inline unsigned char * static inline char *
conf_i18n(unsigned char *s, int i18n) conf_i18n(char *s, int i18n)
{ {
if (i18n) return gettext(s); if (i18n) return gettext(s);
return s; return s;
@ -864,11 +864,11 @@ add_indent_to_string(struct string *string, int depth)
} }
struct string * struct string *
wrap_option_desc(struct string *out, const unsigned char *src, wrap_option_desc(struct string *out, const char *src,
const struct string *indent, int maxwidth) const struct string *indent, int maxwidth)
{ {
const unsigned char *last_space = NULL; const char *last_space = NULL;
const unsigned char *uncopied = src; const char *uncopied = src;
int width = 0; int width = 0;
/* TODO: multibyte or fullwidth characters */ /* TODO: multibyte or fullwidth characters */
@ -909,7 +909,7 @@ static void
output_option_desc_as_comment(struct string *out, const struct option *option, output_option_desc_as_comment(struct string *out, const struct option *option,
int i18n, int depth) int i18n, int depth)
{ {
unsigned char *desc_i18n = conf_i18n(option->desc, i18n); char *desc_i18n = conf_i18n(option->desc, i18n);
struct string indent; struct string indent;
if (!init_string(&indent)) return; if (!init_string(&indent)) return;
@ -923,11 +923,11 @@ out_of_memory:
done_string(&indent); done_string(&indent);
} }
static unsigned char *smart_config_output_fn_domain; static char *smart_config_output_fn_domain;
static void static void
smart_config_output_fn(struct string *string, struct option *option, smart_config_output_fn(struct string *string, struct option *option,
unsigned char *path, int depth, int do_print_comment, char *path, int depth, int do_print_comment,
int action, int i18n) int action, int i18n)
{ {
if (option->type == OPT_ALIAS) if (option->type == OPT_ALIAS)
@ -999,7 +999,7 @@ smart_config_output_fn(struct string *string, struct option *option,
static void static void
add_cfg_header_to_string(struct string *string, unsigned char *text) add_cfg_header_to_string(struct string *string, char *text)
{ {
int n = strlen(text) + 2; int n = strlen(text) + 2;
@ -1012,8 +1012,8 @@ add_cfg_header_to_string(struct string *string, unsigned char *text)
add_to_string(string, "#\n\n"); add_to_string(string, "#\n\n");
} }
unsigned char * char *
create_config_string(unsigned char *prefix, unsigned char *name) create_config_string(char *prefix, char *name)
{ {
struct option *options = config_options; struct option *options = config_options;
struct string config; struct string config;
@ -1130,23 +1130,23 @@ get_me_out:
} }
static int static int
write_config_file(unsigned char *prefix, unsigned char *name, write_config_file(char *prefix, char *name,
struct terminal *term) struct terminal *term)
{ {
int ret = -1; int ret = -1;
struct secure_save_info *ssi; struct secure_save_info *ssi;
unsigned char *config_file = NULL; char *config_file = NULL;
unsigned char *cfg_str = create_config_string(prefix, name); char *cfg_str = create_config_string(prefix, name);
int prefixlen = strlen(prefix); int prefixlen = strlen(prefix);
int prefix_has_slash = (prefixlen && dir_sep(prefix[prefixlen - 1])); int prefix_has_slash = (prefixlen && dir_sep(prefix[prefixlen - 1]));
int name_has_slash = dir_sep(name[0]); int name_has_slash = dir_sep(name[0]);
unsigned char *slash = name_has_slash || prefix_has_slash ? "" : STRING_DIR_SEP; char *slash = name_has_slash || prefix_has_slash ? "" : STRING_DIR_SEP;
if (!cfg_str) return -1; if (!cfg_str) return -1;
if (name_has_slash && prefix_has_slash) name++; if (name_has_slash && prefix_has_slash) name++;
config_file = straconcat(prefix, slash, name, (unsigned char *) NULL); config_file = straconcat(prefix, slash, name, (char *) NULL);
if (!config_file) goto free_cfg_str; if (!config_file) goto free_cfg_str;
ssi = secure_open(config_file); ssi = secure_open(config_file);

View File

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

View File

@ -39,12 +39,12 @@ disable_success_msgbox(void *dummy)
} }
void void
write_config_dialog(struct terminal *term, unsigned char *config_file, write_config_dialog(struct terminal *term, char *config_file,
int secsave_error, int stdio_error) int secsave_error, int stdio_error)
{ {
/* [gettext_accelerator_context(write_config_dialog)] */ /* [gettext_accelerator_context(write_config_dialog)] */
unsigned char *errmsg = NULL; char *errmsg = NULL;
unsigned char *strerr; char *strerr;
if (secsave_error == SS_ERR_NONE && !stdio_error) { if (secsave_error == SS_ERR_NONE && !stdio_error) {
if (!get_opt_bool("ui.success_msgbox", NULL)) return; if (!get_opt_bool("ui.success_msgbox", NULL)) return;
@ -63,7 +63,7 @@ write_config_dialog(struct terminal *term, unsigned char *config_file,
if (stdio_error > 0) if (stdio_error > 0)
errmsg = straconcat(strerr, " (", strerror(stdio_error), ")", errmsg = straconcat(strerr, " (", strerror(stdio_error), ")",
(unsigned char *) NULL); (char *) NULL);
info_box(term, MSGBOX_FREE_TEXT, info_box(term, MSGBOX_FREE_TEXT,
N_("Write config error"), ALIGN_CENTER, N_("Write config error"), ALIGN_CENTER,
@ -99,7 +99,7 @@ is_option_used(struct listbox_item *item)
return is_object_used((struct option *) item->udata); return is_object_used((struct option *) item->udata);
} }
static unsigned char * static char *
get_range_string(struct option *option) get_range_string(struct option *option)
{ {
struct string info; struct string info;
@ -114,25 +114,25 @@ get_range_string(struct option *option)
return info.source; return info.source;
} }
static unsigned char * static char *
get_option_text(struct listbox_item *item, struct terminal *term) get_option_text(struct listbox_item *item, struct terminal *term)
{ {
struct option *option = item->udata; struct option *option = item->udata;
unsigned char *desc = option->capt ? option->capt : option->name; char *desc = option->capt ? option->capt : option->name;
if (option->flags & OPT_TOUCHED) if (option->flags & OPT_TOUCHED)
return straconcat(_(desc, term), return straconcat(_(desc, term),
" (", _("modified", term), ")", " (", _("modified", term), ")",
(unsigned char *) NULL); (char *) NULL);
return stracpy(_(desc, term)); return stracpy(_(desc, term));
} }
static unsigned char * static char *
get_option_info(struct listbox_item *item, struct terminal *term) get_option_info(struct listbox_item *item, struct terminal *term)
{ {
struct option *option = item->udata; struct option *option = item->udata;
unsigned char *desc, *type; char *desc, *type;
struct string info; struct string info;
if (!init_string(&info)) return NULL; if (!init_string(&info)) return NULL;
@ -143,7 +143,7 @@ get_option_info(struct listbox_item *item, struct terminal *term)
if (option->type == OPT_TREE) { if (option->type == OPT_TREE) {
type = straconcat(type, " ", type = straconcat(type, " ",
_("(expand by pressing space)", term), _("(expand by pressing space)", term),
(unsigned char *) NULL); (char *) NULL);
} }
add_format_to_string(&info, "\n%s: %s", _("Type", term), type); add_format_to_string(&info, "\n%s: %s", _("Type", term), type);
@ -153,7 +153,7 @@ get_option_info(struct listbox_item *item, struct terminal *term)
} }
if (option_types[option->type].write) { if (option_types[option->type].write) {
unsigned char *range; char *range;
struct string value; struct string value;
if (!init_string(&value)) { if (!init_string(&value)) {
@ -181,7 +181,7 @@ get_option_info(struct listbox_item *item, struct terminal *term)
} }
desc = _(option->desc ? option->desc : (unsigned char *) "N/A", term); desc = _(option->desc ? option->desc : (char *) "N/A", term);
if (*desc) if (*desc)
add_format_to_string(&info, "\n\n%s:\n%s", _("Description", term), desc); add_format_to_string(&info, "\n\n%s:\n%s", _("Description", term), desc);
@ -202,7 +202,7 @@ get_option_root(struct listbox_item *item)
static enum listbox_match static enum listbox_match
match_option(struct listbox_item *item, struct terminal *term, match_option(struct listbox_item *item, struct terminal *term,
unsigned char *text) char *text)
{ {
struct option *option = item->udata; struct option *option = item->udata;
@ -268,8 +268,8 @@ check_valid_option(struct dialog_data *dlg_data, struct widget_data *widget_data
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
struct option *option = dlg_data->dlg->udata; struct option *option = dlg_data->dlg->udata;
struct session *ses = dlg_data->dlg->udata2; struct session *ses = dlg_data->dlg->udata2;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
unsigned char *chinon; char *chinon;
int dummy_line = 0; int dummy_line = 0;
commandline = 1; commandline = 1;
@ -301,7 +301,7 @@ build_edit_dialog(struct terminal *term, struct session *ses,
/* [gettext_accelerator_context(.build_edit_dialog)] */ /* [gettext_accelerator_context(.build_edit_dialog)] */
#define EDIT_WIDGETS_COUNT 5 #define EDIT_WIDGETS_COUNT 5
struct dialog *dlg; struct dialog *dlg;
unsigned char *value, *name, *desc, *range; char *value, *name, *desc, *range;
struct string tvalue; struct string tvalue;
if (!init_string(&tvalue)) return; if (!init_string(&tvalue)) return;
@ -329,18 +329,18 @@ build_edit_dialog(struct terminal *term, struct session *ses,
name = straconcat(_("Name", term), ": ", option->name, "\n", name = straconcat(_("Name", term), ": ", option->name, "\n",
_("Type", term), ": ", _("Type", term), ": ",
_(option_types[option->type].name, term), _(option_types[option->type].name, term),
(unsigned char *) NULL); (char *) NULL);
desc = straconcat(_("Description", term), ": \n", desc = straconcat(_("Description", term), ": \n",
_(option->desc ? option->desc _(option->desc ? option->desc
: (unsigned char *) "N/A", term), : (char *) "N/A", term),
(unsigned char *) NULL); (char *) NULL);
range = get_range_string(option); range = get_range_string(option);
if (range) { if (range) {
if (*range) { if (*range) {
unsigned char *tmp; char *tmp;
tmp = straconcat(name, " ", range, tmp = straconcat(name, " ", range,
(unsigned char *) NULL); (char *) NULL);
if (tmp) { if (tmp) {
mem_free(name); mem_free(name);
name = tmp; name = tmp;
@ -406,7 +406,7 @@ struct add_option_to_tree_ctx {
}; };
static void static void
add_option_to_tree(void *data, unsigned char *name) add_option_to_tree(void *data, char *name)
{ {
struct add_option_to_tree_ctx *ctx = data; struct add_option_to_tree_ctx *ctx = data;
struct option *old = get_opt_rec_real(ctx->option, name); struct option *old = get_opt_rec_real(ctx->option, name);
@ -422,7 +422,7 @@ add_option_to_tree(void *data, unsigned char *name)
static widget_handler_status_T static widget_handler_status_T
check_option_name(struct dialog_data *dlg_data, struct widget_data *widget_data) check_option_name(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
unsigned char *p; char *p;
for (p = widget_data->cdata; *p; p++) for (p = widget_data->cdata; *p; p++)
if (!is_option_name_char(*p)) { if (!is_option_name_char(*p)) {
@ -632,7 +632,7 @@ is_keybinding_used(struct listbox_item *item)
return is_object_used((struct keybinding *) item->udata); return is_object_used((struct keybinding *) item->udata);
} }
static unsigned char * static char *
get_keybinding_text(struct listbox_item *item, struct terminal *term) get_keybinding_text(struct listbox_item *item, struct terminal *term)
{ {
struct keybinding *keybinding = item->udata; struct keybinding *keybinding = item->udata;
@ -655,11 +655,11 @@ get_keybinding_text(struct listbox_item *item, struct terminal *term)
return info.source; return info.source;
} }
static unsigned char * static char *
get_keybinding_info(struct listbox_item *item, struct terminal *term) get_keybinding_info(struct listbox_item *item, struct terminal *term)
{ {
struct keybinding *keybinding = item->udata; struct keybinding *keybinding = item->udata;
unsigned char *action, *keymap; char *action, *keymap;
struct string info; struct string info;
if (item->depth < 2) return NULL; if (item->depth < 2) return NULL;
@ -698,10 +698,10 @@ get_keybinding_root(struct listbox_item *item)
static enum listbox_match static enum listbox_match
match_keybinding(struct listbox_item *item, struct terminal *term, match_keybinding(struct listbox_item *item, struct terminal *term,
unsigned char *text) char *text)
{ {
const struct action *action = item->udata; const struct action *action = item->udata;
unsigned char *desc; char *desc;
if (item->depth != 1) if (item->depth != 1)
return LISTBOX_MATCH_IMPOSSIBLE; return LISTBOX_MATCH_IMPOSSIBLE;
@ -783,7 +783,7 @@ really_really_add_keybinding(void *data)
} }
static void static void
really_add_keybinding(void *data, unsigned char *keystroke) really_add_keybinding(void *data, char *keystroke)
{ {
/* [gettext_accelerator_context(.really_add_keybinding.yn)] */ /* [gettext_accelerator_context(.really_add_keybinding.yn)] */
struct kbdbind_add_hop *hop = data; struct kbdbind_add_hop *hop = data;
@ -834,7 +834,7 @@ static widget_handler_status_T
check_keystroke(struct dialog_data *dlg_data, struct widget_data *widget_data) check_keystroke(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct kbdbind_add_hop *hop = dlg_data->dlg->udata2; struct kbdbind_add_hop *hop = dlg_data->dlg->udata2;
unsigned char *keystroke = widget_data->cdata; char *keystroke = widget_data->cdata;
if (parse_keystroke(keystroke, &hop->kbd) >= 0) if (parse_keystroke(keystroke, &hop->kbd) >= 0)
return EVENT_PROCESSED; return EVENT_PROCESSED;
@ -853,7 +853,7 @@ push_kbdbind_add_button(struct dialog_data *dlg_data,
struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct listbox_data *box = get_dlg_listbox_data(dlg_data);
struct listbox_item *item = box->sel; struct listbox_item *item = box->sel;
struct kbdbind_add_hop *hop; struct kbdbind_add_hop *hop;
unsigned char *text; char *text;
if (!item || !item->depth) { if (!item || !item->depth) {
info_box(term, 0, N_("Add keybinding"), ALIGN_CENTER, info_box(term, 0, N_("Add keybinding"), ALIGN_CENTER,

View File

@ -14,7 +14,7 @@ extern "C" {
extern struct hierbox_browser option_browser; extern struct hierbox_browser option_browser;
extern struct hierbox_browser keybinding_browser; extern struct hierbox_browser keybinding_browser;
void write_config_dialog(struct terminal *term, unsigned char *config_file, void write_config_dialog(struct terminal *term, char *config_file,
int secsave_error, int stdio_error); int secsave_error, int stdio_error);
void options_manager(struct session *); void options_manager(struct session *);
void keybinding_manager(struct session *); void keybinding_manager(struct session *);

View File

@ -24,8 +24,8 @@ INIT_LIST_OF(struct domain_tree, domain_trees);
* match the given domain-name. Return the option from the the shadow tree * match the given domain-name. Return the option from the the shadow tree
* that best matches the given domain name. */ * that best matches the given domain name. */
static struct option * static struct option *
get_domain_option(unsigned char *domain_name, int domain_len, get_domain_option(char *domain_name, int domain_len,
unsigned char *name) char *name)
{ {
struct option *opt, *longest_match_opt = NULL; struct option *opt, *longest_match_opt = NULL;
struct domain_tree *longest_match = NULL; struct domain_tree *longest_match = NULL;
@ -46,7 +46,7 @@ get_domain_option(unsigned char *domain_name, int domain_len,
} }
struct option * struct option *
get_domain_option_from_session(unsigned char *name, struct session *ses) get_domain_option_from_session(char *name, struct session *ses)
{ {
struct uri *uri; struct uri *uri;
@ -66,7 +66,7 @@ get_domain_option_from_session(unsigned char *name, struct session *ses)
/* Return the shadow shadow tree for the given domain name, and /* Return the shadow shadow tree for the given domain name, and
* if the domain does not yet have a shadow tree, create it. */ * if the domain does not yet have a shadow tree, create it. */
struct option * struct option *
get_domain_tree(unsigned char *domain_name) get_domain_tree(char *domain_name)
{ {
struct domain_tree *domain; struct domain_tree *domain;
int domain_len; int domain_len;

View File

@ -18,14 +18,14 @@ struct domain_tree {
int len; int len;
unsigned char name[1]; /* Must be at end of struct. */ char name[1]; /* Must be at end of struct. */
}; };
extern LIST_OF(struct domain_tree) domain_trees; extern LIST_OF(struct domain_tree) domain_trees;
struct option *get_domain_tree(unsigned char *); struct option *get_domain_tree(char *);
struct option *get_domain_option_from_session(unsigned char *, struct option *get_domain_option_from_session(char *,
struct session *); struct session *);
void done_domain_trees(void); void done_domain_trees(void);

View File

@ -24,11 +24,11 @@
#include "util/string.h" #include "util/string.h"
unsigned char *elinks_home = NULL; char *elinks_home = NULL;
int first_use = 0; int first_use = 0;
static inline void static inline void
strip_trailing_dir_sep(unsigned char *path) strip_trailing_dir_sep(char *path)
{ {
int i; int i;
@ -39,18 +39,18 @@ strip_trailing_dir_sep(unsigned char *path)
path[i + 1] = 0; path[i + 1] = 0;
} }
static unsigned char * static char *
test_confdir(unsigned char *home, unsigned char *path, test_confdir(char *home, char *path,
unsigned char *error_message) char *error_message)
{ {
struct stat st; struct stat st;
unsigned char *confdir; char *confdir;
if (!path || !*path) return NULL; if (!path || !*path) return NULL;
if (home && *home && !dir_sep(*path)) if (home && *home && !dir_sep(*path))
confdir = straconcat(home, STRING_DIR_SEP, path, confdir = straconcat(home, STRING_DIR_SEP, path,
(unsigned char *) NULL); (char *) NULL);
else else
confdir = stracpy(path); confdir = stracpy(path);
@ -86,11 +86,11 @@ test_confdir(unsigned char *home, unsigned char *path,
} }
/* TODO: Check possibility to use <libgen.h> dirname. */ /* TODO: Check possibility to use <libgen.h> dirname. */
static unsigned char * static char *
elinks_dirname(unsigned char *path) elinks_dirname(char *path)
{ {
int i; int i;
unsigned char *dir; char *dir;
if (!path) return NULL; if (!path) return NULL;
@ -106,12 +106,12 @@ elinks_dirname(unsigned char *path)
return dir; return dir;
} }
static unsigned char * static char *
get_home(void) get_home(void)
{ {
unsigned char *home_elinks; char *home_elinks;
unsigned char *envhome = getenv("HOME"); char *envhome = getenv("HOME");
unsigned char *home = NULL; char *home = NULL;
if (!home && envhome) if (!home && envhome)
home = stracpy(envhome); home = stracpy(envhome);

View File

@ -5,7 +5,7 @@
extern "C" { extern "C" {
#endif #endif
extern unsigned char *elinks_home; extern char *elinks_home;
extern int first_use; extern int first_use;
void init_home(void); void init_home(void);

View File

@ -231,7 +231,7 @@ kbd_act_lookup(enum keymap_id keymap_id, action_id_T action_id)
} }
struct keybinding * struct keybinding *
kbd_nm_lookup(enum keymap_id keymap_id, unsigned char *name) kbd_nm_lookup(enum keymap_id keymap_id, char *name)
{ {
action_id_T action_id = get_action_from_string(keymap_id, name); action_id_T action_id = get_action_from_string(keymap_id, name);
@ -241,7 +241,7 @@ kbd_nm_lookup(enum keymap_id keymap_id, unsigned char *name)
} }
static struct keybinding * static struct keybinding *
kbd_stroke_lookup(enum keymap_id keymap_id, const unsigned char *keystroke_str) kbd_stroke_lookup(enum keymap_id keymap_id, const char *keystroke_str)
{ {
struct term_event_keyboard kbd; struct term_event_keyboard kbd;
@ -260,7 +260,7 @@ kbd_stroke_lookup(enum keymap_id keymap_id, const unsigned char *keystroke_str)
static const struct action * static const struct action *
get_action_from_keystroke(enum keymap_id keymap_id, get_action_from_keystroke(enum keymap_id keymap_id,
const unsigned char *keystroke_str) const char *keystroke_str)
{ {
struct keybinding *keybinding = kbd_stroke_lookup(keymap_id, struct keybinding *keybinding = kbd_stroke_lookup(keymap_id,
keystroke_str); keystroke_str);
@ -268,9 +268,9 @@ get_action_from_keystroke(enum keymap_id keymap_id,
return keybinding ? get_action(keymap_id, keybinding->action_id) : NULL; return keybinding ? get_action(keymap_id, keybinding->action_id) : NULL;
} }
unsigned char * char *
get_action_name_from_keystroke(enum keymap_id keymap_id, get_action_name_from_keystroke(enum keymap_id keymap_id,
const unsigned char *keystroke_str) const char *keystroke_str)
{ {
const struct action *action = get_action_from_keystroke(keymap_id, const struct action *action = get_action_from_keystroke(keymap_id,
keystroke_str); keystroke_str);
@ -279,7 +279,7 @@ get_action_name_from_keystroke(enum keymap_id keymap_id,
} }
action_id_T action_id_T
get_action_from_string(enum keymap_id keymap_id, unsigned char *str) get_action_from_string(enum keymap_id keymap_id, char *str)
{ {
const struct action *action; const struct action *action;
@ -303,7 +303,7 @@ get_action(enum keymap_id keymap_id, action_id_T action_id)
return NULL; return NULL;
} }
unsigned char * char *
get_action_name(enum keymap_id keymap_id, action_id_T action_id) get_action_name(enum keymap_id keymap_id, action_id_T action_id)
{ {
const struct action *action = get_action(keymap_id, action_id); const struct action *action = get_action(keymap_id, action_id);
@ -311,7 +311,7 @@ get_action_name(enum keymap_id keymap_id, action_id_T action_id)
return action ? action->str : NULL; return action ? action->str : NULL;
} }
static unsigned char * static char *
get_action_desc(enum keymap_id keymap_id, action_id_T action_id) get_action_desc(enum keymap_id keymap_id, action_id_T action_id)
{ {
const struct action *action = get_action(keymap_id, action_id); const struct action *action = get_action(keymap_id, action_id);
@ -330,7 +330,7 @@ get_keymap(enum keymap_id keymap_id)
} }
static enum keymap_id static enum keymap_id
get_keymap_id(unsigned char *keymap_str) get_keymap_id(char *keymap_str)
{ {
int keymap_id; int keymap_id;
@ -341,7 +341,7 @@ get_keymap_id(unsigned char *keymap_str)
return KEYMAP_INVALID; return KEYMAP_INVALID;
} }
unsigned char * char *
get_keymap_name(enum keymap_id keymap_id) get_keymap_name(enum keymap_id keymap_id)
{ {
return get_keymap(keymap_id)->str; return get_keymap(keymap_id)->str;
@ -349,7 +349,7 @@ get_keymap_name(enum keymap_id keymap_id)
struct named_key { struct named_key {
const unsigned char *str; const char *str;
term_event_key_T num; term_event_key_T num;
}; };
@ -385,7 +385,7 @@ static const struct named_key key_table[] = {
}; };
term_event_key_T term_event_key_T
read_key(const unsigned char *key_str) read_key(const char *key_str)
{ {
const struct named_key *key; const struct named_key *key;
@ -406,7 +406,7 @@ read_key(const unsigned char *key_str)
* This function does not support ::KBD_MOD_PASTE, because keystrokes * This function does not support ::KBD_MOD_PASTE, because keystrokes
* that include it should never be bound to actions. */ * that include it should never be bound to actions. */
int int
parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd) parse_keystroke(const char *s, struct term_event_keyboard *kbd)
{ {
kbd->modifier = KBD_MOD_NONE; kbd->modifier = KBD_MOD_NONE;
while (1) { while (1) {
@ -470,8 +470,8 @@ void
add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd,
int escape) int escape)
{ {
unsigned char key_buffer[3] = "\\x"; char key_buffer[3] = "\\x";
const unsigned char *key_string = NULL; const char *key_string = NULL;
const struct named_key *key; const struct named_key *key;
if (kbd->key == KBD_UNDEF) return; if (kbd->key == KBD_UNDEF) return;
@ -512,7 +512,7 @@ add_keystroke_action_to_string(struct string *string, action_id_T action_id,
add_keystroke_to_string(string, &keybinding->kbd, 0); add_keystroke_to_string(string, &keybinding->kbd, 0);
} }
unsigned char * char *
get_keystroke(action_id_T action_id, enum keymap_id keymap_id) get_keystroke(action_id_T action_id, enum keymap_id keymap_id)
{ {
struct string keystroke; struct string keystroke;
@ -540,7 +540,7 @@ add_actions_to_string(struct string *string, action_id_T action_ids[],
for (i = 0; action_ids[i] != ACT_MAIN_NONE; i++) { for (i = 0; action_ids[i] != ACT_MAIN_NONE; i++) {
struct keybinding *keybinding = kbd_act_lookup(keymap_id, action_ids[i]); struct keybinding *keybinding = kbd_act_lookup(keymap_id, action_ids[i]);
int keystrokelen = string->length; int keystrokelen = string->length;
unsigned char *desc = get_action_desc(keymap_id, action_ids[i]); char *desc = get_action_desc(keymap_id, action_ids[i]);
if (!keybinding) continue; if (!keybinding) continue;
@ -582,8 +582,8 @@ free_keymaps(struct module *xxx)
*/ */
#ifdef CONFIG_SCRIPTING #ifdef CONFIG_SCRIPTING
static unsigned char * static char *
bind_key_to_event(unsigned char *ckmap, const unsigned char *ckey, int event) bind_key_to_event(char *ckmap, const char *ckey, int event)
{ {
struct term_event_keyboard kbd; struct term_event_keyboard kbd;
action_id_T action_id; action_id_T action_id;
@ -605,8 +605,8 @@ bind_key_to_event(unsigned char *ckmap, const unsigned char *ckey, int event)
} }
int int
bind_key_to_event_name(unsigned char *ckmap, const unsigned char *ckey, bind_key_to_event_name(char *ckmap, const char *ckey,
unsigned char *event_name, unsigned char **err) char *event_name, char **err)
{ {
int event_id; int event_id;
@ -849,7 +849,7 @@ add_default_keybindings(void)
*/ */
struct action_alias { struct action_alias {
const unsigned char *str; const char *str;
action_id_T action_id; action_id_T action_id;
}; };
@ -887,7 +887,7 @@ static const struct action_alias *action_aliases[KEYMAP_MAX] = {
}; };
static action_id_T static action_id_T
get_aliased_action(enum keymap_id keymap_id, unsigned char *action_str) get_aliased_action(enum keymap_id keymap_id, char *action_str)
{ {
assert(keymap_id >= 0 && keymap_id < KEYMAP_MAX); assert(keymap_id >= 0 && keymap_id < KEYMAP_MAX);
@ -904,8 +904,8 @@ get_aliased_action(enum keymap_id keymap_id, unsigned char *action_str)
/* Return 0 when ok, something strange otherwise. */ /* Return 0 when ok, something strange otherwise. */
int int
bind_do(unsigned char *keymap_str, const unsigned char *keystroke_str, bind_do(char *keymap_str, const char *keystroke_str,
unsigned char *action_str, int is_system_conf) char *action_str, int is_system_conf)
{ {
enum keymap_id keymap_id; enum keymap_id keymap_id;
action_id_T action_id; action_id_T action_id;
@ -927,11 +927,11 @@ bind_do(unsigned char *keymap_str, const unsigned char *keystroke_str,
return 0; return 0;
} }
unsigned char * char *
bind_act(unsigned char *keymap_str, const unsigned char *keystroke_str) bind_act(char *keymap_str, const char *keystroke_str)
{ {
enum keymap_id keymap_id; enum keymap_id keymap_id;
unsigned char *action; char *action;
struct keybinding *keybinding; struct keybinding *keybinding;
keymap_id = get_keymap_id(keymap_str); keymap_id = get_keymap_id(keymap_str);
@ -946,15 +946,15 @@ bind_act(unsigned char *keymap_str, const unsigned char *keystroke_str)
return NULL; return NULL;
keybinding->flags |= KBDB_WATERMARK; keybinding->flags |= KBDB_WATERMARK;
return straconcat("\"", action, "\"", (unsigned char *) NULL); return straconcat("\"", action, "\"", (char *) NULL);
} }
static void static void
single_bind_config_string(struct string *file, enum keymap_id keymap_id, single_bind_config_string(struct string *file, enum keymap_id keymap_id,
struct keybinding *keybinding) struct keybinding *keybinding)
{ {
unsigned char *keymap_str = get_keymap_name(keymap_id); char *keymap_str = get_keymap_name(keymap_id);
unsigned char *action_str = get_action_name(keymap_id, keybinding->action_id); char *action_str = get_action_name(keymap_id, keybinding->action_id);
if (!keymap_str || !action_str || action_str[0] == ' ') if (!keymap_str || !action_str || action_str[0] == ' ')
return; return;

View File

@ -26,10 +26,10 @@ enum keymap_id {
}; };
struct action { struct action {
unsigned char *str; char *str;
action_id_T num; action_id_T num;
enum keymap_id keymap_id; enum keymap_id keymap_id;
unsigned char *desc; char *desc;
unsigned int flags; unsigned int flags;
}; };
@ -38,9 +38,9 @@ struct action_list {
int num_actions; int num_actions;
}; };
struct keymap { struct keymap {
unsigned char *str; char *str;
enum keymap_id keymap_id; enum keymap_id keymap_id;
unsigned char *desc; char *desc;
}; };
enum action_flags { enum action_flags {
@ -109,10 +109,10 @@ int keybinding_exists(enum keymap_id keymap_id, struct term_event_keyboard *kbd,
void free_keybinding(struct keybinding *); void free_keybinding(struct keybinding *);
const struct action *get_action(enum keymap_id keymap_id, action_id_T action_id); const struct action *get_action(enum keymap_id keymap_id, action_id_T action_id);
unsigned char *get_action_name(enum keymap_id keymap_id, action_id_T action_id); char *get_action_name(enum keymap_id keymap_id, action_id_T action_id);
action_id_T get_action_from_string(enum keymap_id keymap_id, unsigned char *str); action_id_T get_action_from_string(enum keymap_id keymap_id, char *str);
unsigned char *get_action_name_from_keystroke(enum keymap_id keymap_id, char *get_action_name_from_keystroke(enum keymap_id keymap_id,
const unsigned char *keystroke_str); const char *keystroke_str);
static inline unsigned int static inline unsigned int
action_is_anonymous_safe(enum keymap_id keymap_id, action_id_T action_id) action_is_anonymous_safe(enum keymap_id keymap_id, action_id_T action_id)
@ -162,10 +162,10 @@ action_requires_form(enum keymap_id keymap_id, action_id_T action_id)
return action && (action->flags & ACTION_REQUIRE_FORM); return action && (action->flags & ACTION_REQUIRE_FORM);
} }
term_event_key_T read_key(const unsigned char *); term_event_key_T read_key(const char *);
unsigned char *get_keymap_name(enum keymap_id); char *get_keymap_name(enum keymap_id);
int parse_keystroke(const unsigned char *, struct term_event_keyboard *); int parse_keystroke(const char *, struct term_event_keyboard *);
void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, int escape); void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, int escape);
/* void add_accesskey_to_string(struct string *str, unicode_val_T accesskey); */ /* void add_accesskey_to_string(struct string *str, unicode_val_T accesskey); */
@ -184,19 +184,19 @@ void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd
action_id_T kbd_action(enum keymap_id, struct term_event *, int *); action_id_T kbd_action(enum keymap_id, struct term_event *, int *);
struct keybinding *kbd_ev_lookup(enum keymap_id, struct term_event_keyboard *kbd, int *); struct keybinding *kbd_ev_lookup(enum keymap_id, struct term_event_keyboard *kbd, int *);
struct keybinding *kbd_nm_lookup(enum keymap_id, unsigned char *); struct keybinding *kbd_nm_lookup(enum keymap_id, char *);
int bind_do(unsigned char *, const unsigned char *, unsigned char *, int); int bind_do(char *, const char *, char *, int);
unsigned char *bind_act(unsigned char *, const unsigned char *); char *bind_act(char *, const char *);
void bind_config_string(struct string *); void bind_config_string(struct string *);
#ifdef CONFIG_SCRIPTING #ifdef CONFIG_SCRIPTING
int bind_key_to_event_name(unsigned char *, const unsigned char *, unsigned char *, int bind_key_to_event_name(char *, const char *, char *,
unsigned char **); char **);
#endif #endif
void add_keystroke_action_to_string(struct string *string, action_id_T action_id, enum keymap_id keymap_id); void add_keystroke_action_to_string(struct string *string, action_id_T action_id, enum keymap_id keymap_id);
unsigned char *get_keystroke(action_id_T action_id, enum keymap_id keymap_id); char *get_keystroke(action_id_T action_id, enum keymap_id keymap_id);
void add_actions_to_string(struct string *string, action_id_T actions[], void add_actions_to_string(struct string *string, action_id_T actions[],
enum keymap_id keymap_id, struct terminal *term); enum keymap_id keymap_id, struct terminal *term);

View File

@ -68,7 +68,7 @@ static struct option options_root = INIT_OPTION(
struct option *config_options; struct option *config_options;
struct option *cmdline_options; struct option *cmdline_options;
static void add_opt_rec(struct option *, unsigned char *, struct option *); static void add_opt_rec(struct option *, char *, struct option *);
static void free_options_tree(LIST_OF(struct option) *, int recursive); static void free_options_tree(LIST_OF(struct option) *, int recursive);
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
@ -78,7 +78,7 @@ static void free_options_tree(LIST_OF(struct option) *, int recursive);
#define bad_punct(c) (c != ')' && c != '>' && !isquote(c) && ispunct(c)) #define bad_punct(c) (c != ')' && c != '>' && !isquote(c) && ispunct(c))
static void static void
check_caption(unsigned char *caption) check_caption(char *caption)
{ {
int len; int len;
unsigned char c; unsigned char c;
@ -106,7 +106,7 @@ check_caption(unsigned char *caption)
#undef bad_punct #undef bad_punct
static void static void
check_description(unsigned char *desc) check_description(char *desc)
{ {
int len; int len;
unsigned char c; unsigned char c;
@ -170,12 +170,12 @@ static int no_autocreate = 0;
* *
* @relates option */ * @relates option */
struct option * struct option *
get_opt_rec(struct option *tree, const unsigned char *name_) get_opt_rec(struct option *tree, const char *name_)
{ {
struct option *option; struct option *option;
unsigned char *aname = stracpy(name_); char *aname = stracpy(name_);
unsigned char *name = aname; char *name = aname;
unsigned char *sep; char *sep;
if (!aname) return NULL; if (!aname) return NULL;
@ -243,7 +243,7 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
* enabled. * enabled.
* @relates option */ * @relates option */
struct option * struct option *
get_opt_rec_real(struct option *tree, const unsigned char *name) get_opt_rec_real(struct option *tree, const char *name)
{ {
struct option *opt; struct option *opt;
@ -282,9 +282,9 @@ indirect_option(struct option *alias)
union option_value * union option_value *
get_opt_( get_opt_(
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
unsigned char *file, int line, enum option_type option_type, char *file, int line, enum option_type option_type,
#endif #endif
struct option *tree, unsigned char *name, struct session *ses) struct option *tree, char *name, struct session *ses)
{ {
struct option *opt = NULL; struct option *opt = NULL;
@ -437,7 +437,7 @@ append:
/** Add option to tree. /** Add option to tree.
* @relates option */ * @relates option */
static void static void
add_opt_rec(struct option *tree, unsigned char *path, struct option *option) add_opt_rec(struct option *tree, char *path, struct option *option)
{ {
int abi = 0; int abi = 0;
@ -502,9 +502,9 @@ init_option_listbox_item(struct option *option)
/*! @relates option */ /*! @relates option */
struct option * struct option *
add_opt(struct option *tree, unsigned char *path, unsigned char *capt, add_opt(struct option *tree, char *path, char *capt,
unsigned char *name, enum option_flags flags, enum option_type type, char *name, enum option_flags flags, enum option_type type,
long min, long max, longptr_T value, unsigned char *desc) long min, long max, longptr_T value, char *desc)
{ {
struct option *option = mem_calloc(1, sizeof(*option)); struct option *option = mem_calloc(1, sizeof(*option));
@ -539,10 +539,10 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
mem_free(option); mem_free(option);
return NULL; return NULL;
} }
option->value.string = (unsigned char *) value; option->value.string = (char *) value;
break; break;
case OPT_ALIAS: case OPT_ALIAS:
option->value.string = (unsigned char *) value; option->value.string = (char *) value;
break; break;
case OPT_BOOL: case OPT_BOOL:
case OPT_INT: case OPT_INT:
@ -553,7 +553,7 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
option->value.big_number = (long) value; /* FIXME: cast from void * */ option->value.big_number = (long) value; /* FIXME: cast from void * */
break; break;
case OPT_COLOR: case OPT_COLOR:
decode_color((unsigned char *) value, strlen((unsigned char *) value), decode_color((char *) value, strlen((char *) value),
&option->value.color); &option->value.color);
break; break;
case OPT_COMMAND: case OPT_COMMAND:
@ -1059,9 +1059,9 @@ check_nonempty_tree(LIST_OF(struct option) *options)
void void
smart_config_string(struct string *str, int print_comment, int i18n, smart_config_string(struct string *str, int print_comment, int i18n,
LIST_OF(struct option) *options, LIST_OF(struct option) *options,
unsigned char *path, int depth, char *path, int depth,
void (*fn)(struct string *, struct option *, void (*fn)(struct string *, struct option *,
unsigned char *, int, int, int, int)) char *, int, int, int, int))
{ {
struct option *option; struct option *option;
@ -1202,7 +1202,7 @@ commit_option_values(struct option_resolver *resolvers,
assert(resolvers && root && values && size); assert(resolvers && root && values && size);
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
unsigned char *name = resolvers[i].name; char *name = resolvers[i].name;
struct option *option = get_opt_rec(root, name); struct option *option = get_opt_rec(root, name);
int id = resolvers[i].id; int id = resolvers[i].id;
@ -1239,7 +1239,7 @@ checkout_option_values(struct option_resolver *resolvers,
int i; int i;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
unsigned char *name = resolvers[i].name; char *name = resolvers[i].name;
struct option *option = get_opt_rec(root, name); struct option *option = get_opt_rec(root, name);
int id = resolvers[i].id; int id = resolvers[i].id;
@ -1273,7 +1273,7 @@ register_options(union option_info info[], struct option *tree)
const struct option_init init = info[i].init; const struct option_init init = info[i].init;
struct option *option = &info[i].option; struct option *option = &info[i].option;
unsigned char *string; char *string;
*option = zero; *option = zero;
option->name = init.name; option->name = init.name;

View File

@ -136,8 +136,8 @@ struct session; /* session/session.h */
* *
* @return NULL if successful, or a localized error string that the * @return NULL if successful, or a localized error string that the
* caller will not free. */ * caller will not free. */
typedef unsigned char *option_command_fn_T(struct option *option, typedef char *option_command_fn_T(struct option *option,
unsigned char ***argv, int *argc); char ***argv, int *argc);
union option_value { union option_value {
/** The ::OPT_TREE list_head is allocated. /** The ::OPT_TREE list_head is allocated.
@ -161,7 +161,7 @@ union option_value {
* The ::OPT_ALIAS string is NOT allocated, has variable length * The ::OPT_ALIAS string is NOT allocated, has variable length
* (option.max) and should remain untouched! It contains the full path to * (option.max) and should remain untouched! It contains the full path to
* the "real" / aliased option. */ * the "real" / aliased option. */
unsigned char *string; char *string;
}; };
@ -190,13 +190,13 @@ typedef int (*change_hook_T)(struct session *session, struct option *current,
struct option { struct option {
OBJECT_HEAD(struct option); OBJECT_HEAD(struct option);
unsigned char *name; char *name;
enum option_flags flags; enum option_flags flags;
enum option_type type; enum option_type type;
long min, max; long min, max;
union option_value value; union option_value value;
unsigned char *desc; char *desc;
unsigned char *capt; char *capt;
struct option *root; struct option *root;
@ -224,7 +224,7 @@ extern void done_options(void);
struct change_hook_info { struct change_hook_info {
unsigned char *name; char *name;
change_hook_T change_hook; change_hook_T change_hook;
}; };
@ -236,9 +236,9 @@ extern void prepare_mustsave_flags(LIST_OF(struct option) *, int set_all);
extern void untouch_options(LIST_OF(struct option) *); extern void untouch_options(LIST_OF(struct option) *);
extern void smart_config_string(struct string *, int, int, extern void smart_config_string(struct string *, int, int,
LIST_OF(struct option) *, unsigned char *, int, LIST_OF(struct option) *, char *, int,
void (*)(struct string *, struct option *, void (*)(struct string *, struct option *,
unsigned char *, int, int, int, int)); char *, int, int, int, int));
enum copy_option_flags { enum copy_option_flags {
/* Do not create a listbox option for the new option. */ /* Do not create a listbox option for the new option. */
@ -259,7 +259,7 @@ void mark_option_as_deleted(struct option *);
/** Some minimal option cache */ /** Some minimal option cache */
struct option_resolver { struct option_resolver {
int id; int id;
unsigned char *name; char *name;
}; };
/** Update the visibility of the box item of each option /** Update the visibility of the box item of each option
@ -295,14 +295,14 @@ extern void checkout_option_values(struct option_resolver *resolvers,
* use get_opt_type() and add_opt_type(). For command line options, you want to * use get_opt_type() and add_opt_type(). For command line options, you want to
* use get_opt_type_tree(cmdline_options, "option", NULL). */ * use get_opt_type_tree(cmdline_options, "option", NULL). */
extern struct option *get_opt_rec(struct option *, const unsigned char *); extern struct option *get_opt_rec(struct option *, const char *);
extern struct option *get_opt_rec_real(struct option *, const unsigned char *); extern struct option *get_opt_rec_real(struct option *, const char *);
struct option *indirect_option(struct option *); struct option *indirect_option(struct option *);
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *, struct session *); extern union option_value *get_opt_(char *, int, enum option_type, struct option *, char *, struct session *);
#define get_opt(tree, name, ses, type) get_opt_(__FILE__, __LINE__, type, tree, name, ses) #define get_opt(tree, name, ses, type) get_opt_(__FILE__, __LINE__, type, tree, name, ses)
#else #else
extern union option_value *get_opt_(struct option *, unsigned char *, struct session *); extern union option_value *get_opt_(struct option *, char *, struct session *);
#define get_opt(tree, name, ses, type) get_opt_(tree, name, ses) #define get_opt(tree, name, ses, type) get_opt_(tree, name, ses)
#endif #endif
@ -330,9 +330,9 @@ extern union option_value *get_opt_(struct option *, unsigned char *, struct ses
#define get_cmd_opt_color(name) get_opt_color_tree(cmdline_options, name, NULL) #define get_cmd_opt_color(name) get_opt_color_tree(cmdline_options, name, NULL)
#define get_cmd_opt_tree(name) get_opt_tree_tree(cmdline_options, name, NULL) #define get_cmd_opt_tree(name) get_opt_tree_tree(cmdline_options, name, NULL)
extern struct option *add_opt(struct option *, unsigned char *, unsigned char *, extern struct option *add_opt(struct option *, char *, char *,
unsigned char *, enum option_flags, enum option_type, char *, enum option_flags, enum option_type,
long, long, longptr_T, unsigned char *); long, long, longptr_T, char *);
/** Check whether the character @a c may be used in the name of an /** Check whether the character @a c may be used in the name of an
* option. This does not allow the '.' used in multi-part names like * option. This does not allow the '.' used in multi-part names like
@ -350,7 +350,7 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
#ifndef CONFIG_SMALL #ifndef CONFIG_SMALL
#define DESC(x) (x) #define DESC(x) (x)
#else #else
#define DESC(x) ((unsigned char *) "") #define DESC(x) ((char *) "")
#endif #endif
@ -369,7 +369,7 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
/*! @relates option */ /*! @relates option */
#define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \ #define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \
do { \ do { \
unsigned char *ptr = mem_alloc(MAX_STR_LEN); \ char *ptr = mem_alloc(MAX_STR_LEN); \
safe_strncpy(ptr, def, MAX_STR_LEN); \ safe_strncpy(ptr, def, MAX_STR_LEN); \
add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \ add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \
} while (0) } while (0)
@ -409,18 +409,18 @@ do { \
struct option_init { struct option_init {
/** The name of the option tree where the option should be /** The name of the option tree where the option should be
* registered. option.root is computed from this. */ * registered. option.root is computed from this. */
unsigned char *path; char *path;
/** The name of the option. This goes to option.name. */ /** The name of the option. This goes to option.name. */
unsigned char *name; char *name;
/** The caption shown in the option manager. This goes to /** The caption shown in the option manager. This goes to
* option.capt. */ * option.capt. */
unsigned char *capt; char *capt;
/** The long description shown when the user edits the option, /** The long description shown when the user edits the option,
* or NULL if not available. This goes to option.desc. */ * or NULL if not available. This goes to option.desc. */
unsigned char *desc; char *desc;
/** Flags for the option. These go to option.flags. */ /** Flags for the option. These go to option.flags. */
enum option_flags flags; enum option_flags flags;

View File

@ -29,10 +29,10 @@
* since you will parse the commandline _TWO TIMES_! Remember! :-) */ * since you will parse the commandline _TWO TIMES_! Remember! :-) */
int commandline = 0; int commandline = 0;
static unsigned char * static char *
gen_cmd(struct option *o, unsigned char ***argv, int *argc) gen_cmd(struct option *o, char ***argv, int *argc)
{ {
unsigned char *str; char *str;
int dummy_line = 0; int dummy_line = 0;
if (!*argc) return gettext("Parameter expected"); if (!*argc) return gettext("Parameter expected");
@ -56,8 +56,8 @@ gen_cmd(struct option *o, unsigned char ***argv, int *argc)
/* If 0 follows, disable option and eat 0. If 1 follows, enable option and /* If 0 follows, disable option and eat 0. If 1 follows, enable option and
* eat 1. If anything else follow, enable option and don't eat anything. */ * eat 1. If anything else follow, enable option and don't eat anything. */
static unsigned char * static char *
bool_cmd(struct option *o, unsigned char ***argv, int *argc) bool_cmd(struct option *o, char ***argv, int *argc)
{ {
o->value.number = 1; o->value.number = 1;
@ -77,8 +77,8 @@ bool_cmd(struct option *o, unsigned char ***argv, int *argc)
return NULL; return NULL;
} }
static unsigned char * static char *
exec_cmd(struct option *o, unsigned char ***argv, int *argc) exec_cmd(struct option *o, char ***argv, int *argc)
{ {
return o->value.command(o, argv, argc); return o->value.command(o, argv, argc);
} }
@ -90,11 +90,11 @@ exec_cmd(struct option *o, unsigned char ***argv, int *argc)
* possibly changing ptr to structure containing target name and pointer to * possibly changing ptr to structure containing target name and pointer to
* options list? --pasky */ * options list? --pasky */
static unsigned char * static char *
redir_cmd(struct option *opt, unsigned char ***argv, int *argc) redir_cmd(struct option *opt, char ***argv, int *argc)
{ {
struct option *real = get_opt_rec(config_options, opt->value.string); struct option *real = get_opt_rec(config_options, opt->value.string);
unsigned char * ret = NULL; char * ret = NULL;
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string); assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
if_assert_failed { return ret; } if_assert_failed { return ret; }
@ -109,11 +109,11 @@ redir_cmd(struct option *opt, unsigned char ***argv, int *argc)
return ret; return ret;
} }
static unsigned char * static char *
redir_rd(struct option *opt, unsigned char **file, int *line) redir_rd(struct option *opt, char **file, int *line)
{ {
struct option *real = get_opt_rec(config_options, opt->value.string); struct option *real = get_opt_rec(config_options, opt->value.string);
unsigned char *ret = NULL; char *ret = NULL;
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string); assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
if_assert_failed { return ret; } if_assert_failed { return ret; }
@ -141,7 +141,7 @@ redir_wr(struct option *opt, struct string *string)
} }
static int static int
redir_set(struct option *opt, unsigned char *str) redir_set(struct option *opt, char *str)
{ {
struct option *real = get_opt_rec(config_options, opt->value.string); struct option *real = get_opt_rec(config_options, opt->value.string);
int ret = 0; int ret = 0;
@ -154,7 +154,7 @@ redir_set(struct option *opt, unsigned char *str)
if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) { if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) {
negated = !*(long *) str; negated = !*(long *) str;
str = (unsigned char *) &negated; str = (char *) &negated;
} }
ret = option_types[real->type].set(real, str); ret = option_types[real->type].set(real, str);
} }
@ -163,7 +163,7 @@ redir_set(struct option *opt, unsigned char *str)
} }
static int static int
redir_eq(struct option *opt, const unsigned char *str) redir_eq(struct option *opt, const char *str)
{ {
struct option *real = get_opt_rec(config_options, opt->value.string); struct option *real = get_opt_rec(config_options, opt->value.string);
int ret = 0; int ret = 0;
@ -176,7 +176,7 @@ redir_eq(struct option *opt, const unsigned char *str)
if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) { if ((opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) {
negated = !*(const long *) str; negated = !*(const long *) str;
str = (unsigned char *) &negated; str = (char *) &negated;
} }
ret = option_types[real->type].equals(real, str); ret = option_types[real->type].equals(real, str);
} }
@ -189,7 +189,7 @@ redir_eq(struct option *opt, const unsigned char *str)
/* Support functions for config file parsing. */ /* Support functions for config file parsing. */
static void static void
add_optstring_to_string(struct string *s, const unsigned char *q, int qlen) add_optstring_to_string(struct string *s, const char *q, int qlen)
{ {
if (!commandline) add_char_to_string(s, '"'); if (!commandline) add_char_to_string(s, '"');
add_quoted_to_string(s, q, qlen); add_quoted_to_string(s, q, qlen);
@ -198,10 +198,10 @@ add_optstring_to_string(struct string *s, const unsigned char *q, int qlen)
/* Config file handlers. */ /* Config file handlers. */
static unsigned char * static char *
num_rd(struct option *opt, unsigned char **file, int *line) num_rd(struct option *opt, char **file, int *line)
{ {
unsigned char *end = *file; char *end = *file;
long *value = mem_alloc(sizeof(*value)); long *value = mem_alloc(sizeof(*value));
if (!value) return NULL; if (!value) return NULL;
@ -219,11 +219,11 @@ num_rd(struct option *opt, unsigned char **file, int *line)
return NULL; return NULL;
} }
return (unsigned char *) value; return (char *) value;
} }
static int static int
num_set(struct option *opt, unsigned char *str) num_set(struct option *opt, char *str)
{ {
/* In num_rd(), num_set(), and num_eq(), str always points /* In num_rd(), num_set(), and num_eq(), str always points
* to a long, even though these functions are only used for * to a long, even though these functions are only used for
@ -235,7 +235,7 @@ num_set(struct option *opt, unsigned char *str)
} }
static int static int
num_eq(struct option *opt, const unsigned char *str) num_eq(struct option *opt, const char *str)
{ {
return str && opt->value.number == *(const long *) str; return str && opt->value.number == *(const long *) str;
} }
@ -248,14 +248,14 @@ num_wr(struct option *option, struct string *string)
static int static int
long_set(struct option *opt, unsigned char *str) long_set(struct option *opt, char *str)
{ {
opt->value.big_number = *((long *) str); opt->value.big_number = *((long *) str);
return 1; return 1;
} }
static int static int
long_eq(struct option *opt, const unsigned char *str) long_eq(struct option *opt, const char *str)
{ {
return str && opt->value.big_number == *(const long *) str; return str && opt->value.big_number == *(const long *) str;
} }
@ -266,10 +266,10 @@ long_wr(struct option *option, struct string *string)
add_knum_to_string(string, option->value.big_number); add_knum_to_string(string, option->value.big_number);
} }
static unsigned char * static char *
str_rd(struct option *opt, unsigned char **file, int *line) str_rd(struct option *opt, char **file, int *line)
{ {
unsigned char *str = *file; char *str = *file;
struct string str2; struct string str2;
if (!init_string(&str2)) return NULL; if (!init_string(&str2)) return NULL;
@ -321,7 +321,7 @@ str_rd(struct option *opt, unsigned char **file, int *line)
} }
static int static int
str_set(struct option *opt, unsigned char *str) str_set(struct option *opt, char *str)
{ {
assert(opt->value.string); assert(opt->value.string);
@ -330,7 +330,7 @@ str_set(struct option *opt, unsigned char *str)
} }
static int static int
str_eq(struct option *opt, const unsigned char *str) str_eq(struct option *opt, const char *str)
{ {
return str && strcmp(opt->value.string, str) == 0; return str && strcmp(opt->value.string, str) == 0;
} }
@ -347,7 +347,7 @@ str_wr(struct option *o, struct string *s)
static void static void
str_dup(struct option *opt, struct option *template_, int flags) str_dup(struct option *opt, struct option *template_, int flags)
{ {
unsigned char *new_ = mem_alloc(MAX_STR_LEN); char *new_ = mem_alloc(MAX_STR_LEN);
if (new_) safe_strncpy(new_, template_->value.string, MAX_STR_LEN); if (new_) safe_strncpy(new_, template_->value.string, MAX_STR_LEN);
opt->value.string = new_; opt->value.string = new_;
@ -355,7 +355,7 @@ str_dup(struct option *opt, struct option *template_, int flags)
static int static int
cp_set(struct option *opt, unsigned char *str) cp_set(struct option *opt, char *str)
{ {
int ret = get_cp_index(str); int ret = get_cp_index(str);
@ -366,7 +366,7 @@ cp_set(struct option *opt, unsigned char *str)
} }
static int static int
cp_eq(struct option *opt, const unsigned char *str) cp_eq(struct option *opt, const char *str)
{ {
return str && get_cp_index(str) == opt->value.number; return str && get_cp_index(str) == opt->value.number;
} }
@ -374,14 +374,14 @@ cp_eq(struct option *opt, const unsigned char *str)
static void static void
cp_wr(struct option *o, struct string *s) cp_wr(struct option *o, struct string *s)
{ {
unsigned char *mime_name = get_cp_config_name(o->value.number); char *mime_name = get_cp_config_name(o->value.number);
add_optstring_to_string(s, mime_name, strlen(mime_name)); add_optstring_to_string(s, mime_name, strlen(mime_name));
} }
static int static int
lang_set(struct option *opt, unsigned char *str) lang_set(struct option *opt, char *str)
{ {
#ifdef CONFIG_NLS #ifdef CONFIG_NLS
opt->value.number = name_to_language(str); opt->value.number = name_to_language(str);
@ -391,7 +391,7 @@ lang_set(struct option *opt, unsigned char *str)
} }
static int static int
lang_eq(struct option *opt, const unsigned char *str) lang_eq(struct option *opt, const char *str)
{ {
#ifdef CONFIG_NLS #ifdef CONFIG_NLS
return str && name_to_language(str) == opt->value.number; return str && name_to_language(str) == opt->value.number;
@ -403,7 +403,7 @@ lang_eq(struct option *opt, const unsigned char *str)
static void static void
lang_wr(struct option *o, struct string *s) lang_wr(struct option *o, struct string *s)
{ {
unsigned char *lang; char *lang;
#ifdef CONFIG_NLS #ifdef CONFIG_NLS
lang = language_to_name(current_language); lang = language_to_name(current_language);
@ -416,13 +416,13 @@ lang_wr(struct option *o, struct string *s)
static int static int
color_set(struct option *opt, unsigned char *str) color_set(struct option *opt, char *str)
{ {
return !decode_color(str, strlen(str), &opt->value.color); return !decode_color(str, strlen(str), &opt->value.color);
} }
static int static int
color_eq(struct option *opt, const unsigned char *str) color_eq(struct option *opt, const char *str)
{ {
color_T color; color_T color;
@ -434,8 +434,8 @@ static void
color_wr(struct option *opt, struct string *str) color_wr(struct option *opt, struct string *str)
{ {
color_T color = opt->value.color; color_T color = opt->value.color;
unsigned char hexcolor[8]; char hexcolor[8];
const unsigned char *strcolor = get_color_string(color, hexcolor); const char *strcolor = get_color_string(color, hexcolor);
add_optstring_to_string(str, strcolor, strlen(strcolor)); add_optstring_to_string(str, strcolor, strlen(strcolor));
} }
@ -502,7 +502,7 @@ const struct option_type_info option_types[] = {
{ N_("Folder"), NULL, NULL, NULL, tree_dup, NULL, NULL, "" }, { N_("Folder"), NULL, NULL, NULL, tree_dup, NULL, NULL, "" },
}; };
unsigned char * char *
get_option_type_name(enum option_type type) get_option_type_name(enum option_type type)
{ {
assert(type >= 0 && type < sizeof(option_types)/sizeof(struct option_type_info)); assert(type >= 0 && type < sizeof(option_types)/sizeof(struct option_type_info));

View File

@ -9,14 +9,14 @@ extern "C" {
#endif #endif
struct option_type_info { struct option_type_info {
unsigned char *name; char *name;
unsigned char *(*cmdline)(struct option *, unsigned char ***, int *); char *(*cmdline)(struct option *, char ***, int *);
unsigned char *(*read)(struct option *, unsigned char **, int *); char *(*read)(struct option *, char **, int *);
void (*write)(struct option *, struct string *); void (*write)(struct option *, struct string *);
void (*dup)(struct option *, struct option *, int); void (*dup)(struct option *, struct option *, int);
int (*set)(struct option *, unsigned char *); int (*set)(struct option *, char *);
int (*equals)(struct option *, const unsigned char *); int (*equals)(struct option *, const char *);
unsigned char *help_str; char *help_str;
}; };
/* enum option_type is index in this array */ /* enum option_type is index in this array */
@ -24,7 +24,7 @@ extern const struct option_type_info option_types[];
extern int commandline; extern int commandline;
unsigned char *get_option_type_name(enum option_type type); char *get_option_type_name(enum option_type type);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -57,7 +57,7 @@ static INIT_LIST_OF(struct cookie, cookies);
struct c_domain { struct c_domain {
LIST_HEAD(struct c_domain); LIST_HEAD(struct c_domain);
unsigned char domain[1]; /* Must be at end of struct. */ char domain[1]; /* Must be at end of struct. */
}; };
/* List of domains for which there may be cookies. This supposedly /* List of domains for which there may be cookies. This supposedly
@ -137,7 +137,7 @@ static union option_info cookies_options[] = {
#define get_cookies_resave() get_opt_cookies(COOKIES_RESAVE).number #define get_cookies_resave() get_opt_cookies(COOKIES_RESAVE).number
struct cookie_server * struct cookie_server *
get_cookie_server(unsigned char *host, int hostlen) get_cookie_server(char *host, int hostlen)
{ {
struct cookie_server *sort_spot = NULL; struct cookie_server *sort_spot = NULL;
struct cookie_server *cs; struct cookie_server *cs;
@ -226,7 +226,7 @@ delete_cookie(struct cookie *c)
/* Check whether cookie's domain matches server. /* Check whether cookie's domain matches server.
* It returns 1 if ok, 0 else. */ * It returns 1 if ok, 0 else. */
static int static int
is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_len) is_domain_security_ok(char *domain, char *server, int server_len)
{ {
int i; int i;
int domain_len; int domain_len;
@ -301,7 +301,7 @@ is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_l
* although you may also want to set the remaining members and check * although you may also want to set the remaining members and check
* @get_cookies_accept_policy and @is_domain_security_ok. * @get_cookies_accept_policy and @is_domain_security_ok.
* *
* The unsigned char * arguments must be allocated with @mem_alloc or * The char * arguments must be allocated with @mem_alloc or
* equivalent, because @done_cookie will @mem_free them. Likewise, * equivalent, because @done_cookie will @mem_free them. Likewise,
* the caller must already have locked @server. If @init_cookie * the caller must already have locked @server. If @init_cookie
* fails, then it frees the strings itself, and unlocks @server. * fails, then it frees the strings itself, and unlocks @server.
@ -310,8 +310,8 @@ is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_l
* consider that a bug. This means callers can use e.g. @stracpy * consider that a bug. This means callers can use e.g. @stracpy
* and let @init_cookie check whether the call ran out of memory. */ * and let @init_cookie check whether the call ran out of memory. */
struct cookie * struct cookie *
init_cookie(unsigned char *name, unsigned char *value, init_cookie(char *name, char *value,
unsigned char *path, unsigned char *domain, char *path, char *domain,
struct cookie_server *server) struct cookie_server *server)
{ {
struct cookie *cookie = mem_calloc(1, sizeof(*cookie)); struct cookie *cookie = mem_calloc(1, sizeof(*cookie));
@ -337,9 +337,9 @@ init_cookie(unsigned char *name, unsigned char *value,
} }
void void
set_cookie(struct uri *uri, unsigned char *str) set_cookie(struct uri *uri, char *str)
{ {
unsigned char *path, *domain; char *path, *domain;
struct cookie *cookie; struct cookie *cookie;
struct cookie_str cstr; struct cookie_str cstr;
int max_age; int max_age;
@ -354,7 +354,7 @@ set_cookie(struct uri *uri, unsigned char *str)
if (!parse_cookie_str(&cstr, str)) return; if (!parse_cookie_str(&cstr, str)) return;
switch (parse_header_param(str, "path", &path, 0)) { switch (parse_header_param(str, "path", &path, 0)) {
unsigned char *path_end; char *path_end;
case HEADER_PARAM_FOUND: case HEADER_PARAM_FOUND:
if (!path[0]) if (!path[0])
@ -421,7 +421,7 @@ set_cookie(struct uri *uri, unsigned char *str)
max_age = get_cookies_max_age(); max_age = get_cookies_max_age();
if (max_age) { if (max_age) {
unsigned char *date; char *date;
time_t expires; time_t expires;
switch (parse_header_param(str, "expires", &date, 0)) { switch (parse_header_param(str, "expires", &date, 0)) {
@ -611,7 +611,7 @@ send_cookies_common(struct uri *uri, unsigned int httponly)
{ {
struct c_domain *cd; struct c_domain *cd;
struct cookie *c, *next; struct cookie *c, *next;
unsigned char *path = NULL; char *path = NULL;
static struct string header; static struct string header;
time_t now; time_t now;
@ -693,14 +693,14 @@ load_cookies(void) {
/* Buffer size is set to be enough to read long lines that /* Buffer size is set to be enough to read long lines that
* save_cookies may write. 6 is choosen after the fprintf(..) call * save_cookies may write. 6 is choosen after the fprintf(..) call
* in save_cookies(). --Zas */ * in save_cookies(). --Zas */
unsigned char in_buffer[6 * MAX_STR_LEN]; char in_buffer[6 * MAX_STR_LEN];
unsigned char *cookfile = COOKIES_FILENAME; char *cookfile = COOKIES_FILENAME;
FILE *fp; FILE *fp;
time_t now; time_t now;
if (elinks_home) { if (elinks_home) {
cookfile = straconcat(elinks_home, cookfile, cookfile = straconcat(elinks_home, cookfile,
(unsigned char *) NULL); (char *) NULL);
if (!cookfile) return; if (!cookfile) return;
} }
@ -721,11 +721,11 @@ load_cookies(void) {
now = time(NULL); now = time(NULL);
while (fgets(in_buffer, 6 * MAX_STR_LEN, fp)) { while (fgets(in_buffer, 6 * MAX_STR_LEN, fp)) {
struct cookie *cookie; struct cookie *cookie;
unsigned char *p, *q = in_buffer; char *p, *q = in_buffer;
enum { NAME = 0, VALUE, SERVER, PATH, DOMAIN, EXPIRES, SECURE, HTTPONLY, MEMBERS }; enum { NAME = 0, VALUE, SERVER, PATH, DOMAIN, EXPIRES, SECURE, HTTPONLY, MEMBERS };
int member; int member;
struct { struct {
unsigned char *pos; char *pos;
int len; int len;
} members[MEMBERS]; } members[MEMBERS];
time_t expires; time_t expires;
@ -812,7 +812,7 @@ set_cookies_dirty(void)
void void
save_cookies(struct terminal *term) { save_cookies(struct terminal *term) {
struct cookie *c; struct cookie *c;
unsigned char *cookfile; char *cookfile;
struct secure_save_info *ssi; struct secure_save_info *ssi;
time_t now; time_t now;
@ -844,7 +844,7 @@ save_cookies(struct terminal *term) {
} }
cookfile = straconcat(elinks_home, COOKIES_FILENAME, cookfile = straconcat(elinks_home, COOKIES_FILENAME,
(unsigned char *) NULL); (char *) NULL);
if (!cookfile) { if (!cookfile) {
CANNOT_SAVE_COOKIES(0, N_("Out of memory")); CANNOT_SAVE_COOKIES(0, N_("Out of memory"));
return; return;

View File

@ -33,14 +33,14 @@ struct cookie_server {
OBJECT_HEAD(struct cookie_server); OBJECT_HEAD(struct cookie_server);
struct listbox_item *box_item; struct listbox_item *box_item;
unsigned char host[1]; /* Must be at end of struct. */ char host[1]; /* Must be at end of struct. */
}; };
struct cookie { struct cookie {
OBJECT_HEAD(struct cookie); OBJECT_HEAD(struct cookie);
unsigned char *name, *value; char *name, *value;
unsigned char *path, *domain; char *path, *domain;
struct cookie_server *server; /* The host the cookie originated from */ struct cookie_server *server; /* The host the cookie originated from */
time_t expires; /* Expiration time. Zero means undefined */ time_t expires; /* Expiration time. Zero means undefined */
@ -50,14 +50,14 @@ struct cookie {
struct listbox_item *box_item; struct listbox_item *box_item;
}; };
struct cookie_server *get_cookie_server(unsigned char *host, int hostlen); struct cookie_server *get_cookie_server(char *host, int hostlen);
struct cookie *init_cookie(unsigned char *name, unsigned char *value, struct cookie *init_cookie(char *name, char *value,
unsigned char *path, unsigned char *domain, char *path, char *domain,
struct cookie_server *server); struct cookie_server *server);
void accept_cookie(struct cookie *); void accept_cookie(struct cookie *);
void done_cookie(struct cookie *); void done_cookie(struct cookie *);
void delete_cookie(struct cookie *); void delete_cookie(struct cookie *);
void set_cookie(struct uri *, unsigned char *); void set_cookie(struct uri *, char *);
void load_cookies(void); void load_cookies(void);
void save_cookies(struct terminal *); void save_cookies(struct terminal *);
void set_cookies_dirty(void); void set_cookies_dirty(void);

View File

@ -138,7 +138,7 @@ is_cookie_used(struct listbox_item *item)
return is_object_used((struct cookie *) item->udata); return is_object_used((struct cookie *) item->udata);
} }
static unsigned char * static char *
get_cookie_text(struct listbox_item *item, struct terminal *term) get_cookie_text(struct listbox_item *item, struct terminal *term)
{ {
/* Are we dealing with a folder? */ /* Are we dealing with a folder? */
@ -154,7 +154,7 @@ get_cookie_text(struct listbox_item *item, struct terminal *term)
} }
} }
static unsigned char * static char *
get_cookie_info(struct listbox_item *item, struct terminal *term) get_cookie_info(struct listbox_item *item, struct terminal *term)
{ {
struct cookie *cookie = item->udata; struct cookie *cookie = item->udata;
@ -259,7 +259,7 @@ static widget_handler_status_T
set_cookie_name(struct dialog_data *dlg_data, struct widget_data *widget_data) set_cookie_name(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct cookie *cookie = dlg_data->dlg->udata; struct cookie *cookie = dlg_data->dlg->udata;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
mem_free_set(&cookie->name, stracpy(value)); mem_free_set(&cookie->name, stracpy(value));
@ -271,7 +271,7 @@ static widget_handler_status_T
set_cookie_value(struct dialog_data *dlg_data, struct widget_data *widget_data) set_cookie_value(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct cookie *cookie = dlg_data->dlg->udata; struct cookie *cookie = dlg_data->dlg->udata;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
mem_free_set(&cookie->value, stracpy(value)); mem_free_set(&cookie->value, stracpy(value));
@ -283,7 +283,7 @@ static widget_handler_status_T
set_cookie_domain(struct dialog_data *dlg_data, struct widget_data *widget_data) set_cookie_domain(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct cookie *cookie = dlg_data->dlg->udata; struct cookie *cookie = dlg_data->dlg->udata;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
mem_free_set(&cookie->domain, stracpy(value)); mem_free_set(&cookie->domain, stracpy(value));
@ -295,8 +295,8 @@ static widget_handler_status_T
set_cookie_expires(struct dialog_data *dlg_data, struct widget_data *widget_data) set_cookie_expires(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct cookie *cookie = dlg_data->dlg->udata; struct cookie *cookie = dlg_data->dlg->udata;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
unsigned char *end; char *end;
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
#ifdef HAVE_STRPTIME #ifdef HAVE_STRPTIME
@ -324,8 +324,8 @@ static widget_handler_status_T
set_cookie_secure(struct dialog_data *dlg_data, struct widget_data *widget_data) set_cookie_secure(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct cookie *cookie = dlg_data->dlg->udata; struct cookie *cookie = dlg_data->dlg->udata;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
unsigned char *end; char *end;
long number; long number;
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
@ -343,8 +343,8 @@ static widget_handler_status_T
set_cookie_httponly(struct dialog_data *dlg_data, struct widget_data *widget_data) set_cookie_httponly(struct dialog_data *dlg_data, struct widget_data *widget_data)
{ {
struct cookie *cookie = dlg_data->dlg->udata; struct cookie *cookie = dlg_data->dlg->udata;
unsigned char *value = widget_data->cdata; char *value = widget_data->cdata;
unsigned char *end; char *end;
long number; long number;
if (!value || !cookie) return EVENT_NOT_PROCESSED; if (!value || !cookie) return EVENT_NOT_PROCESSED;
@ -365,8 +365,8 @@ build_edit_dialog(struct terminal *term, struct cookie *cookie)
#define EDIT_WIDGETS_COUNT 9 #define EDIT_WIDGETS_COUNT 9
/* [gettext_accelerator_context(.build_edit_dialog)] */ /* [gettext_accelerator_context(.build_edit_dialog)] */
struct dialog *dlg; struct dialog *dlg;
unsigned char *name, *value, *domain, *expires, *secure, *httponly; char *name, *value, *domain, *expires, *secure, *httponly;
unsigned char *dlg_server; char *dlg_server;
int length = 0; int length = 0;
dlg = calloc_dialog(EDIT_WIDGETS_COUNT, MAX_STR_LEN * 6); dlg = calloc_dialog(EDIT_WIDGETS_COUNT, MAX_STR_LEN * 6);
@ -405,7 +405,7 @@ build_edit_dialog(struct terminal *term, struct cookie *cookie)
dlg_server = cookie->server->host; dlg_server = cookie->server->host;
dlg_server = straconcat(_("Server", term), ": ", dlg_server, "\n", dlg_server = straconcat(_("Server", term), ": ", dlg_server, "\n",
(unsigned char *) NULL); (char *) NULL);
if (!dlg_server) { if (!dlg_server) {
mem_free(dlg); mem_free(dlg);
@ -483,7 +483,7 @@ push_add_button(struct dialog_data *dlg_data, struct widget_data *button)
static void static void
add_server_do(void *data) add_server_do(void *data)
{ {
unsigned char *value = data; char *value = data;
struct cookie *dummy_cookie; struct cookie *dummy_cookie;
if (!value) return; if (!value) return;
@ -505,8 +505,8 @@ push_add_server_button(struct dialog_data *dlg_data, struct widget_data *button)
#define SERVER_WIDGETS_COUNT 3 #define SERVER_WIDGETS_COUNT 3
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
struct dialog *dlg; struct dialog *dlg;
unsigned char *name; char *name;
unsigned char *text; char *text;
dlg = calloc_dialog(SERVER_WIDGETS_COUNT, MAX_STR_LEN); dlg = calloc_dialog(SERVER_WIDGETS_COUNT, MAX_STR_LEN);
if (!dlg) return EVENT_NOT_PROCESSED; if (!dlg) return EVENT_NOT_PROCESSED;

View File

@ -17,7 +17,7 @@
#if 0 #if 0
static inline void static inline void
debug_cookie_parser(struct cookie_str *cstr, unsigned char *pos, int ws, int eq) debug_cookie_parser(struct cookie_str *cstr, char *pos, int ws, int eq)
{ {
int namelen = int_max(cstr->nam_end - cstr->str, 0); int namelen = int_max(cstr->nam_end - cstr->str, 0);
int valuelen = int_max(cstr->val_end - cstr->val_start, 0); int valuelen = int_max(cstr->val_end - cstr->val_start, 0);
@ -39,7 +39,7 @@ debug_cookie_parser(struct cookie_str *cstr, unsigned char *pos, int ws, int eq)
/* Defined in RFC 2965. */ /* Defined in RFC 2965. */
/* Return cstr on success, NULL on failure. */ /* Return cstr on success, NULL on failure. */
struct cookie_str * struct cookie_str *
parse_cookie_str(struct cookie_str *cstr, unsigned char *str) parse_cookie_str(struct cookie_str *cstr, char *str)
{ {
memset(cstr, 0, sizeof(*cstr)); memset(cstr, 0, sizeof(*cstr));
cstr->str = str; cstr->str = str;

View File

@ -6,11 +6,11 @@ extern "C" {
#endif #endif
struct cookie_str { struct cookie_str {
unsigned char *str; char *str;
unsigned char *nam_end, *val_start, *val_end; char *nam_end, *val_start, *val_end;
}; };
struct cookie_str *parse_cookie_str(struct cookie_str *cstr, unsigned char *str); struct cookie_str *parse_cookie_str(struct cookie_str *cstr, char *str);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -15,7 +15,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
struct cookie_str cstr; struct cookie_str cstr;
unsigned char name[1024], value[1024], string[1024]; char name[1024], value[1024], string[1024];
printf("This thing is for testing of cookies name-value pair parser.\n" printf("This thing is for testing of cookies name-value pair parser.\n"
"You probably do not want to mess with it :).\n"); "You probably do not want to mess with it :).\n");

View File

@ -4,7 +4,7 @@
#include "cookies/path.h" #include "cookies/path.h"
int int
is_path_prefix(unsigned char *cookiepath, unsigned char *requestpath) is_path_prefix(char *cookiepath, char *requestpath)
{ {
int dl = strlen(cookiepath); int dl = strlen(cookiepath);

View File

@ -5,7 +5,7 @@
extern "C" { extern "C" {
#endif #endif
int is_path_prefix(unsigned char *d, unsigned char *s); int is_path_prefix(char *d, char *s);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -33,7 +33,7 @@
#include "viewer/text/view.h" #include "viewer/text/view.h"
void void
nowhere_box(struct terminal *term, unsigned char *title) nowhere_box(struct terminal *term, char *title)
{ {
assert(term); assert(term);
if_assert_failed return; if_assert_failed return;
@ -50,7 +50,7 @@ add_link_info_to_string(struct string *msg, struct session *ses)
{ {
struct document_view *doc_view = current_frame(ses); struct document_view *doc_view = current_frame(ses);
struct terminal *term = ses->tab->term; struct terminal *term = ses->tab->term;
unsigned char *a; char *a;
struct link *link; struct link *link;
if (!doc_view) return; if (!doc_view) return;
@ -92,7 +92,7 @@ add_link_info_to_string(struct string *msg, struct session *ses)
#ifdef CONFIG_GLOBHIST #ifdef CONFIG_GLOBHIST
historyitem = get_global_history_item(link->where); historyitem = get_global_history_item(link->where);
if (historyitem) { if (historyitem) {
unsigned char *last_visit; char *last_visit;
last_visit = ctime(&historyitem->last_visit); last_visit = ctime(&historyitem->last_visit);
@ -170,7 +170,7 @@ document_info_dialog(struct session *ses)
if (doc_view && doc_view->document->cached) { if (doc_view && doc_view->document->cached) {
struct cache_entry *cached = doc_view->document->cached; struct cache_entry *cached = doc_view->document->cached;
unsigned char *a; char *a;
add_format_to_string(&msg, "\n%s: %" OFF_PRINT_FORMAT, add_format_to_string(&msg, "\n%s: %" OFF_PRINT_FORMAT,
_("Size", term), _("Size", term),
@ -234,7 +234,7 @@ document_info_dialog(struct session *ses)
#ifdef CONFIG_GLOBHIST #ifdef CONFIG_GLOBHIST
{ {
unsigned char *last_visit = NULL; char *last_visit = NULL;
struct global_history_item *historyitem; struct global_history_item *historyitem;
add_format_to_string(&msg, "\n%s: ", add_format_to_string(&msg, "\n%s: ",
@ -272,8 +272,8 @@ void
cached_header_dialog(struct session *ses, struct cache_entry *cached) cached_header_dialog(struct session *ses, struct cache_entry *cached)
{ {
int msgbox_flags = 0; int msgbox_flags = 0;
unsigned char *title = N_("Header info"); char *title = N_("Header info");
unsigned char *headers = NULL; char *headers = NULL;
int i = 0, j = 0; int i = 0, j = 0;
if (!cached || !cached->head || !*cached->head) if (!cached || !cached->head || !*cached->head)

View File

@ -7,7 +7,7 @@
extern "C" { extern "C" {
#endif #endif
void nowhere_box(struct terminal *term, unsigned char *title); void nowhere_box(struct terminal *term, char *title);
void link_info_dialog(struct session *ses); void link_info_dialog(struct session *ses);
void document_info_dialog(struct session *); void document_info_dialog(struct session *);
void cached_header_dialog(struct session *ses, struct cache_entry *cached); void cached_header_dialog(struct session *ses, struct cache_entry *cached);

View File

@ -133,10 +133,10 @@ download_dialog_layouter(struct dialog_data *dlg_data)
int rw = w; int rw = w;
int x, y = 0; int x, y = 0;
int url_len; int url_len;
unsigned char *url; char *url;
struct download *download = &file_download->download; struct download *download = &file_download->download;
struct color_pair *dialog_text_color = get_bfu_color(term, "dialog.text"); struct color_pair *dialog_text_color = get_bfu_color(term, "dialog.text");
unsigned char *msg = get_download_msg(download, term, 1, 1, "\n"); char *msg = get_download_msg(download, term, 1, 1, "\n");
int show_meter = (download_is_progressing(download) int show_meter = (download_is_progressing(download)
&& download->progress->size >= 0); && download->progress->size >= 0);
#ifdef CONFIG_BITTORRENT #ifdef CONFIG_BITTORRENT
@ -306,11 +306,11 @@ is_file_download_used(struct listbox_item *item)
return is_object_used((struct file_download *) item->udata); return is_object_used((struct file_download *) item->udata);
} }
static unsigned char * static char *
get_file_download_text(struct listbox_item *item, struct terminal *term) get_file_download_text(struct listbox_item *item, struct terminal *term)
{ {
struct file_download *file_download = item->udata; struct file_download *file_download = item->udata;
unsigned char *uristring; char *uristring;
uristring = get_uri_string(file_download->uri, URI_PUBLIC); uristring = get_uri_string(file_download->uri, URI_PUBLIC);
if (uristring) { if (uristring) {
@ -325,7 +325,7 @@ get_file_download_text(struct listbox_item *item, struct terminal *term)
return uristring; return uristring;
} }
static unsigned char * static char *
get_file_download_info(struct listbox_item *item, struct terminal *term) get_file_download_info(struct listbox_item *item, struct terminal *term)
{ {
return NULL; return NULL;
@ -377,9 +377,9 @@ draw_file_download(struct listbox_item *item, struct listbox_context *context,
{ {
struct file_download *file_download = item->udata; struct file_download *file_download = item->udata;
struct download *download = &file_download->download; struct download *download = &file_download->download;
unsigned char *stylename; char *stylename;
struct color_pair *color; struct color_pair *color;
unsigned char *text; char *text;
int length; int length;
int trimmedlen; int trimmedlen;
int meter = DOWNLOAD_METER_WIDTH; int meter = DOWNLOAD_METER_WIDTH;

View File

@ -39,9 +39,9 @@ my_cancel_dialog(struct dialog_data *dlg_data, struct widget_data *widget_data)
/* TODO: In bookmark/dialogs.c most users seem to want also the dialog_data /* TODO: In bookmark/dialogs.c most users seem to want also the dialog_data
* so we should make when_*() functions take dialog_data instead. --jonas */ * so we should make when_*() functions take dialog_data instead. --jonas */
void void
do_edit_dialog(struct terminal *term, int intl, unsigned char *title, do_edit_dialog(struct terminal *term, int intl, char *title,
const unsigned char *src_name, const char *src_name,
const unsigned char *src_url, const char *src_url,
struct session *ses, struct dialog_data *parent, struct session *ses, struct dialog_data *parent,
done_handler_T *when_done, done_handler_T *when_done,
void when_cancel(struct dialog *), void when_cancel(struct dialog *),
@ -49,7 +49,7 @@ do_edit_dialog(struct terminal *term, int intl, unsigned char *title,
enum edit_dialog_type dialog_type) enum edit_dialog_type dialog_type)
{ {
/* [gettext_accelerator_context(do_edit_dialog)] */ /* [gettext_accelerator_context(do_edit_dialog)] */
unsigned char *name, *url; char *name, *url;
struct dialog *dlg; struct dialog *dlg;
if (intl) title = _(title, term); if (intl) title = _(title, term);

View File

@ -14,8 +14,8 @@ enum edit_dialog_type {
EDIT_DLG_ADD /* edit/add dialog */ EDIT_DLG_ADD /* edit/add dialog */
}; };
void do_edit_dialog(struct terminal *, int, unsigned char *, void do_edit_dialog(struct terminal *, int, char *,
const unsigned char *, const unsigned char *, const char *, const char *,
struct session *, struct dialog_data *, struct session *, struct dialog_data *,
done_handler_T *when_done, done_handler_T *when_done,
void when_cancel(struct dialog *), void when_cancel(struct dialog *),

View File

@ -35,11 +35,11 @@
static INIT_INPUT_HISTORY(exmode_history); static INIT_INPUT_HISTORY(exmode_history);
typedef int (*exmode_handler_T)(struct session *, unsigned char *, unsigned char *); typedef int (*exmode_handler_T)(struct session *, char *, char *);
static int static int
exmode_action_handler(struct session *ses, unsigned char *command, exmode_action_handler(struct session *ses, char *command,
unsigned char *args) char *args)
{ {
enum main_action action_id = get_action_from_string(KEYMAP_MAIN, command); enum main_action action_id = get_action_from_string(KEYMAP_MAIN, command);
@ -60,8 +60,8 @@ exmode_action_handler(struct session *ses, unsigned char *command,
} }
static int static int
exmode_confcmd_handler(struct session *ses, unsigned char *command, exmode_confcmd_handler(struct session *ses, char *command,
unsigned char *args) char *args)
{ {
enum parse_error err; enum parse_error err;
@ -84,14 +84,14 @@ static const exmode_handler_T exmode_handlers[] = {
}; };
static void static void
exmode_exec(struct session *ses, unsigned char buffer[INPUT_LINE_BUFFER_SIZE]) exmode_exec(struct session *ses, char buffer[INPUT_LINE_BUFFER_SIZE])
{ {
/* First look it up as action, then try it as an event (but the event /* First look it up as action, then try it as an event (but the event
* part should be thought out somehow yet, I s'pose... let's leave it * part should be thought out somehow yet, I s'pose... let's leave it
* off for now). Then try to evaluate it as configfile command. Then at * off for now). Then try to evaluate it as configfile command. Then at
* least pop up an error. */ * least pop up an error. */
unsigned char *command = buffer; char *command = buffer;
unsigned char *args = command; char *args = command;
int i; int i;
while (*command == ':') command++; while (*command == ':') command++;

View File

@ -154,7 +154,7 @@ menu_copying(struct terminal *term, void *xxx, void *xxxx)
} }
static unsigned char * static char *
get_resource_info(struct terminal *term, void *data) get_resource_info(struct terminal *term, void *data)
{ {
struct string info; struct string info;

View File

@ -52,7 +52,7 @@
static void static void
menu_url_shortcut(struct terminal *term, void *url_, void *ses_) menu_url_shortcut(struct terminal *term, void *url_, void *ses_)
{ {
unsigned char *url = url_; char *url = url_;
struct session *ses = ses_; struct session *ses = ses_;
struct uri *uri = get_uri(url, 0); struct uri *uri = get_uri(url, 0);
@ -62,7 +62,7 @@ menu_url_shortcut(struct terminal *term, void *url_, void *ses_)
} }
static void static void
save_url(struct session *ses, unsigned char *url) save_url(struct session *ses, char *url)
{ {
struct document_view *doc_view; struct document_view *doc_view;
struct uri *uri; struct uri *uri;
@ -97,7 +97,7 @@ save_url_as(struct session *ses)
N_("Save URL"), N_("Enter URL"), N_("Save URL"), N_("Enter URL"),
ses, &goto_url_history, ses, &goto_url_history,
MAX_STR_LEN, "", 0, 0, NULL, MAX_STR_LEN, "", 0, 0, NULL,
(void (*)(void *, unsigned char *)) save_url, (void (*)(void *, char *)) save_url,
NULL); NULL);
} }
@ -180,7 +180,7 @@ history_menu_common(struct terminal *term, struct session *ses, int unhist)
for (loc = unhist ? cur_loc(ses)->next : cur_loc(ses)->prev; for (loc = unhist ? cur_loc(ses)->next : cur_loc(ses)->prev;
loc != (struct location *) &ses->history.history; loc != (struct location *) &ses->history.history;
loc = unhist ? loc->next : loc->prev) { loc = unhist ? loc->next : loc->prev) {
unsigned char *url; char *url;
if (!mi) { if (!mi) {
mi = new_menu(FREE_LIST | FREE_TEXT | NO_INTL); mi = new_menu(FREE_LIST | FREE_TEXT | NO_INTL);
@ -537,13 +537,13 @@ activate_bfu_technology(struct session *ses, int item)
void void
dialog_goto_url(struct session *ses, unsigned char *url) dialog_goto_url(struct session *ses, char *url)
{ {
input_dialog(ses->tab->term, NULL, input_dialog(ses->tab->term, NULL,
N_("Go to URL"), N_("Enter URL"), N_("Go to URL"), N_("Enter URL"),
ses, &goto_url_history, ses, &goto_url_history,
MAX_STR_LEN, url, 0, 0, NULL, MAX_STR_LEN, url, 0, 0, NULL,
(void (*)(void *, unsigned char *)) goto_url_with_hook, (void (*)(void *, char *)) goto_url_with_hook,
NULL); NULL);
} }
@ -552,7 +552,7 @@ static INIT_INPUT_HISTORY(file_history);
void void
query_file(struct session *ses, struct uri *uri, void *data, query_file(struct session *ses, struct uri *uri, void *data,
void (*std)(void *, unsigned char *), void (*std)(void *, char *),
void (*cancel)(void *), int interactive) void (*cancel)(void *), int interactive)
{ {
struct string def; struct string def;
@ -601,7 +601,7 @@ query_file(struct session *ses, struct uri *uri, void *data,
N_("Download"), N_("Save to file"), N_("Download"), N_("Save to file"),
data, &file_history, data, &file_history,
MAX_STR_LEN, def.source, 0, 0, check_nonempty, MAX_STR_LEN, def.source, 0, 0, check_nonempty,
(void (*)(void *, unsigned char *)) std, (void (*)(void *, char *)) std,
(void (*)(void *)) cancel); (void (*)(void *)) cancel);
} else { } else {
std(data, def.source); std(data, def.source);
@ -621,7 +621,7 @@ free_history_lists(void)
static void static void
add_cmdline_bool_option(struct string *string, unsigned char *name) add_cmdline_bool_option(struct string *string, char *name)
{ {
if (!get_cmd_opt_bool(name)) return; if (!get_cmd_opt_bool(name)) return;
add_to_string(string, " -"); add_to_string(string, " -");
@ -736,7 +736,7 @@ open_in_new_window(struct terminal *term, void *func_, void *ses_)
void void
add_new_win_to_menu(struct menu_item **mi, unsigned char *text, add_new_win_to_menu(struct menu_item **mi, char *text,
struct terminal *term) struct terminal *term)
{ {
int c = can_open_in_new(term); int c = can_open_in_new(term);
@ -761,7 +761,7 @@ add_new_win_to_menu(struct menu_item **mi, unsigned char *text,
static void static void
do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx) do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx)
{ {
unsigned char *command = command_; char *command = command_;
exec_on_terminal(term, command, "", TERM_EXEC_BG); exec_on_terminal(term, command, "", TERM_EXEC_BG);
mem_free(command); mem_free(command);
@ -771,8 +771,8 @@ do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx)
* - Support for passing MIME type * - Support for passing MIME type
* - Merge this function with rewrite_uri(), subst_cmd(), subst_file() * - Merge this function with rewrite_uri(), subst_cmd(), subst_file()
* and subst_url(). */ * and subst_url(). */
static unsigned char * static char *
format_command(unsigned char *format, struct uri *uri) format_command(char *format, struct uri *uri)
{ {
struct string string; struct string string;
@ -792,7 +792,7 @@ format_command(unsigned char *format, struct uri *uri)
switch (*format) { switch (*format) {
case 'c': case 'c':
{ {
unsigned char *str = struri(uri); char *str = struri(uri);
int length = get_real_uri_length(uri); int length = get_real_uri_length(uri);
add_shell_quoted_to_string(&string, add_shell_quoted_to_string(&string,
@ -856,7 +856,7 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view,
} }
foreach (option, *tree) { foreach (option, *tree) {
unsigned char *text, *data; char *text, *data;
if (!strcmp(option->name, "_template_")) if (!strcmp(option->name, "_template_"))
continue; continue;
@ -895,7 +895,7 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view,
* choose an available accelerator key. */ * choose an available accelerator key. */
void void
add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type,
unsigned char *text) char *text)
{ {
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing", LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing",
NULL); NULL);
@ -949,7 +949,7 @@ static struct menu_item empty_directory_menu[] = {
static void static void
complete_file_menu(struct terminal *term, int no_elevator, void *data, complete_file_menu(struct terminal *term, int no_elevator, void *data,
menu_func_T file_func, menu_func_T dir_func, menu_func_T file_func, menu_func_T dir_func,
unsigned char *dirname, unsigned char *filename) char *dirname, char *filename)
{ {
struct menu_item *menu = new_menu(FREE_LIST | NO_INTL); struct menu_item *menu = new_menu(FREE_LIST | NO_INTL);
struct directory_entry *entries, *entry; struct directory_entry *entries, *entry;
@ -965,7 +965,7 @@ complete_file_menu(struct terminal *term, int no_elevator, void *data,
} }
for (entry = entries; entry->name; entry++) { for (entry = entries; entry->name; entry++) {
unsigned char *text; char *text;
int is_dir = (*entry->attrib == 'd'); int is_dir = (*entry->attrib == 'd');
int is_file = (*entry->attrib == '-'); int is_file = (*entry->attrib == '-');
@ -1018,7 +1018,7 @@ complete_file_menu(struct terminal *term, int no_elevator, void *data,
/* Only one entry */ /* Only one entry */
if (direntries + fileentries == 1) { if (direntries + fileentries == 1) {
unsigned char *text = menu[FILE_COMPLETION_MENU_OFFSET].data; char *text = menu[FILE_COMPLETION_MENU_OFFSET].data;
mem_free(menu); mem_free(menu);
@ -1047,12 +1047,12 @@ complete_file_menu(struct terminal *term, int no_elevator, void *data,
/* Prepares the launching of the file completion menu by expanding the @path /* Prepares the launching of the file completion menu by expanding the @path
* and splitting it in directory and file name part. */ * and splitting it in directory and file name part. */
void void
auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, auto_complete_file(struct terminal *term, int no_elevator, char *path,
menu_func_T file_func, menu_func_T dir_func, void *data) menu_func_T file_func, menu_func_T dir_func, void *data)
{ {
struct uri *uri; struct uri *uri;
unsigned char *dirname; char *dirname;
unsigned char *filename; char *filename;
assert(term && data && file_func && dir_func && data); assert(term && data && file_func && dir_func && data);
@ -1093,7 +1093,7 @@ auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path,
/* Make sure the dirname has an ending slash */ /* Make sure the dirname has an ending slash */
if (!dir_sep(path[-1])) { if (!dir_sep(path[-1])) {
unsigned char separator = *dirname; char separator = *dirname;
int dirnamelen = path - dirname; int dirnamelen = path - dirname;
insert_in_string(&dirname, dirnamelen, &separator, 1); insert_in_string(&dirname, dirnamelen, &separator, 1);

View File

@ -18,7 +18,7 @@ struct uri;
void activate_bfu_technology(struct session *, int); void activate_bfu_technology(struct session *, int);
void dialog_goto_url(struct session *ses, unsigned char *url); void dialog_goto_url(struct session *ses, char *url);
/* void dialog_save_url(struct session *ses); */ /* void dialog_save_url(struct session *ses); */
void tab_menu(struct session *ses, int x, int y, void tab_menu(struct session *ses, int x, int y,
@ -26,7 +26,7 @@ void tab_menu(struct session *ses, int x, int y,
void free_history_lists(void); void free_history_lists(void);
void query_file(struct session *, struct uri *, void *, void (*)(void *, unsigned char *), void (*)(void *), int); void query_file(struct session *, struct uri *, void *, void (*)(void *, char *), void (*)(void *), int);
void query_exit(struct session *ses); void query_exit(struct session *ses);
void exit_prog(struct session *ses, int query); void exit_prog(struct session *ses, int query);
@ -43,7 +43,7 @@ void send_open_in_new_window(struct terminal *term, const struct open_in_new *op
void open_in_new_window(struct terminal *term, void *func_, void *ses_); void open_in_new_window(struct terminal *term, void *func_, void *ses_);
void add_new_win_to_menu(struct menu_item **mi, unsigned char *text, struct terminal *term); void add_new_win_to_menu(struct menu_item **mi, char *text, struct terminal *term);
/* URI passing: */ /* URI passing: */
@ -54,11 +54,11 @@ enum pass_uri_type {
PASS_URI_TAB, PASS_URI_TAB,
}; };
void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, unsigned char *text); void add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, char *text);
enum frame_event_status pass_uri_to_command(struct session *ses, struct document_view *doc_view, int /* enum pass_uri_type */ type); enum frame_event_status pass_uri_to_command(struct session *ses, struct document_view *doc_view, int /* enum pass_uri_type */ type);
void void
auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, auto_complete_file(struct terminal *term, int no_elevator, char *path,
menu_func_T file_func, menu_func_T dir_func, void *data); menu_func_T file_func, menu_func_T dir_func, void *data);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -29,7 +29,7 @@
static void static void
display_codepage(struct terminal *term, void *name_, void *xxx) display_codepage(struct terminal *term, void *name_, void *xxx)
{ {
unsigned char *name = name_; char *name = name_;
struct option *opt = get_opt_rec(term->spec, "charset"); struct option *opt = get_opt_rec(term->spec, "charset");
int index = get_cp_index(name); int index = get_cp_index(name);
@ -49,14 +49,14 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
struct session *ses = ses_; struct session *ses = ses_;
int i, items; int i, items;
int sel = 0; int sel = 0;
const unsigned char *const sel_mime = get_cp_mime_name( const char *const sel_mime = get_cp_mime_name(
get_terminal_codepage(term)); get_terminal_codepage(term));
struct menu_item *mi = new_menu(FREE_LIST); struct menu_item *mi = new_menu(FREE_LIST);
if (!mi) return; if (!mi) return;
for (i = 0, items = 0; ; i++) { for (i = 0, items = 0; ; i++) {
unsigned char *name = get_cp_name(i); char *name = get_cp_name(i);
if (!name) break; if (!name) break;
@ -168,7 +168,7 @@ terminal_options(struct terminal *term, void *xxx, struct session *ses)
struct dialog *dlg; struct dialog *dlg;
union option_value *values; union option_value *values;
int anonymous = get_cmd_opt_bool("anonymous"); int anonymous = get_cmd_opt_bool("anonymous");
unsigned char help_text[MAX_STR_LEN], *text; char help_text[MAX_STR_LEN], *text;
size_t help_textlen = 0; size_t help_textlen = 0;
size_t add_size = TERM_OPTION_VALUE_SIZE; size_t add_size = TERM_OPTION_VALUE_SIZE;
@ -203,7 +203,7 @@ terminal_options(struct terminal *term, void *xxx, struct session *ses)
dlg->layout.padding_top = 1; dlg->layout.padding_top = 1;
dlg->udata = values; dlg->udata = values;
text = ((unsigned char *) values) + TERM_OPTION_VALUE_SIZE; text = ((char *) values) + TERM_OPTION_VALUE_SIZE;
memcpy(text, help_text, help_textlen); memcpy(text, help_text, help_textlen);
add_dlg_text(dlg, text, ALIGN_LEFT, 1); add_dlg_text(dlg, text, ALIGN_LEFT, 1);
@ -279,14 +279,14 @@ menu_language_list(struct terminal *term, void *xxx, void *ses)
/* FIXME: This doesn't in fact belong here at all. --pasky */ /* FIXME: This doesn't in fact belong here at all. --pasky */
static unsigned char width_str[4]; static char width_str[4];
static unsigned char height_str[4]; static char height_str[4];
static void static void
push_resize_button(void *data) push_resize_button(void *data)
{ {
struct terminal *term = data; struct terminal *term = data;
unsigned char str[MAX_STR_LEN]; char str[MAX_STR_LEN];
snprintf(str, sizeof(str), "%s,%s,%d,%d", snprintf(str, sizeof(str), "%s,%s,%d,%d",
width_str, height_str, term->width, term->height); width_str, height_str, term->width, term->height);

View File

@ -16,9 +16,9 @@
#include "util/memory.h" #include "util/memory.h"
#include "util/string.h" #include "util/string.h"
static unsigned char * static char *
get_progress_msg_2(struct progress *progress, struct terminal *term, get_progress_msg_2(struct progress *progress, struct terminal *term,
int wide, int full, unsigned char *separator, unsigned char *type) int wide, int full, char *separator, char *type)
{ {
struct string msg; struct string msg;
int newlines = separator[strlen(separator) - 1] == '\n'; int newlines = separator[strlen(separator) - 1] == '\n';
@ -90,16 +90,16 @@ get_progress_msg_2(struct progress *progress, struct terminal *term,
return msg.source; return msg.source;
} }
unsigned char * char *
get_upload_progress_msg(struct progress *progress, struct terminal *term, get_upload_progress_msg(struct progress *progress, struct terminal *term,
int wide, int full, unsigned char *separator) int wide, int full, char *separator)
{ {
return get_progress_msg_2(progress, term, wide, full, separator, _("Sent", term)); return get_progress_msg_2(progress, term, wide, full, separator, _("Sent", term));
} }
unsigned char * char *
get_progress_msg(struct progress *progress, struct terminal *term, get_progress_msg(struct progress *progress, struct terminal *term,
int wide, int full, unsigned char *separator) int wide, int full, char *separator)
{ {
return get_progress_msg_2(progress, term, wide, full, separator, _("Received", term)); return get_progress_msg_2(progress, term, wide, full, separator, _("Received", term));
} }
@ -107,7 +107,7 @@ get_progress_msg(struct progress *progress, struct terminal *term,
void void
draw_progress_bar(struct progress *progress, struct terminal *term, draw_progress_bar(struct progress *progress, struct terminal *term,
int x, int y, int width, int x, int y, int width,
unsigned char *text, struct color_pair *meter_color) char *text, struct color_pair *meter_color)
{ {
/* Note : values > 100% are theorically possible and were seen. */ /* Note : values > 100% are theorically possible and were seen. */
int percent = 0; int percent = 0;
@ -133,7 +133,7 @@ draw_progress_bar(struct progress *progress, struct terminal *term,
width = int_min(width, strlen(text)); width = int_min(width, strlen(text));
} else if (width > 1) { } else if (width > 1) {
static unsigned char s[] = "????"; /* Reduce or enlarge at will. */ static char s[] = "????"; /* Reduce or enlarge at will. */
unsigned int slen = 0; unsigned int slen = 0;
int max = int_min(sizeof(s), width) - 1; int max = int_min(sizeof(s), width) - 1;

View File

@ -8,21 +8,21 @@ extern "C" {
struct progress; struct progress;
struct terminal; struct terminal;
unsigned char * char *
get_progress_msg(struct progress *progress, struct terminal *term, get_progress_msg(struct progress *progress, struct terminal *term,
int wide, int full, unsigned char *separator); int wide, int full, char *separator);
unsigned char * char *
get_upload_progress_msg(struct progress *progress, struct terminal *term, get_upload_progress_msg(struct progress *progress, struct terminal *term,
int wide, int full, unsigned char *separator); int wide, int full, char *separator);
/* Draws a progress bar meter or progress coloured text depending on whether /* Draws a progress bar meter or progress coloured text depending on whether
* @text is NULL. If @meter_color is NULL dialog.meter color is used. */ * @text is NULL. If @meter_color is NULL dialog.meter color is used. */
void void
draw_progress_bar(struct progress *progress, struct terminal *term, draw_progress_bar(struct progress *progress, struct terminal *term,
int x, int y, int width, int x, int y, int width,
unsigned char *text, struct color_pair *meter_color); char *text, struct color_pair *meter_color);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -41,9 +41,9 @@
#include "viewer/text/view.h" #include "viewer/text/view.h"
unsigned char * char *
get_download_msg(struct download *download, struct terminal *term, get_download_msg(struct download *download, struct terminal *term,
int wide, int full, unsigned char *separator) int wide, int full, char *separator)
{ {
if (!download_is_progressing(download)) { if (!download_is_progressing(download)) {
/* DBG("%d -> %s", download->state, _(get_err_msg(download->state), term)); */ /* DBG("%d -> %s", download->state, _(get_err_msg(download->state), term)); */
@ -142,11 +142,11 @@ update_status(void)
} }
} }
static unsigned char * static char *
get_current_link_info_and_title(struct session *ses, get_current_link_info_and_title(struct session *ses,
struct document_view *doc_view) struct document_view *doc_view)
{ {
unsigned char *link_info, *link_title, *ret = NULL; char *link_info, *link_title, *ret = NULL;
link_info = get_current_link_info(ses, doc_view); link_info = get_current_link_info(ses, doc_view);
if (!link_info) return NULL; if (!link_info) return NULL;
@ -156,7 +156,7 @@ get_current_link_info_and_title(struct session *ses,
assert(*link_title); assert(*link_title);
ret = straconcat(link_info, " - ", link_title, ret = straconcat(link_info, " - ", link_title,
(unsigned char *) NULL); (char *) NULL);
mem_free(link_info); mem_free(link_info);
mem_free(link_title); mem_free(link_title);
} }
@ -169,7 +169,7 @@ get_current_link_info_and_title(struct session *ses,
static inline void static inline void
display_status_bar(struct session *ses, struct terminal *term, int tabs_count) display_status_bar(struct session *ses, struct terminal *term, int tabs_count)
{ {
unsigned char *msg = NULL; char *msg = NULL;
unsigned int tab_info_len = 0; unsigned int tab_info_len = 0;
struct download *download = get_current_download(ses); struct download *download = get_current_download(ses);
struct session_status *status = &ses->status; struct session_status *status = &ses->status;
@ -245,7 +245,7 @@ display_status_bar(struct session *ses, struct terminal *term, int tabs_count)
draw_box(term, &box, ' ', 0, get_bfu_color(term, "status.status-bar")); draw_box(term, &box, ' ', 0, get_bfu_color(term, "status.status-bar"));
if (!status->show_tabs_bar && tabs_count > 1) { if (!status->show_tabs_bar && tabs_count > 1) {
unsigned char tab_info[8]; char tab_info[8];
tab_info[tab_info_len++] = '['; tab_info[tab_info_len++] = '[';
ulongcat(tab_info, &tab_info_len, term->current_tab + 1, 4, 0); ulongcat(tab_info, &tab_info_len, term->current_tab + 1, 4, 0);
@ -312,7 +312,7 @@ display_tab_bar(struct session *ses, struct terminal *term, int tabs_count)
struct document_view *doc_view; struct document_view *doc_view;
struct session *tab_ses = tab->data; struct session *tab_ses = tab->data;
int actual_tab_width = tab_width - 1; int actual_tab_width = tab_width - 1;
unsigned char *msg; char *msg;
/* Adjust tab size to use full term width. */ /* Adjust tab size to use full term width. */
if (tab_remain_width) { if (tab_remain_width) {
@ -398,7 +398,7 @@ display_title_bar(struct session *ses, struct terminal *term)
struct document_view *doc_view; struct document_view *doc_view;
struct document *document; struct document *document;
struct string title; struct string title;
unsigned char buf[40]; char buf[40];
int buflen = 0; int buflen = 0;
int height; int height;
@ -486,8 +486,8 @@ display_window_title(struct session *ses, struct terminal *term)
{ {
static struct session *last_ses; static struct session *last_ses;
struct session_status *status = &ses->status; struct session_status *status = &ses->status;
unsigned char *doc_title = NULL; char *doc_title = NULL;
unsigned char *title; char *title;
int titlelen; int titlelen;
if (ses->doc_view if (ses->doc_view
@ -497,7 +497,7 @@ display_window_title(struct session *ses, struct terminal *term)
doc_title = ses->doc_view->document->title; doc_title = ses->doc_view->document->title;
title = doc_title ? straconcat(doc_title, " - ELinks", title = doc_title ? straconcat(doc_title, " - ELinks",
(unsigned char *) NULL) (char *) NULL)
: stracpy("ELinks"); : stracpy("ELinks");
if (!title) return; if (!title) return;

View File

@ -13,9 +13,9 @@ void print_screen_status(struct session *);
void update_status(void); void update_status(void);
unsigned char * char *
get_download_msg(struct download *download, struct terminal *term, get_download_msg(struct download *download, struct terminal *term,
int wide, int full, unsigned char *separator); int wide, int full, char *separator);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -235,10 +235,10 @@ examine_element(struct html_context *html_context, struct css_selector *base,
} }
if (element->attr.class_ && seltype <= CST_CLASS) { if (element->attr.class_ && seltype <= CST_CLASS) {
const unsigned char *class_ = element->attr.class_; const char *class_ = element->attr.class_;
for (;;) { for (;;) {
const unsigned char *begin; const char *begin;
while (*class_ == ' ') ++class_; while (*class_ == ' ') ++class_;
if (*class_ == '\0') break; if (*class_ == '\0') break;
@ -266,7 +266,7 @@ get_css_selector_for_element(struct html_context *html_context,
struct css_stylesheet *css, struct css_stylesheet *css,
LIST_OF(struct html_element) *html_stack) LIST_OF(struct html_element) *html_stack)
{ {
unsigned char *code; char *code;
struct css_selector *selector; struct css_selector *selector;
assert(element && element->options && css); assert(element && element->options && css);

View File

@ -84,14 +84,14 @@ union option_info css_options_info[] = {
* *
* @return nonzero if the media type is supported, 0 if not. */ * @return nonzero if the media type is supported, 0 if not. */
int int
supports_css_media_type(const unsigned char *optstr, supports_css_media_type(const char *optstr,
const unsigned char *token, size_t token_length) const char *token, size_t token_length)
{ {
/* Split @optstr into comma-delimited strings, strip leading /* Split @optstr into comma-delimited strings, strip leading
* and trailing spaces from each, and compare them to the * and trailing spaces from each, and compare them to the
* token. */ * token. */
while (*optstr != '\0') { while (*optstr != '\0') {
const unsigned char *beg, *end; const char *beg, *end;
while (*optstr == ' ') while (*optstr == ' ')
++optstr; ++optstr;
@ -142,7 +142,7 @@ import_css(struct css_stylesheet *css, struct uri *uri)
fragment = get_cache_fragment(cached); fragment = get_cache_fragment(cached);
if (fragment) { if (fragment) {
unsigned char *end = fragment->data + fragment->length; char *end = fragment->data + fragment->length;
css->import_level++; css->import_level++;
css_parse_stylesheet(css, uri, fragment->data, end); css_parse_stylesheet(css, uri, fragment->data, end);
@ -153,7 +153,7 @@ import_css(struct css_stylesheet *css, struct uri *uri)
static void static void
import_css_file(struct css_stylesheet *css, struct uri *base_uri, import_css_file(struct css_stylesheet *css, struct uri *base_uri,
const unsigned char *url, int urllen) const char *url, int urllen)
{ {
struct string string, filename; struct string string, filename;
@ -169,7 +169,7 @@ import_css_file(struct css_stylesheet *css, struct uri *base_uri,
add_bytes_to_string(&filename, url, urllen); add_bytes_to_string(&filename, url, urllen);
if (is_in_state(read_encoded_file(&filename, &string), S_OK)) { if (is_in_state(read_encoded_file(&filename, &string), S_OK)) {
unsigned char *end = string.source + string.length; char *end = string.source + string.length;
css->import_level++; css->import_level++;
css_parse_stylesheet(css, base_uri, string.source, end); css_parse_stylesheet(css, base_uri, string.source, end);
@ -185,7 +185,7 @@ struct css_stylesheet default_stylesheet = INIT_CSS_STYLESHEET(default_styleshee
static void static void
import_default_css(void) import_default_css(void)
{ {
unsigned char *url = get_opt_str("document.css.stylesheet", NULL); char *url = get_opt_str("document.css.stylesheet", NULL);
if (!css_selector_set_empty(&default_stylesheet.selectors)) if (!css_selector_set_empty(&default_stylesheet.selectors))
done_css_stylesheet(&default_stylesheet); done_css_stylesheet(&default_stylesheet);

View File

@ -27,8 +27,8 @@ extern struct module css_module;
/** This function will try to import the given @a url from the cache. */ /** This function will try to import the given @a url from the cache. */
void import_css(struct css_stylesheet *css, struct uri *uri); void import_css(struct css_stylesheet *css, struct uri *uri);
int supports_css_media_type(const unsigned char *optstr, int supports_css_media_type(const char *optstr,
const unsigned char *token, size_t token_length); const char *token, size_t token_length);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -137,7 +137,7 @@ css_parse_media_types(struct scanner *scanner)
{ {
int matched = 0; int matched = 0;
int empty = 1; int empty = 1;
const unsigned char *const optstr = get_opt_str("document.css.media", NULL); const char *const optstr = get_opt_str("document.css.media", NULL);
struct scanner_token *token = get_scanner_token(scanner); struct scanner_token *token = get_scanner_token(scanner);
while (token && token->type == CSS_TOKEN_IDENT) { while (token && token->type == CSS_TOKEN_IDENT) {
@ -629,7 +629,7 @@ css_parse_ruleset(struct css_stylesheet *css, struct scanner *scanner)
void void
css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri, css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
const unsigned char *string, const unsigned char *end) const char *string, const char *end)
{ {
struct scanner scanner; struct scanner scanner;

View File

@ -28,7 +28,7 @@ void css_parse_properties(LIST_OF(struct css_property) *props,
* given stylesheet @a css. If the selector is already in the stylesheet it * given stylesheet @a css. If the selector is already in the stylesheet it
* properties are added to the that selector. */ * properties are added to the that selector. */
void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri, void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
const unsigned char *string, const unsigned char *end); const char *string, const char *end);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -114,7 +114,7 @@ typedef int (*css_property_value_parser_T)(struct css_property_info *propinfo,
/** The struct css_property_info describes what values the properties can /** The struct css_property_info describes what values the properties can
* have and what internal type they have. */ * have and what internal type they have. */
struct css_property_info { struct css_property_info {
unsigned char *name; char *name;
enum css_property_type type; enum css_property_type type;
/** This is the storage type, basically describing what to save to /** This is the storage type, basically describing what to save to

View File

@ -91,7 +91,7 @@ struct scanner_info css_scanner_info = {
scan_css_tokens, scan_css_tokens,
}; };
#define check_css_table(c, bit) (css_scanner_info.scan_table[(c)] & (bit)) #define check_css_table(c, bit) (css_scanner_info.scan_table[(unsigned char)(c)] & (bit))
#define scan_css(scanner, s, bit) \ #define scan_css(scanner, s, bit) \
while ((s) < (scanner)->end && check_css_table(*(s), bit)) (s)++; while ((s) < (scanner)->end && check_css_table(*(s), bit)) (s)++;
@ -113,7 +113,7 @@ struct scanner_info css_scanner_info = {
&& check_css_precedence(*(s), skipto)) { \ && check_css_precedence(*(s), skipto)) { \
if (isquote(*(s))) { \ if (isquote(*(s))) { \
int size = (scanner)->end - (s); \ int size = (scanner)->end - (s); \
unsigned char *end = memchr(s + 1, *(s), size); \ char *end = memchr(s + 1, *(s), size); \
\ \
if (end) (s) = end; \ if (end) (s) = end; \
} \ } \
@ -124,7 +124,7 @@ struct scanner_info css_scanner_info = {
static inline void static inline void
scan_css_token(struct scanner *scanner, struct scanner_token *token) scan_css_token(struct scanner *scanner, struct scanner_token *token)
{ {
const unsigned char *string = scanner->position; const char *string = scanner->position;
unsigned char first_char = *string; unsigned char first_char = *string;
enum css_token_type type = CSS_TOKEN_GARBAGE; enum css_token_type type = CSS_TOKEN_GARBAGE;
int real_length = -1; int real_length = -1;
@ -158,7 +158,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
type = CSS_TOKEN_NUMBER; type = CSS_TOKEN_NUMBER;
} else { } else {
const unsigned char *ident = string; const char *ident = string;
scan_css(scanner, string, CSS_CHAR_IDENT); scan_css(scanner, string, CSS_CHAR_IDENT);
type = map_scanner_string(scanner, ident, string, type = map_scanner_string(scanner, ident, string,
@ -169,7 +169,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
scan_css(scanner, string, CSS_CHAR_IDENT); scan_css(scanner, string, CSS_CHAR_IDENT);
if (*string == '(') { if (*string == '(') {
const unsigned char *function_end = string + 1; const char *function_end = string + 1;
/* Make sure that we have an ending ')' */ /* Make sure that we have an ending ')' */
skip_css(scanner, function_end, ')'); skip_css(scanner, function_end, ')');
@ -193,8 +193,8 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
* we should of course handle escape * we should of course handle escape
* sequences .. but that will have to * sequences .. but that will have to
* be fixed later. */ * be fixed later. */
const unsigned char *from = string + 1; const char *from = string + 1;
const unsigned char *to = function_end - 1; const char *to = function_end - 1;
scan_css(scanner, from, CSS_CHAR_WHITESPACE); scan_css(scanner, from, CSS_CHAR_WHITESPACE);
scan_back_css(scanner, to, CSS_CHAR_WHITESPACE); scan_back_css(scanner, to, CSS_CHAR_WHITESPACE);
@ -258,7 +258,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
} else if (first_char == '@') { } else if (first_char == '@') {
/* Compose token containing @<ident> */ /* Compose token containing @<ident> */
if (is_css_ident_start(*string)) { if (is_css_ident_start(*string)) {
const unsigned char *ident = string; const char *ident = string;
/* Scan both ident start and ident */ /* Scan both ident start and ident */
scan_css(scanner, string, CSS_CHAR_IDENT); scan_css(scanner, string, CSS_CHAR_IDENT);
@ -302,7 +302,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
} else if (isquote(first_char)) { } else if (isquote(first_char)) {
/* TODO: Escaped delimiters --jonas */ /* TODO: Escaped delimiters --jonas */
int size = scanner->end - string; int size = scanner->end - string;
unsigned char *string_end = memchr(string, first_char, size); char *string_end = memchr(string, first_char, size);
if (string_end) { if (string_end) {
/* We don't want the delimiters in the token */ /* We don't want the delimiters in the token */
@ -320,7 +320,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
type = CSS_TOKEN_NONE; type = CSS_TOKEN_NONE;
} else { } else {
const unsigned char *sgml = string; const char *sgml = string;
/* Skip anything looking like SGML "<!--" and "-->" /* Skip anything looking like SGML "<!--" and "-->"
* comments + <![CDATA[ and ]]> notations. */ * comments + <![CDATA[ and ]]> notations. */

View File

@ -29,7 +29,7 @@ struct css_selector *
find_css_selector(struct css_selector_set *sels, find_css_selector(struct css_selector_set *sels,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation rel, enum css_selector_relation rel,
const unsigned char *name, int namelen) const char *name, int namelen)
{ {
struct css_selector *selector; struct css_selector *selector;
@ -50,7 +50,7 @@ struct css_selector *
init_css_selector(struct css_selector_set *sels, init_css_selector(struct css_selector_set *sels,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation relation, enum css_selector_relation relation,
const unsigned char *name, int namelen) const char *name, int namelen)
{ {
struct css_selector *selector; struct css_selector *selector;
@ -97,7 +97,7 @@ struct css_selector *
get_css_selector(struct css_selector_set *sels, get_css_selector(struct css_selector_set *sels,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation rel, enum css_selector_relation rel,
const unsigned char *name, int namelen) const char *name, int namelen)
{ {
struct css_selector *selector = NULL; struct css_selector *selector = NULL;

View File

@ -96,7 +96,7 @@ struct css_selector {
struct css_selector_set leaves; struct css_selector_set leaves;
enum css_selector_type type; enum css_selector_type type;
unsigned char *name; char *name;
LIST_OF(struct css_property) properties; LIST_OF(struct css_property) properties;
}; };
@ -104,7 +104,7 @@ struct css_selector {
struct css_stylesheet; struct css_stylesheet;
typedef void (*css_stylesheet_importer_T)(struct css_stylesheet *, struct uri *, typedef void (*css_stylesheet_importer_T)(struct css_stylesheet *, struct uri *,
const unsigned char *url, int urllen); const char *url, int urllen);
/** The struct css_stylesheet describes all the useful data that was extracted /** The struct css_stylesheet describes all the useful data that was extracted
* from the CSS source. Currently we don't cache anything but the default user * from the CSS source. Currently we don't cache anything but the default user
@ -148,7 +148,7 @@ void done_css_stylesheet(struct css_stylesheet *css);
struct css_selector *get_css_selector(struct css_selector_set *set, struct css_selector *get_css_selector(struct css_selector_set *set,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation rel, enum css_selector_relation rel,
const unsigned char *name, int namelen); const char *name, int namelen);
#define get_css_base_selector(stylesheet, type, rel, name, namelen) \ #define get_css_base_selector(stylesheet, type, rel, name, namelen) \
get_css_selector((stylesheet) ? &(stylesheet)->selectors : NULL, \ get_css_selector((stylesheet) ? &(stylesheet)->selectors : NULL, \
@ -159,7 +159,7 @@ struct css_selector *get_css_selector(struct css_selector_set *set,
struct css_selector *find_css_selector(struct css_selector_set *set, struct css_selector *find_css_selector(struct css_selector_set *set,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation rel, enum css_selector_relation rel,
const unsigned char *name, int namelen); const char *name, int namelen);
#define find_css_base_selector(stylesheet, type, rel, name, namelen) \ #define find_css_base_selector(stylesheet, type, rel, name, namelen) \
find_css_selector(&stylesheet->selectors, rel, type, name, namelen) find_css_selector(&stylesheet->selectors, rel, type, name, namelen)
@ -169,7 +169,7 @@ struct css_selector *find_css_selector(struct css_selector_set *set,
struct css_selector *init_css_selector(struct css_selector_set *set, struct css_selector *init_css_selector(struct css_selector_set *set,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation relation, enum css_selector_relation relation,
const unsigned char *name, int namelen); const char *name, int namelen);
/** Add all properties from the list to the given @a selector. */ /** Add all properties from the list to the given @a selector. */
void add_selector_properties(struct css_selector *selector, void add_selector_properties(struct css_selector *selector,

View File

@ -40,7 +40,7 @@ css_parse_color_value(struct css_property_info *propinfo,
/* The first two args are terminated by ',' and the /* The first two args are terminated by ',' and the
* last one by ')'. */ * last one by ')'. */
unsigned char paskynator = shift ? ',' : ')'; unsigned char paskynator = shift ? ',' : ')';
const unsigned char *nstring = token->string; const char *nstring = token->string;
int part; int part;
/* Are the current and next token valid? */ /* Are the current and next token valid? */
@ -152,7 +152,7 @@ css_parse_font_weight_value(struct css_property_info *propinfo,
struct scanner *scanner) struct scanner *scanner)
{ {
struct scanner_token *token = get_scanner_token(scanner); struct scanner_token *token = get_scanner_token(scanner);
unsigned char *nstring; char *nstring;
int weight; int weight;
assert(propinfo->value_type == CSS_VT_FONT_ATTRIBUTE); assert(propinfo->value_type == CSS_VT_FONT_ATTRIBUTE);

View File

@ -74,10 +74,10 @@ static INIT_LIST_OF(struct document, format_cache);
static void static void
found_dns(void *data, struct sockaddr_storage *addr, int addrlen) found_dns(void *data, struct sockaddr_storage *addr, int addrlen)
{ {
unsigned char buf[64]; char buf[64];
const unsigned char *res; const char *res;
struct sockaddr *s; struct sockaddr *s;
unsigned char **ip = (unsigned char **)data; char **ip = (char **)data;
void *src; void *src;
if (!ip || !addr) return; if (!ip || !addr) return;
@ -265,7 +265,7 @@ release_document(struct document *document)
} }
int int
find_tag(struct document *document, unsigned char *name, int namelen) find_tag(struct document *document, char *name, int namelen)
{ {
struct tag *tag; struct tag *tag;

View File

@ -64,7 +64,7 @@ struct tag {
LIST_HEAD(struct tag); LIST_HEAD(struct tag);
int x, y; int x, y;
unsigned char name[1]; /* must be last of struct. --Zas */ char name[1]; /* must be last of struct. --Zas */
}; };
@ -92,7 +92,7 @@ struct script_event_hook {
LIST_HEAD(struct script_event_hook); LIST_HEAD(struct script_event_hook);
enum script_event_hook_type type; enum script_event_hook_type type;
unsigned char *src; char *src;
}; };
struct link { struct link {
@ -100,13 +100,13 @@ struct link {
enum link_type type; enum link_type type;
unsigned char *where; char *where;
unsigned char *target; char *target;
unsigned char *where_img; char *where_img;
/** The title of the link. This is in the document charset, /** The title of the link. This is in the document charset,
* and entities have already been decoded. */ * and entities have already been decoded. */
unsigned char *title; char *title;
/** The set of characters belonging to this link (their coordinates /** The set of characters belonging to this link (their coordinates
* in the document) - each character has own struct point. */ * in the document) - each character has own struct point. */
@ -125,7 +125,7 @@ struct link {
LIST_OF(struct script_event_hook) *event_hooks; LIST_OF(struct script_event_hook) *event_hooks;
union { union {
unsigned char *name; char *name;
struct el_form_control *form_control; struct el_form_control *form_control;
} data; } data;
}; };
@ -225,10 +225,10 @@ struct document {
/* for obtaining IP */ /* for obtaining IP */
void *querydns; void *querydns;
unsigned char *ip; char *ip;
/** The title of the document. The charset of this string is /** The title of the document. The charset of this string is
* document.options.cp. */ * document.options.cp. */
unsigned char *title; char *title;
struct cache_entry *cached; struct cache_entry *cached;
struct frame_desc *frame; struct frame_desc *frame;
@ -250,7 +250,7 @@ struct document {
struct point *search_points; struct point *search_points;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
unsigned char buf[7]; char buf[7];
unsigned char buf_length; unsigned char buf_length;
#endif #endif
#ifdef CONFIG_COMBINE #ifdef CONFIG_COMBINE
@ -321,7 +321,7 @@ extern struct module document_module;
* For now, we only support simple printable character. */ * For now, we only support simple printable character. */
#define accesskey_string_to_unicode(s) (((s)[0] && !(s)[1] && isprint((s)[0])) ? (s)[0] : 0) #define accesskey_string_to_unicode(s) (((s)[0] && !(s)[1] && isprint((s)[0])) ? (s)[0] : 0)
int find_tag(struct document *document, unsigned char *name, int namelen); int find_tag(struct document *document, char *name, int namelen);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -81,13 +81,13 @@ void
render_dom_document(struct cache_entry *cached, struct document *document, render_dom_document(struct cache_entry *cached, struct document *document,
struct string *buffer) struct string *buffer)
{ {
unsigned char *head = empty_string_or_(cached->head); char *head = empty_string_or_(cached->head);
struct dom_renderer renderer; struct dom_renderer renderer;
struct dom_config config; struct dom_config config;
struct conv_table *convert_table; struct conv_table *convert_table;
struct sgml_parser *parser; struct sgml_parser *parser;
enum sgml_parser_type parser_type; enum sgml_parser_type parser_type;
unsigned char *string = struri(cached->uri); char *string = struri(cached->uri);
size_t length = strlen(string); size_t length = strlen(string);
struct dom_string uri = INIT_DOM_STRING(string, length); struct dom_string uri = INIT_DOM_STRING(string, length);

View File

@ -66,7 +66,7 @@ render_rss_item(struct dom_renderer *renderer, struct dom_node *item)
if (title && is_dom_string_set(title)) { if (title && is_dom_string_set(title)) {
if (item->data.element.type == RSS_ELEMENT_CHANNEL) { if (item->data.element.type == RSS_ELEMENT_CHANNEL) {
unsigned char *str; char *str;
str = convert_string(renderer->convert_table, str = convert_string(renderer->convert_table,
title->string, title->length, title->string, title->length,
@ -175,12 +175,12 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
static int i_want_struct_module_for_dom; static int i_want_struct_module_for_dom;
if (!i_want_struct_module_for_dom) { if (!i_want_struct_module_for_dom) {
static const unsigned char default_colors[] = static const char default_colors[] =
"title { color: lightgreen } " "title { color: lightgreen } "
"author { color: aqua }" "author { color: aqua }"
"author-date-sep{ color: aqua }" "author-date-sep{ color: aqua }"
"date { color: aqua }"; "date { color: aqua }";
unsigned char *styles = (unsigned char *) default_colors; char *styles = (char *) default_colors;
i_want_struct_module_for_dom = 1; i_want_struct_module_for_dom = 1;
/* When someone will get here earlier than at 4am, /* When someone will get here earlier than at 4am,
@ -198,7 +198,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
for (type = 0; type < RSS_STYLES; type++) { for (type = 0; type < RSS_STYLES; type++) {
struct screen_char *template_ = &rss->styles[type]; struct screen_char *template_ = &rss->styles[type];
static const unsigned char *names[RSS_STYLES] = static const char *names[RSS_STYLES] =
{ "title", "author", "author-date-sep", "date" }; { "title", "author", "author-date-sep", "date" };
struct css_selector *selector = NULL; struct css_selector *selector = NULL;

View File

@ -60,7 +60,7 @@ struct source_renderer {
static inline void static inline void
render_dom_flush(struct dom_renderer *renderer, unsigned char *string) render_dom_flush(struct dom_renderer *renderer, char *string)
{ {
struct source_renderer *data = renderer->data; struct source_renderer *data = renderer->data;
struct screen_char *template_ = &data->styles[DOM_NODE_TEXT]; struct screen_char *template_ = &data->styles[DOM_NODE_TEXT];
@ -80,7 +80,7 @@ static inline void
render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template_, render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template_,
struct dom_node *node) struct dom_node *node)
{ {
unsigned char *string = node->string.string; char *string = node->string.string;
int length = node->string.length; int length = node->string.length;
if (node->type == DOM_NODE_ENTITY_REFERENCE) { if (node->type == DOM_NODE_ENTITY_REFERENCE) {
@ -104,10 +104,10 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
struct source_renderer *data = renderer->data; struct source_renderer *data = renderer->data;
regex_t *regex = &data->url_regex; regex_t *regex = &data->url_regex;
regmatch_t regmatch; regmatch_t regmatch;
unsigned char *string = node->string.string; char *string = node->string.string;
int length = node->string.length; int length = node->string.length;
struct screen_char *template_ = &data->styles[node->type]; struct screen_char *template_ = &data->styles[node->type];
unsigned char *alloc_string; char *alloc_string;
if (check_dom_node_source(renderer, string, length)) { if (check_dom_node_source(renderer, string, length)) {
render_dom_flush(renderer, string); render_dom_flush(renderer, string);
@ -188,7 +188,7 @@ render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, vo
struct dom_stack_state *state = get_dom_stack_top(stack); struct dom_stack_state *state = get_dom_stack_top(stack);
struct sgml_parser_state *pstate = get_dom_stack_state_data(stack->contexts[0], state); struct sgml_parser_state *pstate = get_dom_stack_state_data(stack->contexts[0], state);
struct dom_scanner_token *token = &pstate->end_token; struct dom_scanner_token *token = &pstate->end_token;
unsigned char *string = token->string.string; char *string = token->string.string;
int length = token->string.length; int length = token->string.length;
assert(node && renderer && renderer->document); assert(node && renderer && renderer->document);
@ -208,10 +208,10 @@ render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, vo
} }
static void static void
set_base_uri(struct dom_renderer *renderer, unsigned char *value, size_t valuelen) set_base_uri(struct dom_renderer *renderer, char *value, size_t valuelen)
{ {
unsigned char *href = memacpy(value, valuelen); char *href = memacpy(value, valuelen);
unsigned char *uristring; char *uristring;
struct uri *uri; struct uri *uri;
if (!href) return; if (!href) return;
@ -241,7 +241,7 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
if (is_dom_string_set(&node->data.attribute.value)) { if (is_dom_string_set(&node->data.attribute.value)) {
int quoted = node->data.attribute.quoted == 1; int quoted = node->data.attribute.quoted == 1;
unsigned char *value = node->data.attribute.value.string - quoted; char *value = node->data.attribute.value.string - quoted;
int valuelen = node->data.attribute.value.length + quoted * 2; int valuelen = node->data.attribute.value.length + quoted * 2;
if (check_dom_node_source(renderer, value, 0)) { if (check_dom_node_source(renderer, value, 0)) {
@ -309,7 +309,7 @@ render_dom_cdata_source(struct dom_stack *stack, struct dom_node *node, void *xx
{ {
struct dom_renderer *renderer = stack->current->data; struct dom_renderer *renderer = stack->current->data;
struct source_renderer *data = renderer->data; struct source_renderer *data = renderer->data;
unsigned char *string = node->string.string; char *string = node->string.string;
assert(node && renderer && renderer->document); assert(node && renderer && renderer->document);
@ -340,7 +340,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void *
static int i_want_struct_module_for_dom; static int i_want_struct_module_for_dom;
if (!i_want_struct_module_for_dom) { if (!i_want_struct_module_for_dom) {
static const unsigned char default_colors[] = static const char default_colors[] =
"document { color: yellow } " "document { color: yellow } "
"element { color: lightgreen } " "element { color: lightgreen } "
"entity-reference { color: red } " "entity-reference { color: red } "

View File

@ -116,7 +116,7 @@ add_search_node(struct dom_renderer *renderer, int width)
static void static void
render_dom_line(struct dom_renderer *renderer, struct screen_char *template_, render_dom_line(struct dom_renderer *renderer, struct screen_char *template_,
unsigned char *string, int length) char *string, int length)
{ {
struct document *document = renderer->document; struct document *document = renderer->document;
struct conv_table *convert = renderer->convert_table; struct conv_table *convert = renderer->convert_table;
@ -124,7 +124,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template_,
int x, charlen; int x, charlen;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
int utf8 = document->options.utf8; int utf8 = document->options.utf8;
unsigned char *end; char *end;
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
@ -145,7 +145,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template_,
end = string + length; end = string + length;
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
for (x = 0, charlen = 1; x < length;x += charlen, renderer->canvas_x++) { for (x = 0, charlen = 1; x < length;x += charlen, renderer->canvas_x++) {
unsigned char *text = &string[x]; char *text = &string[x];
/* This is mostly to be able to break out so the indentation /* This is mostly to be able to break out so the indentation
* level won't get to high. */ * level won't get to high. */
@ -194,11 +194,11 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template_,
mem_free(string); mem_free(string);
} }
static inline unsigned char * static inline char *
split_dom_line(unsigned char *line, int length, int *linelen) split_dom_line(char *line, int length, int *linelen)
{ {
unsigned char *end = line + length; char *end = line + length;
unsigned char *pos; char *pos;
/* End of line detection. /* End of line detection.
* We handle \r, \r\n and \n types here. */ * We handle \r, \r\n and \n types here. */
@ -223,12 +223,12 @@ split_dom_line(unsigned char *line, int length, int *linelen)
void void
render_dom_text(struct dom_renderer *renderer, struct screen_char *template_, render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
unsigned char *string, int length) char *string, int length)
{ {
int linelen; int linelen;
for (; length > 0; string += linelen, length -= linelen) { for (; length > 0; string += linelen, length -= linelen) {
unsigned char *newline = split_dom_line(string, length, &linelen); char *newline = split_dom_line(string, length, &linelen);
if (linelen) if (linelen)
render_dom_line(renderer, template_, string, linelen); render_dom_line(renderer, template_, string, linelen);
@ -245,13 +245,13 @@ render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
ALIGN_LINK(&(doc)->links, (doc)->nlinks, size) ALIGN_LINK(&(doc)->links, (doc)->nlinks, size)
NONSTATIC_INLINE struct link * NONSTATIC_INLINE struct link *
add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length, add_dom_link(struct dom_renderer *renderer, char *string, int length,
unsigned char *uristring, int urilength) char *uristring, int urilength)
{ {
struct document *document = renderer->document; struct document *document = renderer->document;
int x = renderer->canvas_x; int x = renderer->canvas_x;
int y = renderer->canvas_y; int y = renderer->canvas_y;
unsigned char *where; char *where;
struct link *link; struct link *link;
struct point *point; struct point *point;
struct screen_char template_; struct screen_char template_;

View File

@ -31,10 +31,10 @@ struct dom_renderer {
struct uri *base_uri; struct uri *base_uri;
unsigned char *source; char *source;
unsigned char *end; char *end;
unsigned char *position; char *position;
int canvas_x, canvas_y; int canvas_x, canvas_y;
/* Renderer-specific data */ /* Renderer-specific data */
@ -50,9 +50,9 @@ void init_template_by_style(struct screen_char *template_,
LIST_OF(struct css_property) *properties); LIST_OF(struct css_property) *properties);
void render_dom_text(struct dom_renderer *renderer, struct screen_char *template_, void render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
unsigned char *string, int length); char *string, int length);
struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string, struct link *add_dom_link(struct dom_renderer *renderer, char *string,
int length, unsigned char *uristring, int urilength); int length, char *uristring, int urilength);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -23,7 +23,7 @@
struct form_type_name { struct form_type_name {
enum form_type num; enum form_type num;
unsigned char *name; char *name;
}; };
static struct form_type_name form_type2name[] = { static struct form_type_name form_type2name[] = {
@ -42,7 +42,7 @@ static struct form_type_name form_type2name[] = {
#define FORM_TYPE_COUNT (sizeof(form_type2name)/sizeof(struct form_type_name)) #define FORM_TYPE_COUNT (sizeof(form_type2name)/sizeof(struct form_type_name))
int int
str2form_type(unsigned char *s) str2form_type(char *s)
{ {
int n; int n;
@ -53,7 +53,7 @@ str2form_type(unsigned char *s)
return -1; return -1;
} }
unsigned char * char *
form_type2str(enum form_type num) form_type2str(enum form_type num)
{ {
int n; int n;

View File

@ -35,10 +35,10 @@ struct form {
int form_num; int form_num;
int form_end; /**< @see #form_num */ int form_end; /**< @see #form_num */
unsigned char *action; char *action;
unsigned char *name; char *name;
unsigned char *onsubmit; char *onsubmit;
unsigned char *target; char *target;
enum form_method method; enum form_method method;
LIST_OF(struct el_form_control) items; LIST_OF(struct el_form_control) items;
@ -88,33 +88,33 @@ struct el_form_control {
enum form_type type; enum form_type type;
enum form_mode mode; enum form_mode mode;
unsigned char *id; /**< used by scripts */ char *id; /**< used by scripts */
unsigned char *name; char *name;
unsigned char *alt; char *alt;
/** Default value, cannot be changed by document scripts. /** Default value, cannot be changed by document scripts.
* - For ::FC_TEXT, ::FC_PASSWORD, and ::FC_TEXTAREA: * - For ::FC_TEXT, ::FC_PASSWORD, and ::FC_TEXTAREA:
* @c default_value is in the charset of the document. * @c default_value is in the charset of the document.
* - For ::FC_FILE: The parser does not set @c default_value. */ * - For ::FC_FILE: The parser does not set @c default_value. */
unsigned char *default_value; char *default_value;
int default_state; int default_state;
int size; int size;
int cols, rows; int cols, rows;
enum form_wrap wrap; enum form_wrap wrap;
int maxlength; int maxlength;
int nvalues; int nvalues;
unsigned char **values; char **values;
/** Labels in a selection menu. /** Labels in a selection menu.
* - For ::FC_SELECT: @c labels are in the charset of the terminal. * - For ::FC_SELECT: @c labels are in the charset of the terminal.
* (That charset can be UTF-8 only if CONFIG_UTF8 is defined, * (That charset can be UTF-8 only if CONFIG_UTF8 is defined,
* and is assumed to be unibyte otherwise.) The charset of * and is assumed to be unibyte otherwise.) The charset of
* the document and the UTF-8 I/O option have no effect here. */ * the document and the UTF-8 I/O option have no effect here. */
unsigned char **labels; char **labels;
struct menu_item *menu; struct menu_item *menu;
}; };
/* Numerical form type <-> form type name */ /* Numerical form type <-> form type name */
int str2form_type(unsigned char *s); int str2form_type(char *s);
unsigned char *form_type2str(enum form_type num); char *form_type2str(enum form_type num);
struct form *init_form(void); struct form *init_form(void);
void done_form(struct form *form); void done_form(struct form *form);

View File

@ -28,7 +28,7 @@
void void
add_frameset_entry(struct frameset_desc *frameset_desc, add_frameset_entry(struct frameset_desc *frameset_desc,
struct frameset_desc *subframe, struct frameset_desc *subframe,
unsigned char *name, unsigned char *url) char *name, char *url)
{ {
struct frame_desc *frame_desc; struct frame_desc *frame_desc;
int offset; int offset;
@ -127,7 +127,7 @@ add_frame_to_list(struct session *ses, struct document_view *doc_view)
} }
static struct document_view * static struct document_view *
find_fd(struct session *ses, unsigned char *name, find_fd(struct session *ses, char *name,
int depth, int x, int y) int depth, int x, int y)
{ {
struct document_view *doc_view; struct document_view *doc_view;
@ -389,15 +389,15 @@ distribute_rows_or_cols_that_left(int *val_, int max_value, int *values, int val
/* Returns 0 on error. */ /* Returns 0 on error. */
static int static int
extract_rows_or_cols_values(unsigned char *str, int max_value, int pixels_per_char, extract_rows_or_cols_values(char *str, int max_value, int pixels_per_char,
int **new_values, int *new_values_count) int **new_values, int *new_values_count)
{ {
unsigned char *tmp_str; char *tmp_str;
int *values = NULL; int *values = NULL;
int values_count = 0; int values_count = 0;
while (1) { while (1) {
unsigned char *end = str; char *end = str;
int *tmp_values; int *tmp_values;
unsigned long number; unsigned long number;
int val = -1; /* Wildcard */ int val = -1; /* Wildcard */
@ -454,7 +454,7 @@ extract_rows_or_cols_values(unsigned char *str, int max_value, int pixels_per_ch
* <frameset cols="33%,33%,33%" rows="33%,33%,33%"> values in percentage * <frameset cols="33%,33%,33%" rows="33%,33%,33%"> values in percentage
* */ * */
void void
parse_frame_widths(unsigned char *str, int max_value, int pixels_per_char, parse_frame_widths(char *str, int max_value, int pixels_per_char,
int **new_values, int *new_values_count) int **new_values, int *new_values_count)
{ {
int val, ret; int val, ret;

View File

@ -17,7 +17,7 @@ struct frameset_desc;
struct frame_desc { struct frame_desc {
struct frameset_desc *subframe; struct frameset_desc *subframe;
unsigned char *name; char *name;
struct uri *uri; struct uri *uri;
int width, height; int width, height;
@ -45,11 +45,11 @@ struct frameset_desc *create_frameset(struct frameset_param *fp);
void void
add_frameset_entry(struct frameset_desc *parent, add_frameset_entry(struct frameset_desc *parent,
struct frameset_desc *subframe, struct frameset_desc *subframe,
unsigned char *name, unsigned char *url); char *name, char *url);
void format_frames(struct session *ses, struct frameset_desc *fsd, struct document_options *op, int depth); void format_frames(struct session *ses, struct frameset_desc *fsd, struct document_options *op, int depth);
void parse_frame_widths(unsigned char *str, int max_value, int pixels_per_char, void parse_frame_widths(char *str, int max_value, int pixels_per_char,
int **new_values, int *new_values_count); int **new_values, int *new_values_count);
#ifdef __cplusplus #ifdef __cplusplus

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