mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 22:16:20 +00:00
Improve const correctness
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -190,7 +190,7 @@ get_nick_from_full_jid(const char* const full_room_jid)
|
|||||||
/*
|
/*
|
||||||
* get the fulljid, fall back to the barejid
|
* get the fulljid, fall back to the barejid
|
||||||
*/
|
*/
|
||||||
char*
|
const char*
|
||||||
jid_fulljid_or_barejid(Jid* jid)
|
jid_fulljid_or_barejid(Jid* jid)
|
||||||
{
|
{
|
||||||
if (jid->fulljid) {
|
if (jid->fulljid) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ gboolean jid_is_valid_room_form(Jid* jid);
|
|||||||
char* create_fulljid(const char* const barejid, const char* const resource);
|
char* create_fulljid(const char* const barejid, const char* const resource);
|
||||||
char* get_nick_from_full_jid(const char* const full_room_jid);
|
char* get_nick_from_full_jid(const char* const full_room_jid);
|
||||||
|
|
||||||
char* jid_fulljid_or_barejid(Jid* jid);
|
const char* jid_fulljid_or_barejid(Jid* jid);
|
||||||
gchar* jid_random_resource(void);
|
gchar* jid_random_resource(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ _available_handler(xmpp_stanza_t* const stanza)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
char* jid = jid_fulljid_or_barejid(xmpp_presence->jid);
|
const char* jid = jid_fulljid_or_barejid(xmpp_presence->jid);
|
||||||
log_debug("Presence available handler fired for: %s", jid);
|
log_debug("Presence available handler fired for: %s", jid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,7 +632,7 @@ _available_handler(xmpp_stanza_t* const stanza)
|
|||||||
XMPPCaps* caps = stanza_parse_caps(stanza);
|
XMPPCaps* caps = stanza_parse_caps(stanza);
|
||||||
if ((g_strcmp0(my_jid->fulljid, xmpp_presence->jid->fulljid) != 0) && caps) {
|
if ((g_strcmp0(my_jid->fulljid, xmpp_presence->jid->fulljid) != 0) && caps) {
|
||||||
log_debug("Presence contains capabilities.");
|
log_debug("Presence contains capabilities.");
|
||||||
char* jid = jid_fulljid_or_barejid(xmpp_presence->jid);
|
const char* jid = jid_fulljid_or_barejid(xmpp_presence->jid);
|
||||||
_handle_caps(jid, caps);
|
_handle_caps(jid, caps);
|
||||||
}
|
}
|
||||||
stanza_free_caps(caps);
|
stanza_free_caps(caps);
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ roster_remove(const char* const name, const char* const barejid)
|
|||||||
if (contact) {
|
if (contact) {
|
||||||
GList* resources = p_contact_get_available_resources(contact);
|
GList* resources = p_contact_get_available_resources(contact);
|
||||||
while (resources) {
|
while (resources) {
|
||||||
auto_gchar gchar* fulljid = g_strdup_printf("%s/%s", barejid, resources->data);
|
auto_gchar gchar* fulljid = g_strdup_printf("%s/%s", barejid, (char*)resources->data);
|
||||||
autocomplete_remove(roster->fulljid_ac, fulljid);
|
autocomplete_remove(roster->fulljid_ac, fulljid);
|
||||||
resources = g_list_next(resources);
|
resources = g_list_next(resources);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ returns_fulljid_when_exists(void** state)
|
|||||||
{
|
{
|
||||||
Jid* jid = jid_create("localpart@domainpart/resourcepart");
|
Jid* jid = jid_create("localpart@domainpart/resourcepart");
|
||||||
|
|
||||||
char* result = jid_fulljid_or_barejid(jid);
|
const char* result = jid_fulljid_or_barejid(jid);
|
||||||
|
|
||||||
assert_string_equal("localpart@domainpart/resourcepart", result);
|
assert_string_equal("localpart@domainpart/resourcepart", result);
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ returns_barejid_when_fulljid_not_exists(void** state)
|
|||||||
{
|
{
|
||||||
Jid* jid = jid_create("localpart@domainpart");
|
Jid* jid = jid_create("localpart@domainpart");
|
||||||
|
|
||||||
char* result = jid_fulljid_or_barejid(jid);
|
const char* result = jid_fulljid_or_barejid(jid);
|
||||||
|
|
||||||
assert_string_equal("localpart@domainpart", result);
|
assert_string_equal("localpart@domainpart", result);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user