rdp: Use xzalloc in rdp_insert_new_mode
We can remove some error handling if we don't allow this to fail. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
fc848b30c8
commit
50d42f88da
@ -328,9 +328,7 @@ static struct weston_mode *
|
|||||||
rdp_insert_new_mode(struct weston_output *output, int width, int height, int rate)
|
rdp_insert_new_mode(struct weston_output *output, int width, int height, int rate)
|
||||||
{
|
{
|
||||||
struct weston_mode *ret;
|
struct weston_mode *ret;
|
||||||
ret = zalloc(sizeof *ret);
|
ret = xzalloc(sizeof *ret);
|
||||||
if (!ret)
|
|
||||||
return NULL;
|
|
||||||
ret->width = width;
|
ret->width = width;
|
||||||
ret->height = height;
|
ret->height = height;
|
||||||
ret->refresh = rate;
|
ret->refresh = rate;
|
||||||
@ -365,11 +363,6 @@ rdp_switch_mode(struct weston_output *output, struct weston_mode *target_mode)
|
|||||||
assert(output);
|
assert(output);
|
||||||
|
|
||||||
local_mode = ensure_matching_mode(output, target_mode);
|
local_mode = ensure_matching_mode(output, target_mode);
|
||||||
if (!local_mode) {
|
|
||||||
rdp_debug(rdpBackend, "mode %dx%d not available\n", target_mode->width, target_mode->height);
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (local_mode == output->current_mode)
|
if (local_mode == output->current_mode)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -426,8 +419,6 @@ rdp_output_set_size(struct weston_output *base,
|
|||||||
initMode.height = height;
|
initMode.height = height;
|
||||||
initMode.refresh = rdpBackend->rdp_monitor_refresh_rate;
|
initMode.refresh = rdpBackend->rdp_monitor_refresh_rate;
|
||||||
currentMode = ensure_matching_mode(&output->base, &initMode);
|
currentMode = ensure_matching_mode(&output->base, &initMode);
|
||||||
if (!currentMode)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
output->base.current_mode = output->base.native_mode = currentMode;
|
output->base.current_mode = output->base.native_mode = currentMode;
|
||||||
|
|
||||||
@ -1020,10 +1011,6 @@ xf_peer_activate(freerdp_peer* client)
|
|||||||
new_mode.width = (int)settings->DesktopWidth;
|
new_mode.width = (int)settings->DesktopWidth;
|
||||||
new_mode.height = (int)settings->DesktopHeight;
|
new_mode.height = (int)settings->DesktopHeight;
|
||||||
target_mode = ensure_matching_mode(&output->base, &new_mode);
|
target_mode = ensure_matching_mode(&output->base, &new_mode);
|
||||||
if (!target_mode) {
|
|
||||||
weston_log("client mode not found\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
weston_output_mode_set_native(&output->base, target_mode, 1);
|
weston_output_mode_set_native(&output->base, target_mode, 1);
|
||||||
output->base.width = new_mode.width;
|
output->base.width = new_mode.width;
|
||||||
output->base.height = new_mode.height;
|
output->base.height = new_mode.height;
|
||||||
|
Loading…
Reference in New Issue
Block a user