From dd70de868d063cee917e7781ebf4541b0e5bb4d6 Mon Sep 17 00:00:00 2001 From: Peter Denison Date: Fri, 2 Feb 2007 13:58:58 +0000 Subject: [PATCH] Fixed PV name lengths in motorUtil and motorUtilAux for 3.14 values --- motorApp/MotorSrc/motorUtil.cc | 18 +++++++++++++----- motorApp/MotorSrc/motorUtilAux.cc | 8 ++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/motorApp/MotorSrc/motorUtil.cc b/motorApp/MotorSrc/motorUtil.cc index a0d6cb46..32e44a63 100644 --- a/motorApp/MotorSrc/motorUtil.cc +++ b/motorApp/MotorSrc/motorUtil.cc @@ -2,9 +2,9 @@ FILENAME... motorUtil.cc USAGE... Motor Record Utility Support. -Version: $Revision: 1.1 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2006-02-23 19:51:50 $ +Version: $Revision: 1.2 $ +Modified By: $Author: peterd $ +Last Modified: $Date: 2007-02-02 13:58:58 $ */ @@ -24,6 +24,7 @@ Last Modified: $Date: 2006-02-23 19:51:50 $ #include #include #include +#include #include #include #include @@ -54,7 +55,7 @@ static void moving(int, chid, short); typedef struct motor_pv_info { - char name[29]; /* pv names limited to 28 chars + term. in dbDefs.h */ + char name[PVNAME_SZ]; /* pv names limited to 28 chars + term. in dbDefs.h */ chid chid_dmov; /* Channel id for .DMOV */ chid chid_stop; /* Channel id for .STOP */ int in_motion; @@ -81,6 +82,13 @@ RTN_STATUS motorUtilInit(char *vme_name) { RTN_STATUS status = OK; + if (strlen(vme) > PVNAME_SZ - 7 ) + { + printf( "motorUtilInit: Prefix %s has more than %d characters. Exiting", + vme_name, PVNAME_SZ - 7 ); + return ERROR; + } + vme = epicsStrDup(vme_name); epicsThreadCreate((char *) "motorUtil", epicsThreadPriorityMedium, @@ -92,7 +100,7 @@ RTN_STATUS motorUtilInit(char *vme_name) static int motorUtil_task(void *arg) { - char temp[34]; + char temp[PVNAME_STRINGSZ+5]; int itera, status; SEVCHK(ca_context_create(ca_enable_preemptive_callback), diff --git a/motorApp/MotorSrc/motorUtilAux.cc b/motorApp/MotorSrc/motorUtilAux.cc index 76ee4e31..6a4891ef 100644 --- a/motorApp/MotorSrc/motorUtilAux.cc +++ b/motorApp/MotorSrc/motorUtilAux.cc @@ -2,9 +2,9 @@ FILENAME... motorUtilAux.cc USAGE... Motor Record Utility Support. -Version: $Revision: 1.3 $ -Modified By: $Author: rivers $ -Last Modified: $Date: 2006-04-06 19:38:48 $ +Version: $Revision: 1.4 $ +Modified By: $Author: peterd $ +Last Modified: $Date: 2007-02-02 13:58:58 $ */ /* @@ -49,7 +49,7 @@ char ** getMotorList() { DBENTRY dbentry, *pdbentry = &dbentry; long status; - char **paprecords = 0, temp[29]; + char **paprecords = 0, temp[PVNAME_STRINGSZ]; int num_entries = 0, length = 0, index = 0; dbInitEntry(pdbbase,pdbentry);