wdomirror icon indicating copy to clipboard operation
wdomirror copied to clipboard

fix: missing field initializer

Open ubavic opened this issue 2 years ago • 2 comments

Trying to compile the code with gcc v11.2.0, wayland-client v1.20.0 and wayland-protocols v1.25 throws

[18/19] Compiling C object wdomirror.p/main.c.o
FAILED: wdomirror.p/main.c.o
cc -Iwdomirror.p -I. -I.. -Iprotocol -I../protocol -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g -Wno-missing-braces -Wno-unused-parameter -MD -MQ wdomirror.p/main.c.o -MF wdomirror.p/main.c.o.d -o wdomirror.p/main.c.o -c ../main.c
../main.c:415:1: error: missing initializer for field ‘configure_bounds’ of ‘const struct xdg_toplevel_listener’ [-Werror=missing-field-initializers]
  415 | };
      | ^
In file included from ../main.c:16:
wdomirror.p/xdg-shell-client-protocol.h:1388:16: note: ‘configure_bounds’ declared here
 1388 |         void (*configure_bounds)(void *data,
      |                ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

ubavic avatar May 06 '22 18:05 ubavic

I think this PR as written would cause a null pointer dereference if the server sent a configure_bounds message.

Probably https://github.com/progandy/wdomirror/issues/5 is a better fix.

ghost avatar May 11 '22 03:05 ghost

@a-m-joseph You are right. I changed the PR. Thanks!

ubavic avatar May 11 '22 08:05 ubavic