···144144{
145145 unsigned long wl_entry_length = strlen(wl_entry);
146146 unsigned long disp_entry_length = strlen(disp->displayName);
147147- if (disp_entry_length < wl_entry_length)
147147+148148+ // If the entry is shorter then it will never match.
149149+ if (disp_entry_length < wl_entry_length) {
148150 return false;
151151+ }
149152150150- if (strncmp(wl_entry, disp->displayName, wl_entry_length) != 0)
153153+ // We only check the first part of the string, extra characters ignored.
154154+ if (strncmp(wl_entry, disp->displayName, wl_entry_length) != 0) {
151155 return false;
156156+ }
157157+158158+ /*
159159+ * We have a match with this allow list entry.
160160+ */
152161153153- // we have a match with this allowlist entry.
162162+ // Make the compositor use this size.
154163 w->base.base.c->settings.preferred.width = disp->physicalResolution.width;
155164 w->base.base.c->settings.preferred.height = disp->physicalResolution.height;
156156- struct comp_window_direct_nvidia_display d = {.name = U_TYPED_ARRAY_CALLOC(char, disp_entry_length + 1),
157157- .display_properties = *disp,
158158- .display = disp->display};
165165+166166+ // Create the entry.
167167+ struct comp_window_direct_nvidia_display d = {
168168+ .name = U_TYPED_ARRAY_CALLOC(char, disp_entry_length + 1),
169169+ .display_properties = *disp,
170170+ .display = disp->display,
171171+ };
159172160173 memcpy(d.name, disp->displayName, disp_entry_length);
161174 d.name[disp_entry_length] = '\0';