summaryrefslogtreecommitdiff
path: root/app/bin/param.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-05-27 14:58:02 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-05-27 14:58:02 +0200
commit359b557176b9bb2ff1aed2082641eed39c358d0d (patch)
treef6c2baca2e6a5d06b7bf32e48e475a6b7b1ea262 /app/bin/param.c
parent9a1d6eded2750572e9f5f79e53ec507dd7a06ba5 (diff)
New upstream version 5.1.2aupstream/5.1.2a
Diffstat (limited to 'app/bin/param.c')
-rw-r--r--app/bin/param.c32
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;