src/objacces.c
changeset 1 b3dc740b4b04
parent 0 4472ee7c6c3e
child 2 8d4a822f95e4
--- a/src/objacces.c	Wed May 10 16:59:40 2006 +0200
+++ b/src/objacces.c	Wed May 10 21:05:57 2006 +0200
@@ -20,6 +20,9 @@
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+//#define DEBUG_WAR_CONSOLE_ON
+//#define DEBUG_ERR_CONSOLE_ON
+
 #include "objacces.h"
 
 #ifdef DEBUG_WAR_CONSOLE_ON
@@ -82,6 +85,7 @@
   }
   
   if (checkAccess && !(ptrTable->pSubindex[bSubindex].bAccessType & WO)) {
+  	MSG_WAR(0x2B30, "Access Type : ", ptrTable->pSubindex[bSubindex].bAccessType);
     accessDictionaryError(wIndex, bSubindex, 0, 0, OD_WRITE_NOT_ALLOWED);
     return OD_READ_NOT_ALLOWED;
   }
@@ -97,8 +101,8 @@
 	      {
 		// data must be transmited with low byte first
 		UNS8 i, j = 0;
-		for ( i = ptrTable->pSubindex[bSubindex].size - 1 ; i >= 0 ; i--) {
-			((char*)pDestData)[j++] = ((char*)ptrTable->pSubindex[bSubindex].pObject)[i];
+		for ( i = ptrTable->pSubindex[bSubindex].size ; i > 0 ; i--) {
+			((char*)pDestData)[j++] = ((char*)ptrTable->pSubindex[bSubindex].pObject)[i-1];
 		}
 	      }
 	#else  	
@@ -135,7 +139,8 @@
     accessDictionaryError(wIndex, bSubindex, 0, *pExpectedSize, OD_NO_SUCH_SUBINDEX);
     return OD_NO_SUCH_SUBINDEX;
   }
-  if (checkAccess && !(ptrTable->pSubindex[bSubindex].bAccessType & RO)) {
+  if (checkAccess && (ptrTable->pSubindex[bSubindex].bAccessType == RO)) {
+  	MSG_WAR(0x2B25, "Access Type : ", ptrTable->pSubindex[bSubindex].bAccessType);
     accessDictionaryError(wIndex, bSubindex, 0, *pExpectedSize, OD_WRITE_NOT_ALLOWED);
     return OD_WRITE_NOT_ALLOWED;
   }
@@ -157,8 +162,8 @@
 	      {
 		// data must be transmited with low byte first
 		UNS8 i, j = 0;
-		for ( i = ptrTable->pSubindex[bSubindex].size - 1 ; i >= 0 ; i--) {
-			((char*)ptrTable->pSubindex[bSubindex].pObject)[i] = ((char*)pSourceData)[j++];
+		for ( i = ptrTable->pSubindex[bSubindex].size ; i > 0 ; i--) {
+			((char*)ptrTable->pSubindex[bSubindex].pObject)[i - 1] = ((char*)pSourceData)[j++];
 		}
 	      }
       #else  	
@@ -198,3 +203,4 @@
 	return errorCode;
 }
 
+