/* look through buffer as long as data is in there */
do
{
- if (daemon_local->receiver.bytesRcvd < sizeof(DltUserHeader))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)sizeof(DltUserHeader))
{
break;
}
offset++;
}
- while ((sizeof(DltUserHeader)+offset)<=daemon_local->receiver.bytesRcvd);
+ while ((int32_t)(sizeof(DltUserHeader)+offset)<=daemon_local->receiver.bytesRcvd);
/* Check for user header pattern */
if (dlt_user_check_userheader(userheader)==0)
return -1;
}
- if (daemon_local->receiver.bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterApplication)))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterApplication)))
{
/* Not enough bytes received */
return -1;
return -1;
}
- if (daemon_local->receiver.bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)))
{
/* Not enough bytes received */
return -1;
return -1;
}
- if (daemon_local->receiver.bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication)))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication)))
{
/* Not enough bytes received */
return -1;
return -1;
}
- if (daemon_local->receiver.bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)))
{
/* Not enough bytes received */
return -1;
return -1;
}
- if (daemon_local->receiver.bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgAppLogLevelTraceStatus )))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgAppLogLevelTraceStatus )))
{
/* Not enough bytes receeived */
return -1;
return -1;
}
- if (daemon_local->receiver.bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)))
+ if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)))
{
/* Not enough bytes received */
return -1;
int dlt_daemon_applications_clear(DltDaemon *daemon,int verbose)
{
- uint32_t i;
+ int i;
PRINT_FUNCTION_VERBOSE(verbose);
int dlt_daemon_applications_save(DltDaemon *daemon,const char *filename, int verbose)
{
FILE *fd;
- uint32_t i;
+ int i;
char apid[DLT_ID_SIZE+1]; /* DLT_ID_SIZE+1, because the 0-termination is required here */
int dlt_daemon_contexts_save(DltDaemon *daemon,const char *filename, int verbose)
{
FILE *fd;
- uint32_t i;
+ int i;
char apid[DLT_ID_SIZE+1], ctid[DLT_ID_SIZE+1]; /* DLT_ID_SIZE+1, because the 0-termination is required here */
return -1;
}
- if (msg->datasize<sizeof(uint32_t))
+ if (msg->datasize < (int32_t)sizeof(uint32_t))
{
return -1;
}
req = (DltServiceSetDefaultLogLevel*) (msg->databuffer);
/* No endianess conversion necessary */
- if ((req->log_level>=0) &&
+ if (/*(req->log_level>=0) &&*/
(req->log_level<=DLT_LOG_VERBOSE))
{
daemon->default_log_level = req->log_level; /* No endianess conversion necessary */
int dlt_free(void)
{
- int i;
+ uint32_t i;
char filename[DLT_USER_MAX_FILENAME_LENGTH];
if (dlt_user_initialised==0)
int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const char * description, int loglevel, int tracestatus)
{
DltContextData log;
- int i;
+ uint32_t i;
int registered,ret;
char ctid[DLT_ID_SIZE+1];
int dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType tracestatus)
{
- int i;
+ uint32_t i;
int ret;
if (dlt_user_initialised==0)
int (*dlt_injection_callback)(uint32_t service_id, void *data, uint32_t length))
{
DltContextData log;
- int i,j,k;
+ uint32_t i,j,k;
int found = 0;
DltUserInjectionCallback *old;
int offset=0;
int leave_while=0;
- int i;
+ uint32_t i;
DltUserHeader *userheader;
DltReceiver *receiver = &(dlt_user.receiver);
/* look through buffer as long as data is in there */
while (1)
{
- if (receiver->bytesRcvd < sizeof(DltUserHeader))
+ if (receiver->bytesRcvd < (int32_t)sizeof(DltUserHeader))
{
break;
}
offset++;
}
- while ((sizeof(DltUserHeader)+offset)<=receiver->bytesRcvd);
+ while ((int32_t)(sizeof(DltUserHeader)+offset)<=receiver->bytesRcvd);
/* Check for user header pattern */
if (dlt_user_check_userheader(userheader)==0)
{
case DLT_USER_MESSAGE_LOG_LEVEL:
{
- if (receiver->bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogLevel)))
+ if (receiver->bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogLevel)))
{
leave_while=1;
break;
{
DLT_SEM_LOCK();
- if ((usercontextll->log_level_pos>=0) && (usercontextll->log_level_pos<dlt_user.dlt_ll_ts_num_entries))
+ if ((usercontextll->log_level_pos >= 0) && (usercontextll->log_level_pos < (int32_t)dlt_user.dlt_ll_ts_num_entries))
{
// printf("Store ll, ts\n");
if (dlt_user.dlt_ll_ts)
case DLT_USER_MESSAGE_INJECTION:
{
/* At least, user header, user context, and service id and data_length of injected message is available */
- if (receiver->bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)))
+ if (receiver->bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)))
{
leave_while = 1;
break;
if (userbuffer!=0)
{
- if (receiver->bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)+usercontextinj->data_length_inject))
+ if (receiver->bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)+usercontextinj->data_length_inject))
{
leave_while = 1;
break;
case DLT_USER_MESSAGE_LOG_STATE:
{
/* At least, user header, user context, and service id and data_length of injected message is available */
- if (receiver->bytesRcvd < (sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogState)))
+ if (receiver->bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogState)))
{
leave_while = 1;
break;
void dlt_user_log_reattach_to_daemon(void)
{
- int num,reregistered=0;
+ uint32_t num,reregistered=0;
DltContext handle;
DltContextData log_new;
return -1;
}
+ if (size>receiver->bytesRcvd)
+ {
+ receiver->buf = receiver->buf + receiver->bytesRcvd;
+ receiver->bytesRcvd=0;
+ return -1;
+ }
+
receiver->bytesRcvd = receiver->bytesRcvd - size;
receiver->buf = receiver->buf + size;
void dlt_buffer_write_block(DltBuffer *buf,int *write, const unsigned char *data,unsigned int size)
{
- if((*write+size) <= buf->size) {
+ if((int)(*write+size) <= buf->size) {
// write one block
memcpy(buf->mem+*write,data,size);
*write += size;
void dlt_buffer_read_block(DltBuffer *buf,int *read,unsigned char *data,unsigned int size)
{
- if((*read+size) <= buf->size) {
+ if((int)(*read+size) <= buf->size) {
// read one block
memcpy(data,buf->mem+*read,size);
*read += size;
free_size = buf->size - write + read;
// check size
- if(free_size < (sizeof(DltBufferBlockHead)+size1+size2+size3)) {
+ if(free_size < (int)(sizeof(DltBufferBlockHead)+size1+size2+size3)) {
// try to increase size if possible
if(dlt_buffer_increase_size(buf)) {
/* increase size is not possible */
used_size = buf->size - read + write;
// first check size
- if(used_size < (sizeof(DltBufferBlockHead))) {
+ if(used_size < (int)(sizeof(DltBufferBlockHead))) {
dlt_log(LOG_ERR,"Buffer: Size check 1 failed\n");
dlt_buffer_reset(buf);
return -1; // ERROR
}
// second check size
- if(used_size < (sizeof(DltBufferBlockHead)+head.size)) {
+ if(used_size < (int)(sizeof(DltBufferBlockHead)+head.size)) {
dlt_log(LOG_ERR,"Buffer: Size check 2 failed\n");
dlt_buffer_reset(buf);
return -1; // ERROR
int dlt_offline_trace_check_size(DltOfflineTrace *trace) {
/* check size of complete offline trace */
- while(dlt_offline_trace_get_total_size(trace) > (trace->maxSize-trace->fileSize))
+ while((int)dlt_offline_trace_get_total_size(trace) > (trace->maxSize-trace->fileSize))
{
/* remove oldest files as long as new file will not fit in completely into complete offline trace */
if(dlt_offline_trace_delete_oldest_file(trace)<0) {
DltReturnValue dlt_user_log_out2(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2)
{
struct iovec iov[2];
- int bytes_written;
+ uint32_t bytes_written;
if (handle<=0)
{
DltReturnValue dlt_user_log_out3(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2, void *ptr3, size_t len3)
{
struct iovec iov[3];
- int bytes_written;
+ uint32_t bytes_written;
if (handle<=0)
{