Remove precompiled headers, fix a few problems they masked

This commit is contained in:
Tamás Bálint Misius 2021-10-15 17:04:04 +02:00
parent d675d483bd
commit afa9fd3d8f
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
8 changed files with 17 additions and 113 deletions

View File

@ -148,6 +148,8 @@ if copt_msvc
args_msvc = [ args_msvc = [
'/GS', '/GS',
'-D_SCL_SECURE_NO_WARNINGS', '-D_SCL_SECURE_NO_WARNINGS',
'-DUNICODE',
'-D_UNICODE',
] ]
if copt_64bit if copt_64bit
message('SSE explicitly configured but unavailable in msvc targeting 64-bit machines') message('SSE explicitly configured but unavailable in msvc targeting 64-bit machines')
@ -300,7 +302,6 @@ if get_option('build_powder')
include_directories: [ project_inc, powder_inc ], include_directories: [ project_inc, powder_inc ],
c_args: project_c_args, c_args: project_c_args,
cpp_args: project_cpp_args, cpp_args: project_cpp_args,
cpp_pch: 'pch/pch_cpp.h',
gui_app: true, gui_app: true,
link_args: project_link_args, link_args: project_link_args,
dependencies: powder_deps, dependencies: powder_deps,
@ -318,7 +319,6 @@ if get_option('build_render')
include_directories: [ project_inc, render_inc ], include_directories: [ project_inc, render_inc ],
c_args: project_c_args, c_args: project_c_args,
cpp_args: project_cpp_args, cpp_args: project_cpp_args,
cpp_pch: 'pch/pch_cpp.h',
link_args: project_link_args, link_args: project_link_args,
dependencies: render_deps, dependencies: render_deps,
) )
@ -339,7 +339,6 @@ if get_option('build_font')
include_directories: [ project_inc, font_inc ], include_directories: [ project_inc, font_inc ],
c_args: project_c_args, c_args: project_c_args,
cpp_args: project_cpp_args, cpp_args: project_cpp_args,
cpp_pch: 'pch/pch_cpp.h',
gui_app: true, gui_app: true,
link_args: project_link_args, link_args: project_link_args,
dependencies: font_deps, dependencies: font_deps,

View File

@ -1,99 +0,0 @@
#include "Config.h"
#include "common/Format.h"
#include "common/Singleton.h"
#include "common/String.h"
#include "common/tpt-compat.h"
#include "common/tpt-inline.h"
#include "common/tpt-minmax.h"
#include "common/tpt-rand.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <condition_variable>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
#include <thread>
#include <typeinfo>
#include <type_traits>
#include <utility>
#include <vector>
#include <errno.h>
#include <fcntl.h>
#include <float.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifndef WIN
# include <sys/param.h>
# include <sys/poll.h>
# include <sys/socket.h>
# include <sys/stat.h>
# include <sys/time.h>
# include <sys/types.h>
# include <sys/un.h>
#endif
#ifdef WIN
# include <shlobj.h>
# include <shlwapi.h>
# include <windows.h>
# include <winsock.h>
#endif
#ifdef GRAVFFT
#include <fftw3.h>
#endif
#ifndef NOHTTP
#include <curl/curl.h>
#endif
#include <bson/BSON.h>
#include <json/json-forwards.h>
#include <json/json.h>
#include <zlib.h>
#if !defined(FONTEDITOR) && !defined(RENDERER) && defined(LUACONSOLE)
# include "lua/LuaCompat.h"
#endif
#include "SDLCompat.h"

View File

