comparison libpurple/protocols/myspace/user.c @ 21022:3f8b32a4786c

Fix this warning: user.c: In function 'msim_store_user_info_each': user.c:214: warning: ISO C90 forbids mixed declarations and code
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 26 Oct 2007 13:22:49 +0000
parents 89c7be36fd61
children e808d83d797e
comparison
equal deleted inserted replaced
21020:f710e48fbe1b 21022:3f8b32a4786c
201 user->song_name = value_str; 201 user->song_name = value_str;
202 } else if (g_str_equal(key_str, "UserName") || g_str_equal(key_str, "IMName") || g_str_equal(key_str, "NickName")) { 202 } else if (g_str_equal(key_str, "UserName") || g_str_equal(key_str, "IMName") || g_str_equal(key_str, "NickName")) {
203 /* Ignore because PurpleBuddy knows this already */ 203 /* Ignore because PurpleBuddy knows this already */
204 g_free(value_str); 204 g_free(value_str);
205 } else if (g_str_equal(key_str, "ImageURL") || g_str_equal(key_str, "AvatarURL")) { 205 } else if (g_str_equal(key_str, "ImageURL") || g_str_equal(key_str, "AvatarURL")) {
206 const gchar *previous_url;
207
206 if (user->temporary_user) { 208 if (user->temporary_user) {
207 /* This user will be destroyed soon; don't try to look up its image or avatar, 209 /* This user will be destroyed soon; don't try to look up its image or avatar,
208 * since that won't return immediately and we will end up accessing freed data. 210 * since that won't return immediately and we will end up accessing freed data.
209 */ 211 */
210 g_free(value_str); 212 g_free(value_str);
211 return; 213 return;
212 } 214 }
213
214 const gchar *previous_url;
215 215
216 if (user->temporary_user) { 216 if (user->temporary_user) {
217 /* This user will be destroyed soon; don't try to look up its image or avatar, 217 /* This user will be destroyed soon; don't try to look up its image or avatar,
218 * since that won't return immediately and we will end up accessing freed data. 218 * since that won't return immediately and we will end up accessing freed data.
219 */ 219 */
220 g_free(value_str); 220 g_free(value_str);
221 return; 221 return;
222 } 222 }
223 223
224 g_free(user->image_url); 224 g_free(user->image_url);
225 225
226 user->image_url = value_str; 226 user->image_url = value_str;
227 227
228 /* Instead of showing 'no photo' picture, show nothing. */ 228 /* Instead of showing 'no photo' picture, show nothing. */
231 purple_buddy_icons_set_for_user(user->buddy->account, 231 purple_buddy_icons_set_for_user(user->buddy->account,
232 user->buddy->name, 232 user->buddy->name,
233 NULL, 0, NULL); 233 NULL, 0, NULL);
234 return; 234 return;
235 } 235 }
236 236
237 /* TODO: use ETag for checksum */ 237 /* TODO: use ETag for checksum */
238 previous_url = purple_buddy_icons_get_checksum_for_user(user->buddy); 238 previous_url = purple_buddy_icons_get_checksum_for_user(user->buddy);
239 239
240 /* Only download if URL changed */ 240 /* Only download if URL changed */
241 if (!previous_url || !g_str_equal(previous_url, user->image_url)) { 241 if (!previous_url || !g_str_equal(previous_url, user->image_url)) {