mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
core, plugins: replace "%lx" by "%p" in calls to sscanf
This commit is contained in:
@@ -1411,7 +1411,6 @@ eval_string_hdata (const char *text, struct t_eval_context *eval_context)
|
||||
void *pointer;
|
||||
struct t_hdata *hdata;
|
||||
int rc;
|
||||
unsigned long ptr;
|
||||
|
||||
value = NULL;
|
||||
hdata_name = NULL;
|
||||
@@ -1463,10 +1462,9 @@ eval_string_hdata (const char *text, struct t_eval_context *eval_context)
|
||||
{
|
||||
if (strncmp (pointer_name, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (pointer_name, "%lx", &ptr);
|
||||
rc = sscanf (pointer_name, "%p", &pointer);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
{
|
||||
pointer = (void *)ptr;
|
||||
if (!hdata_check_pointer (hdata, NULL, pointer))
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -1244,10 +1244,10 @@ hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
|
||||
const char *value)
|
||||
{
|
||||
struct t_hdata_var *var;
|
||||
void *ptr;
|
||||
char **ptr_string, *error;
|
||||
long number;
|
||||
long long number_longlong;
|
||||
unsigned long ptr;
|
||||
int rc;
|
||||
|
||||
if (!hdata->update_pending)
|
||||
@@ -1307,10 +1307,10 @@ hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
|
||||
case WEECHAT_HDATA_POINTER:
|
||||
if (value)
|
||||
{
|
||||
rc = sscanf (value, "%lx", &ptr);
|
||||
rc = sscanf (value, "%p", &ptr);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
{
|
||||
*((void **)(pointer + var->offset)) = (void *)ptr;
|
||||
*((void **)(pointer + var->offset)) = ptr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2163,7 +2163,6 @@ gui_bar_item_focus_buffer_nicklist_cb (const void *pointer,
|
||||
struct t_gui_nick_group *ptr_group;
|
||||
struct t_gui_nick *ptr_nick;
|
||||
int i, rc, bar_item_line;
|
||||
unsigned long value;
|
||||
const char *str_window, *str_buffer, *str_bar_item_line;
|
||||
struct t_gui_window *window;
|
||||
struct t_gui_buffer *buffer;
|
||||
@@ -2181,10 +2180,9 @@ gui_bar_item_focus_buffer_nicklist_cb (const void *pointer,
|
||||
str_window = hashtable_get (info, "_window");
|
||||
if (str_window && str_window[0])
|
||||
{
|
||||
rc = sscanf (str_window, "%lx", &value);
|
||||
rc = sscanf (str_window, "%p", &window);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
window = (struct t_gui_window *)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2199,10 +2197,9 @@ gui_bar_item_focus_buffer_nicklist_cb (const void *pointer,
|
||||
str_buffer = hashtable_get (info, "_buffer");
|
||||
if (str_buffer && str_buffer[0])
|
||||
{
|
||||
rc = sscanf (str_buffer, "%lx", &value);
|
||||
rc = sscanf (str_buffer, "%p", &buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
}
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
+1
-3
@@ -1088,7 +1088,6 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
|
||||
struct t_hashtable *hashtable)
|
||||
{
|
||||
const char *ptr_date, *ptr_date_usec, *line, *prefix, *ptr_prefix, *message;
|
||||
unsigned long value;
|
||||
long number;
|
||||
struct timeval tv;
|
||||
struct t_gui_line *ptr_line;
|
||||
@@ -1135,10 +1134,9 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
|
||||
line = hashtable_get (hashtable, "_chat_line");
|
||||
if (line && line[0])
|
||||
{
|
||||
rc = sscanf (line, "%lx", &value);
|
||||
rc = sscanf (line, "%p", &ptr_line);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
{
|
||||
ptr_line = (struct t_gui_line *)value;
|
||||
if (gui_line_search_tag_starting_with (ptr_line, "prefix_nick"))
|
||||
is_nick = 1;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,6 @@ gui_history_hdata_history_update_cb (void *data,
|
||||
struct t_gui_history *ptr_history;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
const char *text, *buffer;
|
||||
unsigned long value;
|
||||
int rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -385,9 +384,9 @@ gui_history_hdata_history_update_cb (void *data,
|
||||
buffer = hashtable_get (hashtable, "buffer");
|
||||
if (buffer)
|
||||
{
|
||||
rc = sscanf (buffer, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
rc = sscanf (buffer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
ptr_buffer = NULL;
|
||||
}
|
||||
}
|
||||
if (ptr_buffer)
|
||||
|
||||
+3
-4
@@ -2042,7 +2042,6 @@ gui_key_focus_command (const char *key, int context,
|
||||
{
|
||||
struct t_gui_key *ptr_key;
|
||||
int i, matching, debug, rc;
|
||||
unsigned long value;
|
||||
char *command, **commands;
|
||||
const char *str_buffer;
|
||||
struct t_hashtable *hashtable;
|
||||
@@ -2100,9 +2099,9 @@ gui_key_focus_command (const char *key, int context,
|
||||
str_buffer = hashtable_get (hashtable, "_buffer");
|
||||
if (str_buffer && str_buffer[0])
|
||||
{
|
||||
rc = sscanf (str_buffer, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
rc = sscanf (str_buffer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
}
|
||||
if (!ptr_buffer)
|
||||
continue;
|
||||
|
||||
+1
-3
@@ -1647,7 +1647,6 @@ gui_line_hook_update (struct t_gui_line *line,
|
||||
{
|
||||
const char *ptr_value, *ptr_value2;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
unsigned long value_pointer;
|
||||
long value;
|
||||
char *error, *new_message, *pos_newline;
|
||||
int rc, tags_updated, notify_level_updated, highlight_updated;
|
||||
@@ -1681,8 +1680,7 @@ gui_line_hook_update (struct t_gui_line *line,
|
||||
{
|
||||
if ((ptr_value2[0] == '0') && (ptr_value2[1] == 'x'))
|
||||
{
|
||||
rc = sscanf (ptr_value2 + 2, "%lx", &value_pointer);
|
||||
ptr_buffer = (struct t_gui_buffer *)value_pointer;
|
||||
rc = sscanf (ptr_value2, "%p", &ptr_buffer);
|
||||
if ((rc != EOF) && (rc >= 1)
|
||||
&& gui_chat_buffer_valid (ptr_buffer, line->data->buffer->type))
|
||||
{
|
||||
|
||||
@@ -333,7 +333,6 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
char *error, str_command[1024];
|
||||
long number, number2;
|
||||
unsigned long value;
|
||||
int rc, current_buffer_number;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -353,10 +352,9 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
rc = sscanf (ptr_pointer, "%lx", &value);
|
||||
rc = sscanf (ptr_pointer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return WEECHAT_RC_OK;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
error = NULL;
|
||||
number = strtol (ptr_number, &error, 10);
|
||||
|
||||
@@ -41,7 +41,6 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
|
||||
{
|
||||
const char *buffer;
|
||||
int rc, format_number;
|
||||
unsigned long value;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
long y, option_index;
|
||||
char *error, str_value[128];
|
||||
@@ -58,12 +57,10 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
|
||||
if (!buffer)
|
||||
return info;
|
||||
|
||||
rc = sscanf (buffer, "%lx", &value);
|
||||
rc = sscanf (buffer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return info;
|
||||
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
if (!ptr_buffer || (ptr_buffer != fset_buffer))
|
||||
return info;
|
||||
|
||||
@@ -186,7 +183,6 @@ fset_mouse_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
const char *ptr_key, *ptr_fset_option_pointer;
|
||||
char str_command[1024];
|
||||
struct t_fset_option *ptr_fset_option;
|
||||
unsigned long value;
|
||||
int rc, distance, num_options, min_y, max_y, i;
|
||||
int chat_line_x, chat_line_x2, y, y2, chat_line_y, chat_line_y2;
|
||||
int option_index, option_index2, index1, index2;
|
||||
@@ -205,10 +201,9 @@ fset_mouse_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
if (!ptr_key || !ptr_fset_option_pointer)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
rc = sscanf (ptr_fset_option_pointer, "%lx", &value);
|
||||
rc = sscanf (ptr_fset_option_pointer, "%p", &ptr_fset_option);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return WEECHAT_RC_OK;
|
||||
ptr_fset_option = (struct t_fset_option *)value;
|
||||
if (!ptr_fset_option)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
|
||||
@@ -630,7 +630,6 @@ struct t_hashtable *
|
||||
irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data,
|
||||
struct t_hashtable *info)
|
||||
{
|
||||
unsigned long value;
|
||||
int rc;
|
||||
struct t_gui_buffer *buffer;
|
||||
struct t_irc_nick *ptr_nick;
|
||||
@@ -641,12 +640,10 @@ irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data,
|
||||
if (!str_buffer || !str_buffer[0])
|
||||
return NULL;
|
||||
|
||||
rc = sscanf (str_buffer, "%lx", &value);
|
||||
rc = sscanf (str_buffer, "%p", &buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
|
||||
|
||||
/* make C compiler happy */
|
||||
|
||||
@@ -1305,7 +1305,6 @@ irc_list_mouse_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
{
|
||||
const char *ptr_key, *ptr_chat_line_y, *ptr_buffer_pointer;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
unsigned long value;
|
||||
char str_command[1024];
|
||||
int rc;
|
||||
|
||||
@@ -1321,10 +1320,9 @@ irc_list_mouse_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
if (!ptr_key || !ptr_buffer_pointer || !ptr_chat_line_y)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
rc = sscanf (ptr_buffer_pointer, "%lx", &value);
|
||||
rc = sscanf (ptr_buffer_pointer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return WEECHAT_RC_OK;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
if (!ptr_buffer)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ logger_info_log_file_cb (const void *pointer, void *data,
|
||||
const char *arguments)
|
||||
{
|
||||
int rc;
|
||||
unsigned long value;
|
||||
struct t_gui_buffer *buffer;
|
||||
struct t_logger_buffer *logger_buffer;
|
||||
|
||||
@@ -53,16 +52,20 @@ logger_info_log_file_cb (const void *pointer, void *data,
|
||||
buffer = NULL;
|
||||
if (strncmp (arguments, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (arguments, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0) && value)
|
||||
rc = sscanf (arguments, "%p", &buffer);
|
||||
if ((rc != EOF) && (rc != 0) && buffer)
|
||||
{
|
||||
if (weechat_hdata_check_pointer (weechat_hdata_get ("buffer"),
|
||||
NULL,
|
||||
(struct t_gui_buffer *)value))
|
||||
if (!weechat_hdata_check_pointer (weechat_hdata_get ("buffer"),
|
||||
NULL,
|
||||
buffer))
|
||||
{
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -395,7 +395,7 @@ plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *script_name, const char *function_name,
|
||||
const char *str_pointer)
|
||||
{
|
||||
unsigned long value;
|
||||
void *pointer;
|
||||
int rc;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
@@ -405,9 +405,9 @@ plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
if ((str_pointer[0] != '0') || (str_pointer[1] != 'x'))
|
||||
goto invalid;
|
||||
|
||||
rc = sscanf (str_pointer + 2, "%lx", &value);
|
||||
rc = sscanf (str_pointer, "%p", &pointer);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
return (void *)value;
|
||||
return pointer;
|
||||
|
||||
invalid:
|
||||
if ((weechat_plugin->debug >= 1) && script_name && function_name)
|
||||
|
||||
@@ -588,7 +588,6 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
char *path_returned;
|
||||
const char *hdata_name, *array_size;
|
||||
void *pointer, **path_pointers;
|
||||
unsigned long value;
|
||||
int rc, num_keys, num_path, i, type, pos_count, count, rc_sscanf;
|
||||
uint32_t count32;
|
||||
|
||||
@@ -629,10 +628,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
pos[0] = '\0';
|
||||
if (strncmp (list_path[0], "0x", 2) == 0)
|
||||
{
|
||||
rc_sscanf = sscanf (list_path[0], "%lx", &value);
|
||||
rc_sscanf = sscanf (list_path[0], "%p", &pointer);
|
||||
if ((rc_sscanf != EOF) && (rc_sscanf != 0))
|
||||
{
|
||||
pointer = (void *)value;
|
||||
if (!weechat_hdata_check_pointer (ptr_hdata_head, NULL, pointer))
|
||||
{
|
||||
if (weechat_relay_plugin->debug >= 1)
|
||||
@@ -646,6 +644,10 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pointer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
pointer = weechat_hdata_get_list (ptr_hdata_head, list_path[0]);
|
||||
|
||||
@@ -49,17 +49,14 @@ struct t_gui_buffer *
|
||||
relay_weechat_protocol_get_buffer (const char *arg)
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
unsigned long value;
|
||||
int rc;
|
||||
|
||||
ptr_buffer = NULL;
|
||||
|
||||
if (strncmp (arg, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (arg, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
if (ptr_buffer)
|
||||
rc = sscanf (arg, "%p", &ptr_buffer);
|
||||
if ((rc != EOF) && (rc != 0) && ptr_buffer)
|
||||
{
|
||||
if (!weechat_hdata_check_pointer (
|
||||
relay_hdata_buffer,
|
||||
@@ -70,6 +67,10 @@ relay_weechat_protocol_get_buffer (const char *arg)
|
||||
ptr_buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
ptr_buffer = weechat_buffer_search ("==", arg);
|
||||
@@ -527,7 +528,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(info)
|
||||
RELAY_WEECHAT_PROTOCOL_CALLBACK(infolist)
|
||||
{
|
||||
struct t_relay_weechat_msg *msg;
|
||||
unsigned long value;
|
||||
void *pointer;
|
||||
char *args;
|
||||
int rc;
|
||||
|
||||
@@ -536,17 +537,16 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(infolist)
|
||||
msg = relay_weechat_msg_new (id);
|
||||
if (msg)
|
||||
{
|
||||
value = 0;
|
||||
args = NULL;
|
||||
if (argc > 1)
|
||||
{
|
||||
rc = sscanf (argv[1], "%lx", &value);
|
||||
rc = sscanf (argv[1], "%p", &pointer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
value = 0;
|
||||
pointer = NULL;
|
||||
if (argc > 2)
|
||||
args = argv_eol[2];
|
||||
}
|
||||
relay_weechat_msg_add_infolist (msg, argv[0], (void *)value, args);
|
||||
relay_weechat_msg_add_infolist (msg, argv[0], pointer, args);
|
||||
relay_weechat_msg_send (client, msg);
|
||||
relay_weechat_msg_free (msg);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ script_mouse_focus_chat_cb (const void *pointer, void *data,
|
||||
{
|
||||
const char *buffer;
|
||||
int rc;
|
||||
unsigned long value;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
long x;
|
||||
char *error, str_date[64];
|
||||
@@ -57,12 +56,10 @@ script_mouse_focus_chat_cb (const void *pointer, void *data,
|
||||
if (!buffer)
|
||||
return info;
|
||||
|
||||
rc = sscanf (buffer, "%lx", &value);
|
||||
rc = sscanf (buffer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return info;
|
||||
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
if (!ptr_buffer || (ptr_buffer != script_buffer))
|
||||
return info;
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ spell_info_info_spell_dict_cb (const void *pointer, void *data,
|
||||
const char *arguments)
|
||||
{
|
||||
int rc;
|
||||
unsigned long value;
|
||||
struct t_gui_buffer *buffer;
|
||||
const char *buffer_full_name, *ptr_dict;
|
||||
|
||||
@@ -54,10 +53,9 @@ spell_info_info_spell_dict_cb (const void *pointer, void *data,
|
||||
buffer_full_name = NULL;
|
||||
if (strncmp (arguments, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (arguments, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0) && value)
|
||||
rc = sscanf (arguments, "%p", &buffer);
|
||||
if ((rc != EOF) && (rc != 0) && buffer)
|
||||
{
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
if (weechat_hdata_check_pointer (weechat_hdata_get ("buffer"),
|
||||
NULL, buffer))
|
||||
{
|
||||
|
||||
@@ -719,7 +719,6 @@ spell_modifier_cb (const void *pointer, void *data,
|
||||
const char *modifier,
|
||||
const char *modifier_data, const char *string)
|
||||
{
|
||||
unsigned long value;
|
||||
struct t_gui_buffer *buffer;
|
||||
struct t_spell_speller_buffer *ptr_speller_buffer;
|
||||
char **result, *ptr_string, *ptr_string_orig, *pos_space;
|
||||
@@ -742,12 +741,10 @@ spell_modifier_cb (const void *pointer, void *data,
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
rc = sscanf (modifier_data, "%lx", &value);
|
||||
rc = sscanf (modifier_data, "%p", &buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
/* check text during search only if option is enabled */
|
||||
if (weechat_buffer_get_integer (buffer, "text_search")
|
||||
&& !weechat_config_boolean (spell_config_check_during_search))
|
||||
|
||||
@@ -997,7 +997,7 @@ trigger_callback_line_cb (const void *pointer, void *data,
|
||||
{
|
||||
struct t_hashtable *hashtable;
|
||||
struct t_weelist_item *ptr_item;
|
||||
unsigned long value;
|
||||
void *ptr;
|
||||
const char *ptr_key, *ptr_value;
|
||||
char **tags, *str_tags, *string_no_color;
|
||||
int rc, num_tags, length;
|
||||
@@ -1021,10 +1021,10 @@ trigger_callback_line_cb (const void *pointer, void *data,
|
||||
ptr_value = weechat_hashtable_get (line, "buffer");
|
||||
if (!ptr_value || (ptr_value[0] != '0') || (ptr_value[1] != 'x'))
|
||||
goto end;
|
||||
rc = sscanf (ptr_value + 2, "%lx", &value);
|
||||
rc = sscanf (ptr_value, "%p", &ptr);
|
||||
if ((rc == EOF) || (rc < 1))
|
||||
goto end;
|
||||
ctx.buffer = (void *)value;
|
||||
ctx.buffer = ptr;
|
||||
|
||||
weechat_hashtable_set (ctx.pointers, "buffer", ctx.buffer);
|
||||
ptr_value = weechat_hashtable_get (line, "tags");
|
||||
@@ -1367,7 +1367,7 @@ trigger_callback_focus_cb (const void *pointer, void *data,
|
||||
struct t_hashtable *info)
|
||||
{
|
||||
const char *ptr_value;
|
||||
unsigned long value;
|
||||
void *ptr;
|
||||
int rc;
|
||||
|
||||
TRIGGER_CALLBACK_CB_INIT(info);
|
||||
@@ -1381,16 +1381,16 @@ trigger_callback_focus_cb (const void *pointer, void *data,
|
||||
ptr_value = weechat_hashtable_get (info, "_window");
|
||||
if (ptr_value && ptr_value[0] && (strncmp (ptr_value, "0x", 2) == 0))
|
||||
{
|
||||
rc = sscanf (ptr_value + 2, "%lx", &value);
|
||||
rc = sscanf (ptr_value, "%p", &ptr);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
weechat_hashtable_set (ctx.pointers, "window", (void *)value);
|
||||
weechat_hashtable_set (ctx.pointers, "window", ptr);
|
||||
}
|
||||
ptr_value = weechat_hashtable_get (info, "_buffer");
|
||||
if (ptr_value && ptr_value[0] && (strncmp (ptr_value, "0x", 2) == 0))
|
||||
{
|
||||
rc = sscanf (ptr_value + 2, "%lx", &value);
|
||||
rc = sscanf (ptr_value, "%p", &ptr);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
weechat_hashtable_set (ctx.pointers, "buffer", (void *)value);
|
||||
weechat_hashtable_set (ctx.pointers, "buffer", ptr);
|
||||
}
|
||||
|
||||
/* execute the trigger (conditions, regex, command) */
|
||||
|
||||
@@ -181,7 +181,6 @@ typing_input_text_for_buffer_modifier_cb (const void *pointer,
|
||||
const char *string)
|
||||
{
|
||||
int rc, text_search;
|
||||
unsigned long value;
|
||||
const char *ptr_input_for_buffer;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
struct t_typing_status *ptr_typing_status;
|
||||
@@ -192,10 +191,9 @@ typing_input_text_for_buffer_modifier_cb (const void *pointer,
|
||||
(void) modifier;
|
||||
(void) string;
|
||||
|
||||
rc = sscanf (modifier_data, "%lx", &value);
|
||||
rc = sscanf (modifier_data, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
/* ignore any change in input if the user is searching text in the buffer */
|
||||
text_search = weechat_buffer_get_integer (ptr_buffer, "text_search");
|
||||
@@ -382,7 +380,6 @@ typing_typing_set_nick_signal_cb (const void *pointer, void *data,
|
||||
{
|
||||
char **items;
|
||||
int num_items, rc, state, updated;
|
||||
unsigned long value;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
struct t_typing_status *ptr_typing_status;
|
||||
|
||||
@@ -397,10 +394,9 @@ typing_typing_set_nick_signal_cb (const void *pointer, void *data,
|
||||
if (!items || (num_items != 3))
|
||||
goto end;
|
||||
|
||||
rc = sscanf (items[0], "%lx", &value);
|
||||
rc = sscanf (items[0], "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
goto end;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
if (!ptr_buffer)
|
||||
goto end;
|
||||
|
||||
|
||||
@@ -1035,6 +1035,7 @@ TEST(CoreEval, EvalExpression)
|
||||
WEE_CHECK_EVAL("", "${buffer[].full_name}");
|
||||
WEE_CHECK_EVAL("", "${buffer[0x0].full_name}");
|
||||
WEE_CHECK_EVAL("", "${buffer[0x1].full_name}");
|
||||
WEE_CHECK_EVAL("", "${buffer[0xZ].full_name}");
|
||||
WEE_CHECK_EVAL("", "${buffer[unknown_list].full_name}");
|
||||
WEE_CHECK_EVAL("", "${unknown_pointer}");
|
||||
WEE_CHECK_EVAL("", "${my_null_pointer}");
|
||||
|
||||
Reference in New Issue
Block a user