From a254c8f9d6abd248775adfd1c33b7f7d00c6068b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 7 Apr 2024 21:17:14 +0900 Subject: [PATCH] chore: adapt to MSVC --- base16384.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/base16384.h b/base16384.h index 6cb1270..10addcc 100644 --- a/base16384.h +++ b/base16384.h @@ -61,11 +61,18 @@ typedef enum base16384_err_t base16384_err_t; #ifdef _MSC_VER #include -#ifndef ssize_t - #define SSIZE_T ssize_t; -#endif #endif +#ifdef _MSC_VER +/** + * @brief custom reader function interface + * @param client_data the data pointer defined by the client + * @param buffer to where put data + * @param count read bytes count + * @return the size read +*/ +typedef SSIZE_T (*base16384_reader_t)(const void *client_data, void *buffer, size_t count); +#else /** * @brief custom reader function interface * @param client_data the data pointer defined by the client @@ -74,7 +81,18 @@ typedef enum base16384_err_t base16384_err_t; * @return the size read */ typedef ssize_t (*base16384_reader_t)(const void *client_data, void *buffer, size_t count); +#endif +#ifdef _MSC_VER +/** + * @brief custom writer function interface + * @param client_data the data pointer defined by the client + * @param buffer from where read data + * @param count write bytes count + * @return the size written +*/ +typedef SSIZE_T (*base16384_writer_t)(const void *client_data, const void *buffer, size_t count); +#else /** * @brief custom writer function interface * @param client_data the data pointer defined by the client @@ -83,11 +101,6 @@ typedef ssize_t (*base16384_reader_t)(const void *client_data, void *buffer, siz * @return the size written */ typedef ssize_t (*base16384_writer_t)(const void *client_data, const void *buffer, size_t count); - -#ifdef _MSC_VER -#ifdef ssize_t - #undef ssize_t -#endif #endif union base16384_io_function_t {