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:
Huang Qi 2022-02-21 16:29:33 +08:00 committed by Xiang Xiao
parent 051bb32010
commit db260593f1
1 changed files with 1 additions and 1 deletions

View File

@ -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
*