provide more includes to Cppcheck
- added (temporary) suppression of Cppcheck `shiftTooManyBits` false positives in `libxrdp/xrdp_mppc_enc.c` - added (temporary) suppression of Cppcheck `uninitMemberVar` true positives in `ulalaca/ulalaca.cpp` until fixes land downstream - fix Cppcheck `nullPointerRedundantCheck` in `sesman/chansrv/clipboard.c` - fix Cppcheck `syntaxError` in `fontutils/mkfv1.c` because it doesn't see the `freetype/fterrors.h` header / removed astyle workaround
This commit is contained in:
@@ -183,6 +183,7 @@ jobs:
|
|||||||
key: ${{ steps.os.outputs.image }}-build-${{ env.cache-name }}-${{ env.CPPCHECK_VER }}
|
key: ${{ steps.os.outputs.image }}-build-${{ env.cache-name }}-${{ env.CPPCHECK_VER }}
|
||||||
- run: sudo scripts/install_cppcheck_dependencies_with_apt.sh $CPPCHECK_VER
|
- run: sudo scripts/install_cppcheck_dependencies_with_apt.sh $CPPCHECK_VER
|
||||||
- run: ./bootstrap
|
- run: ./bootstrap
|
||||||
|
- run: ./configure
|
||||||
- run: scripts/install_cppcheck.sh $CPPCHECK_REPO $CPPCHECK_VER
|
- run: scripts/install_cppcheck.sh $CPPCHECK_REPO $CPPCHECK_VER
|
||||||
- run: scripts/run_cppcheck.sh -v $CPPCHECK_VER
|
- run: scripts/run_cppcheck.sh -v $CPPCHECK_VER
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -37,11 +37,9 @@ static const struct
|
|||||||
const char *err_msg;
|
const char *err_msg;
|
||||||
} ft_errors[] =
|
} ft_errors[] =
|
||||||
#include <freetype/fterrors.h>
|
#include <freetype/fterrors.h>
|
||||||
|
#ifdef __cppcheck__
|
||||||
#if 0
|
// avoid syntaxError by providing the array contents
|
||||||
/* These lines fix problems with astyle formatting following the ft_errors
|
{};
|
||||||
* definition */
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eufx
|
set -eufx
|
||||||
|
|
||||||
PACKAGES="libz3-dev z3"
|
# these are the packages necessary to run ./configure so config_ac.h is generated
|
||||||
|
PACKAGES="libpam0g-dev libxfixes-dev libxrandr-dev nasm"
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
@@ -15,6 +16,8 @@ if [ $# -ne 1 ]; then
|
|||||||
fi
|
fi
|
||||||
CPPCHECK_VER="$1"
|
CPPCHECK_VER="$1"
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
|
||||||
case "$CPPCHECK_VER" in
|
case "$CPPCHECK_VER" in
|
||||||
1.*)
|
1.*)
|
||||||
# no dependencies
|
# no dependencies
|
||||||
@@ -23,7 +26,8 @@ case "$CPPCHECK_VER" in
|
|||||||
# Cppcheck 2.8 removed the dependency on z3
|
# Cppcheck 2.8 removed the dependency on z3
|
||||||
;;
|
;;
|
||||||
2.*)
|
2.*)
|
||||||
apt-get update
|
PACKAGES="$PACKAGES libz3-dev z3"
|
||||||
apt-get -yq --no-install-suggests --no-install-recommends install $PACKAGES
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
apt-get -yq --no-install-suggests --no-install-recommends install $PACKAGES
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ fi
|
|||||||
# Supply default flags passed to cppcheck if necessary
|
# Supply default flags passed to cppcheck if necessary
|
||||||
if [ -z "$CPPCHECK_FLAGS" ]; then
|
if [ -z "$CPPCHECK_FLAGS" ]; then
|
||||||
CPPCHECK_FLAGS="--quiet --force --std=c11 --std=c++11 --inline-suppr \
|
CPPCHECK_FLAGS="--quiet --force --std=c11 --std=c++11 --inline-suppr \
|
||||||
--enable=warning --error-exitcode=1 -i third_party"
|
--enable=warning --error-exitcode=1 -i third_party \
|
||||||
|
--suppress=uninitMemberVar:ulalaca/ulalaca.cpp \
|
||||||
|
--suppress=shiftTooManyBits:libxrdp/xrdp_mppc_enc.c \
|
||||||
|
-I . -I common"
|
||||||
fi
|
fi
|
||||||
CPPCHECK_FLAGS="$CPPCHECK_FLAGS -D__cppcheck__"
|
CPPCHECK_FLAGS="$CPPCHECK_FLAGS -D__cppcheck__"
|
||||||
|
|
||||||
|
|||||||
@@ -2572,14 +2572,12 @@ clipboard_event_property_notify(XEvent *xevent)
|
|||||||
format_in_bytes = FORMAT_TO_BYTES(actual_format_return);
|
format_in_bytes = FORMAT_TO_BYTES(actual_format_return);
|
||||||
new_data_len = nitems_returned * format_in_bytes;
|
new_data_len = nitems_returned * format_in_bytes;
|
||||||
cptr = (char *) g_malloc(g_clip_s2c.total_bytes + new_data_len, 0);
|
cptr = (char *) g_malloc(g_clip_s2c.total_bytes + new_data_len, 0);
|
||||||
g_memcpy(cptr, g_clip_s2c.data, g_clip_s2c.total_bytes);
|
|
||||||
g_free(g_clip_s2c.data);
|
|
||||||
|
|
||||||
if (cptr == NULL)
|
if (cptr == NULL)
|
||||||
{
|
{
|
||||||
|
/* cannot add any more data */
|
||||||
|
g_free(g_clip_s2c.data);
|
||||||
g_clip_s2c.data = 0;
|
g_clip_s2c.data = 0;
|
||||||
|
|
||||||
/* cannot add any more data */
|
|
||||||
if (data != 0)
|
if (data != 0)
|
||||||
{
|
{
|
||||||
XFree(data);
|
XFree(data);
|
||||||
@@ -2588,14 +2586,15 @@ clipboard_event_property_notify(XEvent *xevent)
|
|||||||
XDeleteProperty(g_display, g_wnd, g_clip_s2c.property);
|
XDeleteProperty(g_display, g_wnd, g_clip_s2c.property);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
g_memcpy(cptr, g_clip_s2c.data, g_clip_s2c.total_bytes);
|
||||||
|
g_free(g_clip_s2c.data);
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_event_property_notify: new_data_len %d", new_data_len);
|
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_event_property_notify: new_data_len %d", new_data_len);
|
||||||
g_clip_s2c.data = cptr;
|
g_clip_s2c.data = cptr;
|
||||||
g_memcpy(g_clip_s2c.data + g_clip_s2c.total_bytes, data, new_data_len);
|
|
||||||
g_clip_s2c.total_bytes += new_data_len;
|
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
g_memcpy(g_clip_s2c.data + g_clip_s2c.total_bytes, data, new_data_len);
|
||||||
|
g_clip_s2c.total_bytes += new_data_len;
|
||||||
XFree(data);
|
XFree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user