Merge branch 'mingw-build'

This commit is contained in:
Geoff McLane 2015-12-03 19:18:07 +01:00
commit 3b13cd8076
3 changed files with 20 additions and 3 deletions

View file

@ -85,7 +85,9 @@ add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 )
add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 ) add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 )
add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" ) add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" )
add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" ) add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" )
### add_definitions ( -DRC_NUMBER="EXP3" ) if (MINGW)
add_definitions ( -DRC_NUMBER="MinGW" )
endif ()
# Issue #188 - Support user items in platform.h # Issue #188 - Support user items in platform.h
if (TIDY_CONFIG_FILE) if (TIDY_CONFIG_FILE)

View file

@ -469,7 +469,7 @@ extern "C" {
*/ */
#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__) #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
#ifndef __WATCOMC__ #if !(defined(__WATCOMC__) || defined(__MINGW32__))
#define fileno _fileno #define fileno _fileno
#define setmode _setmode #define setmode _setmode
#endif #endif

View file

@ -192,6 +192,20 @@ static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp,
if ( !fin ) if ( !fin )
return -1; return -1;
#if defined(__MINGW32__)
{
DWORD lowVal, highVal;
lowVal = GetFileSize(fp, &highVal);
if ((lowVal == INVALID_FILE_SIZE) && (GetLastError() != NO_ERROR))
{
TidyFree(allocator, fin);
return -1;
}
fin->size = highVal;
fin->size = (fin->size << 32);
fin->size += lowVal;
}
#else /* NOT a MinGW build */
#if defined(_MSC_VER) && (_MSC_VER < 1300) /* less than msvc++ 7.0 */ #if defined(_MSC_VER) && (_MSC_VER < 1300) /* less than msvc++ 7.0 */
{ {
LARGE_INTEGER* pli = (LARGE_INTEGER *)&fin->size; LARGE_INTEGER* pli = (LARGE_INTEGER *)&fin->size;
@ -210,6 +224,7 @@ static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp,
return -1; return -1;
} }
#endif #endif
#endif /* MinGW y/n */
fin->map = CreateFileMapping( fp, NULL, PAGE_READONLY, 0, 0, NULL ); fin->map = CreateFileMapping( fp, NULL, PAGE_READONLY, 0, 0, NULL );