Skip to content

Commit e716b80

Browse files
committed
Removing a bunch of unnecessary defines in compat files.
1 parent 37b4002 commit e716b80

File tree

7 files changed

+20
-98
lines changed

7 files changed

+20
-98
lines changed

Release/include/compat/apple_compat.h

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2222
****/
2323

24-
2524
#pragma once
25+
2626
#include <cstdint>
2727
#include <string>
2828
#include <sstream>
@@ -38,51 +38,16 @@
3838
#define __declspec(x) __attribute__ ((x))
3939
#define __export __attribute__ ((dllexport))
4040
#define __stdcall __attribute__ ((stdcall))
41-
#define STDMETHODCALLTYPE __export __stdcall
41+
#define STDMETHODCALLTYPE __export __stdcall // TODO remove on Linux...
4242

4343
// ignore these:
4444
#define dllimport
4545

46-
// OpenProt defines
47-
#define _SH_DENYRW 0x20
48-
4946
#include <stdint.h>
5047

5148
#define __assume(x) do { if (!(x)) __builtin_unreachable(); } while (false)
5249

53-
typedef uint32_t HRESULT;
54-
55-
#define SOCKET int
56-
#define SOCKET_ERROR -1
57-
58-
#define S_OK 0
59-
#define S_FALSE 1
60-
#define STG_E_CANTSAVE 0x80030103
61-
#define STG_E_INVALIDPOINTER 0x80030009
62-
#define E_NOTIMPL 0x80004001
63-
#define E_NOINTERFACE 0x80004002
64-
65-
typedef unsigned long ULONG;
66-
typedef unsigned short WORD;
67-
typedef unsigned long DWORD;
68-
69-
typedef struct _SYSTEMTIME {
70-
WORD wYear;
71-
WORD wMonth;
72-
WORD wDayOfWeek;
73-
WORD wDay;
74-
WORD wHour;
75-
WORD wMinute;
76-
WORD wSecond;
77-
WORD wMilliseconds;
78-
} SYSTEMTIME, *PSYSTEMTIME;
79-
80-
#define ULARGE_INTEGER uint64_t
81-
#define LARGE_INTEGER int64_t
82-
83-
#define WINAPI __stdcall
84-
85-
#define YieldProcessor() __asm__ __volatile__ ("pause")
50+
#define WINAPI __stdcall // TODO
8651

8752
#define CASABLANCA_UNREFERENCED_PARAMETER(x) (void)x
8853
#define _ASSERTE(x) assert(x)
@@ -102,6 +67,3 @@ typedef std::basic_ostringstream<char16_t> utf16ostringstream;
10267
typedef std::basic_ostream<char16_t> utf16ostream;
10368
typedef std::basic_istream<char16_t> utf16istream;
10469
typedef std::basic_istringstream<char16_t> utf16istringstream;
105-
106-
#include "compat/SafeInt3.hpp"
107-
typedef SafeInt<size_t> SafeSize;

Release/include/compat/linux_compat.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,12 @@
4444
#define cdecl
4545
#endif
4646

47-
// OpenProt defines
48-
#define _SH_DENYRW 0x20
49-
5047
#include <stdint.h>
5148

5249
#define __assume(x) do { if (!(x)) __builtin_unreachable(); } while (false)
5350

54-
typedef uint32_t HRESULT;
55-
56-
#define SOCKET int
57-
#define SOCKET_ERROR -1
58-
59-
#define S_OK 0
60-
#define S_FALSE 1
61-
#define STG_E_CANTSAVE 0x80030103
62-
#define STG_E_INVALIDPOINTER 0x80030009
63-
#define E_NOTIMPL 0x80004001
64-
#define E_NOINTERFACE 0x80004002
65-
66-
#define ULARGE_INTEGER uint64_t
67-
#define LARGE_INTEGER int64_t
68-
6951
#define WINAPI __stdcall
7052

71-
#define YieldProcessor() __asm__ __volatile__ ("pause")
72-
7353
#define CASABLANCA_UNREFERENCED_PARAMETER(x) (void)x
7454
#define _ASSERTE(x) assert(x)
7555

@@ -89,6 +69,3 @@ typedef std::basic_ostream<char16_t> utf16ostream;
8969
typedef std::basic_istream<char16_t> utf16istream;
9070
typedef std::basic_istringstream<char16_t> utf16istringstream;
9171

92-
#include "compat/SafeInt3.hpp"
93-
typedef SafeInt<size_t> SafeSize;
94-

Release/include/compat/windows_compat.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
****/
2727
#pragma once
2828

