Skip to content

Commit 3cfe1e9

Browse files
Remove bulk disables of CA warnings.
1 parent 70ace17 commit 3cfe1e9

File tree

9 files changed

+146
-263
lines changed

9 files changed

+146
-263
lines changed

src/Servers/IIS/AspNetCoreModuleV2/CommonLib/EventTracing.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
#pragma once
55

66
#include <httptrace.h>
7-
8-
#pragma warning( push )
9-
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )
10-
117
#include "aspnetcore_event.h"
128

13-
#pragma warning( pop )
14-
159
template< class EVENT, typename ...Params >
1610
void RaiseEvent(IHttpTraceContext * pTraceContext,Params&&... params)
1711
{

src/Servers/IIS/AspNetCoreModuleV2/CommonLib/aspnetcore_event.h

Lines changed: 64 additions & 64 deletions
Large diffs are not rendered by default.

src/Servers/IIS/AspNetCoreModuleV2/IISLib/acache.cpp

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33

44
#include "precomp.h"
55

6-
#pragma warning( push )
7-
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )
8-
96
LONG ALLOC_CACHE_HANDLER::sm_nFillPattern = 0xACA50000;
107
HANDLE ALLOC_CACHE_HANDLER::sm_hHeap;
118

9+
#if defined(_MSC_VER)
10+
static_assert(_MSC_VER >= 1600, "This code requires MSVC 10 or later.");
11+
#else
12+
static_assert(false, "This code requires MSVC");
13+
#endif
14+
1215
//
1316
// This class is used to implement the free list. We cast the free'd
1417
// memory block to a FREE_LIST_HEADER*. The signature is used to guard against
@@ -33,19 +36,19 @@ class FREE_LIST_HEADER
3336
ALLOC_CACHE_HANDLER::ALLOC_CACHE_HANDLER(
3437
) : m_nThreshold(0),
3538
m_cbSize(0),
36-
m_pFreeLists(NULL),
39+
m_pFreeLists(nullptr),
3740
m_nTotal(0)
3841
{
3942
}
4043

4144
ALLOC_CACHE_HANDLER::~ALLOC_CACHE_HANDLER(
4245
)
4346
{
44-
if (m_pFreeLists != NULL)
47+
if (m_pFreeLists != nullptr)
4548
{
4649
CleanupLookaside();
4750
m_pFreeLists->Dispose();
48-
m_pFreeLists = NULL;
51+
m_pFreeLists = nullptr;
4952
}
5053
}
5154

@@ -140,7 +143,7 @@ VOID
140143
ALLOC_CACHE_HANDLER::StaticTerminate(
141144
)
142145
{
143-
sm_hHeap = NULL;
146+
sm_hHeap = nullptr;
144147
}
145148

