Skip to content

Commit 6f24305

Browse files
tamlin-mikeXottab-DUTY
authored andcommitted
More header cleaning, and a few compiler warnings squashed.
1 parent 8e1d0b1 commit 6f24305

23 files changed

+242
-235
lines changed

sdk/include/hxgrid/Interface/hxplatform.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#pragma once
32

43
#ifdef _XBOX
@@ -15,7 +14,13 @@
1514

1615
#else _WINDOWS_ANYWAY
1716

17+
// XXX: Perhaps requesting Windows 2000 functionality is a bit silly in 2016?
18+
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
19+
#ifdef _WIN32_WINNT
20+
#undef _WIN32_WINNT
21+
#endif
1822
#define _WIN32_WINNT 0x0500
23+
#endif
1924

2025
#include <windows.h>
2126

@@ -125,4 +130,4 @@ void __inline MessageBeep(DWORD d)
125130
}
126131
#endif _XBOX
127132

128-
#endif __cplusplus
133+
#endif __cplusplus

src/Common/Compiler.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#endif
88

99
#include "xr_impexp_macros.h"
10-
#include "inlining_macros.h"
10+
#include "xrCommon/inlining_macros.h"
1111

1212
#if defined(__GNUC__)
1313
#define XR_ASSUME(expr) if (expr){} else __builtin_unreachable()

src/Common/PlatformWindows.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define DIRECTINPUT_VERSION 0x0800 //
55

66
#ifndef _WIN32_WINNT
7+
// Request Windows XP functionality
78
#define _WIN32_WINNT 0x0501
89
#endif
910

src/Layers/xrRender/ParticleEffect.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ using namespace PS;
1212
const u32 PS::uDT_STEP = 33;
1313
const float PS::fDT_STEP = float(uDT_STEP) / 1000.f;
1414

15+
#ifdef _MSC_VER
16+
#pragma warning(disable : 4701) // " potentially uninitialized local variable" (magnitude_sse does initialize it)
17+
#endif
18+
1519
static void ApplyTexgen(const Fmatrix& mVP)
1620
{
1721
Fmatrix mTexgen;

src/Layers/xrRender/VertexCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#ifndef VERTEX_CACHE_H
33
#define VERTEX_CACHE_H
4-
#include"Common/inlining_macros.h"
4+
#include"xrCommon/inlining_macros.h"
55
#include"xrCore/_types.h"
66
#include"xrCore/_stl_extensions.h"
77

src/Layers/xrRender/r__dsgraph_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class doug_lea_alloc
4040
{
4141
return (T*)g_render_allocator.malloc_impl(sizeof(T) * (u32)n);
4242
}
43-
void deallocate(pointer p, size_type n) const { g_render_allocator.free_impl((void*&)p); }
43+
void deallocate(pointer p, size_type) const { g_render_allocator.free_impl((void*&)p); }
4444
void deallocate(void* p, size_type n) const { g_render_allocator.free_impl(p); }
4545
char* __charalloc(size_type n) { return (char*)allocate(n); }
4646
void construct(pointer p, const T& _Val) { new(p) T(_Val); }

src/Layers/xrRender/xrRender_console.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,14 @@ class CCC_RestoreQuadIBData : public IConsole_Command
286286
{
287287
public:
288288
CCC_RestoreQuadIBData(LPCSTR N) : IConsole_Command(N){};
289-
virtual void Execute(LPCSTR args) { RCache.RestoreQuadIBData(); }
289+
virtual void Execute(LPCSTR /*args*/) { RCache.RestoreQuadIBData(); }
290290
};
291291

292292
class CCC_ModelPoolStat : public IConsole_Command
293293
{
294294
public:
295295
CCC_ModelPoolStat(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = TRUE; };
296-
virtual void Execute(LPCSTR args) { RImplementation.Models->dump(); }
296+
virtual void Execute(LPCSTR /*args*/) { RImplementation.Models->dump(); }
297297
};
298298

299299
class CCC_SSAO_Mode : public CCC_Token
@@ -383,7 +383,7 @@ class CCC_memory_stats : public IConsole_Command
383383
protected:
384384
public:
385385
CCC_memory_stats(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = true; };
386-
virtual void Execute(LPCSTR args)
386+
virtual void Execute(LPCSTR /*args*/)
387387
{
388388
u32 m_base = 0;
389389
u32 c_base = 0;
@@ -434,7 +434,7 @@ class CCC_BuildSSA : public IConsole_Command
434434
{
435435
public:
436436
CCC_BuildSSA(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = TRUE; };
437-
virtual void Execute(LPCSTR args)
437+
virtual void Execute(LPCSTR /*args*/)
438438
{
439439
#if !defined(USE_DX10) && !defined(USE_DX11)
440440
// TODO: DX10: Implement pixel calculator
@@ -470,7 +470,7 @@ class CCC_DofFar : public CCC_Float
470470
}
471471

472472
// CCC_Dof should save all data as well as load from config
473-
virtual void Save(IWriter* F) { ; }
473+
virtual void Save(IWriter* /*F*/) { ; }
474474
};
475475

476476
class CCC_DofNear : public CCC_Float
@@ -498,7 +498,7 @@ class CCC_DofNear : public CCC_Float
498498
}
499499

500500
// CCC_Dof should save all data as well as load from config
501-
virtual void Save(IWriter* F) { ; }
501+
virtual void Save(IWriter* /*F*/) { ; }
502502
};
503503

