mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-13 22:50:19 +02:00
Add missing platform detection in examples/test
This commit is contained in:
@@ -71,7 +71,11 @@ void unpack(receiver* r) {
|
||||
while (true) {
|
||||
recv_len = receiver_to_unpacker(r, EACH_RECV_SIZE, unp);
|
||||
if (recv_len == 0) break; // (reached end of input)
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
printf("receive count: %d %Id bytes received.\n", recv_count++, recv_len);
|
||||
#else // defined(_MSC_VER) || defined(__MINGW32__)
|
||||
printf("receive count: %d %zd bytes received.\n", recv_count++, recv_len);
|
||||
#endif // defined(_MSC_VER) || defined(__MINGW32__)
|
||||
ret = msgpack_unpacker_next(unp, &result);
|
||||
while (ret == MSGPACK_UNPACK_SUCCESS) {
|
||||
msgpack_object obj = result.data;
|
||||
|
@@ -16,6 +16,12 @@
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#define pipe(fds) _pipe(fds, 4096, _O_BINARY)
|
||||
#endif // _MSC_VER || __MINGW32__
|
||||
|
||||
class Server {
|
||||
public:
|
||||
Server(int sock) : m_sock(sock) { }
|
||||
|
@@ -11,11 +11,11 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define msgpack_rand() ((double)rand() / RAND_MAX)
|
||||
#else // _MSC_VER
|
||||
#else // _MSC_VER || __MINGW32__
|
||||
#define msgpack_rand() drand48()
|
||||
#endif // _MSC_VER
|
||||
#endif // _MSC_VER || __MINGW32__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
@@ -6,11 +6,11 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define msgpack_rand() ((double)rand() / RAND_MAX)
|
||||
#else // _MSC_VER
|
||||
#else // _MSC_VER || __MINGW32__
|
||||
#define msgpack_rand() drand48()
|
||||
#endif // _MSC_VER
|
||||
#endif // _MSC_VER || __MINGW32__
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
Reference in New Issue
Block a user