# HG changeset patch # User dejoigny # Date 1147870890 -7200 # Node ID 64ed038bdc740b12174fe81eaa73914e25a55bb4 # Parent 0c4d04e5fac03fe86f7b4105c31936f4de299af7 Bogue:big endian diff -r 0c4d04e5fac0 -r 64ed038bdc74 src/objacces.c --- a/src/objacces.c Wed May 17 10:52:20 2006 +0200 +++ b/src/objacces.c Wed May 17 15:01:30 2006 +0200 @@ -20,8 +20,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define DEBUG_WAR_CONSOLE_ON -#define DEBUG_ERR_CONSOLE_ON +//#define DEBUG_WAR_CONSOLE_ON +//#define DEBUG_ERR_CONSOLE_ON + +#undef CANOPEN_BIG_ENDIAN #include "objacces.h" @@ -99,17 +101,13 @@ (*pDataType == visible_string && *pExpectedSize > szData)) // We allow to fetch a shorter string than expected { #ifdef CANOPEN_BIG_ENDIAN - if(*pDataType > boolean && *pDataType < visible_string){ + if(*pDataType > boolean && *pDataType < visible_string) { // data must be transmited with low byte first - MSG_WAR(0x2B30, "Dans ENDIANISATION", 0x00); UNS8 i, j = 0; for ( i = ptrTable->pSubindex[bSubindex].size ; i > 0 ; i--) { ((char*)pDestData)[j++] = ((char*)ptrTable->pSubindex[bSubindex].pObject)[i-1]; } } - else { - MSG_WAR(0x2B32, "cas string", 0x00); - } #else memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,*pExpectedSize); #endif @@ -159,23 +157,18 @@ (dataType == visible_string && *pExpectedSize < szData)) // We allow to store a shorter string than entry size { #ifdef CANOPEN_BIG_ENDIAN - if(dataType > boolean && dataType < visible_string){ - // we invert the data source directly. This let us do range testing without - // additional temp variable - MSG_WAR(0x2B31, "Dans ENDIANISATION", 0x00); - UNS8 i, j = 0; - for ( i = ptrTable->pSubindex[bSubindex].size ; i > 0 ; i--) { - ((char*)ptrTable->pSubindex[bSubindex].pObject)[i - 1] = ((char*)pSourceData)[j++]; - } -// for ( i = ptrTable->pSubindex[bSubindex].size >> 1 ; i > 0 ; i--) { -// char tmp = ((char*)pSourceData)[i - 1]; -// ((char*)pSourceData)[i - 1] = ((char*)pSourceData)[j]; -// ((char*)pSourceData)[j++] = tmp; -// } - } - else { - MSG_WAR(0x2B35, "cas string", 0x00); - } + if(dataType > boolean && dataType < visible_string) + { + // we invert the data source directly. This let us do range testing without + // additional temp variable + UNS8 tmp, i; + for ( i = 0 ; i < ( ptrTable->pSubindex[bSubindex].size >> 1) ; i++) + { + UNS8 tmp =((UNS8 *)pSourceData) [(ptrTable->pSubindex[bSubindex].size - 1) - i]; + ((UNS8 *)pSourceData) [(ptrTable->pSubindex[bSubindex].size - 1) - i] = ((UNS8 *)pSourceData)[i]; + ((UNS8 *)pSourceData)[i] = tmp; + } + } #endif errorCode = (*d->valueRangeTest)(dataType, pSourceData); if (errorCode) {