Mercurial > pidgin
changeset 13606:c1157497b32c
[gaim-migrate @ 15992]
Change a few functions to return gboolean instead of int
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 10 Apr 2006 02:38:33 +0000 |
parents | 77e61dc1b525 |
children | a79d422bfe62 |
files | src/protocols/oscar/oscar.h src/protocols/oscar/util.c |
diffstat | 2 files changed, 57 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.h Mon Apr 10 02:34:08 2006 +0000 +++ b/src/protocols/oscar/oscar.h Mon Apr 10 02:38:33 2006 +0000 @@ -1386,9 +1386,9 @@ int aimutil_itemcnt(char *toSearch, char dl); char *aimutil_itemindex(char *toSearch, int theindex, char dl); -int aim_snvalid(const char *sn); -int aim_sn_is_icq(const char *sn); -int aim_sn_is_sms(const char *sn); +gboolean aim_snvalid(const char *sn); +gboolean aim_sn_is_icq(const char *sn); +gboolean aim_sn_is_sms(const char *sn); int aim_snlen(const char *sn); int aim_sncmp(const char *sn1, const char *sn2);
--- a/src/protocols/oscar/util.c Mon Apr 10 02:34:08 2006 +0000 +++ b/src/protocols/oscar/util.c Mon Apr 10 02:38:33 2006 +0000 @@ -37,7 +37,8 @@ * -- DMP. * */ -int aimutil_tokslen(char *toSearch, int theindex, char dl) +int +aimutil_tokslen(char *toSearch, int theindex, char dl) { int curCount = 1; char *next; @@ -61,7 +62,8 @@ return toReturn; } -int aimutil_itemcnt(char *toSearch, char dl) +int +aimutil_itemcnt(char *toSearch, char dl) { int curCount; char *next; @@ -78,7 +80,8 @@ return curCount; } -char *aimutil_itemindex(char *toSearch, int theindex, char dl) +char * +aimutil_itemindex(char *toSearch, int theindex, char dl) { int curCount; char *next; @@ -120,9 +123,9 @@ /** * Calculate the checksum of a given icon. - * */ -guint16 aimutil_iconsum(const guint8 *buf, int buflen) +guint16 +aimutil_iconsum(const guint8 *buf, int buflen) { guint32 sum; int i; @@ -141,9 +144,10 @@ * Example: BobDole * Example: Henry_Ford@mac.com * - * @return 1 if the screen name is valid, 0 if not. + * @return TRUE if the screen name is valid, FALSE if not. */ -static int aim_snvalid_aim(const char *sn) +static gboolean +aim_snvalid_aim(const char *sn) { int i; @@ -151,19 +155,20 @@ if (!isalnum(sn[i]) && (sn[i] != ' ') && (sn[i] != '@') && (sn[i] != '.') && (sn[i] != '_') && (sn[i] != '-')) - return 0; + return FALSE; } - return 1; + return TRUE; } /** * Check if the given screen name is a valid ICQ screen name. * Example: 1234567 * - * @return 1 if the screen name is valid, 0 if not. + * @return TRUE if the screen name is valid, FALSE if not. */ -static int aim_snvalid_icq(const char *sn) +static gboolean +aim_snvalid_icq(const char *sn) { int i; @@ -179,9 +184,10 @@ * Check if the given screen name is a valid SMS screen name. * Example: +19195551234 * - * @return 1 if the screen name is valid, 0 if not. + * @return TRUE if the screen name is valid, FALSE if not. */ -static int aim_snvalid_sms(const char *sn) +static gboolean +aim_snvalid_sms(const char *sn) { int i; @@ -199,9 +205,10 @@ /** * Check if the given screen name is a valid oscar screen name. * - * @return 1 if the screen name is valid, 0 if not. + * @return TRUE if the screen name is valid, FALSE if not. */ -int aim_snvalid(const char *sn) +gboolean +aim_snvalid(const char *sn) { if ((sn == NULL) || (*sn == '\0')) return 0; @@ -217,18 +224,19 @@ } /** - * Determine if a given screen name is an ICQ screen name + * Determine if a given screen name is an ICQ screen name * (i.e. it begins with a number). * * @sn A valid AIM or ICQ screen name. - * @return 1 if the screen name is an ICQ screen name. Otherwise 0 - * is returned. + * @return TRUE if the screen name is an ICQ screen name. Otherwise + * FALSE is returned. */ -int aim_sn_is_icq(const char *sn) +gboolean +aim_sn_is_icq(const char *sn) { if (isalpha(sn[0])) - return 0; - return 1; + return FALSE; + return TRUE; } /** @@ -236,25 +244,24 @@ * (i.e. it begins with a +). * * @sn A valid AIM or ICQ screen name. - * @return 1 if the screen name is an SMS number. Otherwise 0 - * is returned. + * @return TRUE if the screen name is an SMS number. Otherwise + * FALSE is returned. */ -int aim_sn_is_sms(const char *sn) +gboolean +aim_sn_is_sms(const char *sn) { if (sn[0] != '+') - return 0; - return 1; + return FALSE; + return TRUE; } -/* -* int snlen(const char *) -* -* This takes a screen name and returns its length without -* spaces. If there are no spaces in the SN, then the -* return is equal to that of strlen(). -* -*/ -int aim_snlen(const char *sn) +/** + * This takes a screen name and returns its length without + * spaces. If there are no spaces in the SN, then the + * return is equal to that of strlen(). + */ +int +aim_snlen(const char *sn) { int i = 0; @@ -270,20 +277,18 @@ return i; } -/* -* int sncmp(const char *, const char *) -* -* This takes two screen names and compares them using the rules -* on screen names for AIM/AOL. Mainly, this means case and space -* insensitivity (all case differences and spacing differences are -* ignored, with the exception that screen names can not start with -* a space). -* -* Return: 0 if equal -* non-0 if different -* -*/ -int aim_sncmp(const char *sn1, const char *sn2) +/** + * This takes two screen names and compares them using the rules + * on screen names for AIM/AOL. Mainly, this means case and space + * insensitivity (all case differences and spacing differences are + * ignored, with the exception that screen names can not start with + * a space). + * + * Return: 0 if equal + * non-0 if different + */ +int +aim_sncmp(const char *sn1, const char *sn2) { if ((sn1 == NULL) || (sn2 == NULL))