src/objacces.c
changeset 419 f63ce68a8239
parent 402 77f875d45250
child 421 6221b4db8c42
equal deleted inserted replaced
418:64a8c24b61a5 419:f63ce68a8239
   152         MSG_WAR(i," ", j);
   152         MSG_WAR(i," ", j);
   153         ((UNS8*)pDestData)[j++] =
   153         ((UNS8*)pDestData)[j++] =
   154           ((UNS8*)ptrTable->pSubindex[bSubindex].pObject)[i-1];
   154           ((UNS8*)ptrTable->pSubindex[bSubindex].pObject)[i-1];
   155       }
   155       }
   156     }
   156     }
   157     else /* It it is a visible string no endianisation to perform */
   157     else /* no endianisation change */
   158       memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,szData);
       
   159 #  else
       
   160     memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,szData);
       
   161 #  endif
   158 #  endif
   162 
   159     if(*pDataType < visible_string) {
   163     *pExpectedSize = szData;
   160         memcpy(pDestData, ptrTable->pSubindex[bSubindex].pObject,szData);
       
   161         *pExpectedSize = szData;
       
   162     }else{
       
   163         /* TODO : CONFORM TO DS-301 : 
       
   164          *  - stop using NULL terminated strings
       
   165          *  - store string size in td_subindex 
       
   166          * */
       
   167         /* Copy null terminated string to user, and return discovered size */
       
   168         UNS8 *ptr = (UNS8*)ptrTable->pSubindex[bSubindex].pObject;
       
   169         UNS8 *ptr_start = ptr;
       
   170         UNS8 *ptr_end = ptr + *pExpectedSize; /* *pExpectedSize IS < szData */ 
       
   171         while( *ptr && ptr < ptr_end){
       
   172             *((UNS8*)pDestData++) = *(ptr++);
       
   173         } 
       
   174         *pExpectedSize = ptr - ptr_start; 
       
   175     }
   164 
   176 
   165     return OD_SUCCESSFUL;
   177     return OD_SUCCESSFUL;
   166   }
   178   }
   167   else { /* Error ! */
   179   else { /* Error ! */
   168     *pExpectedSize = szData;
   180     *pExpectedSize = szData;