mingw build stuff

This commit is contained in:
Brian Cox 2019-09-29 17:36:14 -07:00
parent ba981b075a
commit 6455c3966c
8 changed files with 28 additions and 16 deletions

View File

@ -449,6 +449,7 @@
# define SUPPORTS_NETWORKING (HAVE_SOCKET && !IS_SORTIX && !IS_DOS_DJGPP && !IS_REDOX)
# define SUPPORTS_SYSLOG (HAVE_SYSLOG && !IS_SKYOS && !IS_RISCOS)
# define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX)
# define SWAB_TAKES_CHAR_PTRS (IS_MINGW)
# define USES_MBLEN (!IS_ANDROID && !IS_AROS)
# define USES_DOS_DEVICE_PATH (IS_DOS_DJGPP || (IS_WIN32 && !IS_CYGWIN) || (IS_OS2 && !IS_EMX))
# define USES_DEVICE_PATH (IS_AROS || IS_RISCOS || IS_REDOX || USES_DOS_DEVICE_PATH)
@ -503,13 +504,6 @@
# define UNAME_SUCCESS_ZERO 1
#endif
// Work around single-arg mkdir on MinGW.
// consider using autoconf AX_FUNC_MKDIR if
// we need to handle any more cases here
/*#if IS_MINGW
# define mkdir(a,b) mkdir(a)
#endif*/
//=============================================================================
// Miscellaneous
//

View File

@ -83,7 +83,7 @@ void util_SignalHandler(int sig)
void tw_psignal(int sig, const TCHAR* str)
{
const TCHAR* siglist[NSIG] = {_T("Unknown Signal"),
const TCHAR* siglist[] = { _T("Unknown Signal"),
_T("Hangup"),
_T("Interrupt"),
_T("Quit"),

View File

@ -114,8 +114,8 @@ void cArchiveSigGen::CalculateSignatures(cArchive& a)
if (s_direct)
{
unsigned long mod = (unsigned long)abBuf % iSignature::SUGGESTED_BLOCK_SIZE;
unsigned long offset = (iSignature::SUGGESTED_BLOCK_SIZE - mod);
uintptr_t mod = (uintptr_t)abBuf % iSignature::SUGGESTED_BLOCK_SIZE;
uintptr_t offset = (iSignature::SUGGESTED_BLOCK_SIZE - mod);
pBuf = abBuf + offset;
}

View File

@ -2076,8 +2076,15 @@ static bool ChangePassphrase(const TCHAR* keyPath, wc16_string passphraseOld, wc
memcpy(passphraseCopyOld, passphraseOld.data(), passphraseLenOld);
memcpy(passphraseCopy, passphrase.data(), passphraseLen);
#else
#if SWAB_TAKES_CHAR_PTRS
swab((char*)passphraseOld.data(), (char*)passphraseCopyOld, passphraseLenOld);
swab((char*)passphrase.data(), (char*)passphraseCopy, passphraseLen);
#else
swab(passphraseOld.data(), passphraseCopyOld, passphraseLenOld);
swab(passphrase.data(), passphraseCopy, passphraseLen);
#endif
#endif
bool result;

View File

@ -385,7 +385,7 @@ std::string TwTestDir()
iFSServices::GetInstance()->GetCurrentDir(dir);
dir.append("/TWTestData");
TCERR << "Using test directory: " << dir << std::endl;
mkdir(dir.c_str(), 0777);
tw_mkdir(dir.c_str(), 0777);
}
return dir;

View File

@ -92,5 +92,16 @@ void RegisterTest(const std::string& suite, const std::string testName, TestPtr
void skip(const std::string& reason);
void fail(const std::string& reason);
////////////////////////////////////////////////////////////////////////////
// Misc platform utility stuff available for all tests
// Could use AX_FUNC_MKDIR autoconf macro if we need to handle
// any additional cases besides these
#if IS_MINGW
# define tw_mkdir(a,b) mkdir(a)
#else
# define tw_mkdir(a,b) mkdir(a,b)
#endif
#endif // __TEST_H

View File

@ -151,9 +151,9 @@ void TestTextReportViewer()
fcoNameSpec1 = fcoNameTempDir += _T("SPEC1/");
fcoNameSpec2 = fcoNameTempDir += _T("SPEC2/");
mkdir( fcoNameTempDir.c_str(), 0777 );
mkdir( fcoNameSpec1.AsString().c_str(), 0777 );
mkdir( fcoNameSpec2.AsString().c_str(), 0777 );
tw_mkdir( fcoNameTempDir.c_str(), 0777 );
tw_mkdir( fcoNameSpec1.AsString().c_str(), 0777 );
tw_mkdir( fcoNameSpec2.AsString().c_str(), 0777 );
fcoNameTempFile = fcoNameTempDir += _T("twtempXXXXXX");
pFSServices->MakeTempFilename( fcoNameTempFile );
@ -473,7 +473,7 @@ void MakeFile(TSTRING& strNameMakeMe)
void MakeDir(const TCHAR* const lpszDirName)
{
TEST(0 == mkdir(lpszDirName, 0777))
TEST(0 == tw_mkdir(lpszDirName, 0777))
}
//#endif //FIXED_TRV_TEST_SUITE

View File

@ -62,7 +62,7 @@ void TestTWUtil()
TSTRING tmpFN = TwTestPath("fileexiststest.tmp");
// make a subdir in the TEMP_DIR
mkdir(tmpDir.c_str(), 0700);
tw_mkdir(tmpDir.c_str(), 0700);
chmod(tmpDir.c_str(), 0700);
// make sure file is not there