mirror of https://gerrit.osmocom.org/asn1c
WIN32 -> _WIN32; see http://predef.sourceforge.net/preos.html#sec25
This commit is contained in:
parent
464166ca44
commit
936595643a
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <errno.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define setuid(s)
|
||||
#define getuid()
|
||||
#define setgid(s)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <unistd.h> /* for unlink(2) */
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <malloc.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue