mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 17:53:13 +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:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user