Skip to content

Commit 541009c

Browse files
committed
chore: adapt to MSVC
1 parent a254c8f commit 541009c

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

base16384.h

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
#include <stdint.h>
2424
#include <stdio.h>
2525
#endif
26+
#ifdef _MSC_VER
27+
#include <BaseTsd.h>
28+
#ifndef ssize_t
29+
typedef SSIZE_T ssize_t;
30+
#endif
31+
#endif
2632

2733
enum base16384_err_t {
2834
base16384_err_ok,
@@ -59,20 +65,6 @@ typedef enum base16384_err_t base16384_err_t;
5965
// forcely do sumcheck without checking data length
6066
#define BASE16384_FLAG_DO_SUM_CHECK_FORCELY (1<<2)
6167

62-
#ifdef _MSC_VER
63-
#include <BaseTsd.h>
64-
#endif
65-
66-
#ifdef _MSC_VER
67-
/**
68-
* @brief custom reader function interface
69-
* @param client_data the data pointer defined by the client
70-
* @param buffer to where put data
71-
* @param count read bytes count
72-
* @return the size read
73-
*/
74-
typedef SSIZE_T (*base16384_reader_t)(const void *client_data, void *buffer, size_t count);
75-
#else
7668
/**
7769
* @brief custom reader function interface
7870
* @param client_data the data pointer defined by the client
@@ -81,18 +73,7 @@ typedef SSIZE_T (*base16384_reader_t)(const void *client_data, void *buffer, siz
8173
* @return the size read
8274
*/
8375
typedef ssize_t (*base16384_reader_t)(const void *client_data, void *buffer, size_t count);
84-
#endif
8576

86-
#ifdef _MSC_VER
87-
/**
88-
* @brief custom writer function interface
89-
* @param client_data the data pointer defined by the client
90-
* @param buffer from where read data
91-
* @param count write bytes count
92-
* @return the size written
93-
*/
94-
typedef SSIZE_T (*base16384_writer_t)(const void *client_data, const void *buffer, size_t count);
95-
#else
9677
/**
9778
* @brief custom writer function interface
9879
* @param client_data the data pointer defined by the client
@@ -101,7 +82,6 @@ typedef SSIZE_T (*base16384_writer_t)(const void *client_data, const void *buffe
10182
* @return the size written
10283
*/
10384
typedef ssize_t (*base16384_writer_t)(const void *client_data, const void *buffer, size_t count);
104-
#endif
10585

10686
union base16384_io_function_t {
10787
base16384_reader_t reader;

0 commit comments

Comments
 (0)