]> git.webhop.me Git - msgbox.git/commitdiff
msgbox: fix for compil with -Wshadow
authorsatbaby <crashdvb@googlemail.com>
Mon, 24 Dec 2012 19:03:33 +0000 (20:03 +0100)
committersatbaby <crashdvb@googlemail.com>
Mon, 24 Dec 2012 19:03:33 +0000 (20:03 +0100)
gfx.c
msgbox.c
msgbox.h
text.c
txtform.c

diff --git a/gfx.c b/gfx.c
index e1fae2151b4c6793718c1ca569c10d07ecb85f36..f724b0a6dca925f828d9baa204fbc451e144fba2 100644 (file)
--- a/gfx.c
+++ b/gfx.c
@@ -1,8 +1,8 @@
 #include "msgbox.h"
 
-void RenderBox(int sx, int sy, int ex, int ey, int rad, int col)
+void RenderBox(int _sx, int _sy, int _ex, int _ey, int rad, int col)
 {
-       int F,R=rad,ssx=startx+sx,ssy=starty+sy,dxx=ex-sx,dyy=ey-sy,rx,ry,wx,wy,count;
+       int F,R=rad,ssx=startx+_sx,ssy=starty+_sy,dxx=_ex-_sx,dyy=_ey-_sy,rx,ry,wx,wy,count;
 
        unsigned char *pos=(lbb+(ssx<<2)+fix_screeninfo.line_length*ssy);
        unsigned char *pos0, *pos1, *pos2, *pos3, *i;
index 3ec7bcbf3437c8f738edf6671f4f6ae6ab1c5f15..fb2fb3861f973ef2de49a645a8e739509709547d 100644 (file)
--- a/msgbox.c
+++ b/msgbox.c
@@ -46,7 +46,8 @@ char TMP_FILE[64]="/tmp/msgbox.tmp";
 unsigned char *lfb = 0, *lbb = 0, *obb = 0, *hbb = 0, *ibb = 0;
 unsigned char nstr[BUFSIZE]="";
 unsigned char *trstr;
-unsigned rc,sc[8]={'a','o','u','A','O','U','z','d'}, tc[8]={0xE4,0xF6,0xFC,0xC4,0xD6,0xDC,0xDF,0xB0};
+unsigned char sc[8]={'a','o','u','A','O','U','z','d'}, tc[8]={0xE4,0xF6,0xFC,0xC4,0xD6,0xDC,0xDF,0xB0};
+unsigned char rc = ' ';
 const char INST_FILE[]="/tmp/rc.locked";
 int instance=0;
 
@@ -199,7 +200,7 @@ static int psx, psy, pxw, pyw, myo=0, buttx=80, butty=30, buttdx=20, buttdy=10,
 int show_txt(int buttonly)
 {
 FILE *tfh;
-int i,bx,by,x1,y1,rv=-1,run=1,line=0,action=1,cut,itmp,btns=buttons,lbtns=(buttons>bpline)?bpline:buttons,blines=1+((btns-1)/lbtns);
+int x1,y1,cut,rv=-1,btns=buttons,lbtns=(buttons>bpline)?bpline:buttons,blines=1+((btns-1)/lbtns);
 
        if(hide)
        {
@@ -226,6 +227,7 @@ int i,bx,by,x1,y1,rv=-1,run=1,line=0,action=1,cut,itmp,btns=buttons,lbtns=(butto
                        if(type==1)
                        {
                                myo=blines*(butty+buttdy);
+                               int itmp = 0,i;
                                for(i=0; i<btns; i++)
                                {
                                        itmp=GetStringLen(sx,butmsg[i], 26)+10;
@@ -270,7 +272,7 @@ int i,bx,by,x1,y1,rv=-1,run=1,line=0,action=1,cut,itmp,btns=buttons,lbtns=(butto
                                buttystart=psy+y1*dy;
                        }
                }
-               
+               int bx,by,run=1,line=0,action=1;
                while(run)
                {
                        //frame layout
@@ -290,6 +292,7 @@ int i,bx,by,x1,y1,rv=-1,run=1,line=0,action=1,cut,itmp,btns=buttons,lbtns=(butto
                                {
                                        if(type==1)
                                        {
+                                               int i;
                                                for(i=0; i<btns; i++)
                                                {
                                                        bx=i%lbtns;
index ef50388c6df52e50831adf36f24e62255c95117e..a2facc0466190a2da2e8d87e8b6d227ce5fe1ced 100644 (file)
--- a/msgbox.h
+++ b/msgbox.h
@@ -123,7 +123,7 @@ struct fb_var_screeninfo var_screeninfo;
 extern unsigned char rd[],gn[],bl[],tr[];
 
 int startx, starty, sx, ex, sy, ey, debounce, rblock;
-extern unsigned sc[8], tc[8];
+extern unsigned char sc[8], tc[8];
 char *butmsg[MAX_BUTTONS];
 extern int buttons,selection;
 extern int instance;
diff --git a/text.c b/text.c
index a54cbf3011ed0812a3440b25af89876d130f0454..e2e363f39454b0a183c1f85ce240c07347f64a0f 100644 (file)
--- a/text.c
+++ b/text.c
@@ -11,11 +11,11 @@ int TABULATOR=72;
  * MyFaceRequester
  ******************************************************************************/
 
-FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face *aface)
+FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library _library, FT_Pointer request_data, FT_Face *aface)
 {
        FT_Error result;
        request_data=request_data;//for unused request_data
-       result = FT_New_Face(library, face_id, 0, aface);
+       result = FT_New_Face(_library, face_id, 0, aface);
 
        if(result) printf("msgbox <Font \"%s\" failed>\n", (char*)face_id);
 
@@ -26,15 +26,13 @@ FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library library, FT_Pointer requ
  * RenderChar
  ******************************************************************************/
 
-int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int color)
+int RenderChar(FT_ULong currentchar, int _sx, int _sy, int _ex, int color)
 {
 //     unsigned char pix[4]={oldcmap.red[col],oldcmap.green[col],oldcmap.blue[col],oldcmap.transp[col]};
 //     unsigned char pix[4]={0x80,0x80,0x80,0x80};
-       unsigned char pix[4]={bl[color],gn[color],rd[color],tr[color]};
-       int row, pitch, bit, x = 0, y = 0;
        FT_UInt glyphindex;
        FT_Vector kerning;
-       FT_Error error;
+//     FT_Error _error;
 
        currentchar=currentchar & 0xFF;
 
@@ -47,9 +45,9 @@ int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int color)
                }
 
 
-               if((error = FTC_SBitCache_Lookup(cache, &desc, glyphindex, &sbit, NULL)))
+               if((/*_error =*/ FTC_SBitCache_Lookup(cache, &desc, glyphindex, &sbit, NULL)))
                {
-//                     printf("msgbox <FTC_SBitCache_Lookup for Char \"%c\" failed with Errorcode 0x%.2X>\n", (int)currentchar, error);
+//                     printf("msgbox <FTC_SBitCache_Lookup for Char \"%c\" failed with Errorcode 0x%.2X>\n", (int)currentchar, _error);
                        return 0;
                }
 
@@ -70,9 +68,12 @@ int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int color)
 
                if(color != -1) /* don't render char, return charwidth only */
                {
-                       if(sx + sbit->xadvance >= ex){
+                       if(_sx + sbit->xadvance >= _ex){
                                return -1; /* limit to maxwidth */
                        }
+                       unsigned char pix[4]={bl[color],gn[color],rd[color],tr[color]};
+                       int row, pitch, bit, x = 0, y = 0;
+
                        for(row = 0; row < sbit->height; row++)
                        {
                                for(pitch = 0; pitch < sbit->pitch; pitch++)
@@ -81,7 +82,7 @@ int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int color)
                                        {
                                                if(pitch*8 + 7-bit >= sbit->width) break; /* render needed bits only */
 
-                                               if((sbit->buffer[row * sbit->pitch + pitch]) & 1<<bit) memcpy(lbb + (startx + sx + sbit->left + kerning.x + x)*4 + fix_screeninfo.line_length*(starty + sy - sbit->top + y),pix,4);
+                                               if((sbit->buffer[row * sbit->pitch + pitch]) & 1<<bit) memcpy(lbb + (startx + _sx + sbit->left + kerning.x + x)*4 + fix_screeninfo.line_length*(starty + _sy - sbit->top + y),pix,4);
 
                                                x++;
                                        }
@@ -102,7 +103,7 @@ int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int color)
  * GetStringLen
  ******************************************************************************/
 
-int GetStringLen(int sx, char *string, int size)
+int GetStringLen(int _sx, char *string, int size)
 {
 unsigned int i = 0;
 int stringlen = 0;
@@ -138,7 +139,7 @@ int stringlen = 0;
                                                if(sscanf(string+1,"%4d",&i)==1)
                                                {
                                                        string+=4;
-                                                       stringlen=i-sx;
+                                                       stringlen=i-_sx;
                                                }
                                        }
                                        else
@@ -184,9 +185,9 @@ void CatchTabs(char *text)
  * RenderString
  ******************************************************************************/
 
-int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int size, int color)
+int RenderString(char *string, int _sx, int _sy, int maxwidth, int layout, int size, int color)
 {
-       int stringlen = 0, ex = 0, charwidth = 0,found = 0;
+       int stringlen = 0, _ex = 0, charwidth = 0,found = 0;
        unsigned int i = 0;
        char rstr[BUFSIZE]={0}, *rptr=rstr, rc=' ';
        int varcolor=color;
@@ -198,16 +199,16 @@ int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int siz
                TABULATOR=3*size;
        //set alignment
 
-               stringlen = GetStringLen(sx, rstr, size);
+               stringlen = GetStringLen(_sx, rstr, size);
 
                if(layout != LEFT)
                {
                        switch(layout)
                        {
-                               case CENTER:    if(stringlen < maxwidth) sx += (maxwidth - stringlen)/2;
+                               case CENTER:    if(stringlen < maxwidth) _sx += (maxwidth - stringlen)/2;
                                                break;
 
-                               case RIGHT:     if(stringlen < maxwidth) sx += maxwidth - stringlen;
+                               case RIGHT:     if(stringlen < maxwidth) _sx += maxwidth - stringlen;
                        }
                }
 
@@ -217,7 +218,7 @@ int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int siz
 
        //render string
 
-               ex = sx + maxwidth;
+               _ex = _sx + maxwidth;
 
                while(*rptr != '\0')
                {
@@ -235,8 +236,8 @@ int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int siz
                                }
                                if(found)
                                {
-                                       if((charwidth = RenderChar(rc, sx, sy, ex, varcolor)) == -1) return sx; /* string > maxwidth */
-                                       sx += charwidth;
+                                       if((charwidth = RenderChar(rc, _sx, _sy, _ex, varcolor)) == -1) return _sx; /* string > maxwidth */
+                                       _sx += charwidth;
                                }
                                else
                                {
@@ -248,13 +249,13 @@ int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int siz
                                                case 'B': varcolor=BLUE1; break;
                                                case 'S': varcolor=color; break;
                                                case 't':
-                                                       sx=TABULATOR*((int)(sx/TABULATOR)+1);
+                                                       _sx=TABULATOR*((int)(_sx/TABULATOR)+1);
                                                        break;
                                                case 'T':
                                                        if(sscanf(rptr+1,"%4d",&i)==1)
                                                        {
                                                                rptr+=4;
-                                                               sx=i;
+                                                               _sx=i;
                                                        }
                                                break;
                                        }
@@ -262,8 +263,8 @@ int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int siz
                        }
                        else
                        {
-                               if((charwidth = RenderChar(*rptr, sx, sy, ex, varcolor)) == -1) return sx; /* string > maxwidth */
-                               sx += charwidth;
+                               if((charwidth = RenderChar(*rptr, _sx, _sy, _ex, varcolor)) == -1) return _sx; /* string > maxwidth */
+                               _sx += charwidth;
                        }
                        rptr++;
                }
index ffa3529dce8b913ff733eec2c1e8a6b98314f553..9b183a43a254c206243f3ed95c1375d7cfe4f8f0 100644 (file)
--- a/txtform.c
+++ b/txtform.c
@@ -89,11 +89,10 @@ int just, color=CMCT;
        return(FH_ERROR_OK);
 }
 
-int fh_txt_load(const char *name, int sx, int wx, int sy, int dy, int size, int line, int *cut)
+int fh_txt_load(const char *name, int _sx, int wx, int _sy, int dy, int size, int line, int *cut)
 {
-int dummy;
-
-       return fh_txt_trans(name, sx, wx, sy, dy, size, line, cut, &dummy, &dummy, 1);
+       int dummy;
+       return fh_txt_trans(name, _sx, wx, _sy, dy, size, line, cut, &dummy, &dummy, 1);
 }