From 936595643a2a71f6ef3e50cb7c71734e30b20b2f Mon Sep 17 00:00:00 2001 From: Lev Walkin <vlm@lionet.info> Date: Sat, 20 Nov 2010 09:47:13 -0800 Subject: [PATCH] WIN32 -> _WIN32; see http://predef.sourceforge.net/preos.html#sec25 --- asn1c/asn1c.c | 10 +++++----- asn1c/sys-common.h | 6 +++--- asn1c/webcgi/asn1c-suid-helper.c | 2 +- libasn1compiler/asn1c_compat.c | 10 +++++----- libasn1compiler/asn1c_internal.h | 2 +- libasn1compiler/asn1c_save.c | 4 ++-- libasn1fix/asn1fix_internal.h | 2 +- libasn1fix/check_fixer.c | 16 ++++++++-------- libasn1parser/asn1parser.c | 6 +++--- skeletons/GeneralizedTime.c | 4 ++-- skeletons/asn_system.h | 8 ++++---- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c index 08a3690c..4c565e4a 100644 --- a/asn1c/asn1c.c +++ b/asn1c/asn1c.c @@ -42,7 +42,7 @@ #include <asn1c_compat.h> /* Portable basename(3) and dirname(3) */ -#ifdef WIN32 +#ifdef _WIN32 #include <io.h> #include <direct.h> #else @@ -345,7 +345,7 @@ importStandardModules(asn1p_t *asn, const char *skeletons_dir) { char *target_dir; int target_dir_len; int len; -#ifdef WIN32 +#ifdef _WIN32 intptr_t dir; struct _finddata_t c_file; char *pattern; @@ -369,7 +369,7 @@ importStandardModules(asn1p_t *asn, const char *skeletons_dir) { snprintf(target_dir, target_dir_len + 1, "%s/standard-modules", skeletons_dir); -#ifdef WIN32 +#ifdef _WIN32 len = target_dir_len + sizeof("/*.asn1"); pattern = malloc(len); assert(pattern); @@ -386,7 +386,7 @@ importStandardModules(asn1p_t *asn, const char *skeletons_dir) { return -1; } -#ifdef WIN32 +#ifdef _WIN32 do { filename = c_file.name; #else @@ -416,7 +416,7 @@ importStandardModules(asn1p_t *asn, const char *skeletons_dir) { } asn1p_delete(new_asn); -#ifdef WIN32 +#ifdef _WIN32 } while(_findnext(dir, &c_file) == 0); _findclose(dir); #else diff --git a/asn1c/sys-common.h b/asn1c/sys-common.h index 514a20cd..cac71c01 100644 --- a/asn1c/sys-common.h +++ b/asn1c/sys-common.h @@ -46,9 +46,9 @@ #include <sys/stat.h> /* for stat(2) */ #endif -#ifndef WIN32 +#ifndef _WIN32 #include <sysexits.h> /* for EX_USAGE & others */ -#else /* WIN32 */ +#else /* _WIN32 */ #ifndef EX_USAGE #define EX_USAGE 64 #endif @@ -66,5 +66,5 @@ #endif #define alloca _alloca #define snprintf _snprintf -#endif /* WIN32 */ +#endif /* _WIN32 */ diff --git a/asn1c/webcgi/asn1c-suid-helper.c b/asn1c/webcgi/asn1c-suid-helper.c index a334f1f2..d987c7a2 100644 --- a/asn1c/webcgi/asn1c-suid-helper.c +++ b/asn1c/webcgi/asn1c-suid-helper.c @@ -6,7 +6,7 @@ #include <errno.h> #include <sysexits.h> -#ifdef WIN32 +#ifdef _WIN32 #define setuid(s) #define getuid() #define setgid(s) diff --git a/libasn1compiler/asn1c_compat.c b/libasn1compiler/asn1c_compat.c index 17dd9068..724124c3 100644 --- a/libasn1compiler/asn1c_compat.c +++ b/libasn1compiler/asn1c_compat.c @@ -6,7 +6,7 @@ #endif #ifndef DEFFILEMODE /* Normally in <sys/stat.h> */ -#ifdef WIN32 +#ifdef _WIN32 #define DEFFILEMODE (S_IREAD|S_IWRITE) #else #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) @@ -21,7 +21,7 @@ FILE * asn1c_open_file(const char *name, const char *ext, char **opt_tmpname) { int created = 1; -#ifndef WIN32 +#ifndef _WIN32 struct stat sb; #endif char *fname; @@ -44,7 +44,7 @@ asn1c_open_file(const char *name, const char *ext, char **opt_tmpname) { * Create temporary file. */ fd = mkstemp(fname); -#ifndef WIN32 +#ifndef _WIN32 (void)fchmod(fd, DEFFILEMODE); #endif } else { @@ -62,7 +62,7 @@ asn1c_open_file(const char *name, const char *ext, char **opt_tmpname) { return NULL; } -#ifndef WIN32 +#ifndef _WIN32 /* * Check sanity. */ @@ -76,7 +76,7 @@ asn1c_open_file(const char *name, const char *ext, char **opt_tmpname) { (void)ftruncate(fd, 0); #else _chsize(fd, 0); -#endif /* WIN32 */ +#endif /* _WIN32 */ /* * Convert file descriptor into file pointer. diff --git a/libasn1compiler/asn1c_internal.h b/libasn1compiler/asn1c_internal.h index fb8cc1e2..f97a40bc 100644 --- a/libasn1compiler/asn1c_internal.h +++ b/libasn1compiler/asn1c_internal.h @@ -22,7 +22,7 @@ #include <unistd.h> /* for unlink(2) */ #endif -#ifdef WIN32 +#ifdef _WIN32 #include <io.h> #include <malloc.h> #include <fcntl.h> diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c index f348f197..2a01b411 100644 --- a/libasn1compiler/asn1c_save.c +++ b/libasn1compiler/asn1c_save.c @@ -356,7 +356,7 @@ identical_files(const char *fname1, const char *fname2) { size_t olen, nlen; int retval = 1; /* Files are identical */ -#ifndef WIN32 +#ifndef _WIN32 struct stat sb; if(lstat(fname1, &sb) || !S_ISREG(sb.st_mode) @@ -431,7 +431,7 @@ real_copy(const char *src, const char *dst) { static int asn1c_copy_over(arg_t *arg, char *path) { char *fname; -#ifdef WIN32 +#ifdef _WIN32 int use_real_copy = 1; #else int use_real_copy = (arg->flags & A1C_SKELETONS_COPY); diff --git a/libasn1fix/asn1fix_internal.h b/libasn1fix/asn1fix_internal.h index 612b718a..3ccae818 100644 --- a/libasn1fix/asn1fix_internal.h +++ b/libasn1fix/asn1fix_internal.h @@ -23,7 +23,7 @@ #include <asn1parser.h> /* Our lovely ASN.1 parser module */ #include "asn1fix.h" -#ifdef WIN32 +#ifdef _WIN32 #define EX_NOINPUT 66 #define EX_DATAERR 65 #define snprintf _snprintf diff --git a/libasn1fix/check_fixer.c b/libasn1fix/check_fixer.c index 51e5bbf0..3d5793e3 100644 --- a/libasn1fix/check_fixer.c +++ b/libasn1fix/check_fixer.c @@ -1,7 +1,7 @@ #undef NDEBUG #include "asn1fix_internal.h" -#ifdef WIN32 +#ifdef _WIN32 #include <io.h> #include <direct.h> #define chdir _chdir @@ -21,7 +21,7 @@ static int post_fix_check_element(asn1p_module_t *mod, asn1p_expr_t *expr); int main(int ac, char **av) { -#ifdef WIN32 +#ifdef _WIN32 intptr_t dir; struct _finddata_t c_file; #else @@ -53,13 +53,13 @@ main(int ac, char **av) { fprintf(stderr, "Testing in ./tests...\n"); ret = chdir("../tests"); assert(ret == 0); -#ifdef WIN32 +#ifdef _WIN32 dir = _findfirst("*.asn1", &c_file); assert(dir != -1L); #else dir = opendir("."); assert(dir); -#endif /* WIN32 */ +#endif /* _WIN32 */ } else { dir = 0; } @@ -68,13 +68,13 @@ main(int ac, char **av) { * Scan every *.asn1 file and try to parse and fix it. */ if(dir) { -#ifdef WIN32 +#ifdef _WIN32 do { filename = c_file.name; #else while((dp = readdir(dir))) { filename = dp->d_name; -#endif /* WIN32 */ +#endif /* _WIN32 */ len = strlen(filename); if(len <= 5 || strcmp(filename + len - 5, ".asn1")) continue; @@ -85,13 +85,13 @@ main(int ac, char **av) { failed++; } completed++; -#ifdef WIN32 +#ifdef _WIN32 } while(_findnext(dir, &c_file) == 0); _findclose(dir); #else } closedir(dir); -#endif /* WIN32 */ +#endif /* _WIN32 */ fprintf(stderr, diff --git a/libasn1parser/asn1parser.c b/libasn1parser/asn1parser.c index 7d9a88d7..2ade9e97 100644 --- a/libasn1parser/asn1parser.c +++ b/libasn1parser/asn1parser.c @@ -69,7 +69,7 @@ asn1p_parse_buffer(const char *buffer, int size /* = -1 */, enum asn1p_flags fla */ asn1p_t * asn1p_parse_file(const char *filename, enum asn1p_flags flags) { -#ifndef WIN32 +#ifndef _WIN32 struct stat sb; #endif asn1p_t *a = 0; @@ -88,7 +88,7 @@ asn1p_parse_file(const char *filename, enum asn1p_flags flags) { return NULL; } -#ifndef WIN32 +#ifndef _WIN32 if(fstat(fileno(fp), &sb) || !S_ISREG(sb.st_mode)) { fclose(fp); @@ -97,7 +97,7 @@ asn1p_parse_file(const char *filename, enum asn1p_flags flags) { errno = EINVAL; return NULL; } -#endif /* WIN32 */ +#endif /* _WIN32 */ asn1p_lineno = 1; diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 9d683efe..1a16ba8a 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -14,7 +14,7 @@ #include <time.h> #endif /* __CYGWIN__ */ -#if defined(WIN32) +#if defined(_WIN32) #pragma message( "PLEASE STOP AND READ!") #pragma message( " localtime_r is implemented via localtime(), which may be not thread-safe.") #pragma message( " gmtime_r is implemented via gmtime(), which may be not thread-safe.") @@ -41,7 +41,7 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { #define putenv(c) _putenv(c) #define _EMULATE_TIMEGM -#endif /* WIN32 */ +#endif /* _WIN32 */ #if defined(sun) || defined(_sun_) || defined(__solaris__) #define _EMULATE_TIMEGM diff --git a/skeletons/asn_system.h b/skeletons/asn_system.h index 0a9b092c..d391b7b7 100644 --- a/skeletons/asn_system.h +++ b/skeletons/asn_system.h @@ -21,7 +21,7 @@ #include <stdarg.h> /* For va_start */ #include <stddef.h> /* for offsetof and ptrdiff_t */ -#ifdef WIN32 +#ifdef _WIN32 #include <malloc.h> #define snprintf _snprintf @@ -46,7 +46,7 @@ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #endif /* ASSUMESTDTYPES */ -#define WIN32_LEAN_AND_MEAN +#define _WIN32_LEAN_AND_MEAN #include <windows.h> #include <float.h> #define isnan _isnan @@ -57,7 +57,7 @@ typedef unsigned int uint32_t; #include <stdint.h> #endif /* _MSC_VER */ -#else /* !WIN32 */ +#else /* !_WIN32 */ #if defined(__vxworks) #include <types/vxTypes.h> @@ -90,7 +90,7 @@ typedef unsigned int uint32_t; #endif /* defined(__vxworks) */ -#endif /* WIN32 */ +#endif /* _WIN32 */ #if __GNUC__ >= 3 #ifndef GCC_PRINTFLIKE -- GitLab