504504
class CCC_DofFocus : public CCC_Float
@@ -534,7 +534,7 @@ class CCC_DofFocus : public CCC_Float
534534
}
535535

536536
// CCC_Dof should save all data as well as load from config
537-
virtual void Save(IWriter* F) { ; }
537+
virtual void Save(IWriter* /*F*/) { ; }
538538
};
539539

540540
class CCC_Dof : public CCC_Vector3
@@ -570,7 +570,7 @@ class CCC_DumpResources : public IConsole_Command
570570
{
571571
public:
572572
CCC_DumpResources(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = TRUE; };
573-
virtual void Execute(LPCSTR args)
573+
virtual void Execute(LPCSTR /*args*/)
574574
{
575575
RImplementation.Models->dump();
576576
RImplementation.Resources->Dump(false);

src/xrAICore/Navigation/graph_abstract_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
////////////////////////////////////////////////////////////////////////////
2-
// Module : graph_inline.h
2+
// Module : graph_abstract_inline.h
33
// Created : 14.01.2004
44
// Modified : 19.02.2005
55
// Author : Dmitriy Iassenev
File renamed without changes.

src/xrCommon/xalloc.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#pragma once
2+
#include "xrCore/xrMemory.h"
3+
4+
template <class T>
5+
class xalloc
6+
{
7+
public:
8+
typedef size_t size_type;
9+
typedef std::ptrdiff_t difference_type;
10+
typedef T* pointer;
11+
typedef const T* const_pointer;
12+
typedef T& reference;
13+
typedef const T& const_reference;
14+
typedef T value_type;
15+
16+
public:
17+
template<class _Other>
18+
struct rebind
19+
{
20+
typedef xalloc<_Other> other;
21+
};
22+
23+
public:
24+
pointer address(reference _Val) const { return &_Val; }
25+
const_pointer address(const_reference _Val) const { return &_Val; }
26+
xalloc() {}
27+
xalloc(const xalloc<T>&) {}
28+
template<class _Other>
29+
xalloc(const xalloc<_Other>&) {}
30+
template<class _Other>
31+
xalloc<T>& operator=(const xalloc<_Other>&) { return *this; }
32+
pointer allocate(size_type n, const void* p = nullptr) const { return xr_alloc<T>((u32)n); }
33+
char* _charalloc(size_type n) { return (char*)allocate(n); }
34+
void deallocate(pointer p, size_type n) const { xr_free(p); }
35+
void deallocate(void* p, size_type n) const { xr_free(p); }
36+
void construct(pointer p, const T& _Val) { std::_Construct(p, _Val); }
37+
void destroy(pointer p) { std::_Destroy(p); }
38+
size_type max_size() const
39+
{
40+
size_type _Count = (size_type)(-1)/sizeof(T);
41+
return 0<_Count ? _Count : 1;
42+
}
43+
};
44+
45+
struct xr_allocator
46+
{
47+
template <typename T>
48+
struct helper
49+
{
50+
typedef xalloc<T> result;
51+
};
52+
53+
static void* alloc(const u32& n) { return xr_malloc((u32)n); }
54+
template <typename T>
55+
static void dealloc(T*& p) { xr_free(p); }
56+
};
57+
58+
template <class _Ty, class _Other>
59+
inline bool operator==(const xalloc<_Ty>&, const xalloc<_Other>&) { return true; }
60+
61+
template <class _Ty, class _Other>
62+
inline bool operator!=(const xalloc<_Ty>&, const xalloc<_Other>&) { return false; }

0 commit comments

Comments
 (0)