Skip to content
Snippets Groups Projects
Commit 36be0aa7 authored by Andrew Johnson's avatar Andrew Johnson
Browse files

rec: Fix minor string in + out issue.

Undo strncmp+strncpy to strcmp+strcpy change in r12048.
The 'n' versions are needed because device support was
never explicitly required to Nil-terminate the string.
The dbAccess routines do enforce termination though.
parent 69d8be78
No related branches found
No related tags found
No related merge requests found
......@@ -156,20 +156,20 @@ static long process(stringinRecord *prec)
static void monitor(stringinRecord *prec)
{
unsigned short monitor_mask;
int monitor_mask = recGblResetAlarms(prec);
monitor_mask = recGblResetAlarms(prec);
if(strcmp(prec->oval,prec->val)) {
monitor_mask |= DBE_VALUE|DBE_LOG;
strcpy(prec->oval,prec->val);
if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
monitor_mask |= DBE_VALUE | DBE_LOG;
strncpy(prec->oval, prec->val, sizeof(prec->val));
}
if (prec->mpst == stringinPOST_Always)
monitor_mask |= DBE_VALUE;
monitor_mask |= DBE_VALUE;
if (prec->apst == stringinPOST_Always)
monitor_mask |= DBE_LOG;
if(monitor_mask)
db_post_events(prec,&(prec->val[0]),monitor_mask);
return;
monitor_mask |= DBE_LOG;
if (monitor_mask)
db_post_events(prec, prec->val, monitor_mask);
}
static long readValue(stringinRecord *prec)
......
......@@ -184,20 +184,20 @@ static long process(stringoutRecord *prec)
static void monitor(stringoutRecord *prec)
{
unsigned short monitor_mask;
int monitor_mask = recGblResetAlarms(prec);
monitor_mask = recGblResetAlarms(prec);
if(strcmp(prec->oval,prec->val)) {
monitor_mask |= DBE_VALUE|DBE_LOG;
strcpy(prec->oval,prec->val);
if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
monitor_mask |= DBE_VALUE | DBE_LOG;
strncpy(prec->oval, prec->val, sizeof(prec->val));
}
if (prec->mpst == stringoutPOST_Always)
monitor_mask |= DBE_VALUE;
monitor_mask |= DBE_VALUE;
if (prec->apst == stringoutPOST_Always)
monitor_mask |= DBE_LOG;
if(monitor_mask)
db_post_events(prec,&(prec->val[0]),monitor_mask);
return;
monitor_mask |= DBE_LOG;
if (monitor_mask)
db_post_events(prec, prec->val, monitor_mask);
}
static long writeValue(stringoutRecord *prec)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment