From 51d0db710717be84c62c24ce9f8b99e98728cc1c Mon Sep 17 00:00:00 2001 From: Daniel Cohen Gindi Date: Sat, 20 Sep 2014 16:42:38 +0300 Subject: `CreateDirectory` might clash with the `CreateDirectoryA`/`CreateDirectoryW` macros on MSVC --- libvncserver/tightvnc-filetransfer/filetransfermsg.c | 5 ++++- libvncserver/tightvnc-filetransfer/filetransfermsg.h | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'libvncserver/tightvnc-filetransfer') diff --git a/libvncserver/tightvnc-filetransfer/filetransfermsg.c b/libvncserver/tightvnc-filetransfer/filetransfermsg.c index 3cda84a..4e18813 100644 --- a/libvncserver/tightvnc-filetransfer/filetransfermsg.c +++ b/libvncserver/tightvnc-filetransfer/filetransfermsg.c @@ -627,6 +627,10 @@ CloseUndoneFileTransfer(rfbClientPtr cl, rfbTightClientPtr rtcp) * Method to handle create directory request. ******************************************************************************/ +#ifdef _MSC_VER +#undef CreateDirectory /* Prevent macro clashes under Windows */ +#endif /* _MSC_VER */ + void CreateDirectory(char* dirName) { @@ -637,4 +641,3 @@ CreateDirectory(char* dirName) __FILE__, __FUNCTION__, dirName); } } - diff --git a/libvncserver/tightvnc-filetransfer/filetransfermsg.h b/libvncserver/tightvnc-filetransfer/filetransfermsg.h index 30e58df..3b27bd0 100644 --- a/libvncserver/tightvnc-filetransfer/filetransfermsg.h +++ b/libvncserver/tightvnc-filetransfer/filetransfermsg.h @@ -26,6 +26,11 @@ #ifndef FILE_TRANSFER_MSG_H #define FILE_TRANSFER_MSG_H +#ifdef _MSC_VER +#pragma push_macro("CreateDirectory") +#undef CreateDirectory /* Prevent macro clashes under Windows */ +#endif /* _MSC_VER */ + typedef struct _FileTransferMsg { char* data; unsigned int length; @@ -50,5 +55,9 @@ void CloseUndoneFileTransfer(rfbClientPtr cl, rfbTightClientPtr data); void FreeFileTransferMsg(FileTransferMsg ftm); +#ifdef _MSC_VER +# pragma pop_macro("CreateDirectory") /* Restore original macro */ +#endif /* _MSC_VER */ + #endif -- cgit v1.2.1