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"