Mercurial > pidgin
annotate src/protocols/zephyr/error_message.c @ 12600:e856f985a0b9
[gaim-migrate @ 14934]
Enable the extra warnings regardless of --enable-debug.
Enable FORTIFY_SOURCE regardless of --enable-debug, adding a --disable-fortify flag to configure.
Enable (well, stop disabling) the missing initializer warnings.
This leads to warnings with: GValue v = {0,}; that must be worked around.
Basically, instead of:
GValue v = {0,};
...
g_value_init(&v, G_TYPE_FOO); /* or other use of the GValue */
We'd need to do:
GValue v;
...
v.g_type = 0;
g_value_init(&v, G_TYPE_FOO); /* or other use of the GValue */
Fix several cases of missing initializers. I don't think any of these are bugs, but having this warning seems like a good idea. It might prevent us from making a mistake in the future.
While I was fixing missing initializers, I optimized substitute_simple_word in plugins/spellchk.c, in the same way as I did substitute_word before. Yes, I'm bad for committing these together.
Added a --enable-fatal-asserts flag to configure. As the name implies, this makes g_return_... guards fatal. This is a useful flag to run on a debug copy of Gaim. It will make it very clear if your changes have triggered one of these guards. It's also useful in detecting g_return_... abuse, which helps prevent crashes if Gaim is compiled with G_DISABLE_ASSERT defined.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Wed, 21 Dec 2005 18:36:19 +0000 |
| parents | 64895571248f |
| children |
| rev | line source |
|---|---|
| 2086 | 1 /* |
| 2 * Copyright 1987 by the Student Information Processing Board | |
| 3 * of the Massachusetts Institute of Technology | |
| 4 * | |
| 5 * For copyright info, see "mit-sipb-copyright.h". | |
| 6 */ | |
| 7 | |
| 8 #include "error_table.h" | |
| 9 #include "com_err.h" | |
| 6903 | 10 #include <sysdep.h> |
| 2086 | 11 |
| 12 char *error_table_name_r __P((int, char *)); | |
| 13 | |
| 14 struct et_list * _et_list = (struct et_list *) NULL; | |
| 15 | |
| 16 const char * error_message (code) | |
| 17 long code; | |
| 18 { | |
| 19 static char buf[COM_ERR_BUF_LEN]; | |
| 20 | |
| 21 return(error_message_r(code, buf)); | |
| 22 } | |
| 23 | |
| 24 const char * error_message_r (code, buf) | |
| 25 long code; | |
| 26 char *buf; | |
| 27 { | |
| 28 int offset; | |
| 29 struct et_list *et; | |
| 30 int table_num; | |
| 31 int started = 0; | |
| 32 char *cp, namebuf[6]; | |
| 33 | |
| 34 offset = code & ((1<<ERRCODE_RANGE)-1); | |
| 35 table_num = code - offset; | |
| 36 if (!table_num) | |
| 37 return strerror(offset); | |
| 38 for (et = _et_list; et; et = et->next) { | |
| 39 if (et->table->base == table_num) { | |
| 40 /* This is the right table */ | |
| 41 if (et->table->n_msgs <= offset) | |
| 42 break; | |
| 43 return(et->table->msgs[offset]); | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 strcpy (buf, "Unknown code "); | |
| 48 if (table_num) { | |
| 49 strcat (buf, error_table_name_r (table_num, namebuf)); | |
| 50 strcat (buf, " "); | |
| 51 } | |
| 52 for (cp = buf; *cp; cp++) | |
| 53 ; | |
| 54 if (offset >= 100) { | |
| 55 *cp++ = '0' + offset / 100; | |
| 56 offset %= 100; | |
| 57 started++; | |
| 58 } | |
| 59 if (started || offset >= 10) { | |
| 60 *cp++ = '0' + offset / 10; | |
| 61 offset %= 10; | |
| 62 } | |
| 63 *cp++ = '0' + offset; | |
| 64 *cp = '\0'; | |
| 65 return(buf); | |
| 66 } |
