Skip to content

Commit a9cbcc2

Browse files
committed
style: Exclude Dependencies/Utility compat headers from conversion
These files use space-based indentation inside #if blocks for platform-specific code. The script cannot reliably handle the interaction between preprocessor nesting and C++ nesting in these files, so they are excluded from conversion.
1 parent f26c2ab commit a9cbcc2

7 files changed

Lines changed: 100 additions & 100 deletions

File tree

Dependencies/Utility/Utility/atl_compat.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ extern "C" HRESULT WINAPI _ATL_DelegateQueryInterface(void* pv, REFIID riid, LPV
6666
// Define _Delegate implementation and macro now that ATL types are available
6767
inline HRESULT WINAPI _ATL_DelegateQueryInterface(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw)
6868
{
69-
IUnknown** ppunk = reinterpret_cast<IUnknown**>(reinterpret_cast<char*>(pv) + dw);
70-
if (*ppunk == nullptr)
71-
return E_NOINTERFACE;
72-
return (*ppunk)->QueryInterface(riid, ppv);
69+
IUnknown** ppunk = reinterpret_cast<IUnknown**>(reinterpret_cast<char*>(pv) + dw);
70+
if (*ppunk == nullptr)
71+
return E_NOINTERFACE;
72+
return (*ppunk)->QueryInterface(riid, ppv);
7373
}
7474

7575
#ifndef _Delegate

Dependencies/Utility/Utility/comsupp_compat.h

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -56,82 +56,82 @@ namespace _com_util
5656

5757
inline BSTR WINAPI ConvertStringToBSTR(const char *pSrc)
5858
{
59-
DWORD cwch;
60-
BSTR wsOut = nullptr;
61-
62-
if (!pSrc)
63-
return nullptr;
64-
65-
// Compute the needed size with the null terminator
66-
cwch = MultiByteToWideChar(CP_ACP, 0, pSrc, -1, nullptr, 0);
67-
if (cwch == 0)
68-
return nullptr;
69-
70-
// Allocate the BSTR (without the null terminator)
71-
wsOut = SysAllocStringLen(nullptr, cwch - 1);
72-
if (!wsOut)
73-
{
74-
_com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY));
75-
return nullptr;
76-
}
77-
78-
// Convert the string
79-
if (MultiByteToWideChar(CP_ACP, 0, pSrc, -1, wsOut, cwch) == 0)
80-
{
81-
// We failed, clean everything up
82-
cwch = GetLastError();
83-
84-
SysFreeString(wsOut);
85-
wsOut = nullptr;
86-
87-
_com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch);
88-
}
89-
90-
return wsOut;
59+
DWORD cwch;
60+
BSTR wsOut = nullptr;
61+
62+
if (!pSrc)
63+
return nullptr;
64+
65+
// Compute the needed size with the null terminator
66+
cwch = MultiByteToWideChar(CP_ACP, 0, pSrc, -1, nullptr, 0);
67+
if (cwch == 0)
68+
return nullptr;
69+
70+
// Allocate the BSTR (without the null terminator)
71+
wsOut = SysAllocStringLen(nullptr, cwch - 1);
72+
if (!wsOut)
73+
{
74+
_com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY));
75+
return nullptr;
76+
}
77+
78+
// Convert the string
79+
if (MultiByteToWideChar(CP_ACP, 0, pSrc, -1, wsOut, cwch) == 0)
80+
{
81+
// We failed, clean everything up
82+
cwch = GetLastError();
83+
84+
SysFreeString(wsOut);
85+
wsOut = nullptr;
86+
87+
_com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch);
88+
}
89+
90+
return wsOut;
9191
}
9292

9393
inline char* WINAPI ConvertBSTRToString(BSTR pSrc)
9494
{
95-
DWORD cb, cwch;
96-
char *szOut = nullptr;
97-
98-
if (!pSrc)
99-
return nullptr;
100-
101-
// Retrieve the size of the BSTR with the null terminator
102-
cwch = SysStringLen(pSrc) + 1;
103-
104-
// Compute the needed size with the null terminator
105-
cb = WideCharToMultiByte(CP_ACP, 0, pSrc, cwch, nullptr, 0, nullptr, nullptr);
106-
if (cb == 0)
107-
{
108-
cwch = GetLastError();
109-
_com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch);
110-
return nullptr;
111-
}
112-
113-
// Allocate the string
114-
szOut = (char*)::operator new(cb * sizeof(char));
115-
if (!szOut)
116-
{
117-
_com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY));
118-
return nullptr;
119-
}
120-
121-
// Convert the string and null-terminate
122-
szOut[cb - 1] = '\0';
123-
if (WideCharToMultiByte(CP_ACP, 0, pSrc, cwch, szOut, cb, nullptr, nullptr) == 0)
124-
{
125-
// We failed, clean everything up
126-
cwch = GetLastError();
127-
128-
::operator delete(szOut);
129-
szOut = nullptr;
130-
131-
_com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch);
132-
}
133-
134-
return szOut;
95+
DWORD cb, cwch;
96+
char *szOut = nullptr;
97+
98+
if (!pSrc)
99+
return nullptr;
100+
101+
// Retrieve the size of the BSTR with the null terminator
102+
cwch = SysStringLen(pSrc) + 1;
103+
104+
// Compute the needed size with the null terminator
105+
cb = WideCharToMultiByte(CP_ACP, 0, pSrc, cwch, nullptr, 0, nullptr, nullptr);
106+
if (cb == 0)
107+
{
108+
cwch = GetLastError();
109+
_com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch);
110+
return nullptr;
111+
}
112+
113+
// Allocate the string
114+
szOut = (char*)::operator new(cb * sizeof(char));
115+
if (!szOut)
116+
{
117+
_com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY));
118+
return nullptr;
119+
}
120+
121+
// Convert the string and null-terminate
122+
szOut[cb - 1] = '\0';
123+
if (WideCharToMultiByte(CP_ACP, 0, pSrc, cwch, szOut, cb, nullptr, nullptr) == 0)
124+
{
125+
// We failed, clean everything up
126+
cwch = GetLastError();
127+
128+
::operator delete(szOut);
129+
szOut = nullptr;
130+
131+
_com_issue_error(!IS_ERROR(cwch) ? HRESULT_FROM_WIN32(cwch) : cwch);
132+
}
133+
134+
return szOut;
135135
}
136136

