diff --git a/libco/settings.h b/libco/settings.h index 2be816c41..3ad073df9 100644 --- a/libco/settings.h +++ b/libco/settings.h @@ -32,7 +32,7 @@ #endif #if defined(_MSC_VER) - #pragma section(".text", execute, read) + #pragma section(".text") #define section(name) __declspec(allocate(".text")) #elif defined(__APPLE__) #define section(name) __attribute__((section("__TEXT,__" #name))) diff --git a/nall/GNUmakefile b/nall/GNUmakefile index 11dbc17fa..6b092515c 100644 --- a/nall/GNUmakefile +++ b/nall/GNUmakefile @@ -117,9 +117,10 @@ endif # global compiler flags ifeq ($(cl),true) - flags.c = -nologo -W0 -Fd$(object.path)/ -TC -std:c11 - flags.cpp = -nologo -W0 -Fd$(object.path)/ -TP -std:c++17 -EHsc - options = -nologo $(if $(findstring clang,$(compiler)),-fuse-ld=lld) -link + flags.c = -TC -std:c11 + flags.cpp = -TP -std:c++17 -EHsc + flags += -nologo -W1 -Fd$(object.path)/ + options += -nologo $(if $(findstring clang,$(compiler)),-fuse-ld=lld) -link else flags.c = -x c -std=c11 flags.cpp = -x c++ -std=c++17 diff --git a/nall/file-buffer.hpp b/nall/file-buffer.hpp index 41bd2e298..eac957070 100644 --- a/nall/file-buffer.hpp +++ b/nall/file-buffer.hpp @@ -229,10 +229,10 @@ private: auto bufferSynchronize() -> void { if(!fileHandle) return; - if(bufferOffset == (fileOffset & ~(buffer.size() - 1))) return; + if(bufferOffset == (fileOffset & ~u64(buffer.size() - 1))) return; bufferFlush(); - bufferOffset = fileOffset & ~(buffer.size() - 1); + bufferOffset = fileOffset & ~u64(buffer.size() - 1); fseek(fileHandle, bufferOffset, SEEK_SET); u64 length = bufferOffset + buffer.size() <= fileSize ? buffer.size() : fileSize & buffer.size() - 1; if(length) (void)fread(buffer.data(), 1, length, fileHandle); diff --git a/nall/file-map.cpp b/nall/file-map.cpp index c579f0c60..3172378ab 100644 --- a/nall/file-map.cpp +++ b/nall/file-map.cpp @@ -41,14 +41,17 @@ NALL_HEADER_INLINE auto file_map::open(const string& filename, u32 mode_) -> boo _file = CreateFileW(utf16_t(filename), desiredAccess, FILE_SHARE_READ, nullptr, creationDisposition, FILE_ATTRIBUTE_NORMAL, nullptr); - if(_file == INVALID_HANDLE_VALUE) return false; + if(_file == INVALID_HANDLE_VALUE) { + _file = nullptr; + return false; + } _size = GetFileSize(_file, nullptr); _map = CreateFileMapping(_file, nullptr, protection, 0, _size, nullptr); - if(_map == INVALID_HANDLE_VALUE) { + if(_map == nullptr) { CloseHandle(_file); - _file = INVALID_HANDLE_VALUE; + _file = nullptr; return false; } @@ -62,14 +65,14 @@ NALL_HEADER_INLINE auto file_map::close() -> void { _data = nullptr; } - if(_map != INVALID_HANDLE_VALUE) { + if(_map != nullptr) { CloseHandle(_map); - _map = INVALID_HANDLE_VALUE; + _map = nullptr; } - if(_file != INVALID_HANDLE_VALUE) { + if(_file != nullptr) { CloseHandle(_file); - _file = INVALID_HANDLE_VALUE; + _file = nullptr; } _open = false; diff --git a/nall/file-map.hpp b/nall/file-map.hpp index 0a7ec7009..66e2cc2e1 100644 --- a/nall/file-map.hpp +++ b/nall/file-map.hpp @@ -50,8 +50,8 @@ private: #if defined(API_WINDOWS) - HANDLE _file = INVALID_HANDLE_VALUE; - HANDLE _map = INVALID_HANDLE_VALUE; + HANDLE _file = nullptr; + HANDLE _map = nullptr; public: auto operator=(file_map&& source) -> file_map& { @@ -67,8 +67,8 @@ public: source._open = false; source._data = nullptr; source._size = 0; - source._file = INVALID_HANDLE_VALUE; - source._map = INVALID_HANDLE_VALUE; + source._file = nullptr; + source._map = nullptr; return *this; } diff --git a/nall/intrinsics.hpp b/nall/intrinsics.hpp index 26c2559f6..d80d46121 100644 --- a/nall/intrinsics.hpp +++ b/nall/intrinsics.hpp @@ -64,6 +64,8 @@ namespace nall { static constexpr bool GCC = 0; static constexpr bool Microsoft = 1; }; + #pragma warning(disable:4804) //unsafe use of type 'bool' in operation + #pragma warning(disable:4805) //unsafe mix of type 'bool' and type 'type' in operation #pragma warning(disable:4996) //libc "deprecation" warnings #else #error "unable to detect compiler" diff --git a/nall/platform.hpp b/nall/platform.hpp index 5fabcb2ae..d7c2dea1f 100644 --- a/nall/platform.hpp +++ b/nall/platform.hpp @@ -67,10 +67,6 @@ namespace Math { #define MSG_NOSIGNAL 0 #define PATH_MAX 260 - #if !defined(INVALID_HANDLE_VALUE) - #define INVALID_HANDLE_VALUE ((HANDLE)-1) - #endif - typedef void* HANDLE; inline auto access(const char* path, int amode) -> int { return _waccess(nall::utf16_t(path), amode); }