@ -41,7 +41,7 @@ int update_start(char *data, unsigned int len)
updName = exeName.substr(0, exeName.length() - 4); updName = exeName.substr(0, exeName.length() - 4);
updName = updName + "_upd.exe"; updName = updName + "_upd.exe";
if (!MoveFile(exeName.c_str(), updName.c_str())) if (!MoveFile(Platform::WinWiden(exeName).c_str(), Platform::WinWiden(updName).c_str()))
return 1; return 1;
f = fopen(exeName.c_str(), "wb"); f = fopen(exeName.c_str(), "wb");
@ -50,14 +50,14 @@ int update_start(char *data, unsigned int len)
if (fwrite(data, 1, len, f) != len) if (fwrite(data, 1, len, f) != len)
{ {
fclose(f); fclose(f);
DeleteFile(exeName.c_str()); Platform::RemoveFile(exeName);
return 1; return 1;
} }
fclose(f); fclose(f);
if ((uintptr_t)ShellExecute(NULL, "open", exeName.c_str(), NULL, NULL, SW_SHOWNORMAL) <= 32) if ((uintptr_t)ShellExecute(NULL, L"open", Platform::WinWiden(exeName).c_str(), NULL, NULL, SW_SHOWNORMAL) <= 32)
{ {
DeleteFile(exeName.c_str()); Platform::RemoveFile(exeName);
return 1; return 1;
} }
@ -114,7 +114,7 @@ int update_finish()
printf("Update: Temp EXE name: %s\n", updName.c_str()); printf("Update: Temp EXE name: %s\n", updName.c_str());
#endif #endif
while (!DeleteFile(updName.c_str())) while (!Platform::RemoveFile(updName))
{ {
err = GetLastError(); err = GetLastError();
if (err == ERROR_FILE_NOT_FOUND) if (err == ERROR_FILE_NOT_FOUND)
@ -128,7 +128,7 @@ int update_finish()
if (extension == ".exe") if (extension == ".exe")
updName = exeName.substr(0, exeName.length() - 4); updName = exeName.substr(0, exeName.length() - 4);
updName = updName + "_update.exe"; updName = updName + "_update.exe";
DeleteFile(updName.c_str()); Platform::RemoveFile(updName);
return 0; return 0;
} }
Sleep(500); Sleep(500);

View File

@ -16,6 +16,7 @@
#include "simulation/ElementClasses.h" #include "simulation/ElementClasses.h"
#include "common/tpt-minmax.h" #include "common/tpt-minmax.h"
#include "common/tpt-compat.h"
GameSave::GameSave(const GameSave & save): GameSave::GameSave(const GameSave & save):
majorVersion(save.majorVersion), majorVersion(save.majorVersion),

View File

@ -14,6 +14,7 @@
#include <io.h> #include <io.h>
#include <shlobj.h> #include <shlobj.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <shellapi.h>
#include <windows.h> #include <windows.h>
#else #else
#include <unistd.h> #include <unistd.h>
@ -259,7 +260,7 @@ bool DirectoryExists(ByteString directory)
} }
} }
bool DeleteFile(ByteString filename) bool RemoveFile(ByteString filename)
{ {
return std::remove(filename.c_str()) == 0; return std::remove(filename.c_str()) == 0;
} }
@ -442,13 +443,13 @@ String DoMigration(ByteString fromDir, ByteString toDir)
result << '\n' << filename.FromUtf8() << " skipped (already exists)"; result << '\n' << filename.FromUtf8() << " skipped (already exists)";
} }
if (!DeleteFile(fromDir + filename)) { if (!RemoveFile(fromDir + filename)) {
logFile << "failed to delete " << filename << std::endl; logFile << "failed to delete " << filename << std::endl;
} }
}; };
// Do actual migration // Do actual migration
DeleteFile(fromDir + "stamps/stamps.def"); RemoveFile(fromDir + "stamps/stamps.def");
migrateList(stamps, "stamps", "Stamps"); migrateList(stamps, "stamps", "Stamps");
migrateList(saves, "Saves", "Saves"); migrateList(saves, "Saves", "Saves");
if (!scripts.empty()) if (!scripts.empty())

View File

@ -27,7 +27,7 @@ namespace Platform
/** /**
* @return true on success * @return true on success
*/ */
bool DeleteFile(ByteString filename); bool RemoveFile(ByteString filename);
/** /**
* @return true on success * @return true on success

View File

@ -3,6 +3,8 @@
#include "bzip2/bz2wrap.h" #include "bzip2/bz2wrap.h"
#include "font.bz2.h" #include "font.bz2.h"
#include <array>
unsigned char *font_data = nullptr; unsigned char *font_data = nullptr;
unsigned int *font_ptrs = nullptr; unsigned int *font_ptrs = nullptr;
unsigned int (*font_ranges)[2] = nullptr; unsigned int (*font_ranges)[2] = nullptr;

View File

@ -3697,7 +3697,7 @@ int LuaScriptInterface::fileSystem_removeFile(lua_State * l)
{ {
const char * filename = luaL_checkstring(l, 1); const char * filename = luaL_checkstring(l, 1);
bool ret = Platform::DeleteFile(filename); bool ret = Platform::RemoveFile(filename);
lua_pushboolean(l, ret); lua_pushboolean(l, ret);
return 1; return 1;
} }