More shorten-64-to-32 warnings.

svn path=/trunk/; revision=54106
This commit is contained in:
Gerald Combs 2013-12-14 19:23:34 +00:00
parent 478f83dd2a
commit 02eea9378e
4 changed files with 25 additions and 25 deletions

View File

@ -114,7 +114,7 @@ static char** attr_str;
static unsigned* attr_uint; static unsigned* attr_uint;
static void ddict_debug(const char* fmt, ...); static void ddict_debug(const char* fmt, ...);
static void append_to_buffer(const char* txt, int len); static void append_to_buffer(const char* txt, unsigned len);
static FILE* ddict_open(const char*, const char*); static FILE* ddict_open(const char*, const char*);
%} %}
@ -257,11 +257,11 @@ description_attr description=\042
<LOADING>{whitespace} APPEND(" ",1); <LOADING>{whitespace} APPEND(" ",1);
<LOADING>{dquoted} APPEND(yytext,yyleng); <LOADING>{dquoted} APPEND(yytext, (unsigned) yyleng);
<LOADING>{equals} APPEND("=",1); <LOADING>{equals} APPEND("=",1);
<LOADING>{any} APPEND(yytext,yyleng); <LOADING>{any} APPEND(yytext, (unsigned) yyleng);
<LOADING>{entity} { <LOADING>{entity} {
char* p = ++yytext; char* p = ++yytext;
@ -330,7 +330,7 @@ description_attr description=\042
} }
<GET_UINT_ATTR>{number} { <GET_UINT_ATTR>{number} {
*attr_uint = strtoul(yytext,NULL,10); *attr_uint = (unsigned) strtoul(yytext,NULL,10);
D(("%s\n",yytext);); D(("%s\n",yytext););
attr_uint = NULL; attr_uint = NULL;
BEGIN END_ATTR; BEGIN END_ATTR;
@ -561,7 +561,7 @@ void ddict_unused(void) {
yy_top_state(); yy_top_state();
} }
static void append_to_buffer(const char* txt, int len) { static void append_to_buffer(const char* txt, unsigned len) {
if (strbuf == NULL) { if (strbuf == NULL) {
read_ptr = write_ptr = strbuf = (char*)g_malloc(size_strbuf); read_ptr = write_ptr = strbuf = (char*)g_malloc(size_strbuf);
@ -672,7 +672,7 @@ ddict_t* ddict_scan(const char* system_directory, const char* filename, int dbg)
BEGIN LOADING; BEGIN LOADING;
yylex(); yylex();
D(("\n---------------\n%s\n------- %d -------\n",strbuf,len_strbuf)); D(("\n---------------\n%s\n------- %u -------\n",strbuf,len_strbuf));
current_yyinput = string_input; current_yyinput = string_input;

View File

@ -70,7 +70,7 @@
static gchar* location; static gchar* location;
static gchar* attr_name; static gchar* attr_name;
static int my_yyinput(char* buff,guint size); static size_t my_yyinput(char* buff,size_t size);
static dtd_token_data_t* new_token(gchar*); static dtd_token_data_t* new_token(gchar*);
@ -310,7 +310,7 @@ static dtd_token_data_t* new_token(gchar* text) {
} }
static int my_yyinput(char* buff, guint size) { static size_t my_yyinput(char* buff, size_t size) {
if (offsetx >= len ) { if (offsetx >= len ) {
return YY_NULL; return YY_NULL;

View File

@ -74,7 +74,7 @@
#define MAX_INCLUDE_DEPTH 10 #define MAX_INCLUDE_DEPTH 10
static void add_vendor(const gchar* name, guint32 id, guint type_octets, guint length_octets, gboolean has_flags); static void add_vendor(const gchar* name, guint32 id, guint type_octets, guint length_octets, gboolean has_flags);
static void add_value(const gchar* attrib_name,const gchar* repr, long value); static void add_value(const gchar* attrib_name,const gchar* repr, guint32 value);
static void add_tlv(const gchar* name, const gchar* code, radius_attr_dissector_t type, const gchar* attr); static void add_tlv(const gchar* name, const gchar* code, radius_attr_dissector_t type, const gchar* attr);
static void add_attribute(const gchar*,const gchar*, radius_attr_dissector_t,const gchar*, guint, gboolean, const gchar*); static void add_attribute(const gchar*,const gchar*, radius_attr_dissector_t,const gchar*, guint, gboolean, const gchar*);
@ -166,22 +166,22 @@
BEGIN VENDOR_W_NAME; BEGIN VENDOR_W_NAME;
} }
<VENDOR_W_NAME>[0-9]+ { <VENDOR_W_NAME>[0-9]+ {
vendor_id = strtol(yytext,NULL,10); vendor_id = (guint32) strtoul(yytext,NULL,10);
BEGIN VENDOR_W_ID; BEGIN VENDOR_W_ID;
} }
<VENDOR_W_NAME>0x[0-9a-f]+ { <VENDOR_W_NAME>0x[0-9a-f]+ {
vendor_id = strtol(yytext,NULL,16); vendor_id = (guint32) strtoul(yytext,NULL,16);
BEGIN VENDOR_W_ID; BEGIN VENDOR_W_ID;
} }
<VENDOR_W_ID>format= { <VENDOR_W_ID>format= {
BEGIN VENDOR_W_FORMAT; BEGIN VENDOR_W_FORMAT;
} }
<VENDOR_W_FORMAT>[124] { <VENDOR_W_FORMAT>[124] {
vendor_type_octets = strtol(yytext,NULL,10); vendor_type_octets = (guint) strtoul(yytext,NULL,10);
BEGIN VENDOR_W_TYPE_OCTETS; BEGIN VENDOR_W_TYPE_OCTETS;
} }
<VENDOR_W_TYPE_OCTETS>,[012] { <VENDOR_W_TYPE_OCTETS>,[012] {
vendor_length_octets = strtol(yytext+1,NULL,10); vendor_length_octets = (guint) strtoul(yytext+1,NULL,10);
BEGIN VENDOR_W_LENGTH_OCTETS; BEGIN VENDOR_W_LENGTH_OCTETS;
} }
<VENDOR_W_LENGTH_OCTETS>,c { <VENDOR_W_LENGTH_OCTETS>,c {
@ -219,7 +219,7 @@
<ATTR_W_ID>tlv { attr_type = radius_tlv; BEGIN ATTR_W_TYPE; } <ATTR_W_ID>tlv { attr_type = radius_tlv; BEGIN ATTR_W_TYPE; }
<ATTR_W_ID>[0-9a-z_-]+ { attr_type = radius_octets; BEGIN ATTR_W_TYPE; } <ATTR_W_ID>[0-9a-z_-]+ { attr_type = radius_octets; BEGIN ATTR_W_TYPE; }
<ATTR_W_TYPE>has_tag[,]? { has_tag = TRUE; } <ATTR_W_TYPE>has_tag[,]? { has_tag = TRUE; }
<ATTR_W_TYPE>encrypt=[123][,]? { encrypted = strtol(yytext+8,NULL,10); } <ATTR_W_TYPE>encrypt=[123][,]? { encrypted = (guint) strtoul(yytext+8,NULL,10); }
<ATTR_W_TYPE>[0-9a-z_-]+=([^\n]*) ; <ATTR_W_TYPE>[0-9a-z_-]+=([^\n]*) ;
<ATTR_W_TYPE>[0-9a-z_-]+ { <ATTR_W_TYPE>[0-9a-z_-]+ {
attr_vendor = g_strdup(yytext); attr_vendor = g_strdup(yytext);
@ -250,10 +250,10 @@
BEGIN WS_OUT; BEGIN WS_OUT;
}; };
<VALUE>[0-9a-z_/-]+ { attr_name = g_strdup(yytext); BEGIN VALUE_W_ATTR; } <VALUE>[0-9a-z_/-]+ { attr_name = g_strdup(yytext); BEGIN VALUE_W_ATTR; }
<VALUE_W_ATTR>[^[:blank:]]+ { value_repr = g_strdup(yytext); BEGIN VALUE_W_NAME; } <VALUE_W_ATTR>[^[:blank:]]+ { value_repr = g_strdup(yytext); BEGIN VALUE_W_NAME; }
<VALUE_W_NAME>[0-9]+ { add_value(attr_name,value_repr,strtol(yytext,NULL,10)); g_free(attr_name); g_free(value_repr); BEGIN WS_OUT;} <VALUE_W_NAME>[0-9]+ { add_value(attr_name,value_repr, (guint32) strtoul(yytext,NULL,10)); g_free(attr_name); g_free(value_repr); BEGIN WS_OUT;}
<VALUE_W_NAME>0x[0-9a-f]+ { add_value(attr_name,value_repr,strtol(yytext,NULL,16)); g_free(attr_name); g_free(value_repr); BEGIN WS_OUT;} <VALUE_W_NAME>0x[0-9a-f]+ { add_value(attr_name,value_repr, (guint32) strtoul(yytext,NULL,16)); g_free(attr_name); g_free(value_repr); BEGIN WS_OUT;}
<INCLUDE>[^[:blank:]\n]+ { <INCLUDE>[^[:blank:]\n]+ {
if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) { if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) {
@ -370,7 +370,7 @@ static void add_attribute(const gchar* name, const gchar* codestr, radius_attr_
by_id = dict->attrs_by_id; by_id = dict->attrs_by_id;
} }
code=strtol(codestr, NULL, 10); code= (guint32) strtoul(codestr, NULL, 10);
a=(radius_attr_info_t*)g_hash_table_lookup(by_id, GUINT_TO_POINTER(code)); a=(radius_attr_info_t*)g_hash_table_lookup(by_id, GUINT_TO_POINTER(code));
@ -432,7 +432,7 @@ static void add_tlv(const gchar* name, const gchar* codestr, radius_attr_dissec
a->tlvs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); a->tlvs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
} }
code=strtol(codestr, NULL, 10); code = (guint32) strtoul(codestr, NULL, 10);
s = (radius_attr_info_t*)g_hash_table_lookup(a->tlvs_by_id, GUINT_TO_POINTER(code)); s = (radius_attr_info_t*)g_hash_table_lookup(a->tlvs_by_id, GUINT_TO_POINTER(code));
@ -463,7 +463,7 @@ static void add_tlv(const gchar* name, const gchar* codestr, radius_attr_dissec
g_hash_table_insert(dict->tlvs_by_name,(gpointer) (s->name),s); g_hash_table_insert(dict->tlvs_by_name,(gpointer) (s->name),s);
} }
void add_value(const gchar* attrib_name, const gchar* repr, long value) { void add_value(const gchar* attrib_name, const gchar* repr, guint32 value) {
value_string v; value_string v;
GArray* a = (GArray*)g_hash_table_lookup(value_strings,attrib_name); GArray* a = (GArray*)g_hash_table_lookup(value_strings,attrib_name);

View File

@ -113,8 +113,8 @@ static guint parse_str_pos;
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
if ( parse_str ) \ if ( parse_str ) \
{ \ { \
int n = 0; \ size_t n = 0; \
guint pslen = strlen(parse_str); \ size_t pslen = strlen(parse_str); \
if (parse_str_pos < pslen) \ if (parse_str_pos < pslen) \
{ \ { \
n = pslen - parse_str_pos; \ n = pslen - parse_str_pos; \
@ -180,11 +180,11 @@ comment #[^\n]*\n
BEGIN END_OF_RECORD; BEGIN END_OF_RECORD;
yyless(yyleng); yyless((int) yyleng);
} }
<START_OF_LINE,NEXT_FIELD>{quoted_string} { <START_OF_LINE,NEXT_FIELD>{quoted_string} {
ptrx = uat_undquote(yytext,yyleng,&len); ptrx = uat_undquote(yytext, (guint) yyleng, &len);
if (colnum < uat->ncols - 1) { if (colnum < uat->ncols - 1) {
@ -197,7 +197,7 @@ comment #[^\n]*\n
} }
<START_OF_LINE,NEXT_FIELD>{binstring} { <START_OF_LINE,NEXT_FIELD>{binstring} {
ptrx = uat_unbinstring(yytext,yyleng,&len); ptrx = uat_unbinstring(yytext, (guint) yyleng, &len);
if (!ptrx) { if (!ptrx) {
ERROR(("uneven hexstring for field %s",uat->fields[colnum].name)); ERROR(("uneven hexstring for field %s",uat->fields[colnum].name));