From caf9fe0130c7c98297e803f74e203b06c0c1d37b Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sat, 25 Jan 2020 15:39:23 +0000 Subject: [PATCH] Remove unused code --- include/util.h | 37 ------------------------------------ meson.build | 1 - src/server.c | 1 - src/util.c | 51 -------------------------------------------------- src/zrle.c | 1 - 5 files changed, 91 deletions(-) delete mode 100644 include/util.h delete mode 100644 src/util.c diff --git a/include/util.h b/include/util.h deleted file mode 100644 index 0e073dc..0000000 --- a/include/util.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2019 Andri Yngvason - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#pragma once - -#include -#include - -struct rfb_pixel_format; - -struct vnc_write_request { - uv_write_t request; - uv_write_cb on_done; - uv_buf_t buffer; - void* userdata; -}; - -int vnc__write(uv_stream_t* stream, const void* payload, size_t size, - uv_write_cb on_done); - -int vnc__write2(uv_stream_t* stream, const void* payload, size_t size, - uv_write_cb on_done, void* userdata); - -int rfb_pixfmt_from_fourcc(struct rfb_pixel_format* dst, uint32_t src); diff --git a/meson.build b/meson.build index 4370cba..acd374f 100644 --- a/meson.build +++ b/meson.build @@ -42,7 +42,6 @@ inc = include_directories('include', 'contrib/miniz') sources = [ 'src/server.c', - 'src/util.c', 'src/vec.c', 'src/zrle.c', 'src/raw-encoding.c', diff --git a/src/server.c b/src/server.c index 72a3e7b..cf54dad 100644 --- a/src/server.c +++ b/src/server.c @@ -15,7 +15,6 @@ */ #include "rfb-proto.h" -#include "util.h" #include "zrle.h" #include "tight.h" #include "raw-encoding.h" diff --git a/src/util.c b/src/util.c deleted file mode 100644 index 0e9cdc3..0000000 --- a/src/util.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2019 Andri Yngvason - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#include "util.h" - -#include -#include -#include - -static void on_write_req_done(uv_write_t* req, int status) -{ - struct vnc_write_request* self = (struct vnc_write_request*)req; - if (self->on_done) - self->on_done(req, status); - free(self); -} - -int vnc__write2(uv_stream_t* stream, const void* payload, size_t size, - uv_write_cb on_done, void* userdata) -{ - struct vnc_write_request* req = calloc(1, sizeof(*req)); - if (!req) - return -1; - - req->buffer.base = (char*)payload; - req->buffer.len = size; - req->on_done = on_done; - req->userdata = userdata; - - return uv_write(&req->request, stream, &req->buffer, 1, - on_write_req_done); -} - -int vnc__write(uv_stream_t* stream, const void* payload, size_t size, - uv_write_cb on_done) -{ - return vnc__write2(stream, payload, size, on_done, NULL); -} diff --git a/src/zrle.c b/src/zrle.c index 30c623e..aeb9a42 100644 --- a/src/zrle.c +++ b/src/zrle.c @@ -15,7 +15,6 @@ */ #include "rfb-proto.h" -#include "util.h" #include "vec.h" #include "zrle.h" #include "miniz.h"