Skip to content

Commit

Permalink
Merge pull request #1 from epics-motor/190920_send_mess_uses_const_char
Browse files Browse the repository at this point in the history
The 3rd parameter in send_mess(), "name" can and should
be a 'const char *' instead of just 'char *'.
Modern compilers complain here, so that the signature now
gets the const.
  • Loading branch information
kmpeters authored Sep 25, 2019
2 parents 5b72942 + 98d9e46 commit d4f694d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kohzuApp/src/drvSC800.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ volatile double drvSC800ReadbackDelay = 0.;

/*----------------functions-----------------*/
static int recv_mess(int card, char *com, int flag);
static RTN_STATUS send_mess(int card, char const *, char *name);
static RTN_STATUS send_mess(int card, const char *, const char *name);
static int set_status(int card, int signal);
static long report(int level);
static long init();
Expand Down Expand Up @@ -221,7 +221,7 @@ static int set_status(int card, int signal)
charcnt = recv_mess(card, buff, FLUSH);

sprintf(buff,"STR1/%d",(signal + 1));
send_mess(card, buff, (char*) NULL); /* Tell Status */
send_mess(card, buff, NULL); /* Tell Status */
charcnt = recv_mess(card, buff, 1);
convert_cnt = sscanf(buff, "C\tSTR%d\t1\t%d\t%d\t%d\t%d\t%d\t%d\t%d",
&str_axis, &str_move, &str_norg, &str_orgg,
Expand Down Expand Up @@ -256,7 +256,7 @@ static int set_status(int card, int signal)

/* Parse motor position */
sprintf(buff,"RDP%d/0", (signal + 1));
send_mess(card, buff, (char*) NULL); /* Tell Position */
send_mess(card, buff, NULL); /* Tell Position */
recv_mess(card, buff, 1);
convert_cnt = sscanf(buff, "C\tRDP%d\t%d", &str_axis, &motorData);

Expand Down Expand Up @@ -285,7 +285,7 @@ static int set_status(int card, int signal)

/* Torque enabled? */
sprintf(buff,"RSY%d/21", (signal + 1));
send_mess(card, buff, (char*) NULL); /* Tell Position */
send_mess(card, buff, NULL); /* Tell Position */
recv_mess(card, buff, 1);
convert_cnt = sscanf(buff, "C\tRSY%d\t21\t%d", &str_axis, &str_move);
status.Bits.EA_POSITION = (str_move == 0) ? 1 : 0;
Expand Down Expand Up @@ -327,7 +327,7 @@ static int set_status(int card, int signal)
nodeptr->postmsgptr != 0)
{
strcpy(buff, nodeptr->postmsgptr);
send_mess(card, buff, (char*) NULL);
send_mess(card, buff, NULL);
nodeptr->postmsgptr = NULL;
}

Expand All @@ -341,7 +341,7 @@ static int set_status(int card, int signal)
/* send a message to the SC800 board */
/* send_mess() */
/*****************************************************/
static RTN_STATUS send_mess(int card, char const *com, char *name)
static RTN_STATUS send_mess(int card, const char *com, const char *name)
{
struct SC800Controller *cntrl;
char local_buff[MAX_MSG_SIZE];
Expand Down

0 comments on commit d4f694d

Please sign in to comment.