From 51d061e9aa02f0e36c07ab69e8d48d926683d3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Mon, 25 Jan 2021 17:31:24 +0100 Subject: [PATCH] minor lint fixes. --- internal/api/room/screen.go | 14 +++++++------- internal/desktop/xorg/xorg.go | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/api/room/screen.go b/internal/api/room/screen.go index 9003f422..be6bf2dc 100644 --- a/internal/api/room/screen.go +++ b/internal/api/room/screen.go @@ -77,17 +77,17 @@ func (h *RoomHandler) screenConfigurationsList(w http.ResponseWriter, r *http.Re } func (h *RoomHandler) screenShotGet(w http.ResponseWriter, r *http.Request) { - var options *jpeg.Options - if quality, err := strconv.Atoi(r.URL.Query().Get("quality")); err == nil { - options = &jpeg.Options{ quality } - } else { - options = &jpeg.Options{ 90 } + quality, err := strconv.Atoi(r.URL.Query().Get("quality")) + if err != nil { + quality = 90 } img := h.desktop.GetScreenshotImage() out := new(bytes.Buffer) - err := jpeg.Encode(out, img, options) - if err != nil { + + if err := jpeg.Encode(out, img, &jpeg.Options{ + Quality: quality, + }); err != nil { utils.HttpInternalServerError(w, err) return } diff --git a/internal/desktop/xorg/xorg.go b/internal/desktop/xorg/xorg.go index f2677f24..bc41b0e9 100644 --- a/internal/desktop/xorg/xorg.go +++ b/internal/desktop/xorg/xorg.go @@ -229,8 +229,7 @@ func GetCursorImage() *types.CursorImage { mu.Lock() defer mu.Unlock() - var cur *C.XFixesCursorImage - cur = C.XGetCursorImage() + cur := C.XGetCursorImage() defer C.XFree(unsafe.Pointer(cur)) width := uint16(cur.width)