freetalk-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freetalk-dev] PATCH: Avoid usage of deprecated `g_strcasecmp'


From: Yavor Doganov
Subject: [Freetalk-dev] PATCH: Avoid usage of deprecated `g_strcasecmp'
Date: Tue, 13 Jan 2009 01:41:46 +0200
User-agent: Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/22.3 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI)

The `g_strcasecmp' function is deprecated since GLib 2.2; it causes
build failure with -DG_DISABLE_DEPRECATED=1 and is nefarious by
nature.  The patch below seems straightforward -- the replacement
`g_ascii_strcasecmp' is used almost everywhere in the Freetalk code.


2009-01-12  Yavor Doganov  <address@hidden>  (tiny change)

        * src/commands.cc (do_change_password):
        * src/register.cc (handle_registration_reply)
        (send_required_fields, do_registration): Use `g_ascii_strcasecmp'
        instead of the deprecated function `g_strcasecmp'.

--- freetalk-3.2/src/commands.cc        2008-11-15 11:02:35.000000000 +0200
+++ freetalk-3.2~/src/commands.cc       2009-01-12 21:08:04.000000000 +0200
@@ -557,7 +557,7 @@ do_main_loop (void)
 void
 do_change_password (char *npass)
 {
-  if (g_strcasecmp (npass, ""))
+  if (g_ascii_strcasecmp (npass, ""))
     {
       LmMessage *msg = lm_message_new_with_sub_type (state.server,
                                                     LM_MESSAGE_TYPE_IQ,
@@ -571,7 +571,7 @@ do_change_password (char *npass)
                                                                  msg, NULL);
 
       const char *type = lm_message_node_get_attribute (reply->node, "type");
-      if (!g_strcasecmp (type, "error"))
+      if (!g_ascii_strcasecmp (type, "error"))
        {
          do_printf ("Password change failed.\n");
        }
diff -Nurp freetalk-3.2/src/register.cc freetalk-3.2~/src/register.cc
--- freetalk-3.2/src/register.cc        2008-08-27 11:58:58.000000000 +0300
+++ freetalk-3.2~/src/register.cc       2009-01-12 21:07:46.000000000 +0200
@@ -44,7 +44,7 @@ static LmMessage *send_registration_quer
 static void handle_registration_reply (LmMessage *reply)
 {
   const char *type = lm_message_node_get_attribute (reply->node, "type");
-  if (!g_strcasecmp (type, "error"))
+  if (!g_ascii_strcasecmp (type, "error"))
     {
       LmMessageNode *err = lm_message_node_find_child (reply->node, "error");
       printf ("Registration failed: ");
@@ -89,9 +89,9 @@ static void send_required_fields (LmMess
 
   for (LmMessageNode *n = query->children; n != NULL; n = n->next)
     {
-      if (g_strcasecmp (n->name, "username") &&
-         g_strcasecmp (n->name, "password") &&
-         g_strcasecmp (n->name, "instructions"))
+      if (g_ascii_strcasecmp (n->name, "username") &&
+         g_ascii_strcasecmp (n->name, "password") &&
+         g_ascii_strcasecmp (n->name, "instructions"))
        {
          char *val;
          string name = string (n->name);
@@ -125,7 +125,7 @@ static void do_registration ()
   LmMessage *reply = send_registration_query ();
   const char *type = lm_message_node_get_attribute (reply->node, "type");
 
-  if (!g_strcasecmp (type, "error"))
+  if (!g_ascii_strcasecmp (type, "error"))
     {
       printf ("In-band registration not available on this server.\n");
       exit (1);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]