From 4ba7670e433a290c769c1539caca06b3687a404f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 4 May 2017 09:20:10 +0200 Subject: [PATCH 1/2] Fixed right shift on 32bit platforms. --- winpr/libwinpr/file/generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/winpr/libwinpr/file/generic.c b/winpr/libwinpr/file/generic.c index 396070428..918d8a8e1 100644 --- a/winpr/libwinpr/file/generic.c +++ b/winpr/libwinpr/file/generic.c @@ -1019,15 +1019,15 @@ BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) #else ft = STAT_TIME_TO_FILETIME(fileStat.st_ctime); #endif - lpFindFileData->ftCreationTime.dwHighDateTime = ft >> 32; + lpFindFileData->ftCreationTime.dwHighDateTime = ((UINT64)ft) >> 32ULL; lpFindFileData->ftCreationTime.dwLowDateTime = ft & 0xFFFFFFFF; ft = STAT_TIME_TO_FILETIME(fileStat.st_mtime); - lpFindFileData->ftLastWriteTime.dwHighDateTime = ft >> 32; + lpFindFileData->ftLastWriteTime.dwHighDateTime = ((UINT64)ft) >> 32ULL; lpFindFileData->ftCreationTime.dwLowDateTime = ft & 0xFFFFFFFF; ft = STAT_TIME_TO_FILETIME(fileStat.st_atime); - lpFindFileData->ftLastAccessTime.dwHighDateTime = ft >> 32; + lpFindFileData->ftLastAccessTime.dwHighDateTime = ((UINT64)ft) >> 32ULL; lpFindFileData->ftLastAccessTime.dwLowDateTime = ft & 0xFFFFFFFF; - lpFindFileData->nFileSizeHigh = fileStat.st_size >> 32; + lpFindFileData->nFileSizeHigh = ((UINT64)fileStat.st_size) >> 32ULL; lpFindFileData->nFileSizeLow = fileStat.st_size & 0xFFFFFFFF; return TRUE; } From 620b1ea6030a81e7349214f11291745767c82375 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 10 May 2017 14:37:03 +0200 Subject: [PATCH 2/2] Added 64bit file support flag for linux. --- CMakeLists.txt | 5 +++++ winpr/CMakeLists.txt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb7903aa3..f6095ac7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,11 @@ if(MSVC) endif() endif() +# Enable 64bit file support on linux. +if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + add_definitions("-D_FILE_OFFSET_BITS=64") +endif() + # Compiler-specific flags if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686") diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index a14d59630..9c2e7925b 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -161,6 +161,11 @@ endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS") +# Enable 64bit file support on linux. +if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + add_definitions("-D_FILE_OFFSET_BITS=64") +endif() + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)