diff --git a/src/iec61850/client/client_report.c b/src/iec61850/client/client_report.c index 425db7ad..cd1594ee 100644 --- a/src/iec61850/client/client_report.c +++ b/src/iec61850/client/client_report.c @@ -31,8 +31,6 @@ #include "libiec61850_platform_includes.h" -#include - struct sClientReport { ReportCallbackFunction callback; @@ -462,7 +460,7 @@ iedConnection_handleReport(IedConnection self, MmsValue* value) matchingReport->timestamp = MmsValue_getBinaryTimeAsUtcMs(timeStampValue); if (DEBUG_IED_CLIENT) - printf("IED_CLIENT: report has timestamp %" PRIu64 "\n", matchingReport->timestamp); + printf("IED_CLIENT: report has timestamp %lu\n", matchingReport->timestamp); inclusionIndex++; } diff --git a/src/mms/iso_client/iso_client_connection.c b/src/mms/iso_client/iso_client_connection.c index 01a6c63b..709ce67b 100644 --- a/src/mms/iso_client/iso_client_connection.c +++ b/src/mms/iso_client/iso_client_connection.c @@ -128,13 +128,13 @@ getState(IsoClientConnection self) return stateVal; } -static inline void +static void setIntState(IsoClientConnection self, eIsoClientInternalState newState) { self->intState = newState; } -static inline eIsoClientInternalState +static eIsoClientInternalState getIntState(IsoClientConnection self) { return self->intState; diff --git a/src/mms/iso_cotp/cotp.c b/src/mms/iso_cotp/cotp.c index a6ef5ad8..e1955212 100644 --- a/src/mms/iso_cotp/cotp.c +++ b/src/mms/iso_cotp/cotp.c @@ -48,13 +48,13 @@ static bool addPayloadToBuffer(CotpConnection* self, uint8_t* buffer, int payloadLength); -static inline uint16_t +static uint16_t getUint16(uint8_t* buffer) { return (buffer[0] * 0x100) + buffer[1]; } -static inline uint8_t +static uint8_t getUint8(uint8_t* buffer) { return buffer[0]; @@ -115,7 +115,7 @@ getOptionsLength(CotpConnection* self) return optionsLength; } -static inline void +static void writeStaticConnectResponseHeader(CotpConnection* self, int optionsLength) { /* always same size (7) and same position in buffer */ @@ -161,7 +161,7 @@ writeDataTpduHeader(CotpConnection* self, int isLastUnit) self->writeBuffer->size = 7; } -static inline int +static int writeToSocket(CotpConnection* self, uint8_t* buf, int size) { #if (CONFIG_MMS_SUPPORT_TLS == 1) @@ -659,7 +659,7 @@ CotpConnection_resetPayload(CotpConnection* self) } -static inline int +static int readFromSocket(CotpConnection* self, uint8_t* buf, int size) { #if (CONFIG_MMS_SUPPORT_TLS == 1) diff --git a/src/mms/iso_mms/common/mms_value.c b/src/mms/iso_mms/common/mms_value.c index 26a5b793..2b6e5f07 100644 --- a/src/mms/iso_mms/common/mms_value.c +++ b/src/mms/iso_mms/common/mms_value.c @@ -36,7 +36,7 @@ #include /* for ctime_r */ -static inline int +static int bitStringByteSize(const MmsValue* value) { int bitSize = value->value.bitString.size; @@ -1492,7 +1492,7 @@ exit_function: return self; } -static inline void +static void setVisibleStringValue(MmsValue* self, const char* string) { if (self->value.visibleString.buf != NULL) { diff --git a/src/mms/iso_mms/server/mms_file_service.c b/src/mms/iso_mms/server/mms_file_service.c index 7af7ba74..60ac9238 100644 --- a/src/mms/iso_mms/server/mms_file_service.c +++ b/src/mms/iso_mms/server/mms_file_service.c @@ -532,8 +532,12 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task) IsoConnection_sendMessage(task->connection->isoConnection, response, false); - FileSystem_closeFile(task->fileHandle); - deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename); + if (task->fileHandle) { + FileSystem_closeFile(task->fileHandle); + + if (task->destinationFilename) + deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename); + } MmsServer_releaseTransmitBuffer(self); @@ -657,15 +661,16 @@ mmsServer_handleObtainFileRequest( FileHandle fileHandle = openFile(MmsServerConnection_getFilesystemBasepath(connection), destinationFilename, true); + task->connection = connection; + task->obtainFileRequestInvokeId = invokeId; + if (fileHandle == NULL) { task->state = MMS_FILE_UPLOAD_STATE_SEND_OBTAIN_FILE_ERROR_DESTINATION; } else { /* send file open request */ task->lastRequestInvokeId = MmsServerConnection_getNextRequestInvokeId(connection); - task->connection = connection; task->fileHandle = fileHandle; - task->obtainFileRequestInvokeId = invokeId; strcpy(task->destinationFilename, destinationFilename);