summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-01-10 07:06:19 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-01-10 07:16:16 +0100
commit912c8f6887b6007c474ca6c1c3134c25936ab982 (patch)
tree83473781e788311d0b7ac7b119f1f82b91c62135 /src/shared
parent9b74a8457aaa9b282cf79427a713b907635d82a2 (diff)
downloadDLT-daemon-912c8f6887b6007c474ca6c1c3134c25936ab982.tar.gz
Defined return value for dlt_message_read().
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/shared')
-rwxr-xr-xsrc/shared/dlt_common.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index 2544446..a12d137 100755
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -1118,7 +1118,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
if ((msg==0) || (buffer==0) || (length<=0))
{
- return -1;
+ return DLT_MESSAGE_ERROR_UNKNOWN;
}
/* initialize resync_offset */
@@ -1128,7 +1128,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
if (length<sizeof(dltSerialHeader))
{
/* dlt_log(LOG_ERR, "Length smaller than serial header!\n"); */
- return -1;
+ return DLT_MESSAGE_ERROR_SIZE;
}
if (memcmp(buffer,dltSerialHeader,sizeof(dltSerialHeader)) == 0)
@@ -1176,7 +1176,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
if (length<sizeof(DltStandardHeader))
{
/* dlt_log(LOG_ERR, "Length smaller than standard header!\n"); */
- return -1;
+ return DLT_MESSAGE_ERROR_SIZE;
}
memcpy(msg->headerbuffer+sizeof(DltStorageHeader),buffer,sizeof(DltStandardHeader));
@@ -1210,7 +1210,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
{
sprintf(str,"Plausibility check failed. Complete message size too short (%d)!\n",msg->datasize);
dlt_log(LOG_ERR, str);
- return -1;
+ return DLT_MESSAGE_ERROR_CONTENT;
}
/* load standard header extra parameters and Extended header if used */
@@ -1218,7 +1218,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
{
if (length < (msg->headersize - sizeof(DltStorageHeader)))
{
- return -1;
+ return DLT_MESSAGE_ERROR_SIZE;
}
memcpy(msg->headerbuffer+sizeof(DltStorageHeader)+sizeof(DltStandardHeader),buffer+sizeof(DltStandardHeader),extra_size);
@@ -1241,7 +1241,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
if (length < (msg->headersize - sizeof(DltStorageHeader) + msg->datasize))
{
/* dlt_log(LOG_ERR,"length does not fit!\n"); */
- return -1;
+ return DLT_MESSAGE_ERROR_SIZE;
}
/* free last used memory for buffer */
@@ -1261,13 +1261,13 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
{
sprintf(str,"Cannot allocate memory for payload buffer of size %d!\n",msg->datasize);
dlt_log(LOG_ERR, str);
- return -1;
+ return DLT_MESSAGE_ERROR_UNKNOWN;
}
/* load payload data from buffer */
memcpy(msg->databuffer,buffer+(msg->headersize-sizeof(DltStorageHeader)),msg->datasize);
- return 0;
+ return DLT_MESSAGE_ERROR_OK;
}
int dlt_message_get_extraparameters(DltMessage *msg,int verbose)