- removed some compiler warnings

pull/309/head
Michael Zillgith 5 years ago
parent ae4f940753
commit 945fe080f3

@ -3,7 +3,7 @@
*
* TLS socket API for protocol libraries using TCP/IP
*
* Copyright 2017-2018 Michael Zillgith, MZ Automation GmbH
* Copyright 2017-2020 Michael Zillgith, MZ Automation GmbH
*
* Abstraction layer for different TLS implementations
*
@ -41,6 +41,7 @@ extern "C" {
* @{
*/
#include <stdint.h>
#include "tls_config.h"
#include "hal_socket.h"

@ -183,7 +183,7 @@ SerialPort_open(SerialPort self)
tios.c_iflag |= INPCK;
}
tios.c_iflag &= ~(IXON | IXOFF | IXANY);
tios.c_iflag &= ~(IXON | IXOFF | IXANY | ICRNL);
tios.c_iflag |= IGNBRK; /* Set ignore break to allow 0xff characters */
tios.c_iflag |= IGNPAR;
tios.c_oflag &=~ OPOST;
@ -265,7 +265,7 @@ SerialPort_readByte(SerialPort self)
int
SerialPort_write(SerialPort self, uint8_t* buffer, int startPos, int bufSize)
{
//TODO assure minimum line idle time
/* TODO assure minimum line idle time? */
self->lastError = SERIAL_PORT_ERROR_NONE;

@ -381,7 +381,7 @@ Timestamp_setTimeInMilliseconds(Timestamp* self, msSinceEpoch millisSinceEpoch)
void
Timestamp_setTimeInNanoseconds(Timestamp* self, nsSinceEpoch nsTime)
{
uint32_t timeval32 = (nsTime / 1000000000LLU);
uint32_t timeval32 = (uint32_t)(nsTime / 1000000000ULL);
uint8_t* valueArray = self->val;
@ -390,7 +390,7 @@ Timestamp_setTimeInNanoseconds(Timestamp* self, nsSinceEpoch nsTime)
valueArray[2] = (timeval32 / 0x100 & 0xff);
valueArray[3] = (timeval32 & 0xff);
uint64_t remainder = (nsTime % 1000000000LLU);
uint64_t remainder = (nsTime % 1000000000ULL);
remainder = remainder << 24;
remainder = remainder / 1000000000UL;
@ -465,7 +465,7 @@ Timestamp_getTimeInNs(Timestamp* self)
nsVal = nsVal * 1000000000UL;
nsVal = nsVal >> 24;
uint64_t timeval64 = (uint64_t) timeval32 * 1000000000LLU + nsVal;
uint64_t timeval64 = (uint64_t) timeval32 * 1000000000ULL + nsVal;
return timeval64;
}
@ -571,7 +571,8 @@ MmsMapping_createMmsVariableNameFromObjectReference(const char* objectReference,
else
mmsVariableName = buffer;
strcpy(mmsVariableName, objectReference + i);
strncpy(mmsVariableName, objectReference + i, len);
mmsVariableName[len - 1] = 0;
return mmsVariableName;
}

@ -27,9 +27,14 @@
#include "iec61850_server.h"
#include "ied_server_private.h"
#include "mms_value_internal.h"
#include <stdio.h>
#if (CONFIG_IEC61850_CONTROL_SERVICE == 1)
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
#endif
#ifndef DEBUG_IED_SERVER
#define DEBUG_IED_SERVER 0
#endif

@ -37,6 +37,10 @@
#include "logging_api.h"
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
#endif
#if (CONFIG_IEC61850_LOG_SERVICE == 1)
LogInstance*

@ -38,6 +38,10 @@
#include "goose_publisher.h"
#include "ied_server_private.h"
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
#endif
struct sMmsGooseControlBlock {
char* name;
bool goEna;

@ -627,7 +627,7 @@ decodeUtcTimeToNsTime(uint8_t* buffer, uint8_t* timeQuality)
if (timeQuality != NULL)
*timeQuality = buffer[7];
uint64_t timeval64 = (uint64_t) timeval32 * 1000000000LLU + nsVal;
uint64_t timeval64 = (uint64_t) timeval32 * 1000000000ULL + nsVal;
return timeval64;
}
@ -640,7 +640,7 @@ SVSubscriber_ASDU_getRefrTmAsMs(SVSubscriber_ASDU self)
if (self->refrTm != NULL)
msTime = decodeUtcTimeToNsTime(self->refrTm, NULL);
return (msTime / 1000000LLU);
return (msTime / 1000000ULL);
}
nsSinceEpoch

Loading…
Cancel
Save