Removed/disable unused stuff (#5694)

C++17 compat by removing stuff that was deprecated in C++14
This commit is contained in:
Dedmen Miller 2017-10-28 21:39:46 +02:00 committed by ulteq
parent c815a9cae8
commit c4f9b6c19b
8 changed files with 17 additions and 7007 deletions

View File

@ -6,6 +6,7 @@
#include <unordered_map>
#include <random>
#include <cmath>
#include <sstream>
#define DELTA_T 0.02f
#define GRAVITY 9.80665f

View File

@ -2,17 +2,17 @@ file(GLOB_RECURSE ACE_COMMON_SOURCES *.h *.hpp *.c *.cpp)
file(GLOB ACE_BASE_COMMON_SOURCES *.h *.hpp *.c *.cpp)
file(GLOB ACE_P3D_SOURCES p3d/*.h p3d/*.hpp p3d/*.c p3d/*.cpp)
file(GLOB ACE_PBO_SOURCES pbo/*.h pbo/*.hpp pbo/*.c pbo/*.cpp)
file(GLOB ACE_SIMULATION_SOURCES simulation/*.h simulation/*.hpp simulation/*.c simulation/*.cpp)
file(GLOB ACE_DIRECTX_SOURCES directx/*.h directx/*.hpp directx/*.c directx/*.cpp)
file(GLOB ACE_GLM_SOURCES glm/*.h glm/*.hpp glm/*.c glm/*.cpp)
#file(GLOB ACE_P3D_SOURCES p3d/*.h p3d/*.hpp p3d/*.c p3d/*.cpp)
#file(GLOB ACE_PBO_SOURCES pbo/*.h pbo/*.hpp pbo/*.c pbo/*.cpp)
#file(GLOB ACE_SIMULATION_SOURCES simulation/*.h simulation/*.hpp simulation/*.c simulation/*.cpp)
#file(GLOB ACE_DIRECTX_SOURCES directx/*.h directx/*.hpp directx/*.c directx/*.cpp)
#file(GLOB ACE_GLM_SOURCES glm/*.h glm/*.hpp glm/*.c glm/*.cpp)
SOURCE_GROUP("common" FILES ${ACE_BASE_COMMON_SOURCES})
SOURCE_GROUP("p3d" FILES ${ACE_P3D_SOURCES})
SOURCE_GROUP("pbo" FILES ${ACE_PBO_SOURCES})
SOURCE_GROUP("simulation" FILES ${ACE_SIMULATION_SOURCES})
SOURCE_GROUP("directx" FILES ${ACE_DIRECTX_SOURCES})
SOURCE_GROUP("glm" FILES ${ACE_GLM_SOURCES})
#SOURCE_GROUP("p3d" FILES ${ACE_P3D_SOURCES})
#SOURCE_GROUP("pbo" FILES ${ACE_PBO_SOURCES})
#SOURCE_GROUP("simulation" FILES ${ACE_SIMULATION_SOURCES})
#SOURCE_GROUP("directx" FILES ${ACE_DIRECTX_SOURCES})
#SOURCE_GROUP("glm" FILES ${ACE_GLM_SOURCES})
add_library(ace_common STATIC ${ACE_GLM_SOURCES} ${ACE_BASE_COMMON_SOURCES} ${ACE_P3D_SOURCES} ${ACE_PBO_SOURCES} ${ACE_SIMULATION_SOURCES} ${ACE_DIRECTX_SOURCES})

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
#pragma once
#define _ELPP_THREAD_SAFE
#define _ELPP_FORCE_USE_STD_THREAD
#define _ELPP_NO_DEFAULT_LOG_FILE
#define _ELPP_DISABLE_DEFAULT_CRASH_HANDLING
#include "easyloggingc++.hpp"

View File

@ -1,9 +1,7 @@
#include "shared.hpp"
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
#include <sstream>
int test(int var) {
return var;
@ -23,19 +21,4 @@ namespace ace {
split(s, delim, elems);
return elems;
}
void runtime_assert(bool result) {
assert(result);
if (!result) {
LOG(ERROR) << "ACE Assertion failed, execution cancelling";
throw exception(-1, "assertion failed");
}
}
void runtime_assert(bool result, const uint32_t code, const std::string & text) {
assert(result);
if (!result) {
LOG(ERROR) << "ACE Assertion failed, execution cancelling";
throw exception(code, text);
}
}
}
}

View File

@ -18,7 +18,8 @@
#include <cstdint>
#include <streambuf>
#include "ace_version.hpp"
#include "logging.hpp"
#include <algorithm>
#include <cctype> //std::isspace
#ifdef _DEBUG
#define ZERO_OUTPUT() { memset(output, 0x00, outputSize); }
@ -55,13 +56,13 @@ namespace ace {
// trim from start
static inline std::string &ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](const char _char) noexcept {return !std::isspace(_char); }));
return s;
}
// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
s.erase(std::find_if(s.rbegin(), s.rend(), [](const char _char) noexcept {return !std::isspace(_char); }).base(), s.end());
return s;
}
@ -70,8 +71,6 @@ namespace ace {
return ltrim(rtrim(s));
}
inline void runtime_assert(bool result);
struct exception {
exception(const uint32_t code_, const std::string & text_) : code(code_), text(text_) {}
@ -83,12 +82,6 @@ namespace ace {
};
}
#ifdef _DEBUG
#define ACE_ASSERT assert()
#else
#define ACE_ASSERT ace::runtime_assert()
#endif
#ifndef _WIN32
#define __stdcall
#endif

View File

@ -1,183 +0,0 @@
#ifdef _WIN32
#include "simplepipe_win32.hpp"
#include <Sddl.h>
#include <AccCtrl.h>
#include <Aclapi.h>
namespace ace {
namespace {
const wchar_t kPipePrefix[] = L"\\\\.\\pipe\\";
const int kPipeBufferSz = 4 * 1024;
} // namespace
bool checkIntegritySupport() {
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
return osvi.dwMajorVersion > 5;
}
LONG g_pipe_seq = 0;
HANDLE pipe_pair::open_pipe_server(const wchar_t* name, bool low_integrity, bool blocking) {
SECURITY_ATTRIBUTES sa = {0};
SECURITY_ATTRIBUTES *psa = 0;
DWORD wait;
static const bool is_integrity_supported = checkIntegritySupport();
if (is_integrity_supported && low_integrity) {
psa = &sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
if (!ConvertStringSecurityDescriptorToSecurityDescriptor(
TEXT("S:(ML;;NWNR;;;LW)"), SDDL_REVISION_1, &sa.lpSecurityDescriptor, NULL))
return INVALID_HANDLE_VALUE;
}
if (blocking) {
wait = PIPE_WAIT;
} else {
wait = PIPE_NOWAIT;
}
std::wstring pipename(kPipePrefix);
pipename.append(name);
return ::CreateNamedPipeW(pipename.c_str(), PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | wait,
1, kPipeBufferSz, kPipeBufferSz, 200, psa);
}
HANDLE pipe_pair::open_pipe_client(const wchar_t* name, bool inherit, bool impersonate) {
std::wstring pipename(kPipePrefix);
pipename.append(name);
SECURITY_ATTRIBUTES sa = {sizeof(sa), NULL, inherit ? TRUE : FALSE};
for (;;) {
DWORD attributes = impersonate ? 0 : SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION;
HANDLE pipe = ::CreateFileW(pipename.c_str(), GENERIC_READ | GENERIC_WRITE, 0, &sa,
OPEN_EXISTING, attributes, NULL);
if (INVALID_HANDLE_VALUE == pipe) {
if (ERROR_PIPE_BUSY != ::GetLastError()) {
return pipe;
}
// wait and retry.
if (! ::WaitNamedPipeW(pipename.c_str(), NMPWAIT_USE_DEFAULT_WAIT))
continue;
} else {
// success.
return pipe;
}
}
}
pipe_pair::pipe_pair(bool inherit_fd2, bool blocking) : srv_(NULL), cln_(NULL) {
// Come up with a reasonable unique name.
const wchar_t kPipePattern[] = L"ko.%x.%x.%x";
wchar_t name[8*3 + sizeof(kPipePattern)];
::wsprintfW(name, kPipePattern, ::GetCurrentProcessId(), ::GetTickCount(),
::InterlockedIncrement(&g_pipe_seq));
HANDLE server = open_pipe_server(name, blocking);
if (INVALID_HANDLE_VALUE == server) {
return;
}
// Don't allow client impersonation.
HANDLE client = open_pipe_client(name, inherit_fd2, false);
if (INVALID_HANDLE_VALUE == client) {
::CloseHandle(server);
return;
}
if (!::ConnectNamedPipe(server, NULL)) {
if (ERROR_PIPE_CONNECTED != ::GetLastError()) {
::CloseHandle(server);
::CloseHandle(client);
return;
}
}
srv_ = server;
cln_ = client;
}
pipe_win::pipe_win() : pipe_(INVALID_HANDLE_VALUE) {
}
pipe_win::~pipe_win() {
if (pipe_ != INVALID_HANDLE_VALUE) {
::DisconnectNamedPipe(pipe_); // $$$ disconect is valid on the server side.
::CloseHandle(pipe_);
}
}
bool pipe_win::open_client(HANDLE pipe) {
pipe_ = pipe;
return true;
}
bool pipe_win::open_server(HANDLE pipe, bool connect) {
pipe_ = pipe;
if (connect) {
if (!::ConnectNamedPipe(pipe, NULL)) {
if (ERROR_PIPE_CONNECTED != ::GetLastError()) {
return false;
}
}
}
return true;
}
bool pipe_win::write(const void* buf, size_t sz) {
DWORD written = 0;
return (TRUE == ::WriteFile(pipe_, buf, sz, &written, NULL));
}
bool pipe_win::CheckStatus() {
char buf[5];
uint32_t size = sizeof(buf);
BOOL ret;
ret = ::ReadFile(pipe_, buf, sizeof(buf), reinterpret_cast<DWORD*>(&size), NULL);
if (!ret) {
if (GetLastError() == ERROR_NO_DATA) {
return true;
} else {
return false;
}
} else {
return true;
}
}
bool pipe_win::read(void* buf, size_t* sz) {
BOOL ret;
ret = ::ReadFile(pipe_, buf, *sz, reinterpret_cast<DWORD*>(sz), NULL);
if (!ret) {
if (GetLastError() == ERROR_BROKEN_PIPE) {
if (!DisconnectNamedPipe(pipe_)) {
printf("DisconnectNamedPipe() failed. hr=%08x", GetLastError());
}
if (!::ConnectNamedPipe(pipe_, NULL)) {
}
}
}
return ret;
}
char* PipeTransport::receive(size_t* size) {
if (buf_.size() < kBufferSz)
buf_.resize(kBufferSz);
*size = kBufferSz;
if (!read(&buf_[0], size))
return NULL;
return &buf_[0];
}
}
#endif

View File

@ -1,60 +0,0 @@
#pragma once
#ifdef _WIN32
#include <cstdint>
#include <string>
#include <vector>
#include <Winsock2.h>
namespace ace {
class pipe_pair {
public:
pipe_pair(bool inherit_fd2 = false, bool blocking = true);
HANDLE fd1() const { return srv_; }
HANDLE fd2() const { return cln_; }
static HANDLE open_pipe_server(const wchar_t* name, bool low_integrity = true, bool blocking = true);
static HANDLE open_pipe_client(const wchar_t* name, bool inherit, bool impersonate);
private:
HANDLE srv_;
HANDLE cln_;
};
class pipe_win {
public:
pipe_win();
~pipe_win();
bool open_client(HANDLE pipe);
bool open_server(HANDLE pipe, bool connect = false);
bool write(const void* buf, size_t sz);
bool read(void* buf, size_t* sz);
bool CheckStatus();
bool IsConnected() const { return INVALID_HANDLE_VALUE != pipe_; }
private:
HANDLE pipe_;
};
class PipeTransport : public pipe_win {
public:
static const size_t kBufferSz = 4096;
size_t send(const void* buf, size_t sz) {
return write(buf, sz) ? -1 : 0;
}
char* receive(size_t* size);
private:
std::vector<char> buf_;
};
}
#endif