Commit 207068c4 authored by Alexandre Julliard's avatar Alexandre Julliard

tools: Move some portability defines out of port.h.

parent 65f3c3ae
......@@ -53,17 +53,12 @@
#include <io.h>
#include <process.h>
#define mkdir(path,mode) mkdir(path)
static inline void *dlopen(const char *name, int flags) { return NULL; }
static inline void *dlsym(void *handle, const char *name) { return NULL; }
static inline int dlclose(void *handle) { return 0; }
static inline const char *dlerror(void) { return "No dlopen support on Windows"; }
#ifdef _MSC_VER
#define popen _popen
#define pclose _pclose
/* The UCRT headers in the Windows SDK #error out if we #define snprintf.
* The C headers that came with previous Visual Studio versions do not have
* snprintf. Check for VS 2015, which appears to be the first version to
......@@ -71,25 +66,6 @@ static inline const char *dlerror(void) { return "No dlopen support on Windows";
#if _MSC_VER < 1900
# define snprintf _snprintf
#endif
#define strtoll _strtoi64
#define strtoull _strtoui64
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
typedef long off_t;
typedef int pid_t;
typedef int ssize_t;
#endif /* _MSC_VER */
#else /* _WIN32 */
#ifndef __int64
# if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) || defined(_WIN64)
# define __int64 long
# else
# define __int64 long long
# endif
#endif
#endif /* _WIN32 */
......@@ -106,36 +82,11 @@ typedef int ssize_t;
#define RTLD_GLOBAL 0x100
#endif
#ifndef S_ISLNK
# define S_ISLNK(mod) (0)
#endif
#ifndef S_ISDIR
# define S_ISDIR(mod) (((mod) & _S_IFMT) == _S_IFDIR)
#endif
#ifndef S_ISCHR
# define S_ISCHR(mod) (((mod) & _S_IFMT) == _S_IFCHR)
#endif
#ifndef S_ISREG
# define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG)
#endif
/* So we open files in 64 bit access mode on Linux */
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif
#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
/****************************************************************
* Constants
*/
......
......@@ -31,14 +31,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <direct.h>
#include <io.h>
#define mkdir(path,mode) mkdir(path)
#endif
#include "tools.h"
#include "wine/list.h"
......
......@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
......@@ -34,10 +35,34 @@
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <direct.h>
# include <io.h>
# include <process.h>
# define mkdir(path,mode) mkdir(path)
# ifndef S_ISREG
# define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG)
# endif
# ifdef _MSC_VER
# define popen _popen
# define pclose _pclose
# define strtoll _strtoi64
# define strtoull _strtoui64
# define strncasecmp _strnicmp
# define strcasecmp _stricmp
# endif
#else
# include <sys/wait.h>
# include <unistd.h>
# ifndef O_BINARY
# define O_BINARY 0
# endif
# ifndef __int64
# if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
# define __int64 long
# else
# define __int64 long long
# endif
# endif
#endif
#if !defined(__GNUC__) && !defined(__attribute__)
......
......@@ -250,7 +250,7 @@ static void tlb_read(int fd, void *buf, int count)
error("error while reading importlib.\n");
}
static void tlb_lseek(int fd, off_t offset)
static void tlb_lseek(int fd, int offset)
{
if(lseek(fd, offset, SEEK_SET) == -1)
error("lseek failed\n");
......
......@@ -287,7 +287,7 @@ static void add_widl_version_define(void)
if (p)
version += atoi(p + 1);
snprintf(version_str, sizeof(version_str), "__WIDL__=0x%x", version);
sprintf(version_str, "__WIDL__=0x%x", version);
wpp_add_cmdline_define(version_str);
}
......
......@@ -68,7 +68,7 @@ void output_spec_symbol (const parsed_symbol *sym)
assert (sym && sym->symbol);
if (sym->ordinal >= 0)
snprintf(ord_spec, 12, "%d", sym->ordinal);
sprintf(ord_spec, "%d", sym->ordinal);
else
{
ord_spec[0] = '@';
......@@ -485,7 +485,7 @@ void output_c_banner (const parsed_symbol *sym)
size_t i;
if (sym->ordinal >= 0)
snprintf(ord_spec, sizeof (ord_spec), "%d", sym->ordinal);
sprintf(ord_spec, "%d", sym->ordinal);
else
{
ord_spec[0] = '@';
......
......@@ -279,9 +279,9 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
printf("-Unknown symbol info version %d\n", symbols->version);
}
if (symbols->flags & 0x8000) /* new */
snprintf(tcver, sizeof(tcver), "%u.%u", (symbols->flags >> 8) & 0x7f, symbols->flags & 0xff);
sprintf(tcver, "%u.%u", (symbols->flags >> 8) & 0x7f, symbols->flags & 0xff);
else
snprintf(tcver, sizeof(tcver), "old-%x", symbols->flags);
sprintf(tcver, "old-%x", symbols->flags);
printf("Symbols:\n"
"\tsignature: %08x\n"
"\tversion: %u\n"
......
......@@ -2442,7 +2442,7 @@ static void do_grab_sym( void )
{
char ordinal_text[256];
/* Ordinal only entry */
snprintf (ordinal_text, sizeof(ordinal_text), "%s_%u",
sprintf (ordinal_text, "%s_%u",
globals.forward_dll ? globals.forward_dll : OUTPUT_UC_DLL_NAME,
exportDir->Base + i);
str_toupper(ordinal_text);
......
......@@ -26,8 +26,8 @@
#include <assert.h>
#include <string.h>
#include "utils.h"
#include "wmc.h"
#include "utils.h"
#include "lang.h"
#include "mcy.tab.h"
......
......@@ -44,8 +44,8 @@
#include <stdlib.h>
#include <assert.h>
#include "utils.h"
#include "wmc.h"
#include "utils.h"
#include "lang.h"
static const char err_syntax[] = "Syntax error\n";
......
......@@ -28,10 +28,9 @@
#include <assert.h>
#include <ctype.h>
#include "wmctypes.h"
#include "wmc.h"
#include "winnls.h"
#include "utils.h"
#include "wmc.h"
#define SUPPRESS_YACC_ERROR_MESSAGE
......
......@@ -21,7 +21,6 @@
#ifndef __WMC_UTILS_H
#define __WMC_UTILS_H
#include "../tools.h"
#include "wmctypes.h"
int mcy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
......
......@@ -21,6 +21,7 @@
#ifndef __WMC_WMC_H
#define __WMC_WMC_H
#include "../tools.h"
#include "wmctypes.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