More char -> const char fixes

Declare some functions static

svn path=/trunk/; revision=15158
This commit is contained in:
Jörg Mayer 2005-07-30 16:34:38 +00:00
parent 38d1c38e99
commit eab0aeb4bb
23 changed files with 65 additions and 70 deletions

View File

@ -460,7 +460,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree)
{
http_proto_t proto;
char *proto_tag;
const char *proto_tag;
proto_tree *http_tree = NULL;
proto_item *ti = NULL;
const guchar *line;
@ -1562,9 +1562,9 @@ is_http_request_or_reply(const gchar *data, int linelen, http_type_t *type,
* Process headers.
*/
typedef struct {
char *name;
gint *hf;
int special;
const char *name;
gint *hf;
int special;
} header_info;
#define HDR_NO_SPECIAL 0
@ -1866,7 +1866,7 @@ dissect_http_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_http_message(tvb, 0, pinfo, tree);
}
void reinit_http(void) {
static void reinit_http(void) {
if ( http_alternate_tcp_port != alternate_tcp_port ) {
if (alternate_tcp_port)

View File

@ -148,7 +148,7 @@ dissect_icmpv6opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre
proto_item *ti, *tf;
struct nd_opt_hdr nd_opt_hdr, *opt;
int len;
char *typename;
const char *typename;
static const guint8 nd_redirect_reserved[6] = {0, 0, 0, 0, 0, 0};
guint8 nd_redirect_res[6];

View File

@ -549,7 +549,7 @@ static guint16
proto_add_icq_attr(proto_tree* tree, /* The tree to add to */
tvbuff_t *tvb, /* Tvbuff with packet */
const int offset, /* Offset from the start of packet of field */
char* descr) /* The description to use in the tree */
const char* descr) /* The description to use in the tree */
{
guint16 len;
@ -577,12 +577,12 @@ icqv5_decode_msgType(proto_tree* tree,
gint sep_offset;
int sz; /* Size of the current element */
unsigned int n;
static char* url_field_descr[] = {
static const char* url_field_descr[] = {
"Description",
"URL",
};
#define N_URL_FIELDS (sizeof url_field_descr / sizeof url_field_descr[0])
static char* email_field_descr[] = {
static const char* email_field_descr[] = {
"Nickname",
"First name",
"Last name",
@ -591,7 +591,7 @@ icqv5_decode_msgType(proto_tree* tree,
"Text"
};
#define N_EMAIL_FIELDS (sizeof email_field_descr / sizeof email_field_descr[0])
static char* auth_req_field_descr[] = {
static const char* auth_req_field_descr[] = {
"Nickname",
"First name",
"Last name",
@ -600,7 +600,7 @@ icqv5_decode_msgType(proto_tree* tree,
"Reason"
};
#define N_AUTH_REQ_FIELDS (sizeof auth_req_field_descr / sizeof auth_req_field_descr[0])
static char* user_added_field_descr[] = {
static const char* user_added_field_descr[] = {
"Nickname",
"First name",
"Last name",
@ -1484,13 +1484,13 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
* They are used to "implement" a poorman's exception handling
*/
int len = 0;
char *descr[] = {
const char *descr[] = {
"Nick",
"First name",
"Last name",
"Email",
NULL};
char** d = descr;
const char** d = descr;
unsigned char auth;
/*
* Read UIN

View File

@ -162,7 +162,7 @@ dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int offset = 0;
gboolean is_request = (pinfo->destport == 631);
guint16 status_code;
gchar *status_fmt;
const gchar *status_fmt;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPP");

View File

@ -439,7 +439,7 @@ static GMemChunk *spx_hash_values = NULL;
static GMemChunk *spx_rexmit_infos = NULL;
/* Hash Functions */
gint
static gint
spx_equal(gconstpointer v, gconstpointer v2)
{
const spx_hash_key *val1 = (const spx_hash_key*)v;
@ -453,7 +453,7 @@ spx_equal(gconstpointer v, gconstpointer v2)
return 0;
}
guint
static guint
spx_hash_func(gconstpointer v)
{
const spx_hash_key *spx_key = (const spx_hash_key*)v;
@ -514,7 +514,7 @@ spx_postseq_cleanup(void)
* needed during random-access processing of the proto_tree.*/
}
spx_hash_value*
static spx_hash_value*
spx_hash_insert(conversation_t *conversation, guint32 spx_src, guint16 spx_seq)
{
spx_hash_key *key;
@ -537,7 +537,7 @@ spx_hash_insert(conversation_t *conversation, guint32 spx_src, guint16 spx_seq)
}
/* Returns the spx_hash_value*, or NULL if not found. */
spx_hash_value*
static spx_hash_value*
spx_hash_lookup(conversation_t *conversation, guint32 spx_src, guint32 spx_seq)
{
spx_hash_key key;
@ -897,7 +897,7 @@ dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int cursor;
int available_length;
static char *rip_type[3] = { "Request", "Response", "Unknown" };
static const char *rip_type[3] = { "Request", "Response", "Unknown" };
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPX RIP");
@ -1238,7 +1238,7 @@ dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint16 server_port;
guint16 intermediate_network;
static char *sap_type[4] = { "General Query", "General Response",
static const char *sap_type[4] = { "General Query", "General Response",
"Nearest Query", "Nearest Response" };
if (check_col(pinfo->cinfo, COL_PROTOCOL))

View File

@ -1985,7 +1985,7 @@ situation2str(guint32 type)
static char msg[SIT_MSG_NUM];
int n = 0;
char * sep = "";
const char * sep = "";
int ret;
if (type & SIT_IDENTITY) {

View File

@ -75,7 +75,7 @@
*/
typedef struct {
int optcode; /* code for option */
char *tree_text; /* text for fold out */
const char *tree_text; /* text for fold out */
gint *tree_id; /* id for add_item */
void (*dissect)(tvbuff_t *tvb, proto_tree *tree,
int offset, int id_length, int length);

View File

@ -488,7 +488,7 @@ dissect_lsp_mt_id(tvbuff_t *tvb, proto_tree *tree, int offset)
*/
static void
dissect_metric(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 value,
char *pstr, int force_supported )
const char *pstr, int force_supported )
{
int s;

View File

@ -86,7 +86,7 @@ static const value_string isis_vals[] = {
*/
void
isis_dissect_unknown(tvbuff_t *tvb, proto_tree *tree, int offset,
char *fmat, ...)
const char *fmat, ...)
{
va_list ap;

View File

@ -55,6 +55,6 @@
extern char *isis_address_to_string(tvbuff_t *tvb, int offset, int len);
extern void isis_dissect_unknown(tvbuff_t *tvb, proto_tree *tree, int offset,
char *fmat, ...);
const char *fmat, ...);
#endif /* _PACKET_ISIS_H */

View File

@ -810,7 +810,7 @@ dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_
guint16 payload_length;
guint32 error_code;
int start_payload_offset = 0; /* Keep the begining of the payload offset */
char *char_error_code[] = {
const char *char_error_code[] = {
"KINK_OK",
"KINK_PROTOERR",
"KINK_INVDOI",

View File

@ -1768,7 +1768,7 @@ static void dissect_ldap_request_compare(ASN1_SCK *a, proto_tree *tree)
int length;
char *string1 = NULL;
char *string2 = NULL;
char *s1, *s2;
const char *s1, *s2;
char *compare;
int ret;

View File

@ -66,7 +66,7 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *manolito_tree;
char* packet_type = 0;
const char* packet_type = 0;
/* Make entries in Protocol column and Info column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@ -125,7 +125,7 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8* data; /* payload */
int start; /* field starting location */
char field_name_str[3]; /* printable name */
char* longname; /* human-friendly field name */
const char* longname; /* human-friendly field name */
start = offset;

View File

@ -784,10 +784,10 @@ void dissect_server_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 tool_version_length = 0;
guint32 download_update_player_length = 0;
guint32 password_encryption_type_length = 0;
char *server_version = "";
char *tool_version = "";
char *download_update_player = "";
char *password_encryption_type = "";
const char *server_version = "";
const char *tool_version = "";
const char *download_update_player = "";
const char *password_encryption_type = "";
/* Prefix bytes */
proto_tree_add_item(tree, hf_msmms_command_prefix1, tvb, offset, 4, TRUE);
@ -919,7 +919,7 @@ void dissect_server_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
void dissect_client_player_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint offset, guint length_remaining)
{
char *player_info = "";
const char *player_info = "";
proto_tree_add_item(tree, hf_msmms_command_prefix1, tvb, offset, 4, TRUE);
offset += 4;
@ -1034,7 +1034,7 @@ void dissect_timing_test_response(tvbuff_t *tvb, proto_tree *tree, guint offset)
void dissect_request_server_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint offset, guint length_remaining)
{
char *server_file = "";
const char *server_file = "";
/* CommandLevel */
proto_tree_add_item(tree, hf_msmms_command_prefix1, tvb, offset, 4, TRUE);

View File

@ -321,7 +321,7 @@ static int display_application_name(tvbuff_t *tvb, int offset,
}
static char *get_msproxy_cmd_name( int cmd, int direction) {
static const char *get_msproxy_cmd_name( int cmd, int direction) {
/* return the command name string for cmd */

View File

@ -72,7 +72,7 @@ static int hf_msrp_end_line = -1;
static int hf_msrp_cnt_flg = -1;
typedef struct {
char *name;
const char *name;
} msrp_header_t;
static const msrp_header_t msrp_headers[] = {

View File

@ -90,8 +90,8 @@ static gint ett_multipart_body = -1;
typedef struct {
char *name;
char *compact_name;
const char *name;
const char *compact_name;
} multipart_header_t;
static const multipart_header_t multipart_headers[] = {

View File

@ -230,7 +230,7 @@ static const value_string rcode_vals[] = {
#define NAME_FLAGS_G (1<<(15-0)) /* group name */
static char *
static const char *
nbns_type_name (int type)
{
switch (type) {
@ -387,7 +387,7 @@ get_nbns_name_type_class(tvbuff_t *tvb, int offset, int nbns_data_offset,
static void
add_name_and_type(proto_tree *tree, tvbuff_t *tvb, int offset, int len,
char *tag, char *name, int name_type)
const char *tag, const char *name, int name_type)
{
if (name_type != -1) {
proto_tree_add_text(tree, tvb, offset, len, "%s: %s (%s)",
@ -408,7 +408,7 @@ dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset,
int name_type;
int type;
int class;
char *type_name;
const char *type_name;
int data_offset;
int data_start;
proto_tree *q_tree;
@ -601,7 +601,7 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset,
int type;
int class;
const char *class_name;
char *type_name;
const char *type_name;
int data_offset;
int cur_offset;
int data_start;
@ -987,7 +987,7 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
static int
dissect_answer_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
int count, column_info *cinfo, proto_tree *nbns_tree, int opcode,
char *name)
const char *name)
{
int start_off, add_off;
proto_tree *qatree = NULL;

View File

@ -77,7 +77,7 @@ typedef struct {
guint8 func;
guint8 subfunc;
guint8 has_subfunc;
gchar* name;
const gchar* name;
gint group;
const ptvc_record *request_ptvc;
const ptvc_record *reply_ptvc;

View File

@ -117,11 +117,6 @@ static dissector_handle_t data_handle;
#define NCP_RQST_HDR_LENGTH 7
#define NCP_RPLY_HDR_LENGTH 8
/* Hash functions */
gint ncp_equal (gconstpointer v, gconstpointer v2);
guint ncp_hash (gconstpointer v);
/* These are the header structures to handle NCP over IP */
#define NCPIP_RQST 0x446d6454 /* "DmdT" */
#define NCPIP_RPLY 0x744e6350 /* "tNcP" */
@ -212,7 +207,7 @@ static GMemChunk *mncp_rhash_keys = NULL;
static GMemChunk *mncp_rhash_values = NULL;
/* Hash Functions */
gint
static gint
mncp_equal(gconstpointer v, gconstpointer v2)
{
const mncp_rhash_key *val1 = (const mncp_rhash_key*)v;
@ -224,7 +219,7 @@ mncp_equal(gconstpointer v, gconstpointer v2)
return 0;
}
guint
static guint
mncp_hash(gconstpointer v)
{
const mncp_rhash_key *mncp_key = (const mncp_rhash_key*)v;
@ -262,7 +257,7 @@ mncp_postseq_cleanup(void)
{
}
mncp_rhash_value*
static mncp_rhash_value*
mncp_hash_insert(conversation_t *conversation)
{
mncp_rhash_key *key;
@ -282,7 +277,7 @@ mncp_hash_insert(conversation_t *conversation)
}
/* Returns the ncp_rec*, or NULL if not found. */
mncp_rhash_value*
static mncp_rhash_value*
mncp_hash_lookup(conversation_t *conversation)
{
mncp_rhash_key key;
@ -313,7 +308,7 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint16 nw_connection, ncp_burst_seqno, ncp_ack_seqno;
guint16 flags = 0;
char flags_str[2+3+1+3+1+3+1+3+1+3+1+1];
char *sep;
const char *sep;
proto_tree *flags_tree = NULL;
int hdr_offset = 0;
int commhdr;

View File

@ -672,7 +672,7 @@ static GMemChunk *ncp_req_hash_keys = NULL;
static GMemChunk *ncp_req_hash_values = NULL;
/* Hash Functions */
gint
static gint
ncp_equal(gconstpointer v, gconstpointer v2)
{
const ncp_req_hash_key *val1 = (const ncp_req_hash_key*)v;
@ -685,7 +685,7 @@ ncp_equal(gconstpointer v, gconstpointer v2)
return 0;
}
gint
static gint
ncp_eid_equal(gconstpointer v, gconstpointer v2)
{
const ncp_req_eid_hash_key *val1 = (const ncp_req_eid_hash_key*)v;
@ -697,14 +697,14 @@ ncp_eid_equal(gconstpointer v, gconstpointer v2)
return 0;
}
guint
static guint
ncp_hash(gconstpointer v)
{
const ncp_req_hash_key *ncp_key = (const ncp_req_hash_key*)v;
return GPOINTER_TO_UINT(ncp_key->conversation) + ncp_key->nw_sequence;
}
guint
static guint
ncp_eid_hash(gconstpointer v)
{
const ncp_req_eid_hash_key *ncp_eid_key = (const ncp_req_eid_hash_key*)v;
@ -798,7 +798,7 @@ ncp_postseq_cleanup(void)
* needed during random-access processing of the proto_tree.*/
}
ncp_req_hash_value*
static ncp_req_hash_value*
ncp_hash_insert(conversation_t *conversation, guint8 nw_sequence,
const ncp_record *ncp_rec)
{
@ -825,7 +825,7 @@ ncp_hash_insert(conversation_t *conversation, guint8 nw_sequence,
return request_value;
}
ncp_req_eid_hash_value*
static ncp_req_eid_hash_value*
ncp_eid_hash_insert(guint32 nw_eid)
{
ncp_req_eid_hash_key *request_eid_key;
@ -846,7 +846,7 @@ ncp_eid_hash_insert(guint32 nw_eid)
}
/* Returns the ncp_rec*, or NULL if not found. */
ncp_req_hash_value*
static ncp_req_hash_value*
ncp_hash_lookup(conversation_t *conversation, guint8 nw_sequence)
{
ncp_req_hash_key request_key;
@ -858,7 +858,7 @@ ncp_hash_lookup(conversation_t *conversation, guint8 nw_sequence)
}
/* Returns the value_rec* for needed EID, or NULL if not found. */
ncp_req_eid_hash_value*
static ncp_req_eid_hash_value*
ncp_eid_hash_lookup(conversation_t *conversation _U_, guint32 nw_eid)
{
ncp_req_eid_hash_key request_eid_key;
@ -1096,7 +1096,7 @@ uint_to_nwtime(guint data, nw_time_t *nwtime)
nwtime->hour = ((data & 0xf800) >> 11);
}
char *
static char *
unicode_to_string(char * data, guint32 length)
{
guint32 i;
@ -1460,7 +1460,7 @@ static const ncp_record ncplip_echo =
NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
/* Wrapper around proto_tree_free() */
void free_proto_tree(void *tree)
static void free_proto_tree(void *tree)
{
if (tree) {
proto_tree_free((proto_tree*) tree);
@ -1578,7 +1578,7 @@ uni_to_string(char * data, guint32 str_length, char *dest_buf)
* %x = integer in hex format = 1
* %s = string = 2
**************************************/
int
static int
get_info_type(const gchar* check_string)
{
guint length;
@ -1603,7 +1603,7 @@ static void
process_bitfield(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values)
{
gchar flags_str[512];
gchar *sep;
const gchar *sep;
proto_item *tinew;
proto_tree *flags_tree;
guint32 i;

View File

@ -337,7 +337,7 @@ netbios_name_type_descr(int name_type)
return val_to_str(name_type, nb_name_type_vals, "Unknown");
}
void netbios_add_name(char* label, tvbuff_t *tvb, int offset,
void netbios_add_name(const char* label, tvbuff_t *tvb, int offset,
proto_tree *tree)
{/* add a name field display tree. Display the name and station type in sub-tree */
@ -544,7 +544,7 @@ static void nb_data2(int hf, tvbuff_t *tvb, int offset, proto_tree *tree)
}
static void nb_resync_indicator( tvbuff_t *tvb, int offset, proto_tree *tree, char *cmd_str)
static void nb_resync_indicator( tvbuff_t *tvb, int offset, proto_tree *tree, const char *cmd_str)
{
guint16 resync_indicator = tvb_get_letohs( tvb, offset + NB_DATA2);

View File

@ -38,7 +38,7 @@ extern int process_netbios_name(const guchar *name_ptr, char *name_ret);
extern int get_netbios_name(tvbuff_t *tvb, int offset,
char *name_ret);
extern const char *netbios_name_type_descr(int name_type);
extern void netbios_add_name( char* label, tvbuff_t *tvb, int offset,
extern void netbios_add_name( const char* label, tvbuff_t *tvb, int offset,
proto_tree *tree);
extern void dissect_netbios_payload(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree);