Moved new variable definitions to the beginning of their block.

Older C compilers such as vxWorks 5.x insist on this.
This commit is contained in:
Andrew Johnson
2010-08-13 12:59:50 -05:00
parent 053ab01db4
commit 0c4746dd66
2 changed files with 11 additions and 5 deletions

View File

@@ -507,6 +507,9 @@ static void read_reply ( void *pArg, struct dbAddr *paddr,
const int readAccess = asCheckGet ( pciu->asClientPVT );
int status;
int v41;
int autosize;
long item_count;
ca_uint32_t payload_size;
SEND_LOCK ( pClient );
@@ -531,10 +534,10 @@ static void read_reply ( void *pArg, struct dbAddr *paddr,
/* If the client has requested a zero element count we interpret this as a
* request for all avaiable elements. In this case we initialise the
* header with the maximum element size specified by the database. */
int autosize = pevext->msg.m_count == 0;
long item_count =
autosize = pevext->msg.m_count == 0;
item_count =
autosize ? paddr->no_elements : pevext->msg.m_count;
ca_uint32_t payload_size = dbr_size_n(pevext->msg.m_dataType, item_count);
payload_size = dbr_size_n(pevext->msg.m_dataType, item_count);
status = cas_copy_in_header(
pClient, pevext->msg.m_cmmd, payload_size,
pevext->msg.m_dataType, item_count, cid, pevext->msg.m_available,

View File

@@ -257,6 +257,7 @@ int cas_copy_in_header (
{
unsigned msgSize;
ca_uint32_t alignedPayloadSize;
caHdr *pMsg;
if ( payloadSize > UINT_MAX - sizeof ( caHdr ) - 8u ) {
return ECA_TOLARGE;
@@ -296,7 +297,7 @@ int cas_copy_in_header (
}
}
caHdr *pMsg = (caHdr *) &pclient->send.buf[pclient->send.stk];
pMsg = (caHdr *) &pclient->send.buf[pclient->send.stk];
pMsg->m_cmmd = htons(response);
pMsg->m_dataType = htons(dataType);
pMsg->m_cid = htonl(cid);
@@ -337,8 +338,10 @@ void cas_set_header_count (struct client *pClient, ca_uint32_t count)
{
caHdr *pMsg = (caHdr *) &pClient->send.buf[pClient->send.stk];
if (pMsg->m_postsize == htons(0xffff)) {
ca_uint32_t *pLW;
assert(pMsg->m_count == 0);
ca_uint32_t *pLW = (ca_uint32_t *) (pMsg + 1);
pLW = (ca_uint32_t *) (pMsg + 1);
pLW[1] = htonl(count);
}
else {