Fix some warnings - declare some arguments, variables, and structure

members to be const pointers when that's possible, and throw in some
casts when the GLib API fails to have properly consted arguments.

Use ep_strdup_printf() in some cases.

svn path=/trunk/; revision=25596
This commit is contained in:
Guy Harris 2008-06-25 03:05:19 +00:00
parent 495ddc2830
commit 9e6329860a
6 changed files with 15 additions and 21 deletions

View File

@ -136,7 +136,7 @@ typedef struct _diam_dictionary_t {
typedef diam_avp_t* (*avp_constructor_t)(const avp_type_t*, guint32, const diam_vnd_t*, const char*, const value_string*, void*);
struct _avp_type_t {
char* name;
const char* name;
diam_avp_dissector_t v16;
diam_avp_dissector_t rfc;
enum ftenum ft;
@ -1066,11 +1066,11 @@ static int dictionary_load(void)
all_cmds = g_array_new(TRUE,TRUE,sizeof(value_string));
pe_tree_insert32(dictionary.vnds,0,&no_vnd);
g_hash_table_insert(vendors,"None",&no_vnd);
g_hash_table_insert(vendors,(gchar *)"None",&no_vnd);
/* initialize the types hash with the known basic types */
for (type = basic_types; type->name; type++) {
g_hash_table_insert(build_dict.types,type->name,(void*)type);
g_hash_table_insert(build_dict.types,(gchar *)type->name,(void*)type);
}
/* load the dictionary */

View File

@ -980,7 +980,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
{
fragment_data *frag_msg = NULL;
tvbuff_t *new_tvb = NULL;
gchar *frag_str = NULL;
const gchar *frag_str = NULL;
gboolean fragmented;
msg_type = tvb_get_guint8(tvb, offset);

View File

@ -2392,7 +2392,7 @@ static int dissect_kademlia_search_expression_tree(tvbuff_t *tvb, packet_info *p
case 0: /* Bool op */
{
int boolop;
char* bool_op_label;
const char* bool_op_label;
proto_item_append_text( ti, "[BoolOp]" );

View File

@ -120,14 +120,14 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint frame_len = 0;
gint header_len = FCOE_HEADER_LEN;
guint version;
char *ver;
const char *ver;
guint16 len_sof;
gint bytes_remaining;
guint8 sof = 0;
guint8 eof = 0;
const char *eof_str;
char *crc_msg;
char *len_msg;
const char *crc_msg;
const char *len_msg;
proto_item *ti;
proto_item *item;
proto_tree *fcoe_tree = NULL;
@ -150,11 +150,8 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
sof |= (sof < 8) ? 0x30 : 0x20;
version = len_sof >> 14;
ver = "pre-T11 ";
if (version != 0) {
int ver_buf_len = 24;
ver = ep_alloc(ver_buf_len);
g_snprintf(ver, ver_buf_len, "pre-T11 ver %d ", version);
}
if (version != 0)
ver = ep_strdup_printf(ver, "pre-T11 ver %d ", version);
} else {
frame_len = tvb_reported_length_remaining(tvb, 0) -
FCOE_HEADER_LEN - FCOE_TRAILER_LEN;
@ -166,11 +163,8 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
ver = "";
version = tvb_get_guint8(tvb, 0) >> 4;
if (version != 0) {
int ver_buf_len = 16;
ver = ep_alloc(ver_buf_len);
g_snprintf(ver, ver_buf_len, "ver %d ", version);
}
if (version != 0)
ver = ep_strdup_printf(ver, "ver %d ", version);
}
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FCoE");

View File

@ -1319,7 +1319,7 @@ se_tree_create_non_persistent(int type, const char *name)
/* This tree is PErmanent and will never be released
*/
emem_tree_t *
pe_tree_create(int type, char *name)
pe_tree_create(int type, const char *name)
{
emem_tree_t *tree_list;
@ -1337,7 +1337,7 @@ pe_tree_create(int type, char *name)
* as the parent tree.
*/
static emem_tree_t *
emem_tree_create_subtree(emem_tree_t *parent_tree, char *name)
emem_tree_create_subtree(emem_tree_t *parent_tree, const char *name)
{
emem_tree_t *tree_list;

View File

@ -270,7 +270,7 @@ emem_tree_t *se_tree_create_non_persistent(int type, const char *name);
* ******************************************************************* */
/* These trees have PErmanent allocation scope and will never be released
*/
emem_tree_t *pe_tree_create(int type, char *name);
emem_tree_t *pe_tree_create(int type, const char *name);
#define pe_tree_insert32 emem_tree_insert32
#define pe_tree_lookup32 emem_tree_lookup32
#define pe_tree_lookup32_le emem_tree_lookup32_le