comparison libpurple/protocols/msn/msg.c @ 30193:1c3ee8378e2e

I'm tired of seeing this warning.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 25 Apr 2010 21:29:40 +0000
parents 9198a5d39c5c
children 0f1df8098d00
comparison
equal deleted inserted replaced
30192:43c58f23c4b0 30193:1c3ee8378e2e
968 968
969 /* TODO: Make these not be such duplicates of each other */ 969 /* TODO: Make these not be such duplicates of each other */
970 static void 970 static void
971 got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) 971 got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size)
972 { 972 {
973 FILE *f; 973 FILE *f = NULL;
974 char *path = NULL; 974 char *path = NULL;
975 const char *who = slpcall->slplink->remote_user; 975 const char *who = slpcall->slplink->remote_user;
976 purple_debug_info("msn", "Received wink from %s\n", who); 976 purple_debug_info("msn", "Received wink from %s\n", who);
977 977
978 if ((f = purple_mkstemp(&path, TRUE))) { 978 if ((f = purple_mkstemp(&path, TRUE)) &&
979 fwrite(data, size, 1, f); 979 (fwrite(data, size, 1, f) == size)) {
980 fclose(f);
981 datacast_inform_user(slpcall->slplink->swboard, 980 datacast_inform_user(slpcall->slplink->swboard,
982 who, 981 who,
983 _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"), 982 _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"),
984 path); 983 path);
985 } else { 984 } else {
986 purple_debug_error("msn", "Couldn\'t create temp file to store wink\n"); 985 purple_debug_error("msn", "Couldn\'t create temp file to store wink\n");
987 datacast_inform_user(slpcall->slplink->swboard, 986 datacast_inform_user(slpcall->slplink->swboard,
988 who, 987 who,
989 _("%s sent a wink, but it could not be saved"), 988 _("%s sent a wink, but it could not be saved"),
990 NULL); 989 NULL);
991 } 990 }
991 if (f)
992 fclose(f);
992 g_free(path); 993 g_free(path);
993 } 994 }
994 995
995 static void 996 static void
996 got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) 997 got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size)
997 { 998 {
998 FILE *f; 999 FILE *f = NULL;
999 char *path = NULL; 1000 char *path = NULL;
1000 const char *who = slpcall->slplink->remote_user; 1001 const char *who = slpcall->slplink->remote_user;
1001 purple_debug_info("msn", "Received voice clip from %s\n", who); 1002 purple_debug_info("msn", "Received voice clip from %s\n", who);
1002 1003
1003 if ((f = purple_mkstemp(&path, TRUE))) { 1004 if ((f = purple_mkstemp(&path, TRUE)) &&
1004 fwrite(data, size, 1, f); 1005 (fwrite(data, size, 1, f) == size)) {
1005 fclose(f);
1006 datacast_inform_user(slpcall->slplink->swboard, 1006 datacast_inform_user(slpcall->slplink->swboard,
1007 who, 1007 who,
1008 _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"), 1008 _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"),
1009 path); 1009 path);
1010 } else { 1010 } else {
1011 purple_debug_error("msn", "Couldn\'t create temp file to store sound\n"); 1011 purple_debug_error("msn", "Couldn\'t create temp file to store sound\n");
1012 datacast_inform_user(slpcall->slplink->swboard, 1012 datacast_inform_user(slpcall->slplink->swboard,
1013 who, 1013 who,
1014 _("%s sent a voice clip, but it could not be saved"), 1014 _("%s sent a voice clip, but it could not be saved"),
1015 NULL); 1015 NULL);
1016 } 1016 }
1017 if (f)
1018 fclose(f);
1017 g_free(path); 1019 g_free(path);
1018 } 1020 }
1019 1021
1020 void 1022 void
1021 msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 1023 msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg)