You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/06/15 14:07:24 UTC

[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1103: MINIFICPP-1567 enable linter checks in extensions (part 3)

fgerlits commented on a change in pull request #1103:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1103#discussion_r651636083



##########
File path: extensions/mqtt/controllerservice/MQTTControllerService.cpp
##########
@@ -70,7 +70,7 @@ void MQTTControllerService::onEnable() {
     }
 
     if (client_) {
-      MQTTClient_setCallbacks(client_, (void *) this, reconnectCallback, receiveCallback, deliveryCallback);
+      MQTTClient_setCallbacks(client_, reinterpret_cast<void *>(this), reconnectCallback, receiveCallback, deliveryCallback);

Review comment:
       the `reinterpret_cast` is not needed, `this` can be implicitly converted to `void*`
   ```suggestion
         MQTTClient_setCallbacks(client_, this, reconnectCallback, receiveCallback, deliveryCallback);
   ```

##########
File path: extensions/opc/src/opc.cpp
##########
@@ -572,7 +574,7 @@ std::string OPCDateTime2String(UA_DateTime raw_date) {
 
 void logFunc(void *context, UA_LogLevel level, UA_LogCategory /*category*/, const char *msg, va_list args) {
   char buffer[1024];
-  vsnprintf(buffer, 1024, msg, args);
+  vsnprintf(buffer, sizeof(buffer), msg, args);

Review comment:
       it's `sizeof(type)` and `sizeof expression` (although we don't follow this consistently in the rest of the code)
   ```suggestion
     vsnprintf(buffer, sizeof buffer, msg, args);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org