Permalink
Browse files

More mingw patches

  • Loading branch information...
twinaphex committed Aug 29, 2017
1 parent ee6086c commit db404adb957f5b3ee26e55e66421759f8213feec
View
@@ -30,7 +30,7 @@ struct u24_be {
}
};
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
typedef unsigned __int8 u8;
typedef unsigned __int16 u16;
View
@@ -93,7 +93,7 @@ FILE *OpenCFile(const std::string &filename, const char *mode)
bool OpenCPPFile(std::fstream & stream, const std::string &filename, std::ios::openmode mode)
{
#if defined(_WIN32) && defined(UNICODE)
#if defined(_WIN32) && defined(UNICODE) && !defined(__MINGW32__)
stream.open(ConvertUTF8ToWString(filename), mode);
#else
stream.open(filename.c_str(), mode);
View
@@ -280,7 +280,7 @@ void LogManager::RemoveListener(LogListener *listener) {
}
FileLogListener::FileLogListener(const char *filename) {
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
m_logfile.open(ConvertUTF8ToWString(filename).c_str(), std::ios::app);
#else
m_logfile.open(filename, std::ios::app);
@@ -7,8 +7,6 @@
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
#define fseeko _fseeki64
#define ftello _ftelli64
#else
#include <dirent.h>
#include <unistd.h>
@@ -84,14 +82,24 @@ uint64_t GetSize(FILE *f)
return 0;
}
return size;
#else
#ifdef _WIN32
uint64_t pos = _ftelli64(f);
#else
uint64_t pos = ftello(f);
#endif
if (fseek(f, 0, SEEK_END) != 0) {
return 0;
}
#ifdef _WIN32
uint64_t size = _ftelli64(f);
// Reset the seek position to where it was when we started.
if (size != pos && _fseeki64(f, pos, SEEK_SET) != 0) {
#else
uint64_t size = ftello(f);
// Reset the seek position to where it was when we started.
if (size != pos && fseeko(f, pos, SEEK_SET) != 0) {
#endif
// Should error here.
return 0;
}
@@ -503,7 +503,7 @@ bool IniFile::Load(const char* filename)
// Open file
std::ifstream in;
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
in.open(ConvertUTF8ToWString(filename), std::ios::in);
#else
in.open(filename, std::ios::in);
@@ -581,7 +581,7 @@ bool IniFile::Load(std::istream &in) {
bool IniFile::Save(const char* filename)
{
std::ofstream out;
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
out.open(ConvertUTF8ToWString(filename), std::ios::out);
#else
out.open(filename, std::ios::out);
@@ -12,6 +12,7 @@
#define NOMINMAX
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -11,6 +11,9 @@
#ifdef _WIN32
#include <WinSock2.h>
#include <Ws2tcpip.h>
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x0400
#endif
#undef min
#undef max
#else

0 comments on commit db404ad

Please sign in to comment.