diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-color.c | 4 | ||||
-rw-r--r-- | src/gui/gui-action.c | 2 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 4 | ||||
-rw-r--r-- | src/gui/gui-color.c | 2 | ||||
-rw-r--r-- | src/gui/gui-completion.c | 6 | ||||
-rw-r--r-- | src/gui/gui-input.c | 6 | ||||
-rw-r--r-- | src/gui/gui-keyboard.c | 6 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index cacb8ec46..dcd7428bb 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -228,7 +228,7 @@ gui_color_assign (t_gui_color **color, char *fg_and_bg) if (*color->string) free (*color->string); - *color->string = (char *)malloc (4); + *color->string = (char *)malloc (4 * sizeof (char)); if (*color->string) snprintf (*color->string, 4, "%s%02d", @@ -278,7 +278,7 @@ gui_color_build (int number, int foreground, int background) new_color->foreground = gui_weechat_colors[foreground].foreground; new_color->background = gui_weechat_colors[background].foreground; new_color->attributes = gui_weechat_colors[foreground].attributes; - new_color->string = (char *)malloc (4); + new_color->string = (char *)malloc (4 * sizeof (char)); if (new_color->string) snprintf (new_color->string, 4, "%s%02d", diff --git a/src/gui/gui-action.c b/src/gui/gui-action.c index 1f0eb5337..b33bdcdd5 100644 --- a/src/gui/gui-action.c +++ b/src/gui/gui-action.c @@ -63,7 +63,7 @@ gui_action_clipboard_copy (char *buffer, int size) if (gui_input_clipboard != NULL) free (gui_input_clipboard); - gui_input_clipboard = (char *)malloc( (size + 1) * sizeof(*gui_input_clipboard)); + gui_input_clipboard = (char *)malloc((size + 1) * sizeof(*gui_input_clipboard)); if (gui_input_clipboard) { diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 72add97f4..c7fc0d4b6 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -134,8 +134,8 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name, new_buffer->input_callback_data = input_callback_data; new_buffer->input_nick = NULL; new_buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE; - new_buffer->input_buffer = (char *)malloc (GUI_BUFFER_INPUT_BLOCK_SIZE); - new_buffer->input_buffer_color_mask = (char *)malloc (GUI_BUFFER_INPUT_BLOCK_SIZE); + new_buffer->input_buffer = (char *)malloc (GUI_BUFFER_INPUT_BLOCK_SIZE * sizeof (char)); + new_buffer->input_buffer_color_mask = (char *)malloc (GUI_BUFFER_INPUT_BLOCK_SIZE * sizeof (char)); new_buffer->input_buffer[0] = '\0'; new_buffer->input_buffer_color_mask[0] = '\0'; new_buffer->input_buffer_size = 0; diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index d41572815..6b34b758c 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -81,7 +81,7 @@ gui_color_decode (unsigned char *string) int out_length, out_pos, length; out_length = (strlen ((char *)string) * 2) + 1; - out = (unsigned char *)malloc (out_length); + out = (unsigned char *)malloc (out_length * sizeof (unsigned char)); if (!out) return NULL; diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 12cc974f6..9d8b5a974 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -179,7 +179,7 @@ gui_completion_strdup_alphanum (char *string) { char *result, *pos; - result = (char *)malloc (strlen (string) + 1); + result = (char *)malloc ((strlen (string) + 1) * sizeof (char)); pos = result; while (string[0]) { @@ -947,7 +947,7 @@ gui_completion_find_context (struct t_gui_completion *completion, char *data, if (pos_start <= pos_end) { completion->position_replace = pos_start; - completion->base_word = (char *)malloc (pos_end - pos_start + 2); + completion->base_word = (char *)malloc ((pos_end - pos_start + 2) * sizeof (char)); for (i = pos_start; i <= pos_end; i++) completion->base_word[i - pos_start] = data[i]; completion->base_word[pos_end - pos_start + 1] = '\0'; @@ -972,7 +972,7 @@ gui_completion_find_context (struct t_gui_completion *completion, char *data, if (data[pos_end] == ' ') pos_end--; - completion->base_command = (char *)malloc (pos_end - pos_start + 2); + completion->base_command = (char *)malloc ((pos_end - pos_start + 2) * sizeof (char)); for (i = pos_start; i <= pos_end; i++) completion->base_command[i - pos_start] = data[i]; completion->base_command[pos_end - pos_start + 1] = '\0'; diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index 3dbc1c831..a38ba6765 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -56,9 +56,9 @@ gui_input_optimize_size (struct t_gui_buffer *buffer) if (buffer->input_buffer_alloc != optimal_size) { buffer->input_buffer_alloc = optimal_size; - buffer->input_buffer = realloc (buffer->input_buffer, optimal_size); + buffer->input_buffer = realloc (buffer->input_buffer, optimal_size * sizeof (char)); buffer->input_buffer_color_mask = realloc (buffer->input_buffer_color_mask, - optimal_size); + optimal_size * sizeof (char)); } } } @@ -150,7 +150,7 @@ gui_input_insert_string (struct t_gui_buffer *buffer, char *string, int pos) buffer->input_buffer_pos += length; - string2 = (char *)malloc (size + 2); + string2 = (char *)malloc ((size + 2) * sizeof (char)); if (string2) { snprintf (string2, size + 2, "*%s", string); diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index 47aec611c..17e248ec0 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -245,7 +245,7 @@ gui_keyboard_get_internal_code (char *key) { char *result; - if ((result = (char *)malloc (strlen (key) + 1))) + if ((result = (char *)malloc ((strlen (key) + 1) * sizeof (char)))) { result[0] = '\0'; while (key[0]) @@ -288,7 +288,7 @@ gui_keyboard_get_expanded_name (char *key) { char *result; - if ((result = (char *)malloc ((strlen (key) * 5) + 1))) + if ((result = (char *)malloc (((strlen (key) * 5) + 1) * sizeof (char)))) { result[0] = '\0'; while (key[0]) @@ -735,7 +735,7 @@ gui_keyboard_buffer_optimize () if (gui_keyboard_buffer_alloc != optimal_size) { gui_keyboard_buffer_alloc = optimal_size; - gui_keyboard_buffer = realloc (gui_keyboard_buffer, optimal_size); + gui_keyboard_buffer = realloc (gui_keyboard_buffer, optimal_size * sizeof (char)); } } |