Make compile under Windows/MSVC
ClosedPublic

Authored by kfunk on Jun 8 2017, 10:20 AM.

Details

Test Plan

Compiles fine under Linux
Compiles fine under Windows

Diff Detail

Repository
R320 KIO Extras
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kfunk created this revision.Jun 8 2017, 10:20 AM
kfunk edited the test plan for this revision. (Show Details)Jun 8 2017, 10:20 AM
kfunk added a reviewer: bcooksley.

The utime issue in kio_sftp is not trivial to fix, let's just make it compile for now for KDE CI.

marten edited edge metadata.Jun 8 2017, 2:19 PM

+1 from me

CMakeLists.txt
157

Used for getting the resource limit for closing all child process FDs. Could be completely replaced by fcloseall() if available for Unix or _fcloseall() for Windows, either conditionally on Q_OS_type or using a configure test.

kfunk added a comment.Jun 8 2017, 4:30 PM

Note: Waiting for someone to accept this Diff.

kfunk updated this revision to Diff 15292.Jun 8 2017, 10:05 PM

Include unistd.h where needed, again

dfaure added inline comments.Jun 9 2017, 7:01 AM
CMakeLists.txt
157

It would be useful to get the information from marten's comment into the CMakeLists.txt, for the next reader.

164

Everywhere else we just skip calling utime() on non-unix.

Long term, QFileDevice::setFileTime is coming, slowly.

archive/kio_archivebase.cpp
41

I'm surprised that this is needed, we use S_ISDIR in KIO without such #define.

kfunk added inline comments.Jun 9 2017, 7:13 AM
archive/kio_archivebase.cpp
41

None of the files using S_ISDIR are actually compiled on Windows.

src/ioslaves/ftp/ftp.cpp
1558:            //if ( S_ISDIR( (mode_t)ftpEnt.type ) )

src/ioslaves/trash/trashimpl.cpp
1164:        if ((S_ISDIR(buff.st_mode))  // must be a dir
1177:                        && (S_ISDIR(buff.st_mode)) // must be a dir
1200:                && (S_ISDIR(buff.st_mode)) // must be a dir

ftp.cpp: Commented line
trashimpl.cpp: Not compiled. See [1]

[1]

if(WIN32)
  set(kio_trash_PART_SRCS kio_trash_win.cpp kiotrashdebug.cpp)
else()
  # Files that are shared with the KCM. Unix specific.
  set (trashcommon_unix_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/trashimpl.cpp
...
kfunk updated this revision to Diff 15296.Jun 9 2017, 7:15 AM

Add more comments

dfaure accepted this revision.Jun 9 2017, 7:43 AM

I see.

This revision is now accepted and ready to land.Jun 9 2017, 7:43 AM
This revision was automatically updated to reflect the committed changes.
adridg added a subscriber: adridg.Jun 9 2017, 8:50 AM

LGoF (Looks Good on FreeBSD)

CMakeLists.txt
157

While fcloseall() is listed as a GNU extension in the Linux man pages, it is also available on FreeBSD -- but not OpenBSD or NetBSD. A configure test seems appropriate.