From 3274a3b4d8b8b0a09ae69875a888442d78d4ef67 Mon Sep 17 00:00:00 2001 From: levalup Date: Sun, 30 Jun 2024 21:27:04 +0800 Subject: [PATCH] fix type wrong. format python file. add `this->` to improve code readability. --- CHANGELOG.md | 2 +- include/uvcxx/stream.h | 16 ++++++++-------- scripts/merge.py | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3583859..a0f6c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ - `fs_event` start return `callback`. - `fs_poll` start return `callback`. - `poll` start return `callback`. - - `stream` listen return `callback`. + - `stream` listen return `callback<>`. - Handle status issue with `except(...)`. -------------------------------- diff --git a/include/uvcxx/stream.h b/include/uvcxx/stream.h index cfad8d6..d599f33 100644 --- a/include/uvcxx/stream.h +++ b/include/uvcxx/stream.h @@ -95,14 +95,14 @@ namespace uv { UVCXX_NODISCARD uvcxx::promise<> write(const write_t &req, uvcxx::buffer buf) { - return write(req, &buf.buf, 1); + return this->write(req, &buf.buf, 1); } UVCXX_NODISCARD uvcxx::promise<> write(const write_t &req, std::initializer_list bufs) { std::vector buffers; for (auto &buf: bufs) { buffers.emplace_back(buf.buf); } - return write(req, buffers.data(), (unsigned int) buffers.size()); + return this->write(req, buffers.data(), (unsigned int) buffers.size()); } UVCXX_NODISCARD @@ -112,14 +112,14 @@ namespace uv { UVCXX_NODISCARD uvcxx::promise<> write(uvcxx::buffer buf) { - return write(&buf.buf, 1); + return this->write(&buf.buf, 1); } UVCXX_NODISCARD uvcxx::promise<> write(std::initializer_list bufs) { std::vector buffers; for (auto &buf: bufs) { buffers.emplace_back(buf.buf); } - return write(buffers.data(), (unsigned int) buffers.size()); + return this->write(buffers.data(), (unsigned int) buffers.size()); } UVCXX_NODISCARD @@ -131,7 +131,7 @@ namespace uv { UVCXX_NODISCARD uvcxx::promise<> write2(const write_t &req, uvcxx::mutable_buffer buf, const stream_t &send_handle) { - return write2(req, &buf.buf, 1, send_handle); + return this->write2(req, &buf.buf, 1, send_handle); } UVCXX_NODISCARD @@ -139,7 +139,7 @@ namespace uv { std::initializer_list bufs, const stream_t &send_handle) { std::vector buffers; for (auto &buf: bufs) { buffers.emplace_back(buf.buf); } - return write2(req, buffers.data(), (unsigned int) buffers.size(), send_handle); + return this->write2(req, buffers.data(), (unsigned int) buffers.size(), send_handle); } UVCXX_NODISCARD @@ -149,14 +149,14 @@ namespace uv { UVCXX_NODISCARD uvcxx::promise<> write2(uvcxx::mutable_buffer buf, const stream_t &send_handle) { - return write2(&buf.buf, 1, send_handle); + return this->write2(&buf.buf, 1, send_handle); } UVCXX_NODISCARD uvcxx::promise<> write2(std::initializer_list bufs, const stream_t &send_handle) { std::vector buffers; for (auto &buf: bufs) { buffers.emplace_back(buf.buf); } - return write2(buffers.data(), (unsigned int) buffers.size(), send_handle); + return this->write2(buffers.data(), (unsigned int) buffers.size(), send_handle); } int try_write(const uv_buf_t bufs[], unsigned int nbufs) { diff --git a/scripts/merge.py b/scripts/merge.py index 9121196..e1b0c2d 100644 --- a/scripts/merge.py +++ b/scripts/merge.py @@ -282,6 +282,7 @@ def comment_license(lic: str) -> List[str]: */ """ + def merge_header() -> str: macro_control = 'UVCXX_H' version_control_header = 'uvcxx/cxx/version.h'