Fix warnings for printf formats

r1975 | dcl | 2007-05-22 08:29:38 +1000 (Tue, 22 May 2007) | 2 lines
This commit is contained in:
Douglas Clowes
2007-05-22 08:29:38 +10:00
parent 6d449014fc
commit 377ce04879
2 changed files with 7 additions and 6 deletions

View File

@@ -364,7 +364,7 @@
{ {
fSet = fVal; fSet = fVal;
iSet = (int)(fSet*self->fMult); iSet = (int)(fSet*self->fMult);
sprintf(pCommand,"T%05.5d",iSet); sprintf(pCommand,"T%5.5d",iSet);
} }
/* try three times: send, read, test, if OK return, else /* try three times: send, read, test, if OK return, else

View File

@@ -43,6 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
@@ -371,11 +372,11 @@
info_ptr->msg_id++; /* Set up an incrementing message id */ info_ptr->msg_id++; /* Set up an incrementing message id */
if (info_ptr->msg_id > 9999) info_ptr->msg_id = 1; if (info_ptr->msg_id > 9999) info_ptr->msg_id = 1;
sprintf (info_ptr->to_host.msg_id, "%04.4d", info_ptr->msg_id); sprintf (info_ptr->to_host.msg_id, "%4.4d", info_ptr->msg_id);
memcpy (info_ptr->to_host.c_pcol_lvl, RS__PROTOCOL_ID_V01B, memcpy (info_ptr->to_host.c_pcol_lvl, RS__PROTOCOL_ID_V01B,
sizeof (info_ptr->to_host.c_pcol_lvl)); sizeof (info_ptr->to_host.c_pcol_lvl));
sprintf (info_ptr->to_host.serial_port, "%04.4d", info_ptr->chan); sprintf (info_ptr->to_host.serial_port, "%4.4d", info_ptr->chan);
sprintf (info_ptr->to_host.tmo, "%04d", info_ptr->tmo); sprintf (info_ptr->to_host.tmo, "%04d", info_ptr->tmo);
strncpy(info_ptr->sAsync.eot,info_ptr->pTerms,4); strncpy(info_ptr->sAsync.eot,info_ptr->pTerms,4);
@@ -407,20 +408,20 @@
{ {
c_len = strlen (txt_ptr); c_len = strlen (txt_ptr);
} }
sprintf (text, "%04.4d", c_len); sprintf (text, "%4.4d", c_len);
memcpy (cmnd_lst_ptr, text, 4); memcpy (cmnd_lst_ptr, text, 4);
cmnd_lst_ptr = cmnd_lst_ptr + c_len + 4; cmnd_lst_ptr = cmnd_lst_ptr + c_len + 4;
ncmnds++; ncmnds++;
bytes_left = bytes_left - size; bytes_left = bytes_left - size;
} }
sprintf (text, "%04.4d", ncmnds); sprintf (text, "%4.4d", ncmnds);
memcpy (info_ptr->to_host.n_cmnds, memcpy (info_ptr->to_host.n_cmnds,
text, sizeof (info_ptr->to_host.n_cmnds)); text, sizeof (info_ptr->to_host.n_cmnds));
size = cmnd_lst_ptr - info_ptr->to_host.msg_id; size = cmnd_lst_ptr - info_ptr->to_host.msg_id;
size = (size + 3) & (~3); /* Round up to multiple of 4 */ size = (size + 3) & (~3); /* Round up to multiple of 4 */
sprintf (text, "%04.4d", size); sprintf (text, "%4.4d", size);
memcpy (info_ptr->to_host.msg_size, text, 4); memcpy (info_ptr->to_host.msg_size, text, 4);
status = send (info_ptr->skt, (char *) &info_ptr->to_host, size+4, 0); status = send (info_ptr->skt, (char *) &info_ptr->to_host, size+4, 0);