mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
vncserver: Correct size calculation of rfb_setencodings_s
Fix
```
video/vnc/vnc_negotiate.c:426:29: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
DEBUGASSERT(nrecvd >= SIZEOF_RFB_SETENCODINGS_S(0));
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/huang/Work/nx/nuttx/include/nuttx/video/rfb.h:359:51: note: expanded from macro 'SIZEOF_RFB_SETENCODINGS_S'
(sizeof(struct rfb_setencodings_s) + (((n) - 1) << 2))
^
/home/huang/Work/nx/nuttx/include/assert.h:56:33: note: expanded from macro 'DEBUGASSERT'
~~~~~~~^~
/home/huang/Work/nx/nuttx/include/assert.h:51:37: note: expanded from macro 'ASSERT'
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
@@ -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))
|
||||
|
||||
/* 6.4.3 FramebufferUpdateRequest
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user