diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-hook.c | 6 | ||||
-rw-r--r-- | src/core/wee-string.c | 13 | ||||
-rw-r--r-- | src/core/wee-utf8.c | 10 | ||||
-rw-r--r-- | src/core/wee-utf8.h | 7 | ||||
-rw-r--r-- | src/core/wee-util.c | 3 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-bar-window.c | 2 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-chat.c | 7 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-key.c | 2 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-mouse.c | 2 | ||||
-rw-r--r-- | src/gui/gui-chat.c | 4 | ||||
-rw-r--r-- | src/gui/gui-completion.c | 5 | ||||
-rw-r--r-- | src/gui/gui-input.c | 66 | ||||
-rw-r--r-- | src/gui/gui-window.c | 2 | ||||
-rw-r--r-- | src/plugins/alias/alias.c | 8 | ||||
-rw-r--r-- | src/plugins/aspell/weechat-aspell.c | 10 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 9 |
16 files changed, 81 insertions, 75 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 12426ef5e..216f90fb6 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -422,7 +422,8 @@ hook_command_build_completion (struct t_hook_command *hook_command) int i, j, k, length, num_items; struct t_weelist *list; char *pos_completion, *pos_double_pipe, *pos_start, *pos_end; - char **items, *last_space, *ptr_template; + char **items; + const char *last_space, *ptr_template; /* split templates using "||" as separator */ hook_command->cplt_num_templates = 1; @@ -673,7 +674,8 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin, struct t_hook *ptr_hook, *next_hook; struct t_hook *hook_plugin, *hook_other_plugin, *hook_other_plugin2; struct t_hook *hook_incomplete_command; - char **argv, **argv_eol, *ptr_command_name; + char **argv, **argv_eol; + const char *ptr_command_name; int argc, rc, length_command_name, allow_incomplete_commands; int count_other_plugin, count_incomplete_commands; diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 58ae2cb5c..e27603512 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -104,7 +104,7 @@ string_tolower (char *string) { if ((string[0] >= 'A') && (string[0] <= 'Z')) string[0] += ('a' - 'A'); - string = utf8_next_char (string); + string = (char *)utf8_next_char (string); } } @@ -119,7 +119,7 @@ string_toupper (char *string) { if ((string[0] >= 'a') && (string[0] <= 'z')) string[0] -= ('a' - 'A'); - string = utf8_next_char (string); + string = (char *)utf8_next_char (string); } } @@ -1851,7 +1851,7 @@ string_split_shell (const char *string, int *num_items) { add_char_to_temp = 0; add_temp_to_args = 0; - ptr_next = utf8_next_char (ptr_string); + ptr_next = (char *)utf8_next_char (ptr_string); saved_char = ptr_next[0]; ptr_next[0] = '\0'; if (state == ' ') @@ -2180,8 +2180,8 @@ string_iconv (int from_utf8, const char *from_code, const char *to_code, #ifdef HAVE_ICONV iconv_t cd; - char *inbuf, *ptr_inbuf, *ptr_outbuf, *next_char; - char *ptr_inbuf_shift; + char *inbuf, *ptr_outbuf; + const char *ptr_inbuf, *ptr_inbuf_shift, *next_char; int done; size_t err, inbytesleft, outbytesleft; #endif /* HAVE_ICONV */ @@ -2711,7 +2711,8 @@ string_is_command_char (const char *string) const char * string_input_for_buffer (const char *string) { - char *pos_slash, *pos_space, *next_char; + char *pos_slash, *pos_space; + const char *next_char; if (!string) return NULL; diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c index 0475f399e..afa64d951 100644 --- a/src/core/wee-utf8.c +++ b/src/core/wee-utf8.c @@ -179,7 +179,7 @@ utf8_normalize (char *string, char replacement) * "string_start" was reached). */ -char * +const char * utf8_prev_char (const char *string_start, const char *string) { if (!string || (string <= string_start)) @@ -222,7 +222,7 @@ utf8_prev_char (const char *string_start, const char *string) * Returns pointer to next UTF-8 char, NULL if string was NULL. */ -char * +const char * utf8_next_char (const char *string) { if (!string) @@ -673,7 +673,7 @@ utf8_char_size_screen (const char *string) * Returns pointer to the new position in string. */ -char * +const char * utf8_add_offset (const char *string, int offset) { if (!string) @@ -684,7 +684,7 @@ utf8_add_offset (const char *string, int offset) string = utf8_next_char (string); offset--; } - return (char *)string; + return string; } /* @@ -701,7 +701,7 @@ int utf8_real_pos (const char *string, int pos) { int count, real_pos; - char *next_char; + const char *next_char; if (!string) return pos; diff --git a/src/core/wee-utf8.h b/src/core/wee-utf8.h index 461f8dc3c..8e256c9f7 100644 --- a/src/core/wee-utf8.h +++ b/src/core/wee-utf8.h @@ -32,8 +32,9 @@ extern void utf8_init (); extern int utf8_has_8bits (const char *string); extern int utf8_is_valid (const char *string, char **error); extern void utf8_normalize (char *string, char replacement); -extern char *utf8_prev_char (const char *string_start, const char *string); -extern char *utf8_next_char (const char *string); +extern const char *utf8_prev_char (const char *string_start, + const char *string); +extern const char *utf8_next_char (const char *string); extern int utf8_char_int (const char *string); extern void utf8_int_string (unsigned int unicode_value, char *string); extern wint_t utf8_wide_char (const char *string); @@ -46,7 +47,7 @@ extern int utf8_charcasecmp (const char *string1, const char *string2); extern int utf8_charcasecmp_range (const char *string1, const char *string2, int range); extern int utf8_char_size_screen (const char *string); -extern char *utf8_add_offset (const char *string, int offset); +extern const char *utf8_add_offset (const char *string, int offset); extern int utf8_real_pos (const char *string, int pos); extern int utf8_pos (const char *string, int real_pos); extern char *utf8_strndup (const char *string, int length); diff --git a/src/core/wee-util.c b/src/core/wee-util.c index 6781c1278..d2b6a3681 100644 --- a/src/core/wee-util.c +++ b/src/core/wee-util.c @@ -718,7 +718,8 @@ util_file_get_content (const char *filename) int util_version_number (const char *version) { - char **items, buf[64], *ptr_item, *error; + char **items, buf[64], *error; + const char *ptr_item; int num_items, i, version_int[4], index_buf; long number; diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index bb9854d7a..8c6749cd8 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -332,7 +332,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window, 1); break; default: - next_char = utf8_next_char (string); + next_char = (char *)utf8_next_char (string); if (!next_char) break; diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 4731058fc..91c7bc7c1 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -394,7 +394,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line, if (!string) return chars_displayed; - next_char = utf8_next_char (string); + next_char = (char *)utf8_next_char (string); if (next_char) { ptr_char = utf_char; @@ -1231,8 +1231,9 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, int read_marker_x, read_marker_y; int word_start_offset, word_end_offset; int word_length_with_spaces, word_length; - char *ptr_data, *ptr_end_offset, *next_char; - char *ptr_style, *message_with_tags, *message_with_search; + char *ptr_data, *ptr_end_offset; + char *message_with_tags, *message_with_search; + const char *ptr_style, *next_char; struct t_gui_line *ptr_prev_line, *ptr_next_line; struct tm local_time, local_time2; struct timeval tv_time; diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c index 408d76d81..47356fa27 100644 --- a/src/gui/curses/gui-curses-key.c +++ b/src/gui/curses/gui-curses-key.c @@ -380,7 +380,7 @@ gui_key_flush (int paste) (void) utf8_is_valid (ptr_char, &ptr_error); if (!ptr_error) break; - next_char = utf8_next_char (ptr_error); + next_char = (char *)utf8_next_char (ptr_error); if (next_char && next_char[0]) { ptr_char = ptr_error; diff --git a/src/gui/curses/gui-curses-mouse.c b/src/gui/curses/gui-curses-mouse.c index d20ba4ce2..4162ada77 100644 --- a/src/gui/curses/gui-curses-mouse.c +++ b/src/gui/curses/gui-curses-mouse.c @@ -255,7 +255,7 @@ gui_mouse_event_code2key (const char *code) int i, x, y, code_utf8, length; double diff_x, diff_y, distance, angle, pi4; static char key[128]; - char *ptr_code; + const char *ptr_code; key[0] = '\0'; diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index ff607d937..387a24238 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -326,8 +326,8 @@ gui_chat_get_word_info (struct t_gui_window *window, int *word_start_offset, int *word_end_offset, int *word_length_with_spaces, int *word_length) { - const char *start_data; - char *next_char, *next_char2; + char *next_char; + const char *start_data, *next_char2; int leading_spaces, char_size_screen; *word_start_offset = 0; diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 1c865d4f7..c371c39ca 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -706,8 +706,7 @@ gui_completion_find_context (struct t_gui_completion *completion, const char *data, int size, int pos) { int i, command_arg, pos_start, pos_end; - const char *ptr_command, *ptr_data; - char *prev_char; + const char *ptr_command, *ptr_data, *prev_char; /* look for context */ gui_completion_free_data (completion); @@ -913,7 +912,7 @@ int gui_completion_common_prefix_size (struct t_arraylist *list, const char *utf_char) { - char *ptr_first_item, *ptr_char, *next_char; + const char *ptr_first_item, *ptr_char, *next_char; struct t_gui_completion_word *ptr_completion_word; int i; diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index 70c0f924a..a913c3642 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -270,11 +270,11 @@ gui_input_insert_string (struct t_gui_buffer *buffer, const char *string, buffer->input_buffer[buffer->input_buffer_size] = '\0'; /* move end of string to the right */ - ptr_start = utf8_add_offset (buffer->input_buffer, pos); + ptr_start = (char *)utf8_add_offset (buffer->input_buffer, pos); memmove (ptr_start + size, ptr_start, strlen (ptr_start)); /* insert new string */ - ptr_start = utf8_add_offset (buffer->input_buffer, pos); + ptr_start = (char *)utf8_add_offset (buffer->input_buffer, pos); strncpy (ptr_start, string_utf8, size); buffer->input_buffer_pos += length; @@ -751,9 +751,9 @@ gui_input_delete_previous_char (struct t_gui_buffer *buffer) if (buffer->input && (buffer->input_buffer_pos > 0)) { gui_buffer_undo_snap (buffer); - pos = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); - pos_last = utf8_prev_char (buffer->input_buffer, pos); + pos = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); + pos_last = (char *)utf8_prev_char (buffer->input_buffer, pos); char_size = pos - pos_last; size_to_move = strlen (pos); memmove (pos_last, pos, size_to_move); @@ -782,9 +782,9 @@ gui_input_delete_next_char (struct t_gui_buffer *buffer) && (buffer->input_buffer_pos < buffer->input_buffer_length)) { gui_buffer_undo_snap (buffer); - pos = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); - pos_next = utf8_next_char (pos); + pos = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); + pos_next = (char *)utf8_next_char (pos); char_size = pos_next - pos; size_to_move = strlen (pos_next); memmove (pos, pos_next, size_to_move); @@ -811,30 +811,30 @@ gui_input_delete_previous_word (struct t_gui_buffer *buffer) if (buffer->input && (buffer->input_buffer_pos > 0)) { gui_buffer_undo_snap (buffer); - start = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos - 1); + start = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos - 1); string = start; while (string && !string_is_word_char_input (string)) { - string = utf8_prev_char (buffer->input_buffer, string); + string = (char *)utf8_prev_char (buffer->input_buffer, string); } if (string) { while (string && string_is_word_char_input (string)) { - string = utf8_prev_char (buffer->input_buffer, string); + string = (char *)utf8_prev_char (buffer->input_buffer, string); } if (string) { while (string && !string_is_word_char_input (string)) { - string = utf8_prev_char (buffer->input_buffer, string); + string = (char *)utf8_prev_char (buffer->input_buffer, string); } } } if (string) - string = utf8_next_char (utf8_next_char (string)); + string = (char *)utf8_next_char (utf8_next_char (string)); else string = buffer->input_buffer; @@ -869,15 +869,15 @@ gui_input_delete_next_word (struct t_gui_buffer *buffer) if (buffer->input) { gui_buffer_undo_snap (buffer); - start = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); + start = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); string = start; length_deleted = 0; while (string[0]) { if (!string_is_word_char_input (string) && (string > start)) break; - string = utf8_next_char (string); + string = (char *)utf8_next_char (string); length_deleted++; } size_deleted = string - start; @@ -910,8 +910,8 @@ gui_input_delete_beginning_of_line (struct t_gui_buffer *buffer) if (buffer->input && (buffer->input_buffer_pos > 0)) { gui_buffer_undo_snap (buffer); - start = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); + start = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); size_deleted = start - buffer->input_buffer; length_deleted = utf8_strnlen (buffer->input_buffer, size_deleted); gui_input_clipboard_copy (buffer->input_buffer, @@ -943,8 +943,8 @@ gui_input_delete_end_of_line (struct t_gui_buffer *buffer) if (buffer->input) { gui_buffer_undo_snap (buffer); - start = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); + start = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); size_deleted = strlen (start); gui_input_clipboard_copy (start, size_deleted); start[0] = '\0'; @@ -996,9 +996,9 @@ gui_input_transpose_chars (struct t_gui_buffer *buffer) if (buffer->input_buffer_pos == buffer->input_buffer_length) buffer->input_buffer_pos--; - start = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); - prev_char = utf8_prev_char (buffer->input_buffer, start); + start = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); + prev_char = (char *)utf8_prev_char (buffer->input_buffer, start); size_prev_char = start - prev_char; size_start_char = utf8_char_size (start); @@ -1085,20 +1085,20 @@ gui_input_move_previous_word (struct t_gui_buffer *buffer) if (buffer->input && (buffer->input_buffer_pos > 0)) { - pos = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos - 1); + pos = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos - 1); while (pos && !string_is_word_char_input (pos)) { - pos = utf8_prev_char (buffer->input_buffer, pos); + pos = (char *)utf8_prev_char (buffer->input_buffer, pos); } if (pos) { while (pos && string_is_word_char_input (pos)) { - pos = utf8_prev_char (buffer->input_buffer, pos); + pos = (char *)utf8_prev_char (buffer->input_buffer, pos); } if (pos) - pos = utf8_next_char (pos); + pos = (char *)utf8_next_char (pos); else pos = buffer->input_buffer; buffer->input_buffer_pos = utf8_pos (buffer->input_buffer, @@ -1124,17 +1124,17 @@ gui_input_move_next_word (struct t_gui_buffer *buffer) if (buffer->input && (buffer->input_buffer_pos < buffer->input_buffer_length)) { - pos = utf8_add_offset (buffer->input_buffer, - buffer->input_buffer_pos); + pos = (char *)utf8_add_offset (buffer->input_buffer, + buffer->input_buffer_pos); while (pos[0] && !string_is_word_char_input (pos)) { - pos = utf8_next_char (pos); + pos = (char *)utf8_next_char (pos); } if (pos[0]) { while (pos[0] && string_is_word_char_input (pos)) { - pos = utf8_next_char (pos); + pos = (char *)utf8_next_char (pos); } if (pos[0]) { diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 8c393f808..4da811ed4 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -141,7 +141,7 @@ gui_window_get_context_at_xy (struct t_gui_window *window, { int win_x, win_y; char *ptr_data, *data_next_line, *str_temp; - char *word_start, *word_end, *last_space; + const char *word_start, *word_end, *last_space; *chat = 0; *line = NULL; diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index c0df3a3d7..b325e7120 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -688,13 +688,13 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, { ptr_completion = argv[2]; ptr_alias_name = (weechat_string_is_command_char (argv[3])) ? - weechat_utf8_next_char (argv[3]) : argv[3]; + (char *)weechat_utf8_next_char (argv[3]) : argv[3]; ptr_command = argv_eol[4]; } else { ptr_alias_name = (weechat_string_is_command_char (argv[1])) ? - weechat_utf8_next_char (argv[1]) : argv[1]; + (char *)weechat_utf8_next_char (argv[1]) : argv[1]; ptr_command = argv_eol[2]; } @@ -735,7 +735,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, { /* get pointer to alias name */ ptr_alias_name = (weechat_string_is_command_char (argv[1])) ? - weechat_utf8_next_char (argv[1]) : argv[1]; + (char *)weechat_utf8_next_char (argv[1]) : argv[1]; /* display list of aliases */ alias_found = 0; @@ -790,7 +790,7 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, for (i = 1; i < argc; i++) { alias_name = (weechat_string_is_command_char (argv[i])) ? - weechat_utf8_next_char (argv[i]) : argv[i]; + (char *)weechat_utf8_next_char (argv[i]) : argv[i]; ptr_alias = alias_search (alias_name); if (!ptr_alias) { diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c index 4c35dff95..ae2775b2c 100644 --- a/src/plugins/aspell/weechat-aspell.c +++ b/src/plugins/aspell/weechat-aspell.c @@ -708,7 +708,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, pos_space = ptr_string; while (pos_space && pos_space[0] && (pos_space[0] != ' ')) { - pos_space = weechat_utf8_next_char (pos_space); + pos_space = (char *)weechat_utf8_next_char (pos_space); } if (!pos_space || !pos_space[0]) { @@ -766,7 +766,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, /* find end of word: ' and - allowed in word, but not at the end */ ptr_end_valid = ptr_string; - ptr_end = weechat_utf8_next_char (ptr_string); + ptr_end = (char *)weechat_utf8_next_char (ptr_string); code_point = weechat_utf8_char_int (ptr_end); while (iswalnum (code_point) || (code_point == '\'') || (code_point == '-')) @@ -778,12 +778,12 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, ptr_end_valid = ptr_end; word_end_pos_valid = word_end_pos; } - ptr_end = weechat_utf8_next_char (ptr_end); + ptr_end = (char *)weechat_utf8_next_char (ptr_end); if (!ptr_end[0]) break; code_point = weechat_utf8_char_int (ptr_end); } - ptr_end = weechat_utf8_next_char (ptr_end_valid); + ptr_end = (char *)weechat_utf8_next_char (ptr_end_valid); word_end_pos = word_end_pos_valid; word_ok = 0; if (weechat_aspell_string_is_url (ptr_string) @@ -799,7 +799,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, code_point = weechat_utf8_char_int (ptr_end); while (!iswspace (code_point)) { - ptr_end = weechat_utf8_next_char (ptr_end); + ptr_end = (char *)weechat_utf8_next_char (ptr_end); if (!ptr_end[0]) break; code_point = weechat_utf8_char_int (ptr_end); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index f5d99226e..51cf06281 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -57,7 +57,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20150703-01" +#define WEECHAT_PLUGIN_API_VERSION "20150704-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -319,8 +319,9 @@ struct t_weechat_plugin int (*utf8_has_8bits) (const char *string); int (*utf8_is_valid) (const char *string, char **error); void (*utf8_normalize) (char *string, char replacement); - char *(*utf8_prev_char) (const char *string_start, const char *string); - char *(*utf8_next_char) (const char *string); + const char *(*utf8_prev_char) (const char *string_start, + const char *string); + const char *(*utf8_next_char) (const char *string); int (*utf8_char_int) (const char *string); int (*utf8_char_size) (const char *string); int (*utf8_strlen) (const char *string); @@ -329,7 +330,7 @@ struct t_weechat_plugin int (*utf8_charcmp) (const char *string1, const char *string2); int (*utf8_charcasecmp) (const char *string1, const char *string2); int (*utf8_char_size_screen) (const char *string); - char *(*utf8_add_offset) (const char *string, int offset); + const char *(*utf8_add_offset) (const char *string, int offset); int (*utf8_real_pos) (const char *string, int pos); int (*utf8_pos) (const char *string, int real_pos); char *(*utf8_strndup) (const char *string, int length); |