29-
#include "compat\safeint3.hpp"
3029
#include <string>
3130

3231
#if _MSC_VER >= 1700
@@ -52,12 +51,4 @@ typedef std::wstringstream utf16stringstream;
5251
typedef std::wostringstream utf16ostringstream;
5352
typedef std::wostream utf16ostream;
5453
typedef std::wistream utf16istream;
55-
typedef std::wistringstream utf16istringstream;
56-
57-
#define _XPLATSTR(x) L ## x
58-
59-
#ifndef _TURN_OFF_PLATFORM_STRING
60-
#define U(x) _XPLATSTR(x)
61-
#endif // !_TURN_OFF_PLATFORM_STRING
62-
63-
typedef SafeInt<size_t> SafeSize;
54+
typedef std::wistringstream utf16istringstream;

Release/include/cpprest/basic_types.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#include <cstdint>
4141
#endif
4242

43+
#include "compat/SafeInt3.hpp"
44+
typedef SafeInt<size_t> SafeSize;
45+
4346
namespace utility
4447
{
4548

@@ -51,6 +54,10 @@ namespace utility
5154
// not involve specifying the size of a memory allocation or buffer.
5255
typedef uint64_t size64_t;
5356

57+
#ifndef _MS_WINDOWS
58+
typedef uint32_t HRESULT; // Needed for PPLX
59+
#endif
60+
5461
#ifdef _UTF16_STRINGS
5562
//
5663
// On Windows, all strings are wide

Release/include/cpprest/containerstream.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ namespace Concurrency { namespace streams {
6565
namespace details {
6666

6767
/// <summary>
68-
/// The basic_container_buffer class serves as a memory-based steam buffer that supports writing or reading
68+
/// The basic_container_buffer class serves as a memory-based steam buffer that supports writing or reading
6969
/// sequences of characters.
70-
/// The class itself should not be used in application code, it is used by the stream definitions farther down in the header file.
70+
/// The class itself should not be used in application code, it is used by the stream definitions farther down in the header file.
7171
/// </summary>
72-
/// <remarks> When closed, neither writing nor reading is supported any longer. <c>basic_container_buffer</c> does not support simultaneous use of the buffer
73-
/// for reading and writing.</remarks>
72+
/// <remarks> When closed, neither writing nor reading is supported any longer. <c>basic_container_buffer</c> does not support simultaneous use of the buffer
73+
/// for reading and writing.</remarks>
7474
template<typename _CollectionType>
7575
class basic_container_buffer : public streams::details::streambuf_state_manager<typename _CollectionType::value_type>
7676
{

Release/include/cpprest/http_client_impl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class _http_client_communicator
327327
// First see if client needs to be opened.
328328
auto error = open_if_required();
329329

330-
if (error != S_OK)
330+
if (error != 0)
331331
{
332332
// Failed to open
333333
request->report_error(error, _XPLATSTR("Open failed"));
@@ -343,18 +343,18 @@ class _http_client_communicator
343343

344344
unsigned long open_if_required()
345345
{
346-
unsigned long error = S_OK;
346+
unsigned long error = 0;
347347

348-
if( !m_opened )
348+
if(!m_opened)
349349
{
350350
pplx::extensibility::scoped_critical_section_t l(m_open_lock);
351351

352352
// Check again with the lock held
353-
if ( !m_opened )
353+
if (!m_opened)
354354
{
355355
error = open();
356356

357-
if (error == S_OK)
357+
if (error == 0)
358358
{
359359
m_opened = true;
360360
}

Release/include/cpprest/xxpublic.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
// for UINT_PTR types used in winsock APIs
5050
#ifdef _MS_WINDOWS
5151
#include <BaseTsd.h>
52-
typedef UINT_PTR SOCKET;
5352
#endif
5453

5554
// for guids, used in comm.h
@@ -66,20 +65,6 @@ typedef UINT_PTR SOCKET;
6665

6766
#define UNREACHABLE __assume(0)
6867

69-
// for winhttp.h
70-
typedef void * HINTERNET;
71-
72-
// for file io (windows.h)
73-
typedef void * HANDLE;
74-
75-
#ifdef _MS_WINDOWS
76-
typedef void* FILE_HANDLE;
77-
#else
7868
#ifdef __clang__
7969
#include <cstdio>
8070
#endif
81-
typedef FILE* FILE_HANDLE;
82-
#endif
83-
84-
// for http client and others that use overlapped IO delegates (windef.h)
85-
#define CALLBACK __stdcall

0 commit comments

Comments
 (0)