Mercurial > pidgin.yaz
comparison src/util.c @ 7430:783eea64614c
[gaim-migrate @ 8034]
a better fix. gaim_normalize() isn't meant to return NULL.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 05 Nov 2003 00:18:51 +0000 |
parents | 414c701ef1ff |
children | 825351e3b01b |
comparison
equal
deleted
inserted
replaced
7429:58a426e1bd1a | 7430:783eea64614c |
---|---|
1299 const char * | 1299 const char * |
1300 gaim_normalize(const GaimAccount *account, const char *s) | 1300 gaim_normalize(const GaimAccount *account, const char *s) |
1301 { | 1301 { |
1302 GaimPlugin *prpl = NULL; | 1302 GaimPlugin *prpl = NULL; |
1303 GaimPluginProtocolInfo *prpl_info = NULL; | 1303 GaimPluginProtocolInfo *prpl_info = NULL; |
1304 const char *ret = NULL; | |
1304 | 1305 |
1305 if(account) | 1306 if(account) |
1306 prpl = gaim_find_prpl(gaim_account_get_protocol(account)); | 1307 prpl = gaim_find_prpl(gaim_account_get_protocol(account)); |
1307 | 1308 |
1308 if(prpl) | 1309 if(prpl) |
1309 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); | 1310 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); |
1310 | 1311 |
1311 if(prpl_info && prpl_info->normalize) { | 1312 if(prpl_info && prpl_info->normalize) |
1312 return prpl_info->normalize(account, s); | 1313 ret = prpl_info->normalize(account, s); |
1313 } else { | 1314 |
1315 if(!ret) { | |
1314 static char buf[BUF_LEN]; | 1316 static char buf[BUF_LEN]; |
1315 char *tmp; | 1317 char *tmp; |
1316 int i, j; | 1318 int i, j; |
1317 | 1319 |
1318 g_return_val_if_fail(s != NULL, NULL); | 1320 g_return_val_if_fail(s != NULL, NULL); |
1330 g_free(tmp); | 1332 g_free(tmp); |
1331 tmp = g_utf8_normalize(buf, -1, G_NORMALIZE_DEFAULT); | 1333 tmp = g_utf8_normalize(buf, -1, G_NORMALIZE_DEFAULT); |
1332 g_snprintf(buf, sizeof(buf), "%s", tmp); | 1334 g_snprintf(buf, sizeof(buf), "%s", tmp); |
1333 g_free(tmp); | 1335 g_free(tmp); |
1334 | 1336 |
1335 return buf; | 1337 ret = buf; |
1336 } | 1338 } |
1339 return ret; | |
1337 } | 1340 } |
1338 | 1341 |
1339 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date, | 1342 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date, |
1340 or time */ | 1343 or time */ |
1341 const char * | 1344 const char * |