Project "Tuxbox-GIT: apps": The branch, master has been updated via ffea7f69cec8b47d66d4dc027371fb6b1ad32012 (commit) from 7c16926b6522d4606d6bf20864f3f627bc2ed1c8 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ffea7f69cec8b47d66d4dc027371fb6b1ad32012 Author: GetAway <get-a...@t-online.de> Date: Fri Apr 11 08:17:31 2014 +0200 msgbox: fix truncated text fix sizeof(int) initialize some variables remove unused code bump version to 1.72 Signed-off-by: Thilo Graf <d...@novatux.de> diff --git a/tuxbox/tools/msgbox/msgbox.c b/tuxbox/tools/msgbox/msgbox.c index 3e83886..615e93b 100644 --- a/tuxbox/tools/msgbox/msgbox.c +++ b/tuxbox/tools/msgbox/msgbox.c @@ -33,7 +33,7 @@ #include <dbox/fb.h> #endif -#define M_VERSION 1.71 +#define M_VERSION 1.72 #define FONT "/share/fonts/pakenham.ttf" @@ -53,7 +53,6 @@ struct fb_cmap oldcmap = {0, 256, ord, ogn, obl, otr}; char *line_buffer=NULL, *title=NULL; int size=36, type=0, timeout=0, refresh=3, flash=0, selection=0, tbuttons=0, buttons=0, bpline=3, echo=0, absolute=0, mute=1, header=1, cyclic=1; -char *butmsg[16]; int rbutt[16],hide=0,radius=0; //static void ShowInfo(void); @@ -84,10 +83,9 @@ int rval=0; void put_instance(int pval) { -FILE *fh; - if(pval) { + FILE *fh; if((fh=fopen(INST_FILE,"w"))!=NULL) { fputc(pval,fh); @@ -110,13 +108,11 @@ static void quit_signal(int sig) int Read_Neutrino_Cfg(char *entry) { FILE *nfh; -char tstr [512], *cfptr=NULL; int rv=-1,styp=0; if ( ( ((nfh=fopen(NCF_FILE,"r"))!=NULL) && (styp=1) ) || ( ((nfh=fopen(ECF_FILE,"r"))!=NULL) && (styp=2) ) ) { - tstr[0]=0; - + char tstr[512]={0}, *cfptr=NULL; while((!feof(nfh)) && ((strstr(tstr,entry)==NULL) || ((cfptr=strchr(tstr,'='))==NULL))) { fgets(tstr,500,nfh); @@ -296,7 +292,7 @@ int i,bx,by,x1,y1,rv=-1,run=1,line=0,action=1,cut,itmp,btns=buttons,lbtns=(butto printf("msgbox <invalid Text-Format>\n"); return -1; } - x1+=10; + //x1+=10; dy=0.8*(double)size; if(pxw<x1) @@ -465,12 +461,12 @@ void ShowUsage(void) int main (int argc, char **argv) { -int index,index2,tv,found=0; +int index=0 ,index2,tv=0,found=0; int dloop=1, rcc=-1, flsh=0, cupd=0; -char rstr[BUFSIZE], *rptr, *aptr; -time_t tm1,tm2; +char rstr[BUFSIZE]={0}, *rptr=NULL, *aptr=NULL; +time_t tm1=0,tm2=0; unsigned int alpha; -clock_t tk1=0; +//clock_t tk1=0; FILE *fh; if(argc<2) @@ -986,7 +982,7 @@ return 0; time(&tm1); tm2=tm1; - tk1=clock()/(CLOCKS_PER_SEC/1000); +// tk1=clock()/(CLOCKS_PER_SEC/1000); #ifdef HAVE_DREAMBOX_HARDWARE ClearKeys(); #endif @@ -1097,9 +1093,6 @@ return 0; //cleanup // clear Display -// memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres); -// memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres); - memcpy(lfb, obb, var_screeninfo.xres*var_screeninfo.yres); munmap(lfb, fix_screeninfo.smem_len); #ifdef HAVE_DBOX_HARDWARE diff --git a/tuxbox/tools/msgbox/msgbox.h b/tuxbox/tools/msgbox/msgbox.h index 8708716..c1f1729 100644 --- a/tuxbox/tools/msgbox/msgbox.h +++ b/tuxbox/tools/msgbox/msgbox.h @@ -187,7 +187,7 @@ struct fb_var_screeninfo var_screeninfo; int startx, starty, sx, ex, sy, ey, debounce, rblock; extern unsigned char sc[8], tc[8]; -extern char *butmsg[MAX_BUTTONS]; +char *butmsg[MAX_BUTTONS]; extern int buttons,selection; extern int instance; int get_instance(void); diff --git a/tuxbox/tools/msgbox/text.c b/tuxbox/tools/msgbox/text.c index 0848214..b85681f 100644 --- a/tuxbox/tools/msgbox/text.c +++ b/tuxbox/tools/msgbox/text.c @@ -127,7 +127,7 @@ int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int color) int GetStringLen(int sx, char *string) { -int i, found; +unsigned int i = 0; int stringlen = 0, min_length = 0; int count = 1, count_tilde = 0; @@ -158,7 +158,7 @@ int count = 1, count_tilde = 0; if(sscanf(string+1,"%3d",&i)==1) { string+=3; - stringlen=i-sx; + stringlen = i - ((sx < 20) ? 20 : sx); if (count_tilde == 1 && count == 1) { min_length = ex-startx-2*i-10; } @@ -166,8 +166,8 @@ int count = 1, count_tilde = 0; } else { - found=0; - for(i=0; i<sizeof(sc) && !found; i++) + int found=0; + for(i=0; i<sizeof(sc)/sizeof(sc[0]) && !found; i++) { if(*string==sc[i]) { @@ -190,8 +190,9 @@ int count = 1, count_tilde = 0; int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int size, int color) { - int stringlen, ex, charwidth,i,found; - char rstr[BUFSIZE], *rptr=rstr, rc; + int stringlen = 0, ex = 0, charwidth = 0, found = 0; + unsigned int i = 0; + char rstr[BUFSIZE]={0}, *rptr=rstr, rc=' '; int varcolor=color; //set size @@ -236,7 +237,7 @@ int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int siz ++rptr; rc=*rptr; found=0; - for(i=0; i<sizeof(sc) && !found; i++) + for(i=0; i<sizeof(sc)/sizeof(sc[0]) && !found; i++) { if(rc==sc[i]) { diff --git a/tuxbox/tools/msgbox/txtform.c b/tuxbox/tools/msgbox/txtform.c index 3a9a4e7..0f9a059 100644 --- a/tuxbox/tools/msgbox/txtform.c +++ b/tuxbox/tools/msgbox/txtform.c @@ -37,13 +37,13 @@ int fh_txt_trans(const char *name, int xs, int xw, int ys, int dy, int cs, int line, int *cut, int *x, int *y, int plot) { char tstr[BUFSIZE],rstr[BUFSIZE],*tptr; -int loop=1, j, first, slen, cnt=0; +int loop=1, j, slen, cnt=0; FILE *fh; int just, color=CMCT; if(!(fh=fopen(name,"rb"))) return(FH_ERROR_FILE); - first=(line==0); +// first=(line==0); *x=0; *y=0; while((loop>0) && (fgets(tstr, sizeof(tstr), fh))) @@ -87,18 +87,18 @@ int just, color=CMCT; if(loop>=line) { RenderString(rstr, xs, ys, xw, just, cs, color); - if(strlen(rstr)) +/* if(strlen(rstr)) { first=0; } - ys+=dy; +*/ ys+=dy; } } else { if(strlen(rstr)) { - slen=GetStringLen(xs,rstr)-10; + slen=GetStringLen(xs,rstr)+10; if(slen>*x) { *x=slen; ----------------------------------------------------------------------- Summary of changes: tuxbox/tools/msgbox/msgbox.c | 25 +++++++++---------------- tuxbox/tools/msgbox/msgbox.h | 2 +- tuxbox/tools/msgbox/text.c | 15 ++++++++------- tuxbox/tools/msgbox/txtform.c | 10 +++++----- 4 files changed, 23 insertions(+), 29 deletions(-) -- Tuxbox-GIT: apps ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ Tuxbox-cvs-commits mailing list Tuxbox-cvs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits