You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/21 08:59:07 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5572: vncserver: Corret size calculation of rfb_setencodings_s

pkarashchenko commented on a change in pull request #5572:
URL: https://github.com/apache/incubator-nuttx/pull/5572#discussion_r810903081



##########
File path: include/nuttx/video/rfb.h
##########
@@ -356,7 +356,7 @@ struct rfb_setencodings_s
 };
 
 #define SIZEOF_RFB_SETENCODINGS_S(n) \
-  (sizeof(struct rfb_setencodings_s) + (((n) - 1) << 2))
+  (sizeof(struct rfb_setencodings_s) + (n == 0 ? -4 : (n - 1) << 2))

Review comment:
       Just as an alternative, but will require `#include <nuttx/compiler.h>`
   ```suggestion
     (offsetof(struct rfb_setencodings_s, encodings) + ((n) << 2))
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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