From b9f950e33f55b16d358595b9a34731dfbbd6b9c0 Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Mon, 26 Nov 2012 01:30:41 +0000 Subject: [PATCH] Fix several [-Wshadow] warnings; svn path=/trunk/; revision=46194 --- epan/dtd_parse.l | 18 +++++++++--------- epan/uat_load.l | 34 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/epan/dtd_parse.l b/epan/dtd_parse.l index 29a3c5f4e4..e918e138bc 100644 --- a/epan/dtd_parse.l +++ b/epan/dtd_parse.l @@ -60,7 +60,7 @@ static void* pParser; static GString* input_string; - static guint offset; + static guint offsetx; static guint len; static gchar* location; static gchar* attr_name; @@ -307,16 +307,16 @@ static dtd_token_data_t* new_token(gchar* text) { static int my_yyinput(char* buff, guint size) { - if (offset >= len ) { + if (offsetx >= len ) { return YY_NULL; - } else if ( offset + size <= len ) { - memcpy(buff, input_string->str + offset,size); - offset += size; + } else if ( offsetx + size <= len ) { + memcpy(buff, input_string->str + offsetx,size); + offsetx += size; return size; } else { - size = len - offset; - memcpy(buff, input_string->str + offset,size); - offset = len; + size = len - offsetx; + memcpy(buff, input_string->str + offsetx,size); + offsetx = len; return size; } } @@ -324,7 +324,7 @@ static int my_yyinput(char* buff, guint size) { extern dtd_build_data_t* dtd_parse(GString* s) { input_string = s; - offset = 0; + offsetx = 0; len = (guint) input_string->len; pParser = DtdParseAlloc(g_malloc); diff --git a/epan/uat_load.l b/epan/uat_load.l index c6052e240c..83ee82a69b 100644 --- a/epan/uat_load.l +++ b/epan/uat_load.l @@ -67,7 +67,7 @@ static uat_t* uat; static guint colnum; -static gchar* ptr; +static gchar* ptrx; static guint len; static gchar* error; static void* record; @@ -78,20 +78,20 @@ static guint parse_str_pos; #define ERROR(fmtd) do { error = ep_strdup_printf("%s:%d: %s",uat->filename,linenum,ep_strdup_printf fmtd); yyterminate(); } while(0) #define SET_FIELD() \ - { const gchar* err; \ + { const gchar* errx; \ if (uat->fields[colnum].cb.chk) { \ - if ( ! uat->fields[colnum].cb.chk(record, ptr, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data, &err) ) { \ - ERROR(("%s",err)); \ + if ( ! uat->fields[colnum].cb.chk(record, ptrx, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data, &errx) ) { \ + ERROR(("%s",errx)); \ }\ }\ - uat->fields[colnum].cb.set(record, ptr, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data);\ - g_free(ptr);\ + uat->fields[colnum].cb.set(record, ptrx, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data);\ + g_free(ptrx);\ colnum++; \ } while(0) #ifdef DEBUG_UAT_LOAD #define DUMP_FIELD(str) \ - { guint i; printf("%s: %s='",str,uat->fields[colnum].name); for(i=0;ifields[colnum].mode == PT_TXTMOD_HEXBYTES) { printf("%.2x ",((guint8*)ptr)[i]); } else putc(ptr[i],stdout); printf("'[%d]\n",len); } + { guint i; printf("%s: %s='",str,uat->fields[colnum].name); for(i=0;ifields[colnum].mode == PT_TXTMOD_HEXBYTES) { printf("%.2x ",((guint8*)ptrx)[i]); } else putc(ptrx[i],stdout); printf("'[%d]\n",len); } #define DUMP(str) printf("%s\n",str) #else @@ -150,7 +150,7 @@ comment #[^\n]*\n {comment} linenum++; {separator} { - ptr = g_strdup(""); + ptrx = g_strdup(""); len = 0; DUMP_FIELD("empty->next"); @@ -165,7 +165,7 @@ comment #[^\n]*\n } {newline} { - ptr = ""; + ptrx = ""; len = 0; BEGIN END_OF_RECORD; @@ -174,7 +174,7 @@ comment #[^\n]*\n } {quoted_string} { - ptr = uat_undquote(yytext,yyleng,&len); + ptrx = uat_undquote(yytext,yyleng,&len); if (colnum < uat->ncols - 1) { @@ -187,9 +187,9 @@ comment #[^\n]*\n } {binstring} { - ptr = uat_unbinstring(yytext,yyleng,&len); + ptrx = uat_unbinstring(yytext,yyleng,&len); - if (!ptr) { + if (!ptrx) { ERROR(("uneven hexstring for field %s",uat->fields[colnum].name)); } @@ -248,7 +248,7 @@ comment #[^\n]*\n } colnum = 0; - ptr = NULL; + ptrx = NULL; len = 0; /* XXX is this necessary since we free it before reusing anyway? */ @@ -273,7 +273,7 @@ comment #[^\n]*\n gboolean -uat_load(uat_t *uat_in, char **err) +uat_load(uat_t *uat_in, char **errx) { gchar *fname = uat_get_actual_filename(uat_in, FALSE); @@ -291,7 +291,7 @@ uat_load(uat_t *uat_in, char **err) if (!(yyin = ws_fopen(fname,"r"))) { - *err = g_strerror(errno); + *errx = g_strerror(errno); g_free(fname); return FALSE; } @@ -315,14 +315,14 @@ uat_load(uat_t *uat_in, char **err) UAT_UPDATE(uat); if (error) { - *err = ep_strdup(error); + *errx = ep_strdup(error); return FALSE; } if (uat->post_update_cb) uat->post_update_cb(); - *err = NULL; + *errx = NULL; return TRUE; }