# HG changeset patch # User greg # Date 1253106928 -7200 # Node ID c175351a69946cc12233bc47e0fb76ae00c6f39f # Parent 05ba6b57ff2b1025596e7309cd00c3cd9214c43c fix warnings with msvc compiler diff -r 05ba6b57ff2b -r c175351a6994 src/dcf.c --- a/src/dcf.c Wed Sep 16 15:13:51 2009 +0200 +++ b/src/dcf.c Wed Sep 16 15:15:28 2009 +0200 @@ -87,7 +87,7 @@ */ UNS8 send_consise_dcf(CO_Data* d,UNS8 nodeId) { - UNS8 szData; + UNS32 szData; /* Fetch DCF OD entry, if not already done */ if(!d->dcf_odentry) { @@ -124,7 +124,7 @@ if(d->dcf_odentry->pSubindex[nodeId].bAccessType & DCF_TO_SEND){ UNS8* dcfend; UNS32 nb_entries; - UNS8 szData = d->dcf_odentry->pSubindex[nodeId].size; + UNS32 szData = d->dcf_odentry->pSubindex[nodeId].size; { UNS8* dcf = *((UNS8**)d->dcf_odentry->pSubindex[nodeId].pObject); @@ -171,7 +171,7 @@ nodeId, /* UNS8 nodeId*/ target_Index, /* UNS16 index*/ target_Subindex, /* UNS8 subindex*/ - target_Size, /* UNS8 count*/ + (UNS8)target_Size, /* UNS8 count*/ 0, /* UNS8 dataType*/ d->dcf_cursor,/* void *data*/ CheckSDOAndContinue,/* SDOCallback_t diff -r 05ba6b57ff2b -r c175351a6994 src/emcy.c --- a/src/emcy.c Wed Sep 16 15:13:51 2009 +0200 +++ b/src/emcy.c Wed Sep 16 15:15:28 2009 +0200 @@ -101,7 +101,7 @@ MSG_WAR(0x3051, "sendEMCY", 0); - m.cob_id = UNS16_LE(*(UNS32*)d->error_cobid); + m.cob_id = (UNS16)UNS16_LE(*(UNS32*)d->error_cobid); m.rtr = NOT_A_REQUEST; m.len = 8; m.data[0] = errCode & 0xFF; /* LSB */ diff -r 05ba6b57ff2b -r c175351a6994 src/pdo.c --- a/src/pdo.c Wed Sep 16 15:13:51 2009 +0200 +++ b/src/pdo.c Wed Sep 16 15:15:28 2009 +0200 @@ -52,7 +52,7 @@ const indextable *TPDO_map = d->objdict + d->firstIndex->PDO_TRS_MAP + numPdo; UNS8 prp_j = 0x00; - UNS8 offset = 0x00; + UNS32 offset = 0x00000000; const UNS8 *pMappingCount = (UNS8 *) TPDO_map->pSubindex[0].pObject; pdo->cob_id = UNS16_LE(*(UNS32*)TPDO_com->pSubindex[1].pObject & 0x7FF); @@ -93,8 +93,8 @@ return 0xFF; } /* copy bit per bit in little endian */ - CopyBits (Size, ((UNS8 *) tmp), 0, 0, - (UNS8 *) & pdo->data[offset >> 3], offset % 8, 0); + CopyBits ((UNS8) Size, ((UNS8 *) tmp), 0, 0, + (UNS8 *) & pdo->data[offset >> 3], (UNS8)(offset % 8), 0); offset += Size; } @@ -102,7 +102,7 @@ } while (prp_j < *pMappingCount); - pdo->len = 1 + ((offset - 1) >> 3); + pdo->len = (UNS8)(1 + ((offset - 1) >> 3)); MSG_WAR (0x3015, " End scan mapped variable", 0); @@ -141,7 +141,7 @@ MSG_WAR (0x3930, "sendPDOrequest cobId is : ", *pwCobId); { Message pdo; - pdo.cob_id = UNS16_LE(*pwCobId); + pdo.cob_id = (UNS16)UNS16_LE(*pwCobId); pdo.rtr = REQUEST; pdo.len = 0; return canSend (d->canHandle, &pdo); diff -r 05ba6b57ff2b -r c175351a6994 src/sdo.c --- a/src/sdo.c Wed Sep 16 15:13:51 2009 +0200 +++ b/src/sdo.c Wed Sep 16 15:15:28 2009 +0200 @@ -551,7 +551,7 @@ pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject; } /* message copy for sending */ - m.cob_id = UNS16_LE(*pwCobId); + m.cob_id = (UNS8)UNS16_LE(*pwCobId); m.rtr = NOT_A_REQUEST; /* the length of SDO must be 8 */ m.len = 8; @@ -576,10 +576,7 @@ { s_SDO sdo; UNS8 ret; - UNS8* pNodeIdServer; - UNS8 nodeIdServer; - UNS16 offset; - + MSG_WAR(0x2A50,"Sending SDO abort ", abortCode); if(whoami == SDO_SERVER) { @@ -626,7 +623,8 @@ UNS16 index; UNS8 subIndex; UNS32 abortCode; - UNS8 i,j; + UNS32 i; + UNS8 j; UNS32 *pCobId = NULL; UNS16 offset; UNS16 lastIndex; @@ -868,7 +866,7 @@ } else {/* So, if it is not an expedited transfert */ if (getSDOs(m->data[0])) { - nbBytes = m->data[4] + m->data[5]<<8 + m->data[6]<<16 + m->data[7]<<24; + nbBytes = (m->data[4]) + (m->data[5]<<8) + (m->data[6]<<16) + (m->data[7]<<24); err = setSDOlineRestBytes(d, nodeId, nbBytes); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR); @@ -935,7 +933,7 @@ /* code to send the last segment. (cs = 0; c = 1)*/ d->transfers[line].toggle = ! d->transfers[line].toggle & 1; sdo.nodeId = nodeId; /* The server node Id; */ - sdo.body.data[0] = (d->transfers[line].toggle << 4) | ((7 - nbBytes) << 1) | 1; + sdo.body.data[0] = (UNS8)((d->transfers[line].toggle << 4) | ((7 - nbBytes) << 1) | 1); err = lineToSDO(d, line, nbBytes, sdo.body.data + 1); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR); @@ -995,7 +993,7 @@ sdo.body.data[1] = index & 0xFF; /* LSB */ sdo.body.data[2] = (index >> 8) & 0xFF; /* MSB */ sdo.body.data[3] = subIndex; - sdo.body.data[4] = nbBytes; /* Limitation of canfestival2 : Max tranfert is 256 bytes.*/ + sdo.body.data[4] = (UNS8)nbBytes; /* Limitation of canfestival2 : Max tranfert is 256 bytes.*/ /* It takes too much memory to upgrate to 2^32 because the size of data is also coded */ /* in the object dictionary, at every index and subindex. */ for (i = 5 ; i < 8 ; i++) @@ -1005,7 +1003,7 @@ } else { /* Expedited upload. (cs = 2 ; e = 1) */ - sdo.body.data[0] = (2 << 5) | ((4 - nbBytes) << 2) | 3; + sdo.body.data[0] = (UNS8)((2 << 5) | ((4 - nbBytes) << 2) | 3); sdo.body.data[1] = index & 0xFF; /* LSB */ sdo.body.data[2] = (index >> 8) & 0xFF; /* MSB */ sdo.body.data[3] = subIndex; @@ -1060,7 +1058,7 @@ else { /* So, if it is not an expedited transfert */ /* Storing the nb of data to receive. */ if (getSDOs(m->data[0])) { - nbBytes = m->data[4] + m->data[5]<<8 + m->data[6]<<16 + m->data[7]<<24; + nbBytes = m->data[4] + (m->data[5]<<8) + (m->data[6]<<16) + (m->data[7]<<24); err = setSDOlineRestBytes(d, line, nbBytes); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR); @@ -1124,7 +1122,7 @@ /* Last segment. */ /* code to send the last segment. (cs = 0; c = 1) */ sdo.nodeId = nodeId; /** The server node Id; */ - sdo.body.data[0] = (d->transfers[line].toggle << 4) | ((7 - nbBytes) << 1) | 1; + sdo.body.data[0] = (UNS8)((d->transfers[line].toggle << 4) | ((7 - nbBytes) << 1) | 1); err = lineToSDO(d, line, nbBytes, sdo.body.data + 1); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR); @@ -1178,7 +1176,7 @@ /* Last segment.*/ /* code to send the last segment. (cs = 0; c = 1) */ sdo.nodeId = nodeId; /* The server node Id; */ - sdo.body.data[0] = (d->transfers[line].toggle << 4) | ((7 - nbBytes) << 1) | 1; + sdo.body.data[0] = (UNS8)((d->transfers[line].toggle << 4) | ((7 - nbBytes) << 1) | 1); err = lineToSDO(d, line, nbBytes, sdo.body.data + 1); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR); @@ -1330,7 +1328,7 @@ /* Send the SDO to the server. Initiate download, cs=1. */ sdo.nodeId = nodeId; if (count <= 4) { /* Expedited transfert */ - sdo.body.data[0] = (1 << 5) | ((4 - count) << 2) | 3; + sdo.body.data[0] = (UNS8)((1 << 5) | ((4 - count) << 2) | 3); for (i = 4 ; i < 8 ; i++) sdo.body.data[i] = d->transfers[line].data[i - 4]; d->transfers[line].offset = count; @@ -1338,7 +1336,7 @@ else { /** Normal transfert */ sdo.body.data[0] = (1 << 5) | 1; for (i = 0 ; i < 4 ; i++) - sdo.body.data[i+4] = count << (i<<3); /* i*8 */ + sdo.body.data[i+4] = (UNS8)((count << (i<<3))); /* i*8 */ } sdo.body.data[1] = index & 0xFF; /* LSB */ sdo.body.data[2] = (index >> 8) & 0xFF; /* MSB */ diff -r 05ba6b57ff2b -r c175351a6994 src/sync.c --- a/src/sync.c Wed Sep 16 15:13:51 2009 +0200 +++ b/src/sync.c Wed Sep 16 15:15:28 2009 +0200 @@ -131,7 +131,7 @@ MSG_WAR(0x3001, "sendSYNC ", 0); - m.cob_id = UNS16_LE(*d->COB_ID_Sync); + m.cob_id = (UNS16)UNS16_LE(*d->COB_ID_Sync); m.rtr = NOT_A_REQUEST; m.len = 0;