pidgin: 2b342906: Replace strrchr(..., '/')+1 with g_path_..
qulogic at pidgin.im
qulogic at pidgin.im
Wed Dec 10 23:25:38 EST 2008
-----------------------------------------------------------------
Revision: 2b3429067be9bc2eb9be9e8deeeac9c35001f61d
Ancestor: 0dcf85a11f17f3b6f7471e8f0faa684c4e0905c4
Author: qulogic at pidgin.im
Date: 2008-12-11T04:20:14
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2b3429067be9bc2eb9be9e8deeeac9c35001f61d
Modified files:
libpurple/protocols/qq/send_file.c
ChangeLog:
Replace strrchr(..., '/')+1 with g_path_get_basename in QQ plugin. Didn't
someone fix this already?
-------------- next part --------------
============================================================
--- libpurple/protocols/qq/send_file.c 6771387353dfd697189c9537b9533a304d2c8261
+++ libpurple/protocols/qq/send_file.c 52794a7b292e5492449b91bb05a02a251221ab5b
@@ -612,7 +612,8 @@ _qq_xfer_init (PurpleXfer * xfer)
PurpleConnection *gc;
PurpleAccount *account;
guint32 to_uid;
- gchar *filename, *filename_without_path;
+ const gchar *filename;
+ gchar *base_filename;
g_return_if_fail (xfer != NULL);
account = purple_xfer_get_account(xfer);
@@ -621,13 +622,14 @@ _qq_xfer_init (PurpleXfer * xfer)
to_uid = purple_name_to_uid (xfer->who);
g_return_if_fail (to_uid != 0);
- filename = (gchar *) purple_xfer_get_local_filename (xfer);
+ filename = purple_xfer_get_local_filename (xfer);
g_return_if_fail (filename != NULL);
- filename_without_path = strrchr (filename, '/') + 1;
+ base_filename = g_path_get_basename(filename);
- _qq_send_packet_file_request (gc, to_uid, filename_without_path,
+ _qq_send_packet_file_request (gc, to_uid, base_filename,
purple_xfer_get_size(xfer));
+ g_free(base_filename);
}
/* cancel the transfer of receiving files */
@@ -696,7 +698,7 @@ void qq_process_recv_file_reject (guint8
return;
}
*/
- filename = strrchr(purple_xfer_get_local_filename(qd->xfer), '/') + 1;
+ filename = g_path_get_basename(purple_xfer_get_local_filename(qd->xfer));
msg = g_strdup_printf(_("%d has declined the file %s"),
sender_uid, filename);
@@ -704,7 +706,8 @@ void qq_process_recv_file_reject (guint8
purple_xfer_request_denied(qd->xfer);
qd->xfer = NULL;
- g_free (msg);
+ g_free(filename);
+ g_free(msg);
}
/* process cancel im for file transfer request */
@@ -725,7 +728,7 @@ void qq_process_recv_file_cancel (guint8
return;
}
*/
- filename = strrchr(purple_xfer_get_local_filename(qd->xfer), '/') + 1;
+ filename = g_path_get_basename(purple_xfer_get_local_filename(qd->xfer));
msg = g_strdup_printf
(_("%d canceled the transfer of %s"),
sender_uid, filename);
@@ -734,7 +737,8 @@ void qq_process_recv_file_cancel (guint8
purple_xfer_cancel_remote(qd->xfer);
qd->xfer = NULL;
- g_free (msg);
+ g_free(filename);
+ g_free(msg);
}
/* process accept im for file transfer request */
More information about the Commits
mailing list