Skip to content

Commit 6d2f0f9

Browse files
committed
Fix various minor mistakes that clang doesn't like
1 parent d57d607 commit 6d2f0f9

File tree

11 files changed

+23
-20
lines changed

11 files changed

+23
-20
lines changed

src/Common/PlatformLinux.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ inline void _splitpath (
115115
}
116116

117117
#include <iostream>
118-
inline void OutputDebugString(char *str) // for linux debugger
118+
inline void OutputDebugString(const char *str) // for linux debugger
119119
{
120120
std::cerr << str;
121121
}
@@ -202,7 +202,7 @@ typedef struct _EXCEPTION_POINTERS {
202202

203203
#ifdef XR_X64
204204
typedef int64_t INT_PTR;
205-
typedef uint16_t UINT_PTR;
205+
typedef uint64_t UINT_PTR;
206206
typedef int64_t LONG_PTR;
207207
#else
208208
typedef int INT_PTR;

src/xrCore/XML/XMLDocument.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class XML_NODE
3131
return node;
3232
}
3333

34-
bool operator==(nullptr_t) = delete;
34+
bool operator==(std::nullptr_t) = delete;
3535

3636
XML_NODE firstChild() const
3737
{

src/xrCore/log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct LogCallback
3030
void* Context;
3131

3232
LogCallback() : Log(nullptr), Context(nullptr) {}
33-
LogCallback(nullptr_t) : Log(nullptr), Context(nullptr) {}
33+
LogCallback(std::nullptr_t) : Log(nullptr), Context(nullptr) {}
3434
LogCallback(Func log, void* ctx) : Log(log), Context(ctx) {}
3535
void operator()(const char* s) { Log(Context, s); }
3636
operator bool() const { return !!Log; }

src/xrCore/xrMemory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "Common/Common.hpp"
44
#include "_types.h"
55

6-
#include "tbb/tbb_allocator.h"
7-
#include "tbb/scalable_allocator.h"
6+
#include <tbb/tbb_allocator.h>
7+
#include <tbb/scalable_allocator.h>
88

99
/*
1010
Можно заключить - прокси перехватывает не всегда и/или не всё используемые функции.

src/xrCore/xr_trims.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ LPCSTR _CopyVal(LPCSTR src, LPSTR dst, char separator)
5151
LPCSTR p;
5252
size_t n;
5353
p = strchr(src, separator);
54-
n = (p > 0) ? (p - src) : xr_strlen(src);
54+
n = (p != nullptr) ? (p - src) : xr_strlen(src);
5555
strncpy(dst, src, n);
5656
dst[n] = 0;
5757
return dst;
@@ -279,7 +279,7 @@ LPCSTR _CopyVal(LPCSTR src, AnsiString& dst, char separator)
279279
LPCSTR p;
280280
u32 n;
281281
p = strchr(src, separator);
282-
n = (p > 0) ? (p - src) : xr_strlen(src);
282+
n = (p != nullptr) ? (p - src) : xr_strlen(src);
283283
dst = src;
284284
dst = dst.Delete(n + 1, dst.Length());
285285
return dst.c_str();
@@ -490,7 +490,7 @@ LPCSTR _CopyVal(LPCSTR src, xr_string& dst, char separator)
490490
LPCSTR p;
491491
std::ptrdiff_t n;
492492
p = strchr(src, separator);
493-
n = (p > 0) ? (p - src) : xr_strlen(src);
493+
n = (p != nullptr) ? (p - src) : xr_strlen(src);
494494
dst = src;
495495
dst = dst.erase(n, dst.length());
496496
return dst.c_str();

src/xrEngine/xrSheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ void Scheduler::Unregister(ISheduled* object)
702702
Msg("SCHEDULERMT: unregister [%s][%x]", object->shedule_Name().c_str(), object);
703703
#endif
704704

705-
ItemReg item = { false, object->GetSchedulerData().b_RT, object };
705+
ItemReg item = { false, object->GetSchedulerData().b_RT != 0, object };
706706

707707
RegistrationQueue.emplace_back(std::move(item));
708708
}

src/xrGame/alife_registry_wrapper.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const typename _registry_type::_data* CALifeRegistryWrapper<_registry_type>::obj
4040
if (I == local_registry.end())
4141
{
4242
typename _registry_type::_data new_registry;
43-
std::pair<_registry_type::iterator, bool> p = local_registry.insert(std::make_pair(id, new_registry));
44-
VERIFY(p.second);
45-
return &(*local_registry.find(id)).second;
43+
auto [iter, inserted] = local_registry.insert(std::make_pair(id, new_registry));
44+
VERIFY(inserted);
45+
return &(iter->second);
4646
}
4747
return (&(*I).second);
4848
}
@@ -63,9 +63,9 @@ typename _registry_type::_data& CALifeRegistryWrapper<_registry_type>::objects(u
6363
if (I == local_registry.end())
6464
{
6565
typename _registry_type::_data new_registry;
66-
std::pair<_registry_type::iterator, bool> p = local_registry.insert(std::make_pair(id, new_registry));
67-
VERIFY(p.second);
68-
return (*local_registry.find(id)).second;
66+
auto [iter, inserted] = local_registry.insert(std::make_pair(id, new_registry));
67+
VERIFY(inserted);
68+
return (iter->second);
6969
}
7070
else
7171
return ((*I).second);

src/xrGame/ik/IKLimb.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
#include "ik_limb_state_predict.h"
1010

1111
class IKinematics;
12-
class CDB::TRI;
1312
struct SCalculateData;
1413
struct SIKCollideData;
1514
class CGameObject;
1615
class motion_marks;
1716
class ik_goal_matrix;
17+
namespace CDB
18+
{
19+
class TRI;
20+
}
1821
namespace extrapolation
1922
{
2023
class points;

src/xrScriptEngine/script_engine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ CScriptProcess* CScriptEngine::script_process(const ScriptProcessor& process_id)
11601160

11611161
void CScriptEngine::parse_script_namespace(const char* name, char* ns, u32 nsSize, char* func, u32 funcSize)
11621162
{
1163-
auto p = strrchr(name, '.');
1163+
const char* p = strrchr(name, '.');
11641164
if (!p)
11651165
{
11661166
xr_strcpy(ns, nsSize, GlobalNamespace);

src/xrSound/xr_streamsnd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void CSoundStream::LoadADPCM()
347347
DataPos = NULL;
348348

349349
hf = FS.r_open("$game_sounds$", fn);
350-
R_ASSERT(hf >= 0);
350+
VERIFY(hf);
351351
ZeroMemory(&riff, sizeof(riff));
352352
XRead(riff);
353353
CopyMemory(buf, riff.id, 4);

0 commit comments

Comments
 (0)