diff options
Diffstat (limited to 'solenv/bin/concat-deps.c')
-rw-r--r-- | solenv/bin/concat-deps.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c index 5b478aa822fa..5782f66e10b2 100644 --- a/solenv/bin/concat-deps.c +++ b/solenv/bin/concat-deps.c @@ -30,12 +30,12 @@ #define USE_MEMORY_ALIGNMENT 4 #endif /* Def _AIX */ -#ifdef __CYGWIN__ +#ifdef _MSC_VER #define __windows #define CORE_BIG_ENDIAN 0 #define CORE_LITTLE_ENDIAN 1 #define USE_MEMORY_ALIGNMENT 64 /* big value -> no alignment */ -#endif /* Def __CYGWIN__ */ +#endif /* Def _MSC_VER */ #if defined(__linux) || defined(__OpenBSD__) || \ defined(__FreeBSD__) || defined(__NetBSD__) || \ @@ -97,7 +97,10 @@ #ifdef __windows #define FILE_O_RDONLY _O_RDONLY #define FILE_O_BINARY _O_BINARY -#define PATHNCMP strncasecmp /* MSVC converts paths to lower-case sometimes? */ +#define PATHNCMP _strnicmp /* MSVC converts paths to lower-case sometimes? */ +#define inline __inline +#define ssize_t long +#define S_ISREG(mode) (((mode) & _S_IFMT) == (_S_IFREG)) /* MSVC does not have this macro */ #else /* not windaube */ #define FILE_O_RDONLY O_RDONLY #define FILE_O_BINARY 0 @@ -775,10 +778,17 @@ static void emit_unpacked_target(char const*const token, char const*const end) { /* is there some obvious way to printf N characters that i'm missing? */ size_t size = end - token + 1; - char tmp[size]; + char* tmp=(char *)malloc(size*sizeof(char)); + #ifdef _MSC_VER + // MSVC _snprintf doesn't null terminate strings + _snprintf(tmp, size, "%s", token); + tmp[size-1]='\0'; + #else snprintf(tmp, size, "%s", token); + #endif fputs(tmp, stdout); fputs(".done ", stdout); + free(tmp); } /* prefix paths to absolute */ @@ -787,6 +797,7 @@ static inline void print_fullpaths(char* line) char* token; char* end; int boost_count = 0; + int token_len; const char * unpacked_end = 0; /* end of UnpackedTarget match (if any) */ /* for UnpackedTarget the target is GenC{,xx}Object, dont mangle! */ int target_seen = 0; @@ -805,7 +816,7 @@ static inline void print_fullpaths(char* line) while (*end && (' ' != *end) && ('\t' != *end) && (':' != *end)) { ++end; } - int token_len = end - token; + token_len = end - token; if (target_seen && elide_dependency(token, token_len, &unpacked_end)) { @@ -855,8 +866,9 @@ static inline void print_fullpaths(char* line) static inline char * eat_space_at_end(char * end) { + char * real_end; assert('\0' == *end); - char * real_end = end - 1; + real_end = end - 1; while (' ' == *real_end || '\t' == *real_end || '\n' == *real_end || ':' == *real_end) { /* eat colon and whitespace at end */ |