Skip to content

Commit

Permalink
get rid of some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Artikash committed Sep 22, 2018
1 parent 22c4f10 commit 310d12e
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 55 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@ project(NextHooker)

add_compile_options(
/std:c++17
#/Zc:auto # config.pri
/wd4819 # config.pri
/MP
/GS-
)

add_definitions(
/D_SECURE_SCL=0 # config.pri
/D_SCL_SECURE_NO_WARNINGS # config.pri
/D_CRT_SECURE_NO_WARNINGS # config.pri
/DUNICODE # config.pri
/D_UNICODE
/D_CRT_NON_CONFORMING_SWPRINTFS # common.pri
/DITH_HAS_CRT
)

include_directories(include)
Expand Down
2 changes: 1 addition & 1 deletion GUI/extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ std::map<int, QString> LoadExtensions()
bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map<std::string, int64_t> miscInfo)
{
wchar_t* sentenceBuffer = (wchar_t*)malloc((sentence.size() + 1) * sizeof(wchar_t));
wcscpy(sentenceBuffer, sentence.c_str());
wcscpy_s(sentenceBuffer, sentence.size() + 1, sentence.c_str());
InfoForExtension* miscInfoLinkedList = new InfoForExtension;
InfoForExtension* miscInfoTraverser = miscInfoLinkedList;
for (auto& i : miscInfo) miscInfoTraverser = miscInfoTraverser->nextProperty = new InfoForExtension{ i.first.c_str(), i.second, nullptr };
Expand Down
8 changes: 4 additions & 4 deletions extensions/removerepeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

bool RemoveRepeatedChars(std::wstring& sentence)
{
unsigned int repeatNumber = 0;
int repeatNumber = 0;
wchar_t prevChar = sentence[0];
for (auto i : sentence)
if (i == prevChar) repeatNumber++;
Expand All @@ -25,7 +25,7 @@ bool RemoveRepeatedChars(std::wstring& sentence)

bool RemoveCyclicRepeats(std::wstring& sentence)
{
unsigned int junkLength = 0;
int junkLength = 0;
wchar_t junk[2000] = {};
while (wcsstr(sentence.c_str() + junkLength, junk))
{
Expand All @@ -41,9 +41,9 @@ bool RemoveCyclicRepeats(std::wstring& sentence)
return false;
}

bool RemoveRepeatedSentences(std::wstring& sentence, int handle)
bool RemoveRepeatedSentences(std::wstring& sentence, int64_t handle)
{
static std::set<std::pair<int, std::wstring>> seenSentences;
static std::set<std::pair<int64_t, std::wstring>> seenSentences;
static std::mutex m;
std::lock_guard<std::mutex> l(m);
if (seenSentences.count({ handle, sentence }) != 0) throw std::exception();
Expand Down
4 changes: 2 additions & 2 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static bool operator==(const ThreadParam& one, const ThreadParam& two) { return

struct InsertHookCmd // From host
{
InsertHookCmd(HookParam hp, std::string name = "") : hp(hp) { strncpy(this->name, name.c_str(), 500); };
InsertHookCmd(HookParam hp, std::string name = "") : hp(hp) { strcpy_s<MESSAGE_SIZE>(this->name, name.c_str()); };
int command = HOST_COMMAND_NEW_HOOK;
HookParam hp;
char name[MESSAGE_SIZE] = {};
Expand All @@ -56,7 +56,7 @@ struct RemoveHookCmd // From host

struct ConsoleOutputNotif // From hook
{
ConsoleOutputNotif(std::string message = "") { strncpy(this->message, message.c_str(), 500); };
ConsoleOutputNotif(std::string message = "") { strcpy_s<MESSAGE_SIZE>(this->message, message.c_str()); };
int command = HOST_NOTIFICATION_TEXT;
char message[MESSAGE_SIZE] = {};
};
Expand Down
15 changes: 3 additions & 12 deletions vnrhook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,12 @@ add_library(vnrhook SHARED ${vnrhook_src})

enable_language(ASM_MASM)

set_source_files_properties(
${PROJECT_SOURCE_DIR}/winseh/safeseh.asm
PROPERTIES
# CMAKE_ASM_MASM_FLAGS /safeseh # CMake bug 14711: http://www.cmake.org/Bug/view.php?id=14711
COMPILE_FLAGS /safeseh
)

set_target_properties(vnrhook PROPERTIES
LINK_FLAGS "/SUBSYSTEM:WINDOWS /MANIFEST:NO"
)

target_compile_options(vnrhook PRIVATE
/EHa
$<$<CONFIG:Release>:>
$<$<CONFIG:Debug>:>
/wd4819
)

set(vnrhook_libs
Expand All @@ -54,7 +45,7 @@ target_link_libraries(vnrhook ${vnrhook_libs})

target_compile_definitions(vnrhook
PRIVATE
ITH_HAS_CRT
ITH_HAS_SEH
_CRT_NON_CONFORMING_SWPRINTFS
_SCL_SECURE_NO_WARNINGS # config.pri
_CRT_SECURE_NO_WARNINGS
)
1 change: 0 additions & 1 deletion vnrhook/engine/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "main.h"
#include "engine/mono/funcinfo.h"
#include "engine/ppsspp/funcinfo.h"
#include "except.h"
#include "ithsys/ithsys.h"
#include "memdbg/memsearch.h"
#include "disasm/disasm.h"
Expand Down
1 change: 0 additions & 1 deletion vnrhook/engine/match.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "util/growl.h"
#include "util/util.h"
#include "main.h"
#include "except.h"
#include "ithsys/ithsys.h"

//#define ConsoleOutput(...) (void)0 // jichi 8/18/2013: I don't need ConsoleOutput
Expand Down
1 change: 0 additions & 1 deletion vnrhook/hijack/texthook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "hijack/texthook.h"
#include "MinHook.h"
#include "engine/match.h"
#include "except.h"
#include "main.h"
#include "pipe.h"
#include "const.h"
Expand Down
5 changes: 5 additions & 0 deletions vnrhook/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ void NewHook(const HookParam &hp, LPCSTR name, DWORD flag = HOOK_ENGINE);
void RemoveHook(uint64_t addr);
void SwitchTrigger(DWORD on);

#define ITH_RAISE (*(int*)0 = 0) // raise C000005, for debugging only
#define ITH_TRY __try
#define ITH_EXCEPT __except(EXCEPTION_EXECUTE_HANDLER)
#define ITH_WITH_SEH(...) ITH_TRY { __VA_ARGS__; } ITH_EXCEPT {}

// EOF
25 changes: 0 additions & 25 deletions vnrhook/util/except.h

This file was deleted.

0 comments on commit 310d12e

Please sign in to comment.