summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-07-04 16:32:18 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-07-04 16:32:18 +0200
commit0c79b2fda861922e4351fab262d57981d4771dac (patch)
treed167f7761d81ff804cabf12857e5630bad0ff169 /src/gui
parent23fd23fd1a189ad13573bd4277def21ead4b91ed (diff)
downloadweechat-0c79b2fda861922e4351fab262d57981d4771dac.zip
core: fix type of value returned by functions gui_chat_string_next_char, gui_chat_string_add_offset and gui_chat_string_add_offset_screen
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-chat.c5
-rw-r--r--src/gui/gui-chat.c11
-rw-r--r--src/gui/gui-chat.h18
-rw-r--r--src/gui/gui-window.c4
4 files changed, 18 insertions, 20 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 91c7bc7c1..c1cf10a82 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -223,7 +223,7 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate)
* colors/attributes are skipped and optionally applied.
*/
-char *
+const char *
gui_chat_string_next_char (struct t_gui_window *window, struct t_gui_line *line,
const unsigned char *string, int apply_style,
int apply_style_inactive,
@@ -1231,9 +1231,8 @@ 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;
char *message_with_tags, *message_with_search;
- const char *ptr_style, *next_char;
+ const char *ptr_data, *ptr_end_offset, *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/gui-chat.c b/src/gui/gui-chat.c
index 387a24238..163e2d9c0 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -197,7 +197,7 @@ gui_chat_strlen_screen (const char *string)
* colors/attributes).
*/
-char *
+const char *
gui_chat_string_add_offset (const char *string, int offset)
{
while (string && string[0] && (offset > 0))
@@ -211,7 +211,7 @@ gui_chat_string_add_offset (const char *string, int offset)
offset--;
}
}
- return (char *)string;
+ return string;
}
/*
@@ -219,7 +219,7 @@ gui_chat_string_add_offset (const char *string, int offset)
* formatting chars (like colors/attributes).
*/
-char *
+const char *
gui_chat_string_add_offset_screen (const char *string, int offset_screen)
{
int size_on_screen;
@@ -236,7 +236,7 @@ gui_chat_string_add_offset_screen (const char *string, int offset_screen)
string = utf8_next_char (string);
}
}
- return (char *)string;
+ return string;
}
/*
@@ -326,8 +326,7 @@ 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)
{
- char *next_char;
- const char *start_data, *next_char2;
+ const char *start_data, *next_char, *next_char2;
int leading_spaces, char_size_screen;
*word_start_offset = 0;
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index 11b1e9add..70c73edd9 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -67,9 +67,9 @@ extern void gui_chat_init ();
extern void gui_chat_prefix_build ();
extern int gui_chat_utf_char_valid (const char *utf_char);
extern int gui_chat_strlen_screen (const char *string);
-extern char *gui_chat_string_add_offset (const char *string, int offset);
-extern char *gui_chat_string_add_offset_screen (const char *string,
- int offset_screen);
+extern const char *gui_chat_string_add_offset (const char *string, int offset);
+extern const char *gui_chat_string_add_offset_screen (const char *string,
+ int offset_screen);
extern int gui_chat_string_real_pos (const char *string, int pos,
int use_screen_size);
extern int gui_chat_string_pos (const char *string, int real_pos);
@@ -95,12 +95,12 @@ extern void gui_chat_end ();
/* chat functions (GUI dependent) */
-extern char *gui_chat_string_next_char (struct t_gui_window *window,
- struct t_gui_line *line,
- const unsigned char *string,
- int apply_style,
- int apply_style_inactive,
- int nick_offline);
+extern const char *gui_chat_string_next_char (struct t_gui_window *window,
+ struct t_gui_line *line,
+ const unsigned char *string,
+ int apply_style,
+ int apply_style_inactive,
+ int nick_offline);
extern void gui_chat_draw (struct t_gui_buffer *buffer, int clear_chat);
extern void gui_chat_draw_line (struct t_gui_buffer *buffer,
struct t_gui_line *line);
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index 4da811ed4..32ad5fe9c 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -140,8 +140,8 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
char **end)
{
int win_x, win_y;
- char *ptr_data, *data_next_line, *str_temp;
- const char *word_start, *word_end, *last_space;
+ char *data_next_line, *str_temp;
+ const char *ptr_data, *word_start, *word_end, *last_space;
*chat = 0;
*line = NULL;