diff --git a/console/tidy.c b/console/tidy.c index 4c1a77e..507baac 100644 --- a/console/tidy.c +++ b/console/tidy.c @@ -2426,7 +2426,7 @@ int main( int argc, char** argv ) if ( argc > 1 ) { htmlfil = argv[1]; -#if (!defined(NDEBUG) && defined(_MSC_VER)) +#if (!defined(NDEBUG)) SPRTF("Tidying '%s'\n", htmlfil); #endif /* DEBUG outout */ if ( tidyOptGetBool(tdoc, TidyEmacs) ) @@ -2458,7 +2458,7 @@ int main( int argc, char** argv ) if ( outfil ) { status = tidySaveFile( tdoc, outfil ); } else { -#if !defined(NDEBUG) && defined(_MSC_VER) +#if !defined(NDEBUG) static char tmp_buf[264]; sprintf(tmp_buf,"%s.html",get_log_file()); status = tidySaveFile( tdoc, tmp_buf ); diff --git a/include/tidyplatform.h b/include/tidyplatform.h index 7ffac19..5fa7cb7 100644 --- a/include/tidyplatform.h +++ b/include/tidyplatform.h @@ -481,6 +481,10 @@ extern "C" { # define setmode _setmode # endif +# if defined(_MSC_VER) +# define fileno _fileno +#endif + # define access _access # define strcasecmp _stricmp diff --git a/src/fileio.c b/src/fileio.c index da5882e..66df434 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -82,8 +82,8 @@ void TIDY_CALL TY_(filesink_putByte)( void* sinkData, byte bv ) { FILE* fout = (FILE*) sinkData; fputc( bv, fout ); -#if !defined(NDEBUG) && defined(_MSC_VER) - if (_fileno(fout) != 2) +#if !defined(NDEBUG) + if (fileno(fout) != 2) { if (bv != 0x0d) { diff --git a/src/istack.c b/src/istack.c index 2576407..a82227d 100644 --- a/src/istack.c +++ b/src/istack.c @@ -269,7 +269,7 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc ) istack = lexer->insert; /* #if 0 && defined(_DEBUG) */ -#if !defined(NDEBUG) && defined(_MSC_VER) +#if !defined(NDEBUG) if ( lexer->istacksize == 0 ) { SPRTF( "WARNING: ZERO sized istack!\n" ); diff --git a/src/lexer.c b/src/lexer.c index 876d690..38be8e9 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -40,7 +40,7 @@ #include "utf8.h" #include "streamio.h" -#if !defined(NDEBUG) && defined(_MSC_VER) +#if !defined(NDEBUG) /* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */ static void check_me(char *name); static Bool show_attrs = yes; @@ -173,9 +173,9 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node ) } } #define GTDBG(a,b,c) Show_Node(a,b,c) -#else +#else /* NDEBUG is define */ #define GTDBG(a,b,c) -#endif +#endif /* !defined(NDEBUG) */ /* Forward references */ @@ -322,7 +322,7 @@ static uint GetVersFromFPI(ctmbstr fpi) return 0; } -#if (defined(_MSC_VER) && !defined(NDEBUG)) +#if defined(_MSC_VER) /* Issue #377 - Output diminishing version bits */ typedef struct tagV2S { uint bit; @@ -413,14 +413,14 @@ void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers) SPRTF("After : %s\n", vcur); } } -#else /* !#if (defined(_MSC_VER) && !defined(NDEBUG)) */ +#else /* !#if defined(_MSC_VER) */ /* everything is allowed in proprietary version of HTML */ /* this is handled here rather than in the tag/attr dicts */ void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers) { doc->lexer->versions &= (vers | VERS_PROPRIETARY); } -#endif /* #if (defined(_MSC_VER) && !defined(NDEBUG)) y/n */ +#endif /* #if defined(_MSC_VER) y/n */ Bool TY_(IsWhite)(uint c) { @@ -1413,7 +1413,7 @@ Node *TY_(NewNode)(TidyAllocator* allocator, Lexer *lexer) node->column = lexer->columns; } node->type = TextNode; -#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_ALLOCATION) +#if !defined(NDEBUG) && defined(DEBUG_ALLOCATION) SPRTF("Allocated node %p\n", node ); #endif return node; @@ -1507,7 +1507,7 @@ void TY_(RemoveAttribute)( TidyDocImpl* doc, Node *node, AttVal *attr ) */ void TY_(FreeNode)( TidyDocImpl* doc, Node *node ) { -#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_ALLOCATION) +#if !defined(NDEBUG) && defined(DEBUG_ALLOCATION) /* avoid showing free of root node! */ if (node) { if (RootNode != node->type) { @@ -2484,7 +2484,7 @@ Node* TY_(GetToken)( TidyDocImpl* doc, GetTokenMode mode ) return GetTokenFromStream( doc, mode ); } -#if !defined(NDEBUG) && defined(_MSC_VER) +#if !defined(NDEBUG) static void check_me(char *name) { SPRTF("Have node %s\n", name); @@ -3418,7 +3418,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode ) return node; /* the COMMENT token */ } -#if !defined(NDEBUG) && defined(_MSC_VER) +#if !defined(NDEBUG) SPRTF("Returning NULL...\n"); #endif return NULL;