Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: fix size of ssize_t #57

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions include/valkey/sds.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@

#define SDS_MAX_PREALLOC (1024*1024)
#ifdef _MSC_VER
typedef long long ssize_t;
#define SSIZE_MAX (LLONG_MAX >> 1)
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#ifdef _WIN64
#define SSIZE_MAX (_I64_MAX >> 1)
#else
#define SSIZE_MAX (_I32_MAX >> 1)
#endif
#ifndef __clang__
#define __attribute__(x)
#endif
Expand Down
3 changes: 2 additions & 1 deletion include/valkey/sockcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
#include <mstcpip.h>

#ifdef _MSC_VER
typedef long long ssize_t;
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#endif

/* Emulate the parts of the BSD socket API that we need (override the winsock signatures). */
Expand Down
3 changes: 2 additions & 1 deletion include/valkey/valkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
#ifndef _MSC_VER
#include <sys/time.h> /* for struct timeval */
#else
#include <basetsd.h>
struct timeval; /* forward declaration */
typedef long long ssize_t;
typedef SSIZE_T ssize_t;
#endif
#include <stdint.h> /* uintXX_t, etc */
#include "sds.h" /* for sds */
Expand Down
Loading