provisoire
authordejoigny
Wed, 17 May 2006 10:52:20 +0200
changeset 10 0c4d04e5fac0
parent 9 49f701f3dca7
child 11 64ed038bdc74
provisoire
src/objacces.c
--- a/src/objacces.c	Tue May 16 17:29:08 2006 +0200
+++ b/src/objacces.c	Wed May 17 10:52:20 2006 +0200
@@ -20,8 +20,8 @@
 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
 
 #include "objacces.h"
 
@@ -99,13 +99,17 @@
   	(*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
@@ -158,12 +162,19 @@
 	      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 >> 1 ; i > 0 ; i--) {
-			char tmp = ((char*)pSourceData)[i - 1];
-			((char*)pSourceData)[i - 1] = ((char*)pSourceData)[j];
-			((char*)pSourceData)[j++] = tmp;
+		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);
 	      }
       #endif
       errorCode = (*d->valueRangeTest)(dataType, pSourceData);