diff options
author | Lev Walkin <vlm@lionet.info> | 2005-02-25 14:20:30 +0000 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2005-02-25 14:20:30 +0000 |
commit | 4efbfb7e5553b41f4d725479823705aa6ef073cc (patch) | |
tree | da88699c9d0001e9f7415a7b38e1fc2887bf3503 /libasn1compiler/asn1c_compat.c | |
parent | 8d35c46db72ad6cf53e47c10253d9754af535f22 (diff) |
portability fixes
Diffstat (limited to 'libasn1compiler/asn1c_compat.c')
-rw-r--r-- | libasn1compiler/asn1c_compat.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libasn1compiler/asn1c_compat.c b/libasn1compiler/asn1c_compat.c index 1a402bf4..ebc6d3f0 100644 --- a/libasn1compiler/asn1c_compat.c +++ b/libasn1compiler/asn1c_compat.c @@ -1,24 +1,26 @@ #include "asn1c_internal.h" -#include <asn1c_compat.h> - -#ifdef HAVE_SYS_PARAM_H -#include <sys/param.h> /* For MAXPATHLEN */ -#endif +#include "asn1c_compat.h" #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif #ifndef DEFFILEMODE /* Normally in <sys/stat.h> */ +#ifdef WIN32 +#define DEFFILEMODE 0 +#else #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif +#endif FILE * asn1c_open_file(const char *name, const char *ext) { int created = 1; +#ifndef WIN32 struct stat sb; +#endif char *fname; - int len; + size_t len; FILE *fp; int fd; @@ -42,6 +44,7 @@ asn1c_open_file(const char *name, const char *ext) { return NULL; } +#ifndef WIN32 /* * Check sanity. */ @@ -53,6 +56,9 @@ asn1c_open_file(const char *name, const char *ext) { } (void)ftruncate(fd, 0); +#else + _chsize(fd, 0); +#endif /* WIN32 */ /* * Convert file descriptor into file pointer. |