Commit df9537ea authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Use inline functions instead of macros to avoid problems in C++.

Inline functions respect scope, whereas macros don't. Define umask in sys/stat.h, and mode_t in sys/types.h.
parent 6843fee6
...@@ -156,27 +156,33 @@ int _wunlink(const MSVCRT(wchar_t)*); ...@@ -156,27 +156,33 @@ int _wunlink(const MSVCRT(wchar_t)*);
#ifndef USE_MSVCRT_PREFIX #ifndef USE_MSVCRT_PREFIX
#define access _access static inline int access(const char* path, int mode) { return _access(path, mode); }
#define chmod _chmod static inline int chmod(const char* path, int mode) { return _chmod(path, mode); }
#define chsize _chsize static inline int chsize(int fd, long size) { return _chsize(fd, size); }
#define close _close static inline int close(int fd) { return _close(fd); }
#define creat _creat static inline int creat(const char* path, int mode) { return _creat(path, mode); }
#define dup _dup static inline int dup(int od) { return _dup(od); }
#define dup2 _dup2 static inline int dup2(int od, int nd) { return _dup2(od, nd); }
#define eof _eof static inline int eof(int fd) { return _eof(fd); }
#define filelength _filelength static inline long filelength(int fd) { return _filelength(fd); }
#define isatty _isatty static inline int isatty(int fd) { return _isatty(fd); }
#define locking _locking static inline int locking(int fd, int mode, long size) { return _locking(fd, mode, size); }
#define lseek _lseek static inline long lseek(int fd, long off, int where) { return _lseek(fd, off, where); }
#define mktemp _mktemp static inline char* mktemp(char* pat) { return _mktemp(pat); }
#define open _open #define open _open
#define read _read static inline int read(int fd, void* buf, unsigned int size) { return _read(fd, buf, size); }
#define setmode _setmode static inline int setmode(int fd, int mode) { return _setmode(fd, mode); }
#define sopen _sopen #define sopen _sopen
#define tell _tell static inline long tell(int fd) { return _tell(fd); }
#define umask _umask #ifndef MSVCRT_UMASK_DEFINED
#define unlink _unlink static inline int umask(int fd) { return _umask(fd); }
#define write _write #define MSVCRT_UMASK_DEFINED
#endif /* USE_MSVCRT_PREFIX */ #endif
#ifndef MSVCRT_UNLINK_DEFINED
static inline int unlink(const char* path) { return _unlink(path); }
#define MSVCRT_UNLINK_DEFINED
#endif
static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); }
#endif /* USE _MSVCRT_PREFIX */
#endif /* __WINE_IO_H */ #endif /* __WINE_IO_H */
...@@ -263,7 +263,10 @@ int MSVCRT(wscanf)(const MSVCRT(wchar_t)*,...); ...@@ -263,7 +263,10 @@ int MSVCRT(wscanf)(const MSVCRT(wchar_t)*,...);
#define pclose _pclose #define pclose _pclose
#define popen _popen #define popen _popen
#define tempnam _tempnam #define tempnam _tempnam
#define unlink _unlink #ifndef MSVCRT_UNLINK_DEFINED
static inline int unlink(const char* path) { return _unlink(path); }
#define MSVCRT_UNLINK_DEFINED
#endif
#define fgetwchar _fgetwchar #define fgetwchar _fgetwchar
#define fputwchar _fputwchar #define fputwchar _fputwchar
......
...@@ -106,6 +106,7 @@ int MSVCRT(_fstat)(int,struct _stat*); ...@@ -106,6 +106,7 @@ int MSVCRT(_fstat)(int,struct _stat*);
int MSVCRT(_stat)(const char*,struct _stat*); int MSVCRT(_stat)(const char*,struct _stat*);
int _fstati64(int,struct _stati64*); int _fstati64(int,struct _stati64*);
int _stati64(const char*,struct _stati64*); int _stati64(const char*,struct _stati64*);
int _umask(int);
#ifndef MSVCRT_WSTAT_DEFINED #ifndef MSVCRT_WSTAT_DEFINED
#define MSVCRT_WSTAT_DEFINED #define MSVCRT_WSTAT_DEFINED
...@@ -127,8 +128,12 @@ int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*); ...@@ -127,8 +128,12 @@ int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
#define S_IWRITE _S_IWRITE #define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC #define S_IEXEC _S_IEXEC
#define fstat _fstat static inline int fstat(int fd, struct _stat* ptr) { return _fstat(fd, ptr); }
#define stat _stat static inline int stat(const char* path, struct _stat* ptr) { return _stat(path, ptr); }
#ifndef MSVCRT_UMASK_DEFINED
static inline int umask(int fd) { return _umask(fd); }
#define MSVCRT_UMASK_DEFINED
#endif
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_SYS_STAT_H */ #endif /* __WINE_SYS_STAT_H */
...@@ -60,7 +60,7 @@ void _ftime(struct _timeb*); ...@@ -60,7 +60,7 @@ void _ftime(struct _timeb*);
#ifndef USE_MSVCRT_PREFIX #ifndef USE_MSVCRT_PREFIX
#define timeb _timeb #define timeb _timeb
#define ftime _ftime static inline void ftime(struct _timeb* ptr) { return _ftime(ptr); }
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_SYS_TIMEB_H */ #endif /* __WINE_SYS_TIMEB_H */
...@@ -39,6 +39,11 @@ typedef unsigned short _ino_t; ...@@ -39,6 +39,11 @@ typedef unsigned short _ino_t;
#define MSVCRT_INO_T_DEFINED #define MSVCRT_INO_T_DEFINED
#endif #endif
#ifndef MSVCRT_MODE_T_DEFINED
typedef unsigned short _mode_t;
#define MSVCRT_MODE_T_DEFINED
#endif
#ifndef MSVCRT_OFF_T_DEFINED #ifndef MSVCRT_OFF_T_DEFINED
typedef int MSVCRT(_off_t); typedef int MSVCRT(_off_t);
#define MSVCRT_OFF_T_DEFINED #define MSVCRT_OFF_T_DEFINED
...@@ -49,10 +54,10 @@ typedef long MSVCRT(time_t); ...@@ -49,10 +54,10 @@ typedef long MSVCRT(time_t);
#define MSVCRT_TIME_T_DEFINED #define MSVCRT_TIME_T_DEFINED
#endif #endif
#ifndef USE_MSVCRT_PREFIX #ifndef USE_MSVCRT_PREFIX
#define dev_t _dev_t #define dev_t _dev_t
#define ino_t _ino_t #define ino_t _ino_t
#define mode_t _mode_t
#define off_t _off_t #define off_t _off_t
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
......
...@@ -67,7 +67,7 @@ int _wutime(const MSVCRT(wchar_t)*,struct _utimbuf*); ...@@ -67,7 +67,7 @@ int _wutime(const MSVCRT(wchar_t)*,struct _utimbuf*);
#ifndef USE_MSVCRT_PREFIX #ifndef USE_MSVCRT_PREFIX
#define utimbuf _utimbuf #define utimbuf _utimbuf
#define utime _utime static inline int utime(const char* path, struct _utimbuf* buf) { return _utime(path, buf); }
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_SYS_UTIME_H */ #endif /* __WINE_SYS_UTIME_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment