mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Revert "core, plugins: replace "%lx" by "%p" in calls to sscanf"
This reverts commit e64ab3c675.
This was causing incorrect conversion of strings "0x..." to pointers on systems
like Solaris/ILLUMOS.
And as a side effect, buffers were sometimes empty in weechat relay clients
like glowing-bear.
This commit is contained in:
@@ -1422,6 +1422,7 @@ 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;
|
||||
@@ -1473,9 +1474,10 @@ eval_string_hdata (const char *text, struct t_eval_context *eval_context)
|
||||
{
|
||||
if (strncmp (pointer_name, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (pointer_name, "%p", &pointer);
|
||||
rc = sscanf (pointer_name, "%lx", &ptr);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
{
|
||||
pointer = (void *)ptr;
|
||||
if (!hdata_check_pointer (hdata, NULL, pointer))
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -1246,10 +1246,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)
|
||||
@@ -1309,10 +1309,10 @@ hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
|
||||
case WEECHAT_HDATA_POINTER:
|
||||
if (value)
|
||||
{
|
||||
rc = sscanf (value, "%p", &ptr);
|
||||
rc = sscanf (value, "%lx", &ptr);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
{
|
||||
*((void **)(pointer + var->offset)) = ptr;
|
||||
*((void **)(pointer + var->offset)) = (void *)ptr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2150,6 +2150,7 @@ 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;
|
||||
@@ -2167,9 +2168,10 @@ 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, "%p", &window);
|
||||
rc = sscanf (str_window, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
window = (struct t_gui_window *)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2184,9 +2186,10 @@ 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, "%p", &buffer);
|
||||
rc = sscanf (str_buffer, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
}
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
+3
-1
@@ -1398,6 +1398,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
|
||||
{
|
||||
const char *ptr_date, *ptr_date_usec, *line, *prefix, *ptr_prefix, *message;
|
||||
long long number;
|
||||
unsigned long value;
|
||||
struct timeval tv;
|
||||
struct t_gui_line *ptr_line;
|
||||
int is_nick, rc;
|
||||
@@ -1442,9 +1443,10 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
|
||||
line = hashtable_get (hashtable, "_chat_line");
|
||||
if (line && line[0])
|
||||
{
|
||||
rc = sscanf (line, "%p", &ptr_line);
|
||||
rc = sscanf (line, "%lx", &value);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -358,6 +358,7 @@ 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 */
|
||||
@@ -386,9 +387,9 @@ gui_history_hdata_history_update_cb (void *data,
|
||||
buffer = hashtable_get (hashtable, "buffer");
|
||||
if (buffer)
|
||||
{
|
||||
rc = sscanf (buffer, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
ptr_buffer = NULL;
|
||||
rc = sscanf (buffer, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
}
|
||||
}
|
||||
if (ptr_buffer)
|
||||
|
||||
+4
-3
@@ -2044,6 +2044,7 @@ gui_key_focus_command (const char *key, int context,
|
||||
{
|
||||
struct t_gui_key *ptr_key;
|
||||
int matching, debug, rc;
|
||||
unsigned long value;
|
||||
char *command, **commands, **ptr_command;
|
||||
const char *str_buffer;
|
||||
struct t_hashtable *hashtable;
|
||||
@@ -2101,9 +2102,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, "%p", &ptr_buffer);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
rc = sscanf (str_buffer, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
}
|
||||
if (!ptr_buffer)
|
||||
continue;
|
||||
|
||||
+3
-1
@@ -1673,6 +1673,7 @@ 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;
|
||||
@@ -1706,7 +1707,8 @@ gui_line_hook_update (struct t_gui_line *line,
|
||||
{
|
||||
if ((ptr_value2[0] == '0') && (ptr_value2[1] == 'x'))
|
||||
{
|
||||
rc = sscanf (ptr_value2, "%p", &ptr_buffer);
|
||||
rc = sscanf (ptr_value2 + 2, "%lx", &value_pointer);
|
||||
ptr_buffer = (struct t_gui_buffer *)value_pointer;
|
||||
if ((rc != EOF) && (rc >= 1)
|
||||
&& gui_chat_buffer_valid (ptr_buffer, line->data->buffer->type))
|
||||
{
|
||||
|
||||
@@ -335,6 +335,7 @@ 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 */
|
||||
@@ -354,9 +355,10 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
rc = sscanf (ptr_pointer, "%p", &ptr_buffer);
|
||||
rc = sscanf (ptr_pointer, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return WEECHAT_RC_OK;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
error = NULL;
|
||||
number = strtol (ptr_number, &error, 10);
|
||||
|
||||
@@ -43,6 +43,7 @@ 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];
|
||||
@@ -59,10 +60,12 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
|
||||
if (!buffer)
|
||||
return info;
|
||||
|
||||
rc = sscanf (buffer, "%p", &ptr_buffer);
|
||||
rc = sscanf (buffer, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return info;
|
||||
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
if (!ptr_buffer || (ptr_buffer != fset_buffer))
|
||||
return info;
|
||||
|
||||
@@ -186,6 +189,7 @@ 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;
|
||||
@@ -204,9 +208,10 @@ 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, "%p", &ptr_fset_option);
|
||||
rc = sscanf (ptr_fset_option_pointer, "%lx", &value);
|
||||
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;
|
||||
|
||||
|
||||
@@ -626,6 +626,7 @@ 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;
|
||||
@@ -636,10 +637,12 @@ irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data,
|
||||
if (!str_buffer || !str_buffer[0])
|
||||
return NULL;
|
||||
|
||||
rc = sscanf (str_buffer, "%p", &buffer);
|
||||
rc = sscanf (str_buffer, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return NULL;
|
||||
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
|
||||
|
||||
/* make C compiler happy */
|
||||
|
||||
@@ -1313,6 +1313,7 @@ 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;
|
||||
|
||||
@@ -1328,9 +1329,10 @@ 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, "%p", &ptr_buffer);
|
||||
rc = sscanf (ptr_buffer_pointer, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return WEECHAT_RC_OK;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
if (!ptr_buffer)
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ 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;
|
||||
|
||||
@@ -54,20 +55,16 @@ logger_info_log_file_cb (const void *pointer, void *data,
|
||||
buffer = NULL;
|
||||
if (strncmp (arguments, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (arguments, "%p", &buffer);
|
||||
if ((rc != EOF) && (rc != 0) && buffer)
|
||||
rc = sscanf (arguments, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0) && value)
|
||||
{
|
||||
if (!weechat_hdata_check_pointer (weechat_hdata_get ("buffer"),
|
||||
NULL,
|
||||
buffer))
|
||||
if (weechat_hdata_check_pointer (weechat_hdata_get ("buffer"),
|
||||
NULL,
|
||||
(struct t_gui_buffer *)value))
|
||||
{
|
||||
buffer = NULL;
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -407,7 +407,7 @@ plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *script_name, const char *function_name,
|
||||
const char *str_pointer)
|
||||
{
|
||||
void *pointer;
|
||||
unsigned long value;
|
||||
int rc;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
@@ -417,9 +417,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, "%p", &pointer);
|
||||
rc = sscanf (str_pointer + 2, "%lx", &value);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
return pointer;
|
||||
return (void *)value;
|
||||
|
||||
invalid:
|
||||
if ((weechat_plugin->debug >= 1) && script_name && function_name)
|
||||
|
||||
@@ -590,6 +590,7 @@ 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;
|
||||
|
||||
@@ -630,9 +631,10 @@ 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], "%p", &pointer);
|
||||
rc_sscanf = sscanf (list_path[0], "%lx", &value);
|
||||
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,10 +648,6 @@ 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]);
|
||||
|
||||
@@ -51,14 +51,17 @@ 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, "%p", &ptr_buffer);
|
||||
if ((rc != EOF) && (rc != 0) && ptr_buffer)
|
||||
rc = sscanf (arg, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0))
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
if (ptr_buffer)
|
||||
{
|
||||
if (!weechat_hdata_check_pointer (
|
||||
relay_hdata_buffer,
|
||||
@@ -69,10 +72,6 @@ relay_weechat_protocol_get_buffer (const char *arg)
|
||||
ptr_buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_buffer = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
ptr_buffer = weechat_buffer_search ("==", arg);
|
||||
@@ -529,7 +528,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(info)
|
||||
RELAY_WEECHAT_PROTOCOL_CALLBACK(infolist)
|
||||
{
|
||||
struct t_relay_weechat_msg *msg;
|
||||
void *pointer;
|
||||
unsigned long value;
|
||||
char *args;
|
||||
int rc;
|
||||
|
||||
@@ -538,17 +537,17 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(infolist)
|
||||
msg = relay_weechat_msg_new (id);
|
||||
if (msg)
|
||||
{
|
||||
pointer = NULL;
|
||||
value = 0;
|
||||
args = NULL;
|
||||
if (argc > 1)
|
||||
{
|
||||
rc = sscanf (argv[1], "%p", &pointer);
|
||||
rc = sscanf (argv[1], "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
pointer = NULL;
|
||||
value = 0;
|
||||
if (argc > 2)
|
||||
args = argv_eol[2];
|
||||
}
|
||||
relay_weechat_msg_add_infolist (msg, argv[0], pointer, args);
|
||||
relay_weechat_msg_add_infolist (msg, argv[0], (void *)value, args);
|
||||
relay_weechat_msg_send (client, msg);
|
||||
relay_weechat_msg_free (msg);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ 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];
|
||||
@@ -58,10 +59,12 @@ script_mouse_focus_chat_cb (const void *pointer, void *data,
|
||||
if (!buffer)
|
||||
return info;
|
||||
|
||||
rc = sscanf (buffer, "%p", &ptr_buffer);
|
||||
rc = sscanf (buffer, "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
return info;
|
||||
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
|
||||
if (!ptr_buffer || (ptr_buffer != script_buffer))
|
||||
return info;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ 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;
|
||||
|
||||
@@ -55,9 +56,10 @@ spell_info_info_spell_dict_cb (const void *pointer, void *data,
|
||||
buffer_full_name = NULL;
|
||||
if (strncmp (arguments, "0x", 2) == 0)
|
||||
{
|
||||
rc = sscanf (arguments, "%p", &buffer);
|
||||
if ((rc != EOF) && (rc != 0) && buffer)
|
||||
rc = sscanf (arguments, "%lx", &value);
|
||||
if ((rc != EOF) && (rc != 0) && value)
|
||||
{
|
||||
buffer = (struct t_gui_buffer *)value;
|
||||
if (weechat_hdata_check_pointer (weechat_hdata_get ("buffer"),
|
||||
NULL, buffer))
|
||||
{
|
||||
|
||||
@@ -715,6 +715,7 @@ 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;
|
||||
@@ -737,10 +738,12 @@ spell_modifier_cb (const void *pointer, void *data,
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
rc = sscanf (modifier_data, "%p", &buffer);
|
||||
rc = sscanf (modifier_data, "%lx", &value);
|
||||
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))
|
||||
|
||||
@@ -999,7 +999,7 @@ trigger_callback_line_cb (const void *pointer, void *data,
|
||||
{
|
||||
struct t_hashtable *hashtable;
|
||||
struct t_weelist_item *ptr_item;
|
||||
void *ptr;
|
||||
unsigned long value;
|
||||
const char *ptr_key, *ptr_value;
|
||||
char **tags, *str_tags, *string_no_color;
|
||||
int rc, num_tags;
|
||||
@@ -1023,10 +1023,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, "%p", &ptr);
|
||||
rc = sscanf (ptr_value + 2, "%lx", &value);
|
||||
if ((rc == EOF) || (rc < 1))
|
||||
goto end;
|
||||
ctx.buffer = ptr;
|
||||
ctx.buffer = (void *)value;
|
||||
|
||||
weechat_hashtable_set (ctx.pointers, "buffer", ctx.buffer);
|
||||
ptr_value = weechat_hashtable_get (line, "tags");
|
||||
@@ -1363,7 +1363,7 @@ trigger_callback_focus_cb (const void *pointer, void *data,
|
||||
struct t_hashtable *info)
|
||||
{
|
||||
const char *ptr_value;
|
||||
void *ptr;
|
||||
unsigned long value;
|
||||
int rc;
|
||||
|
||||
TRIGGER_CALLBACK_CB_INIT(info);
|
||||
@@ -1377,16 +1377,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, "%p", &ptr);
|
||||
rc = sscanf (ptr_value + 2, "%lx", &value);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
weechat_hashtable_set (ctx.pointers, "window", ptr);
|
||||
weechat_hashtable_set (ctx.pointers, "window", (void *)value);
|
||||
}
|
||||
ptr_value = weechat_hashtable_get (info, "_buffer");
|
||||
if (ptr_value && ptr_value[0] && (strncmp (ptr_value, "0x", 2) == 0))
|
||||
{
|
||||
rc = sscanf (ptr_value, "%p", &ptr);
|
||||
rc = sscanf (ptr_value + 2, "%lx", &value);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
weechat_hashtable_set (ctx.pointers, "buffer", ptr);
|
||||
weechat_hashtable_set (ctx.pointers, "buffer", (void *)value);
|
||||
}
|
||||
|
||||
/* execute the trigger (conditions, regex, command) */
|
||||
|
||||
@@ -183,6 +183,7 @@ 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;
|
||||
@@ -193,9 +194,10 @@ typing_input_text_for_buffer_modifier_cb (const void *pointer,
|
||||
(void) modifier;
|
||||
(void) string;
|
||||
|
||||
rc = sscanf (modifier_data, "%p", &ptr_buffer);
|
||||
rc = sscanf (modifier_data, "%lx", &value);
|
||||
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,6 +384,7 @@ 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;
|
||||
|
||||
@@ -396,9 +399,10 @@ typing_typing_set_nick_signal_cb (const void *pointer, void *data,
|
||||
if (!items || (num_items != 3))
|
||||
goto end;
|
||||
|
||||
rc = sscanf (items[0], "%p", &ptr_buffer);
|
||||
rc = sscanf (items[0], "%lx", &value);
|
||||
if ((rc == EOF) || (rc == 0))
|
||||
goto end;
|
||||
ptr_buffer = (struct t_gui_buffer *)value;
|
||||
if (!ptr_buffer)
|
||||
goto end;
|
||||
|
||||
|
||||
@@ -1037,7 +1037,6 @@ 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