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:
[email protected]


Reply via email to