# HG changeset patch # User edouard # Date 1254908449 -7200 # Node ID 96e632bc1e58957623aa295a1d26009f2d7f25db # Parent 4dc76e6624121a76e6ca4abad157d894088ac8e7 Fixed casts subject to problems on some compilers. diff -r 4dc76e662412 -r 96e632bc1e58 src/sdo.c --- a/src/sdo.c Wed Oct 07 11:39:53 2009 +0200 +++ b/src/sdo.c Wed Oct 07 11:40:49 2009 +0200 @@ -113,7 +113,7 @@ /** Returns the index from the bytes 1 and 2 of the SDO */ -#define getSDOindex(byte1, byte2) ((byte2 << 8) | (byte1)) +#define getSDOindex(byte1, byte2) (((UNS16)byte2 << 8) | ((UNS16)byte1)) /** Returns the subIndex from the byte 3 of the SDO */ @@ -866,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]) + ((UNS32)(m->data[5])<<8) + ((UNS32)(m->data[6])<<16) + ((UNS32)(m->data[7])<<24); err = setSDOlineRestBytes(d, nodeId, nbBytes); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR); @@ -1058,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] + ((UNS32)(m->data[5])<<8) + ((UNS32)(m->data[6])<<16) + ((UNS32)(m->data[7])<<24); err = setSDOlineRestBytes(d, line, nbBytes); if (err) { failedSDO(d, nodeId, whoami, index, subIndex, SDOABT_GENERAL_ERROR);