Commit d2d2f32 ("Add libdrm include path to cflags") fixed the build for
FreeBSD but introduced host leakage which breaks cross-compile builds.
To fix this we need to specifying the include path by unsing '-I=' so
the compiler searches within the specified sysroot dir.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
The packets sent from the client especially for client cut text,
are typically sent in two packets, one for the message containing
the type and length and the other for the actual data. Sometimes
the first message is read but we still don't have the data yet.
We need to continue reading data to use the structure but this
revealed a bug. The client event handler was calling memmove()
with buffer_index as the size argument. This meant that it was
copying the wrong amount of data, resulting in garbage at the
end of the expected data. This patch fixes the problem by first
subtracting buffer_index from buffer_len and then moving buffer_len
worth of data, which is what was read into msg_buffer. The problem
possibly manifested itself with random crashes, after reading
random data.
size_t is unsigned and hence can't be below zero, triggering this gcc
warning with gcc 10:
warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
It seems this if statement is meant to check if there are messages to
process (larger than 0). If there are no messages, we should jump out
early.
Add a warning if a function is not declared. Functions used only inside
a compile unit still can be used, but have to be declared with the
static keyword.
Add static for all functions only used inside the individual compile
units. This helps the compiler to potentially inline these functions.
This allows to use neatvnc as a Meson subproject in Weston which has
-Wmissing-prototypes enabled by default.