Tue, 26 Sep 2006 17:38:09 +0000
[gaim-migrate @ 17356]
After the comments on gaim-devel about 'bad' code, I looked into the function referenced. It appears that yahoo_buddy_icon_upload_connected() is only called as a callback. It's registered from yahoo_buddy_icon_upload(). yahoo_buddy_icon_upload() is only called twice. In neither case can a NULL make it down to yahoo_buddy_icon_upload_connected(). As this is an exceptional case rather than a normal one, a g_return_if_fail() is more appropriate. That adds logging, makes the intent clearer, and will help the Coverity software detect violations of this assumption.
|
11181
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
1 | /** |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
2 | * @file sipmsg.h |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
3 | * |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
4 | * gaim |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
5 | * |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
6 | * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de> |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
7 | * |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
12 | * |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
17 | * |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
21 | */ |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
22 | |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
23 | #ifndef _GAIM_SIPMSG_H |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
24 | #define _GAIM_SIPMSG_H |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
25 | |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
26 | #include <glib.h> |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
27 | |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
28 | struct sipmsg { |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11181
diff
changeset
|
29 | int response; /* 0 means request, otherwise response code */ |
|
11181
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
30 | gchar *method; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
31 | gchar *target; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
32 | GSList *headers; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
33 | int bodylen; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
34 | gchar *body; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
35 | }; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
36 | |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
37 | struct siphdrelement { |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
38 | gchar *name; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
39 | gchar *value; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
40 | }; |
|
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
41 | |
|
14131
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
42 | struct sipmsg *sipmsg_parse_msg(const gchar *msg); |
|
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
43 | struct sipmsg *sipmsg_parse_header(const gchar *header); |
|
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
44 | void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value); |
|
11181
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
45 | void sipmsg_free(struct sipmsg *msg); |
|
14131
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
46 | gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name); |
|
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
47 | void sipmsg_remove_header(struct sipmsg *msg, const gchar *name); |
|
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
48 | void sipmsg_print(const struct sipmsg *msg); |
|
2cd4ddea2f52
[gaim-migrate @ 16690]
Daniel Atallah <datallah@pidgin.im>
parents:
11829
diff
changeset
|
49 | char *sipmsg_to_string(const struct sipmsg *msg); |
|
11181
e872a55b9524
[gaim-migrate @ 13292]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
diff
changeset
|
50 | #endif /* _GAIM_SIMPLE_H */ |