Fixed cppcheck warnings
This commit is contained in:
@@ -206,7 +206,6 @@ static void
|
||||
_jabber_process_events(void)
|
||||
{
|
||||
int reconnect_sec;
|
||||
int elapsed_sec;
|
||||
|
||||
switch (jabber_conn.conn_status)
|
||||
{
|
||||
@@ -218,7 +217,7 @@ _jabber_process_events(void)
|
||||
case JABBER_DISCONNECTED:
|
||||
reconnect_sec = prefs_get_reconnect();
|
||||
if ((reconnect_sec != 0) && (reconnect_timer != NULL)) {
|
||||
elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
|
||||
int elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
|
||||
if (elapsed_sec > reconnect_sec) {
|
||||
_jabber_reconnect();
|
||||
}
|
||||
|
||||
@@ -439,13 +439,13 @@ _disco_info_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
|
||||
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||
|
||||
if (g_strcmp0(id, "discoinforeq") == 0) {
|
||||
GSList *identities = NULL;
|
||||
GSList *features = NULL;
|
||||
|
||||
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
||||
|
||||
if (query != NULL) {
|
||||
xmpp_stanza_t *child = xmpp_stanza_get_children(query);
|
||||
GSList *identities = NULL;
|
||||
GSList *features = NULL;
|
||||
while (child != NULL) {
|
||||
const char *stanza_name = xmpp_stanza_get_name(child);
|
||||
if (g_strcmp0(stanza_name, STANZA_NAME_FEATURE) == 0) {
|
||||
@@ -606,9 +606,6 @@ _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
|
||||
log_debug("Recieved diso#items response");
|
||||
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
|
||||
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||
const char *stanza_name = NULL;
|
||||
const char *item_jid = NULL;
|
||||
const char *item_name = NULL;
|
||||
GSList *items = NULL;
|
||||
|
||||
if ((g_strcmp0(id, "confreq") == 0) || (g_strcmp0(id, "discoitemsreq") == 0)) {
|
||||
@@ -618,13 +615,13 @@ _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
|
||||
if (query != NULL) {
|
||||
xmpp_stanza_t *child = xmpp_stanza_get_children(query);
|
||||
while (child != NULL) {
|
||||
stanza_name = xmpp_stanza_get_name(child);
|
||||
const char *stanza_name = xmpp_stanza_get_name(child);
|
||||
if ((stanza_name != NULL) && (g_strcmp0(stanza_name, STANZA_NAME_ITEM) == 0)) {
|
||||
item_jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
|
||||
const char *item_jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
|
||||
if (item_jid != NULL) {
|
||||
DiscoItem *item = malloc(sizeof(struct disco_item_t));
|
||||
item->jid = strdup(item_jid);
|
||||
item_name = xmpp_stanza_get_attribute(child, STANZA_ATTR_NAME);
|
||||
const char *item_name = xmpp_stanza_get_attribute(child, STANZA_ATTR_NAME);
|
||||
if (item_name != NULL) {
|
||||
item->name = strdup(item_name);
|
||||
} else {
|
||||
|
||||
@@ -237,8 +237,6 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
xmpp_ctx_t *ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER);
|
||||
char *room = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||
char *invitor = NULL;
|
||||
char *reason = NULL;
|
||||
|
||||
if (room == NULL) {
|
||||
log_warning("Message received with no from attribute, ignoring");
|
||||
@@ -258,8 +256,9 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
if (jidp == NULL) {
|
||||
return 1;
|
||||
}
|
||||
invitor = jidp->barejid;
|
||||
char *invitor = jidp->barejid;
|
||||
|
||||
char *reason = NULL;
|
||||
xmpp_stanza_t *reason_st = xmpp_stanza_get_child_by_name(invite, STANZA_NAME_REASON);
|
||||
if (reason_st != NULL) {
|
||||
reason = xmpp_stanza_get_text(reason_st);
|
||||
|
||||
@@ -139,12 +139,6 @@ _presence_sub_request_count(void)
|
||||
return autocomplete_length(sub_requests_ac);
|
||||
}
|
||||
|
||||
void
|
||||
presence_free_sub_requests(void)
|
||||
{
|
||||
autocomplete_free(sub_requests_ac);
|
||||
}
|
||||
|
||||
void
|
||||
presence_clear_sub_requests(void)
|
||||
{
|
||||
@@ -625,7 +619,7 @@ _get_caps_key(xmpp_stanza_t * const stanza)
|
||||
if ((hash_type != NULL) && (strcmp(hash_type, "sha-1") == 0)) {
|
||||
log_debug("Hash type %s supported.", hash_type);
|
||||
caps_key = strdup(node);
|
||||
char *id = generate_unique_id("caps");
|
||||
id = generate_unique_id("caps");
|
||||
|
||||
_send_caps_request(node, caps_key, id, from);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
void presence_sub_requests_init(void);
|
||||
void presence_add_handlers(void);
|
||||
void presence_free_sub_requests(void);
|
||||
void presence_clear_sub_requests(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -830,62 +830,6 @@ stanza_contains_caps(xmpp_stanza_t * const stanza)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
stanza_is_version_request(xmpp_stanza_t * const stanza)
|
||||
{
|
||||
char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
|
||||
|
||||
if (g_strcmp0(type, STANZA_TYPE_GET) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
||||
|
||||
if (query == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *ns = xmpp_stanza_get_ns(query);
|
||||
|
||||
if (ns == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strcmp(ns, STANZA_NS_VERSION) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
stanza_is_caps_request(xmpp_stanza_t * const stanza)
|
||||
{
|
||||
char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
|
||||
|
||||
if (g_strcmp0(type, STANZA_TYPE_GET) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
||||
|
||||
if (query == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *ns = xmpp_stanza_get_ns(query);
|
||||
|
||||
if (ns == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strcmp(ns, XMPP_NS_DISCO_INFO) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *
|
||||
stanza_caps_get_hash(xmpp_stanza_t * const stanza)
|
||||
{
|
||||
@@ -957,8 +901,6 @@ stanza_get_error_message(xmpp_stanza_t *stanza)
|
||||
|
||||
// otherwise check each defined-condition RFC-6120 8.3.3
|
||||
} else {
|
||||
xmpp_stanza_t *cond_stanza = NULL;
|
||||
|
||||
gchar *defined_conditions[] = {
|
||||
STANZA_NAME_BAD_REQUEST,
|
||||
STANZA_NAME_CONFLICT,
|
||||
@@ -985,7 +927,7 @@ stanza_get_error_message(xmpp_stanza_t *stanza)
|
||||
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(defined_conditions); i++) {
|
||||
cond_stanza = xmpp_stanza_get_child_by_name(error_stanza, defined_conditions[i]);
|
||||
xmpp_stanza_t *cond_stanza = xmpp_stanza_get_child_by_name(error_stanza, defined_conditions[i]);
|
||||
if (cond_stanza != NULL) {
|
||||
char *result = strdup(xmpp_stanza_get_name(cond_stanza));
|
||||
return result;
|
||||
|
||||
@@ -192,9 +192,6 @@ int stanza_get_idle_time(xmpp_stanza_t * const stanza);
|
||||
char * stanza_get_caps_str(xmpp_stanza_t * const stanza);
|
||||
gboolean stanza_contains_caps(xmpp_stanza_t * const stanza);
|
||||
char * stanza_caps_get_hash(xmpp_stanza_t * const stanza);
|
||||
gboolean stanza_is_caps_request(xmpp_stanza_t * const stanza);
|
||||
|
||||
gboolean stanza_is_version_request(xmpp_stanza_t * const stanza);
|
||||
|
||||
DataForm * stanza_create_form(xmpp_stanza_t * const stanza);
|
||||
void stanza_destroy_form(DataForm *form);
|
||||
|
||||
Reference in New Issue
Block a user