Skip to content

Commit

Permalink
Fix various minor mistakes that clang doesn't like
Browse files Browse the repository at this point in the history
  • Loading branch information
Zegeri committed Sep 24, 2018
1 parent d57d607 commit 6d2f0f9
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/Common/PlatformLinux.inl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ inline void _splitpath (
}

#include <iostream>
inline void OutputDebugString(char *str) // for linux debugger
inline void OutputDebugString(const char *str) // for linux debugger
{
std::cerr << str;
}
Expand Down Expand Up @@ -202,7 +202,7 @@ typedef struct _EXCEPTION_POINTERS {

#ifdef XR_X64
typedef int64_t INT_PTR;
typedef uint16_t UINT_PTR;
typedef uint64_t UINT_PTR;
typedef int64_t LONG_PTR;
#else
typedef int INT_PTR;
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/XML/XMLDocument.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class XML_NODE
return node;
}

bool operator==(nullptr_t) = delete;
bool operator==(std::nullptr_t) = delete;

XML_NODE firstChild() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct LogCallback
void* Context;

LogCallback() : Log(nullptr), Context(nullptr) {}
LogCallback(nullptr_t) : Log(nullptr), Context(nullptr) {}
LogCallback(std::nullptr_t) : Log(nullptr), Context(nullptr) {}
LogCallback(Func log, void* ctx) : Log(log), Context(ctx) {}
void operator()(const char* s) { Log(Context, s); }
operator bool() const { return !!Log; }
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "Common/Common.hpp"
#include "_types.h"

#include "tbb/tbb_allocator.h"
#include "tbb/scalable_allocator.h"
#include <tbb/tbb_allocator.h>
#include <tbb/scalable_allocator.h>

/*
Можно заключить - прокси перехватывает не всегда и/или не всё используемые функции.
Expand Down
6 changes: 3 additions & 3 deletions src/xrCore/xr_trims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ LPCSTR _CopyVal(LPCSTR src, LPSTR dst, char separator)
LPCSTR p;
size_t n;
p = strchr(src, separator);
n = (p > 0) ? (p - src) : xr_strlen(src);
n = (p != nullptr) ? (p - src) : xr_strlen(src);
strncpy(dst, src, n);
dst[n] = 0;
return dst;
Expand Down Expand Up @@ -279,7 +279,7 @@ LPCSTR _CopyVal(LPCSTR src, AnsiString& dst, char separator)
LPCSTR p;
u32 n;
p = strchr(src, separator);
n = (p > 0) ? (p - src) : xr_strlen(src);
n = (p != nullptr) ? (p - src) : xr_strlen(src);
dst = src;
dst = dst.Delete(n + 1, dst.Length());
return dst.c_str();
Expand Down Expand Up @@ -490,7 +490,7 @@ LPCSTR _CopyVal(LPCSTR src, xr_string& dst, char separator)
LPCSTR p;
std::ptrdiff_t n;
p = strchr(src, separator);
n = (p > 0) ? (p - src) : xr_strlen(src);
n = (p != nullptr) ? (p - src) : xr_strlen(src);
dst = src;
dst = dst.erase(n, dst.length());
return dst.c_str();
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xrSheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ void Scheduler::Unregister(ISheduled* object)
Msg("SCHEDULERMT: unregister [%s][%x]", object->shedule_Name().c_str(), object);
#endif

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

RegistrationQueue.emplace_back(std::move(item));
}
Expand Down
12 changes: 6 additions & 6 deletions src/xrGame/alife_registry_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const typename _registry_type::_data* CALifeRegistryWrapper<_registry_type>::obj
if (I == local_registry.end())
{
typename _registry_type::_data new_registry;
std::pair<_registry_type::iterator, bool> p = local_registry.insert(std::make_pair(id, new_registry));
VERIFY(p.second);
return &(*local_registry.find(id)).second;
auto [iter, inserted] = local_registry.insert(std::make_pair(id, new_registry));
VERIFY(inserted);
return &(iter->second);
}
return (&(*I).second);
}
Expand All @@ -63,9 +63,9 @@ typename _registry_type::_data& CALifeRegistryWrapper<_registry_type>::objects(u
if (I == local_registry.end())
{
typename _registry_type::_data new_registry;
std::pair<_registry_type::iterator, bool> p = local_registry.insert(std::make_pair(id, new_registry));
VERIFY(p.second);
return (*local_registry.find(id)).second;
auto [iter, inserted] = local_registry.insert(std::make_pair(id, new_registry));
VERIFY(inserted);
return (iter->second);
}
else
return ((*I).second);
Expand Down
5 changes: 4 additions & 1 deletion src/xrGame/ik/IKLimb.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
#include "ik_limb_state_predict.h"

class IKinematics;
class CDB::TRI;
struct SCalculateData;
struct SIKCollideData;
class CGameObject;
class motion_marks;
class ik_goal_matrix;
namespace CDB
{
class TRI;
}
namespace extrapolation
{
class points;
Expand Down
2 changes: 1 addition & 1 deletion src/xrScriptEngine/script_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ CScriptProcess* CScriptEngine::script_process(const ScriptProcessor& process_id)

void CScriptEngine::parse_script_namespace(const char* name, char* ns, u32 nsSize, char* func, u32 funcSize)
{
auto p = strrchr(name, '.');
const char* p = strrchr(name, '.');
if (!p)
{
xr_strcpy(ns, nsSize, GlobalNamespace);
Expand Down
2 changes: 1 addition & 1 deletion src/xrSound/xr_streamsnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void CSoundStream::LoadADPCM()
DataPos = NULL;

hf = FS.r_open("$game_sounds$", fn);
R_ASSERT(hf >= 0);
VERIFY(hf);
ZeroMemory(&riff, sizeof(riff));
XRead(riff);
CopyMemory(buf, riff.id, 4);
Expand Down
2 changes: 1 addition & 1 deletion src/xr_3da/entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(int argc, char *argv[])
for(i = 1; i < argc; ++i)
sum += strlen(argv[i]) + 1;

commandLine = malloc(sum);
commandLine = (char*)malloc(sum);
memset(commandLine, 0, sum);

for(i = 1; i < argc; ++i)
Expand Down

0 comments on commit 6d2f0f9

Please sign in to comment.