#include <stdbool.h>
#include <gio/gio.h>
#include <assert.h>
+#include <stdint.h>
#define ERROR_STATE -1
#define SAFE_BUFFER_SIZE 2048
{
AtspiStateSet *node_state_set = atspi_accessible_get_state_set(node);
GArray *states = atspi_state_set_get_states(node_state_set);
- if (!states) return NULL;
+ if (!states) {
+ g_clear_object(&node_state_set);
+ return NULL;
+ }
g_array_sort(states, _int_sort_function);
AtspiStateType state_type;
for (int i = 0; i < states->len; i++) {
state_type = g_array_index(states, AtspiStateType, i);
- char node_state_str[8];
- snprintf(node_state_str, 8, "(%d)", state_type);
+ char node_state_str[27] = "";
+ strncat(node_state_str, "(", sizeof(node_state_str) - strlen(node_state_str) - 1);
+ strncat(node_state_str, atspi_state_names[state_type], sizeof(node_state_str) - strlen(node_state_str) - 1);
+ strncat(node_state_str, ")", sizeof(node_state_str) - strlen(node_state_str) - 1);
+
_combine_strings(&state_string, node_state_str);
}
g_array_free(states, 0);
- g_object_unref(node_state_set);
+ g_clear_object(&node_state_set);
_truncate_string(state_string, length_limit);
char *node_name = atspi_accessible_get_name(node, NULL);
char *node_role_name = atspi_accessible_get_role_name(node, NULL);
char *unique_id = atspi_accessible_get_unique_id(node, NULL);
+ char *path = atspi_accessible_get_path(node, NULL);
+ unsigned long long eo_ptr = 0;
+ sscanf(path, "%llu", &eo_ptr);
char *attributes = _get_attributes(node, length_limit, attributes_are_too_long);
Box_Size *box_size = _get_box_size(node);
bool current_node_has_relations = (relations && relations->len);
char result[SAFE_BUFFER_SIZE];
- int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%s],[%s,%s,%s,%s],[%s],[%s],[%s]]",
- unique_id,
+ int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s(%p)],[%s],[%s],[%s,%s,%s,%s],[%s],[%s],[%s]]",
+ unique_id, (uintptr_t)eo_ptr,
node_role_name,
attributes,
- box_size->x,
- box_size->y,
- box_size->width,
- box_size->height,
+ box_size ? box_size->x : "nil",
+ box_size ? box_size->y : "nil",
+ box_size ? box_size->width : "nil",
+ box_size ? box_size->height : "nil",
node_name,
states,
current_node_has_relations ? "*" : "");
free(node_name);
free(node_role_name);
free(unique_id);
+ free(path);
free(attributes);
if (box_size) {
free(box_size->width);
free(box_size);
}
free(states);
- g_array_free(relations, TRUE);
+ if (relations)
+ g_array_free(relations, TRUE);
return g_strdup(result);
}
printf("\n");
_print_horizontal_line_in_relations_table();
- g_array_free(relations, TRUE);
+ if (relations)
+ g_array_free(relations, TRUE);
}
typedef void (*print_information_about_object_function)(AtspiAccessible *);
if (!dump && !check)
printf("%s\n", name);
- if ((check || dump) && name && !strcmp(name, app_name)) {
+ if ((check || dump) && name && app_name && !strcmp(name, app_name)) {
app_name_matched = true;
_print_module_legend();