瀏覽代碼

Cleanup: Avoid warnings and type mismatch issue

CipEpathGetLogicalValue() had a return type decorated with the const
storage class attribute. But in C return types can't have storage class
attributes, they are ignored. Got rid of the compiler warning triggered
by this.

NotifyMessageRouter() used a variable of type EipByte to receive a return
value where CipError would have been appropriate because the called
function returns CipError.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Stefan Mätje 6 年之前
父節點
當前提交
49ff3e5c0a
共有 3 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      source/src/cip/cipepath.c
  2. 1 1
      source/src/cip/cipepath.h
  3. 1 1
      source/src/cip/cipmessagerouter.c

+ 1 - 1
source/src/cip/cipepath.c

@@ -329,7 +329,7 @@ void SetPathLogicalSegmentLogicalFormat(LogicalSegmentLogicalFormat format,
   }
 }
 
-const CipDword CipEpathGetLogicalValue(const EipUint8 **message) {
+CipDword CipEpathGetLogicalValue(const EipUint8 **message) {
   LogicalSegmentLogicalFormat logical_format =
     GetPathLogicalSegmentLogicalFormat(*message);
   CipDword data = 0;

+ 1 - 1
source/src/cip/cipepath.h

@@ -257,7 +257,7 @@ LogicalSegmentLogicalFormat GetPathLogicalSegmentLogicalFormat(
 void SetPathLogicalSegmentLogicalFormat(LogicalSegmentLogicalFormat format,
                                         CipOctet *const cip_path);
 
-const CipDword CipEpathGetLogicalValue(const EipUint8 **message);
+CipDword CipEpathGetLogicalValue(const EipUint8 **message);
 
 size_t CipEpathSetLogicalValue(const CipDword logical_value,
                                const LogicalSegmentLogicalFormat logical_format,

+ 1 - 1
source/src/cip/cipmessagerouter.c

@@ -175,7 +175,7 @@ EipStatus NotifyMessageRouter(EipUint8 *data,
                               const struct sockaddr *const originator_address,
                               const int encapsulation_session) {
   EipStatus eip_status = kEipStatusOkSend;
-  EipByte status = kCipErrorSuccess;
+  CipError status = kCipErrorSuccess;
 
   g_message_router_response.data = g_message_data_reply_buffer; /* set reply buffer, using a fixed buffer (OPENER_MESSAGE_DATA_REPLY_BUFFER bytes) */