diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-05-27 14:58:13 +0200 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-05-27 14:58:13 +0200 | 
| commit | 265d6934cd70a60228e7a11cfc000aff73dd4701 (patch) | |
| tree | 610eb753fea70e7f407e751e22697fc8a1ec04bd /app/bin/param.c | |
| parent | bd8c21a35fd05fcbdaa95e4c0b7c94c3b97507b6 (diff) | |
| parent | 359b557176b9bb2ff1aed2082641eed39c358d0d (diff) | |
Update upstream source from tag 'upstream/5.1.2a'
Update to upstream version '5.1.2a'
with Debian dir 4d0d8239e41bb5de5dc968c2a5c6eb9c140bb2f3
Diffstat (limited to 'app/bin/param.c')
| -rw-r--r-- | app/bin/param.c | 32 | 
1 files changed, 19 insertions, 13 deletions
| diff --git a/app/bin/param.c b/app/bin/param.c index 47399ee..2f54d77 100644 --- a/app/bin/param.c +++ b/app/bin/param.c @@ -588,10 +588,10 @@ EXPORT void ParamLoadControl(  		case PD_STRING:  			if (p->oldD.s)  				MyFree( p->oldD.s ); -			if (p->context) { -				p->oldD.s = MyMalloc((uint32_t)p->context); -				strncpy(p->oldD.s, (char*)p->valueP, (uint32_t)p->context); -				*(p->oldD.s + (uint32_t)p->context - 1) = '\0'; +			if (p->max_string) { +                p->oldD.s = MyMalloc(p->max_string); +				strncpy(p->oldD.s, (char*)p->valueP, p->max_string-1); +				*(p->oldD.s + (uint32_t)p->max_string - 1) = '\0';  				wStringSetValue((wString_p)p->control, (char*)p->oldD.s);  			}  			else { @@ -732,12 +732,11 @@ EXPORT long ParamUpdate(  				p->oldD.s = MyStrdup( stringV );  				if ( p->valueP ) {  					if (p->option & PDO_STRINGLIMITLENGTH ) { -						strncpy((char*)p->valueP, stringV, (uint32_t)p->context); -						((char *)p->valueP)[(uint32_t)p->context - 1] = '\0'; -						if (strlen(stringV) > (uint32_t)p->context) { -							NoticeMessage2(0, MSG_ENTERED_STRING_TRUNCATED, _("Ok"), NULL, (uint32_t)p->context); +						strncpy((char*)p->valueP, stringV, p->max_string-1); +						((char *)p->valueP)[p->max_string - 1] = '\0'; +						if (strlen(stringV) > p->max_string-1) { +							NoticeMessage2(0, MSG_ENTERED_STRING_TRUNCATED, _("Ok"), NULL, p->max_string-1);  						} -  					}  					else {  						strcpy((char*)p->valueP, stringV); @@ -916,10 +915,16 @@ static long ParamIntRestore(  			break;  		case PD_STRING:  			if ( oldP->s && strcmp((char*)p->valueP,oldP->s) != 0 ) { -				/*if ((p->option&PDO_NORSTUPD)==0)*/ +				if (p->max_string && (p->option & PDO_STRINGLIMITLENGTH)) { +					((char*)p->valueP)[0] = '\0'; +					strncat((char*)p->valueP,oldP->s,p->max_string-1); +					if (p->control) +						wStringSetValue( (wString_p)p->control, (char*)p->valueP ); +				} else {  					strcpy( (char*)p->valueP, oldP->s ); -				if (p->control) -					wStringSetValue( (wString_p)p->control, oldP->s ); +					if (p->control) +						wStringSetValue( (wString_p)p->control, oldP->s ); +				}  				change |= (1L<<inx);  			}  			break; @@ -2211,7 +2216,7 @@ static void ParamPositionControl(  				ctlH = winH - (pd->group->origH-drawDataP->height);  			else  				ctlH = wControlGetHeight( pd->control ); -			wDrawSetSize( (wDraw_p)pd->control, ctlW, ctlH ); +			wDrawSetSize( (wDraw_p)pd->control, ctlW, ctlH, NULL );  			if ( drawDataP->redraw )  				drawDataP->redraw( (wDraw_p)pd->control, pd->context, ctlW, ctlH );  			break; @@ -2486,6 +2491,7 @@ SkipControl:  static void ParamDlgProc(  		wWin_p win,  		winProcEvent e, +		void * refresh,  		void * data )  {  	paramGroup_p pg = (paramGroup_p)data; | 