137137
}

Dependencies/Utility/Utility/intrin_compat.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ static inline __int64 _rdtsc()
3939
mov [l],eax
4040
}
4141

42-
__int64 result ((__int64)h << 32 | l);
43-
return result;
42+
__int64 result ((__int64)h << 32 | l);
43+
return result;
4444
}
4545
#endif //_rdtsc
4646

@@ -75,10 +75,10 @@ static inline __int64 _rdtsc()
7575
static inline uint32_t _lrotl(uint32_t value, int shift)
7676
{
7777
#if defined(__has_builtin) && __has_builtin(__builtin_rotateleft32)
78-
return __builtin_rotateleft32(value, shift);
78+
return __builtin_rotateleft32(value, shift);
7979
#else
80-
shift &= 31;
81-
return ((value << shift) | (value >> (32 - shift)));
80+
shift &= 31;
81+
return ((value << shift) | (value >> (32 - shift)));
8282
#endif
8383
}
8484
#endif
@@ -93,11 +93,11 @@ static inline uint32_t _lrotl(uint32_t value, int shift)
9393
static inline uint64_t _rdtsc()
9494
{
9595
#ifdef _WIN32
96-
return __rdtsc();
96+
return __rdtsc();
9797
#elif defined(__has_builtin) && __has_builtin(__builtin_readcyclecounter)
98-
return __builtin_readcyclecounter();
98+
return __builtin_readcyclecounter();
9999
#elif defined(__has_builtin) && __has_builtin(__builtin_ia32_rdtsc)
100-
return __builtin_ia32_rdtsc();
100+
return __builtin_ia32_rdtsc();
101101
#else
102102
#error "No implementation for _rdtsc"
103103
#endif
@@ -111,7 +111,7 @@ static inline uint64_t _rdtsc()
111111
#if __has_builtin(__builtin_return_address)
112112
static inline uintptr_t _ReturnAddress()
113113
{
114-
return reinterpret_cast<uintptr_t>(__builtin_return_address(0));
114+
return reinterpret_cast<uintptr_t>(__builtin_return_address(0));
115115
}
116116
#else
117117
#error "No implementation for _ReturnAddress"

Dependencies/Utility/Utility/iostream_adapter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ using ostream = std::ostream;
3838
template <class _Elem, class _Traits>
3939
std::basic_ostream<_Elem, _Traits>& endl(std::basic_ostream<_Elem, _Traits>& _Ostr)
4040
{
41-
return std::endl(_Ostr);
41+
return std::endl(_Ostr);
4242
}
4343

4444
template <class _Elem, class _Traits>
4545
std::basic_ostream<_Elem, _Traits>& flush(std::basic_ostream<_Elem, _Traits>& _Ostr)
4646
{
47-
return std::flush(_Ostr);
47+
return std::flush(_Ostr);
4848
}
4949

5050
#endif

Dependencies/Utility/Utility/string_compat.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ typedef char* LPSTR;
2525

2626
// String functions
2727
inline char *_strlwr(char *str) {
28-
for (int i = 0; str[i] != '\0'; i++) {
29-
str[i] = tolower(str[i]);
30-
}
31-
return str;
28+
for (int i = 0; str[i] != '\0'; i++) {
29+
str[i] = tolower(str[i]);
30+
}
31+
return str;
3232
}
3333

3434
#define strlwr _strlwr

Dependencies/Utility/Utility/thread_compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
inline int GetCurrentThreadId()
2525
{
26-
return pthread_self();
26+
return pthread_self();
2727
}
2828

2929
inline void Sleep(int ms)
3030
{
31-
usleep(ms * 1000);
31+
usleep(ms * 1000);
3232
}
3333

Dependencies/Utility/Utility/time_compat.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ static inline MMRESULT timeEndPeriod(int) { return TIMERR_NOERROR; }
2727

2828
inline unsigned int timeGetTime()
2929
{
30-
struct timespec ts;
31-
clock_gettime(CLOCK_BOOTTIME, &ts);
32-
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
30+
struct timespec ts;
31+
clock_gettime(CLOCK_BOOTTIME, &ts);
32+
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
3333
}
3434
inline unsigned int GetTickCount()
3535
{
36-
struct timespec ts;
37-
clock_gettime(CLOCK_MONOTONIC, &ts);
38-
// Return ms since boot
39-
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
36+
struct timespec ts;
37+
clock_gettime(CLOCK_MONOTONIC, &ts);
38+
// Return ms since boot
39+
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
4040
}
4141

0 commit comments

Comments
 (0)