Browse Source

2 more winsock.h includes, also set PRIu64 for mingw

tags/v1.9.15
falkTX 4 years ago
parent
commit
a11c6995e4
2 changed files with 16 additions and 6 deletions
  1. +9
    -2
      windows/JackTypes_os.h
  2. +7
    -4
      windows/JackWinMutex.h

+ 9
- 2
windows/JackTypes_os.h View File

@@ -21,12 +21,19 @@
#ifndef __JackTypes_WIN32__ #ifndef __JackTypes_WIN32__
#define __JackTypes_WIN32__ #define __JackTypes_WIN32__


#ifdef __MINGW32__
#include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>


typedef ULONGLONG UInt64;
typedef ULONGLONG UInt64;
typedef UInt64 uint64_t; typedef UInt64 uint64_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef DWORD jack_tls_key;
typedef DWORD jack_tls_key;

#if defined(__MINGW32__)
#define PRIu64 "llu"
#endif


#endif #endif



+ 7
- 4
windows/JackWinMutex.h View File

@@ -23,6 +23,9 @@


#include "JackCompilerDeps.h" #include "JackCompilerDeps.h"
#include "JackException.h" #include "JackException.h"
#ifdef __MINGW32__
#include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>


@@ -71,13 +74,13 @@ class SERVER_EXPORT JackWinMutex


JackWinMutex(const char* name = NULL) JackWinMutex(const char* name = NULL)
{ {
// In recursive mode by default
// In recursive mode by default
if (name) { if (name) {
char buffer[MAX_PATH]; char buffer[MAX_PATH];
snprintf(buffer, sizeof(buffer), "%s_%s", "JackWinMutex", name); snprintf(buffer, sizeof(buffer), "%s_%s", "JackWinMutex", name);
fMutex = CreateMutex(NULL, FALSE, buffer);
} else {
fMutex = CreateMutex(NULL, FALSE, NULL);
fMutex = CreateMutex(NULL, FALSE, buffer);
} else {
fMutex = CreateMutex(NULL, FALSE, NULL);
} }


ThrowIf((fMutex == 0), JackException("JackWinMutex: could not init the mutex")); ThrowIf((fMutex == 0), JackException("JackWinMutex: could not init the mutex"));


Loading…
Cancel
Save