146149
VOID
@@ -163,13 +166,12 @@ ALLOC_CACHE_HANDLER::CleanupLookaside(
163166
// memory must be 16 bytes aligned and currently it is 64.
164167
//
165168

166-
#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
167169
auto Predicate = [=] (SLIST_HEADER * pListHeader)
168170
{
169171
LONG NodesToDelete = QueryDepthSList( pListHeader );
170172

171173
PSLIST_ENTRY pl = InterlockedPopEntrySList(pListHeader);
172-
while ( pl != NULL && --NodesToDelete >= 0 )
174+
while ( pl != nullptr && --NodesToDelete >= 0 )
173175
{
174176
InterlockedDecrement( &m_nTotal);
175177

@@ -178,48 +180,22 @@ ALLOC_CACHE_HANDLER::CleanupLookaside(
178180
pl = InterlockedPopEntrySList(pListHeader);
179181
}
180182
};
181-
#else
182-
class Functor
183-
{
184-
public:
185-
explicit Functor(ALLOC_CACHE_HANDLER * pThis) : _pThis(pThis)
186-
{
187-
}
188-
void operator()(SLIST_HEADER * pListHeader)
189-
{
190-
PSLIST_ENTRY pl;
191-
LONG NodesToDelete = QueryDepthSList( pListHeader );
192-
193-
pl = InterlockedPopEntrySList( pListHeader );
194-
while ( pl != NULL && --NodesToDelete >= 0 )
195-
{
196-
InterlockedDecrement( &_pThis->m_nTotal);
197-
198-
::HeapFree( sm_hHeap, 0, pl );
199-
200-
pl = InterlockedPopEntrySList(pListHeader);
201-
}
202-
}
203-
private:
204-
ALLOC_CACHE_HANDLER * _pThis;
205-
} Predicate(this);
206-
#endif
207183

208184
m_pFreeLists ->ForEach(Predicate);
209185
}
210-
186+
211187
LPVOID
212188
ALLOC_CACHE_HANDLER::Alloc(
213189
)
214190
{
215-
LPVOID pMemory = NULL;
191+
LPVOID pMemory = nullptr;
216192

217193
if ( m_nThreshold > 0 )
218194
{
219195
SLIST_HEADER * pListHeader = m_pFreeLists ->GetLocal();
220196
pMemory = (LPVOID) InterlockedPopEntrySList(pListHeader); // get the real object
221197

222-
if (pMemory != NULL)
198+
if (pMemory != nullptr)
223199
{
224200
FREE_LIST_HEADER* pfl = static_cast<FREE_LIST_HEADER*>(pMemory);
225201
//
@@ -231,7 +207,7 @@ ALLOC_CACHE_HANDLER::Alloc(
231207
}
232208
}
233209

234-
if ( pMemory == NULL )
210+
if ( pMemory == nullptr )
235211
{
236212
//
237213
// No free entry. Need to alloc a new object.
@@ -240,7 +216,7 @@ ALLOC_CACHE_HANDLER::Alloc(
240216
0,
241217
m_cbSize );
242218

243-
if ( pMemory != NULL )
219+
if ( pMemory != nullptr )
244220
{
245221
//
246222
// Update counters.
@@ -249,7 +225,7 @@ ALLOC_CACHE_HANDLER::Alloc(
249225
}
250226
}
251227

252-
if ( pMemory == NULL )
228+
if ( pMemory == nullptr )
253229
{
254230
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
255231
}
@@ -261,7 +237,7 @@ ALLOC_CACHE_HANDLER::Alloc(
261237

262238
return pMemory;
263239
}
264-
240+
265241
VOID
266242
ALLOC_CACHE_HANDLER::Free(
267243
__in LPVOID pMemory
@@ -270,7 +246,7 @@ ALLOC_CACHE_HANDLER::Free(
270246
//
271247
// Assume that this is allocated using the Alloc() function.
272248
//
273-
DBG_ASSERT(NULL != pMemory);
249+
DBG_ASSERT(nullptr != pMemory);
274250

275251
//
276252
// Use a signature to check against double deletions.
@@ -339,7 +315,7 @@ Return Value:
339315
{
340316
DWORD Count = 0;
341317

342-
if (m_pFreeLists != NULL)
318+
if (m_pFreeLists != nullptr)
343319
{
344320
#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
345321
auto Predicate = [&Count] (SLIST_HEADER * pListHeader)
@@ -377,17 +353,17 @@ ALLOC_CACHE_HANDLER::IsPageheapEnabled(
377353
{
378354
BOOL fRet = FALSE;
379355
BOOL fLockedHeap = FALSE;
380-
HMODULE hModule = NULL;
381-
HANDLE hHeap = NULL;
382-
PROCESS_HEAP_ENTRY heapEntry = {0};
356+
HMODULE hModule = nullptr;
357+
HANDLE hHeap = nullptr;
358+
PROCESS_HEAP_ENTRY heapEntry = {};
383359

384360
//
385361
// If verifier.dll is loaded - we are running under app verifier == pageheap is enabled
386362
//
387363
hModule = GetModuleHandle( L"verifier.dll" );
388-
if ( hModule != NULL )
364+
if ( hModule != nullptr)
389365
{
390-
hModule = NULL;
366+
hModule = nullptr;
391367
fRet = TRUE;
392368
goto Finished;
393369
}
@@ -397,7 +373,7 @@ ALLOC_CACHE_HANDLER::IsPageheapEnabled(
397373
// otherwise HeapWalk turns off lookasides for a useful heap
398374
//
399375
hHeap = ::HeapCreate( 0, 0, 0 );
400-
if ( hHeap == NULL )
376+
if ( hHeap == nullptr )
401377
{
402378
fRet = FALSE;
403379
goto Finished;
@@ -435,10 +411,8 @@ ALLOC_CACHE_HANDLER::IsPageheapEnabled(
435411
if ( hHeap )
436412
{
437413
DBG_REQUIRE( ::HeapDestroy( hHeap ) );
438-
hHeap = NULL;
414+
hHeap = nullptr;
439415
}
440416

441417
return fRet;
442418
}
443-
444-
#pragma warning( pop )

src/Servers/IIS/AspNetCoreModuleV2/IISLib/buffer.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#include <crtdbg.h>
77
#include <CodeAnalysis/Warnings.h>
88

9-
#pragma warning( push )
10-
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )
11-
129
//
1310
// BUFFER_T class shouldn't be used directly. Use BUFFER specialization class instead.
1411
// The only BUFFER_T partners are STRU and STRA classes.
@@ -69,17 +66,17 @@ class BUFFER_T
6966
7067
--*/
7168
{
72-
_ASSERTE( NULL != pbInit );
69+
_ASSERTE(nullptr != pbInit );
7370
_ASSERTE( cbInit > 0 );
7471
}
7572

7673
~BUFFER_T()
7774
{
7875
if( IsHeapAllocated() )
7976
{
80-
_ASSERTE( NULL != m_pBuffer );
77+
_ASSERTE( nullptr != m_pBuffer );
8178
HeapFree( GetProcessHeap(), 0, m_pBuffer );
82-
m_pBuffer = NULL;
79+
m_pBuffer = nullptr;
8380
m_cbBuffer = 0;
8481
m_fHeapAllocated = false;
8582
}
@@ -155,7 +152,7 @@ class BUFFER_T
155152
pNewMem = HeapAlloc( GetProcessHeap(), dwHeapAllocFlags, cbNewSize );
156153
}
157154

158-
if( pNewMem == NULL )
155+
if( pNewMem == nullptr )
159156
{
160157
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
161158
return false;
@@ -272,5 +269,3 @@ C_ASSERT( sizeof(VOID*) <= sizeof(ULONGLONG) );
272269

273270
#define INLINE_BUFFER_INIT( _name ) \
274271
_name( (BYTE*)__aqw##_name, sizeof( __aqw##_name ) )
275-
276-
#pragma warning( pop )

src/Servers/IIS/AspNetCoreModuleV2/IISLib/percpu.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ PER_CPU<T>::Create(
9494
DWORD CacheLineSize = 0;
9595
DWORD ObjectCacheLineSize = 0;
9696
DWORD NumberOfProcessors = 0;
97-
PER_CPU<T> * pInstance = NULL;
97+
PER_CPU<T> * pInstance = nullptr;
9898

9999
hr = GetProcessorInformation(&CacheLineSize,
100100
&NumberOfProcessors);
@@ -124,7 +124,7 @@ PER_CPU<T>::Create(
124124
SIZE_T Size = CacheLineSize + NumberOfProcessors * ObjectCacheLineSize;
125125

126126
pInstance = (PER_CPU<T>*) _aligned_malloc(Size, CacheLineSize);
127-
if (pInstance == NULL)
127+
if (pInstance == nullptr)
128128
{
129129
hr = E_OUTOFMEMORY;
130130
goto Finished;
@@ -150,17 +150,17 @@ PER_CPU<T>::Create(
150150
}
151151

152152
*ppInstance = pInstance;
153-
pInstance = NULL;
153+
pInstance = nullptr;
154154

155155
Finished:
156156

157-
if (pInstance != NULL)
157+
if (pInstance != nullptr)
158158
{
159159
//
160160
// Free the instance without disposing it.
161161
//
162162
pInstance->Dispose();
163-
pInstance = NULL;
163+
pInstance = nullptr;
164164
}
165165

166166
return hr;

src/Servers/IIS/AspNetCoreModuleV2/IISLib/reftrace.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <windows.h>
55
#include "reftrace.h"
66

7-
87
PTRACE_LOG
98
CreateRefTraceLog(
109
IN LONG LogSize,
@@ -40,7 +39,6 @@ Return Value:
4039

4140
} // CreateRefTraceLog
4241

43-
4442
VOID
4543
DestroyRefTraceLog(
4644
IN PTRACE_LOG Log
@@ -66,7 +64,6 @@ Return Value:
6664

6765
} // DestroyRefTraceLog
6866

69-
7067
//
7168
// N.B. For RtlCaptureBacktrace() to work properly, the calling function
7269
// *must* be __cdecl, and must have a "normal" stack frame. So, we decorate
@@ -119,8 +116,6 @@ Return Value:
119116
} // WriteRefTraceLog
120117

121118

122-
123-
124119
LONG
125120
__cdecl
126121
WriteRefTraceLogEx(

0 commit comments

Comments
 (0)