From 238b8f0a66dcffb2b8d705697171c249e7b46124 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 3 Oct 2017 13:56:31 -0400 Subject: [PATCH] Wipe out dead code. We use git for a reason, so it's never really deleted. --- CMakeLists.txt | 8 ++- console/tidy.c | 18 ------ src/access.c | 44 -------------- src/attrs.c | 157 ------------------------------------------------- src/clean.c | 141 -------------------------------------------- src/clean.h | 8 --- src/config.c | 7 +-- src/entities.c | 34 ----------- src/lexer.c | 43 -------------- src/lexer.h | 16 ----- src/parser.c | 103 -------------------------------- src/pprint.c | 99 ------------------------------- src/pprint.h | 5 -- src/streamio.c | 129 ---------------------------------------- src/tags.c | 12 ---- src/tags.h | 8 --- src/tidy-int.h | 16 ----- src/tidylib.c | 83 -------------------------- src/tmbstr.c | 45 -------------- src/utf8.c | 11 ---- src/win32tc.c | 57 ------------------ 21 files changed, 9 insertions(+), 1035 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 571da1d..f393c89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,7 +226,9 @@ endif () #------------------------------------------------------------------------ # Macro Values -# These additional macros are set in Tidy's source code. +# These additional macros are set in Tidy's source code. It is *very* +# seldom that you would ever have to change any of these in order to +# achieve a functioning build. #------------------------------------------------------------------------ add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" ) add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" ) @@ -241,6 +243,10 @@ if (NO_NATIVE_ISO2022_SUPPORT) add_definitions ( -DNO_NATIVE_ISO2022_SUPPORT=1 ) endif () +# If your OS doesn't have library function access(), build with this flag. +if (NO_ACCESS_SUPPORT) + add_definitions ( -DNO_ACCESS_SUPPORT=1 ) +endif () # Delete me? Not used in Tidy source! add_definitions ( -DHAVE_CONFIG_H ) diff --git a/console/tidy.c b/console/tidy.c index 665d112..0768eda 100644 --- a/console/tidy.c +++ b/console/tidy.c @@ -2451,24 +2451,6 @@ int main( int argc, char** argv ) if ( status >= 0 ) { status = tidyRunDiagnostics( tdoc ); - /*\ Issue #119 - but not really related to 'custom_tags' support. - * Issue ?: To remove some 2014 extra debug output - I wanted to - * remove the Info: messages, but chose to except one, namely - * tidyReportDoctype(), but never intended keeping it here - * for so long! - * That doctype Info:, and all others, are still reported by - * default. geoff - \*/ -#if 0 /* 000000000 this code can be removed some time in future 00000000000 */ - if ( !tidyOptGetBool(tdoc, TidyQuiet) ) { - /* NOT quiet, show DOCTYPE, if not already shown */ - if (!tidyOptGetBool(tdoc, TidyShowInfo)) { - tidyOptSetBool( tdoc, TidyShowInfo, yes ); - tidyReportDoctype( tdoc ); /* FIX20140913: like warnings, errors, ALWAYS report DOCTYPE */ - tidyOptSetBool( tdoc, TidyShowInfo, no ); - } - } -#endif /* 000000000 this code can be removed some time in future 00000000000 */ } if ( status > 1 ) /* If errors, do we want to force output? */ status = ( tidyOptGetBool(tdoc, TidyForceOutput) ? status : -1 ); diff --git a/src/access.c b/src/access.c index 5f5beba..55bfde6 100644 --- a/src/access.c +++ b/src/access.c @@ -2505,50 +2505,6 @@ static void AccessibleCompatible( TidyDocImpl* doc, Node* node ) } -/******************************************************** -* WordCount -* -* Counts the number of words in the document. Must have -* more than 3 words to verify changes in natural -* language of document. -* -* CPR - Not sure what intent is here, but this -* routine has nothing to do with changes in language. -* It seems like a bad idea to emit this message for -* every document with _more_ than 3 words! -********************************************************/ -#if 0 -static int WordCount( TidyDocImpl* doc, Node* node ) -{ - int wc = 0; - - if (Level1_Enabled( doc )) - { - /* Count the number of words found within a text node */ - if ( TY_(nodeIsText)( node ) ) - { - tmbchar ch; - ctmbstr word = textFromOneNode( doc, node ); - if ( !IsWhitespace(word) ) - { - ++wc; - while ( (ch = *word++) && wc < 5 ) - { - if ( ch == ' ') - ++wc; - } - } - } - - for ( node = node->content; wc < 5 && node; node = node->next ) - { - wc += WordCount( doc, node ); - } - } - return wc; -} -#endif - /************************************************** * CheckFlicker * diff --git a/src/attrs.c b/src/attrs.c index 147f0b6..f687c6f 100644 --- a/src/attrs.c +++ b/src/attrs.c @@ -412,24 +412,14 @@ static const Attribute attribute_defs [] = { TidyAttr_ARIA_VALUEMIN, "aria-valuemin", CH_PCDATA }, { TidyAttr_ARIA_VALUENOW, "aria-valuenow", CH_PCDATA }, { TidyAttr_ARIA_VALUETEXT, "aria-valuetext", CH_PCDATA }, - { TidyAttr_X, "x", CH_PCDATA }, /* for */ { TidyAttr_Y, "y", CH_PCDATA }, /* for */ -#if 0 /* with uppercase chars taken directly from W3C; are these case-insensitive everywhere? */ - { TidyAttr_VIEWBOX, "viewBox", VERS_INLINE_SVG, CH_PCDATA }, /* for */ - { TidyAttr_PRESERVEASPECTRATIO, "preserveAspectRatio", VERS_INLINE_SVG, CH_PCDATA }, /* for */ - { TidyAttr_ZOOMANDPAN, "zoomAndPan", VERS_INLINE_SVG, CH_PCDATA }, /* for */ - { TidyAttr_BASEPROFILE, "baseProfile", VERS_INLINE_SVG, CH_PCDATA }, /* for */ - { TidyAttr_CONTENTSCRIPTTYPE, "contentScriptType", VERS_INLINE_SVG, CH_PCDATA }, /* for */ - { TidyAttr_CONTENTSTYLETYPE, "contentStyleType", VERS_INLINE_SVG, CH_PCDATA }, /* for */ -#else { TidyAttr_VIEWBOX, "viewbox", CH_PCDATA }, /* for */ { TidyAttr_PRESERVEASPECTRATIO, "preserveaspectratio", CH_PCDATA }, /* for */ { TidyAttr_ZOOMANDPAN, "zoomandpan", CH_PCDATA }, /* for */ { TidyAttr_BASEPROFILE, "baseprofile", CH_PCDATA }, /* for */ { TidyAttr_CONTENTSCRIPTTYPE, "contentscripttype", CH_PCDATA }, /* for */ { TidyAttr_CONTENTSTYLETYPE, "contentstyletype", CH_PCDATA }, /* for */ -#endif { TidyAttr_DISPLAY, "display", CH_PCDATA }, /* on MATH tag (html5) */ /* RDFa Attributes */ @@ -592,153 +582,6 @@ static ctmbstr GetColorName(ctmbstr code) return NULL; } -#if 0 -static const struct _colors fancy_colors[] = -{ - { "darkgreen", "#006400" }, - { "antiquewhite", "#FAEBD7" }, - { "aqua", "#00FFFF" }, - { "aquamarine", "#7FFFD4" }, - { "azure", "#F0FFFF" }, - { "beige", "#F5F5DC" }, - { "bisque", "#FFE4C4" }, - { "black", "#000000" }, - { "blanchedalmond", "#FFEBCD" }, - { "blue", "#0000FF" }, - { "blueviolet", "#8A2BE2" }, - { "brown", "#A52A2A" }, - { "burlywood", "#DEB887" }, - { "cadetblue", "#5F9EA0" }, - { "chartreuse", "#7FFF00" }, - { "chocolate", "#D2691E" }, - { "coral", "#FF7F50" }, - { "cornflowerblue", "#6495ED" }, - { "cornsilk", "#FFF8DC" }, - { "crimson", "#DC143C" }, - { "cyan", "#00FFFF" }, - { "darkblue", "#00008B" }, - { "darkcyan", "#008B8B" }, - { "darkgoldenrod", "#B8860B" }, - { "darkgray", "#A9A9A9" }, - { "darkgreen", "#006400" }, - { "darkkhaki", "#BDB76B" }, - { "darkmagenta", "#8B008B" }, - { "darkolivegreen", "#556B2F" }, - { "darkorange", "#FF8C00" }, - { "darkorchid", "#9932CC" }, - { "darkred", "#8B0000" }, - { "darksalmon", "#E9967A" }, - { "darkseagreen", "#8FBC8F" }, - { "darkslateblue", "#483D8B" }, - { "darkslategray", "#2F4F4F" }, - { "darkturquoise", "#00CED1" }, - { "darkviolet", "#9400D3" }, - { "deeppink", "#FF1493" }, - { "deepskyblue", "#00BFFF" }, - { "dimgray", "#696969" }, - { "dodgerblue", "#1E90FF" }, - { "firebrick", "#B22222" }, - { "floralwhite", "#FFFAF0" }, - { "forestgreen", "#228B22" }, - { "fuchsia", "#FF00FF" }, - { "gainsboro", "#DCDCDC" }, - { "ghostwhite", "#F8F8FF" }, - { "gold", "#FFD700" }, - { "goldenrod", "#DAA520" }, - { "gray", "#808080" }, - { "green", "#008000" }, - { "greenyellow", "#ADFF2F" }, - { "honeydew", "#F0FFF0" }, - { "hotpink", "#FF69B4" }, - { "indianred", "#CD5C5C" }, - { "indigo", "#4B0082" }, - { "ivory", "#FFFFF0" }, - { "khaki", "#F0E68C" }, - { "lavender", "#E6E6FA" }, - { "lavenderblush", "#FFF0F5" }, - { "lawngreen", "#7CFC00" }, - { "lemonchiffon", "#FFFACD" }, - { "lightblue", "#ADD8E6" }, - { "lightcoral", "#F08080" }, - { "lightcyan", "#E0FFFF" }, - { "lightgoldenrodyellow", "#FAFAD2" }, - { "lightgreen", "#90EE90" }, - { "lightgrey", "#D3D3D3" }, - { "lightpink", "#FFB6C1" }, - { "lightsalmon", "#FFA07A" }, - { "lightseagreen", "#20B2AA" }, - { "lightskyblue", "#87CEFA" }, - { "lightslategray", "#778899" }, - { "lightsteelblue", "#B0C4DE" }, - { "lightyellow", "#FFFFE0" }, - { "lime", "#00FF00" }, - { "limegreen", "#32CD32" }, - { "linen", "#FAF0E6" }, - { "magenta", "#FF00FF" }, - { "maroon", "#800000" }, - { "mediumaquamarine", "#66CDAA" }, - { "mediumblue", "#0000CD" }, - { "mediumorchid", "#BA55D3" }, - { "mediumpurple", "#9370DB" }, - { "mediumseagreen", "#3CB371" }, - { "mediumslateblue", "#7B68EE" }, - { "mediumspringgreen", "#00FA9A" }, - { "mediumturquoise", "#48D1CC" }, - { "mediumvioletred", "#C71585" }, - { "midnightblue", "#191970" }, - { "mintcream", "#F5FFFA" }, - { "mistyrose", "#FFE4E1" }, - { "moccasin", "#FFE4B5" }, - { "navajowhite", "#FFDEAD" }, - { "navy", "#000080" }, - { "oldlace", "#FDF5E6" }, - { "olive", "#808000" }, - { "olivedrab", "#6B8E23" }, - { "orange", "#FFA500" }, - { "orangered", "#FF4500" }, - { "orchid", "#DA70D6" }, - { "palegoldenrod", "#EEE8AA" }, - { "palegreen", "#98FB98" }, - { "paleturquoise", "#AFEEEE" }, - { "palevioletred", "#DB7093" }, - { "papayawhip", "#FFEFD5" }, - { "peachpuff", "#FFDAB9" }, - { "peru", "#CD853F" }, - { "pink", "#FFC0CB" }, - { "plum", "#DDA0DD" }, - { "powderblue", "#B0E0E6" }, - { "purple", "#800080" }, - { "red", "#FF0000" }, - { "rosybrown", "#BC8F8F" }, - { "royalblue", "#4169E1" }, - { "saddlebrown", "#8B4513" }, - { "salmon", "#FA8072" }, - { "sandybrown", "#F4A460" }, - { "seagreen", "#2E8B57" }, - { "seashell", "#FFF5EE" }, - { "sienna", "#A0522D" }, - { "silver", "#C0C0C0" }, - { "skyblue", "#87CEEB" }, - { "slateblue", "#6A5ACD" }, - { "slategray", "#708090" }, - { "snow", "#FFFAFA" }, - { "springgreen", "#00FF7F" }, - { "steelblue", "#4682B4" }, - { "tan", "#D2B48C" }, - { "teal", "#008080" }, - { "thistle", "#D8BFD8" }, - { "tomato", "#FF6347" }, - { "turquoise", "#40E0D0" }, - { "violet", "#EE82EE" }, - { "wheat", "#F5DEB3" }, - { "white", "#FFFFFF" }, - { "whitesmoke", "#F5F5F5" }, - { "yellow", "#FFFF00" }, - { "yellowgreen", "#9ACD32" }, - { NULL, NULL } -}; -#endif - #if ATTRIBUTE_HASH_LOOKUP static uint attrsHash(ctmbstr s) { diff --git a/src/clean.c b/src/clean.c index f59767b..de4caf5 100644 --- a/src/clean.c +++ b/src/clean.c @@ -2166,129 +2166,6 @@ void TY_(BumpObject)( TidyDocImpl* doc, Node *html ) } } -/* This is disabled due to http://tidy.sf.net/bug/681116 */ -#if 0 -void FixBrakes( TidyDocImpl* pDoc, Node *pParent ) -{ - Node *pNode; - Bool bBRDeleted = no; - - if (NULL == pParent) - return; - - /* First, check the status of All My Children */ - pNode = pParent->content; - while (NULL != pNode ) - { - /* The node may get trimmed, so save the next pointer, if any */ - Node *pNext = pNode->next; - FixBrakes( pDoc, pNode ); - pNode = pNext; - } - - - /* As long as my last child is a
, move it to my last peer */ - if ( nodeCMIsBlock( pParent )) - { - for ( pNode = pParent->last; - NULL != pNode && nodeIsBR( pNode ); - pNode = pParent->last ) - { - if ( NULL == pNode->attributes && no == bBRDeleted ) - { - TY_(DiscardElement)( pDoc, pNode ); - bBRDeleted = yes; - } - else - { - TY_(RemoveNode)( pNode ); - TY_(InsertNodeAfterElement)( pParent, pNode ); - } - } - TY_(TrimEmptyElement)( pDoc, pParent ); - } -} -#endif - -/* Issue #456 - This is discarded - See replacement TidyMetaCharset */ -#if 0 /* 000000000000000000000000 */ -void TY_(VerifyHTTPEquiv)(TidyDocImpl* doc, Node *head) -{ - Node *pNode; - StyleProp *pFirstProp = NULL, *pLastProp = NULL, *prop = NULL; - tmbstr s, pszBegin, pszEnd; - ctmbstr enc = TY_(GetEncodingNameFromTidyId)(cfg(doc, TidyOutCharEncoding)); - - if (!enc) - return; - - if (!nodeIsHEAD(head)) - head = TY_(FindHEAD)(doc); - - if (!head) - return; - - /* Find any */ - for (pNode = head->content; NULL != pNode; pNode = pNode->next) - { - AttVal* httpEquiv = TY_(AttrGetById)(pNode, TidyAttr_HTTP_EQUIV); - AttVal* metaContent = TY_(AttrGetById)(pNode, TidyAttr_CONTENT); - - if ( !nodeIsMETA(pNode) || !metaContent || - !AttrValueIs(httpEquiv, "Content-Type") ) - continue; - - pszBegin = s = TY_(tmbstrdup)( doc->allocator, metaContent->value ); - while (pszBegin && *pszBegin) - { - while (isspace( *pszBegin )) - pszBegin++; - pszEnd = pszBegin; - while ('\0' != *pszEnd && ';' != *pszEnd) - pszEnd++; - if (';' == *pszEnd ) - *(pszEnd++) = '\0'; - if (pszEnd > pszBegin) - { - prop = (StyleProp *)TidyDocAlloc(doc, sizeof(StyleProp)); - prop->name = TY_(tmbstrdup)( doc->allocator, pszBegin ); - prop->value = NULL; - prop->next = NULL; - - if (NULL != pLastProp) - pLastProp->next = prop; - else - pFirstProp = prop; - - pLastProp = prop; - pszBegin = pszEnd; - } - } - TidyDocFree( doc, s ); - - /* find the charset property */ - for (prop = pFirstProp; NULL != prop; prop = prop->next) - { - if (0 != TY_(tmbstrncasecmp)( prop->name, "charset", 7 )) - continue; - - TidyDocFree( doc, prop->name ); - prop->name = (tmbstr)TidyDocAlloc( doc, 8 + TY_(tmbstrlen)(enc) + 1 ); - TY_(tmbstrcpy)(prop->name, "charset="); - TY_(tmbstrcpy)(prop->name+8, enc); - s = CreatePropString( doc, pFirstProp ); - TidyDocFree( doc, metaContent->value ); - metaContent->value = s; - break; - } - /* #718127, prevent memory leakage */ - FreeStyleProps(doc, pFirstProp); - pFirstProp = NULL; - pLastProp = NULL; - } -} -#endif /* 000000000000000000000000 */ /*\ * Issue #456 - Check meta charset @@ -2328,13 +2205,6 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc) if (cfgAutoBool(doc, TidyBodyOnly) == TidyYesState) return no; /* nothing to do here if showing body only */ -#if 0 /* 000000000000000000000000 */ - if (!add_meta) { - TY_(VerifyHTTPEquiv)(doc, head); - return no; - } -#endif /* 000000000000000000000000 */ - tidyBufInit(&charsetString); /* Set up the content test 'charset=value' */ tidyBufClear(&charsetString); @@ -2407,17 +2277,6 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc) continue; /* is not 'content-type' */ if (!contentAttr->value) { - /* While this **seems** like a good idea, current tidy accepts this - see reg.test case-1117013.html which contains - so for now. This could be reviewed - in future, since there seem no need to keep this invalid meta */ -#if 0 /* 0000000000000000000000000000000000000000000000000 */ - prevNode = currentNode->prev; - /* maybe need better message here */ - TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED); - TY_(DiscardElement)(doc, currentNode); - currentNode = prevNode; -#endif /* 000000000000000000000000000000000000000000000000 */ continue; /* has no 'content' attribute has NO VALUE! */ } /* check encoding matches diff --git a/src/clean.h b/src/clean.h index f0dab0f..f0ef7a6 100644 --- a/src/clean.h +++ b/src/clean.h @@ -59,14 +59,6 @@ Bool TY_(IsWord2000)( TidyDocImpl* doc ); /* where appropriate move object elements from head to body */ void TY_(BumpObject)( TidyDocImpl* doc, Node *html ); -/* This is disabled due to http://tidy.sf.net/bug/681116 */ -#if 0 -void TY_(FixBrakes)( TidyDocImpl* pDoc, Node *pParent ); -#endif -/* Issue #456 - This is discarded */ -#if 0 -void TY_(VerifyHTTPEquiv)( TidyDocImpl* pDoc, Node *pParent ); -#endif Bool TY_(TidyMetaCharset)(TidyDocImpl* doc); void TY_(DropComments)(TidyDocImpl* doc, Node* node); diff --git a/src/config.c b/src/config.c index 0667f3c..5d0e007 100644 --- a/src/config.c +++ b/src/config.c @@ -751,10 +751,6 @@ Bool TIDY_CALL tidyFileExists( TidyDoc tdoc, ctmbstr filename ) } -#ifndef TIDY_MAX_NAME -#define TIDY_MAX_NAME 64 -#endif - int TY_(ParseConfigFile)( TidyDocImpl* doc, ctmbstr file ) { return TY_(ParseConfigFileEnc)( doc, file, "ascii" ); @@ -764,6 +760,7 @@ int TY_(ParseConfigFile)( TidyDocImpl* doc, ctmbstr file ) */ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc ) { + enum { tidy_max_name = 64 }; uint opterrs = doc->optionErrors; tmbstr fname = (tmbstr) ExpandTilde( doc, file ); TidyConfigImpl* cfg = &doc->config; @@ -784,7 +781,7 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc ) for ( c = SkipWhite(cfg); c != EndOfStream; c = NextProperty(cfg) ) { uint ix = 0; - tmbchar name[ TIDY_MAX_NAME ] = {0}; + tmbchar name[ tidy_max_name ] = {0}; /* // or # start a comment */ if ( c == '/' || c == '#' ) diff --git a/src/entities.c b/src/entities.c index 7dd55eb..a1cf25e 100644 --- a/src/entities.c +++ b/src/entities.c @@ -315,40 +315,6 @@ static const entity* entitiesLookup( ctmbstr s ) return NULL; } -#if 0 -/* entity starting with "&" returns zero on error */ -uint EntityCode( ctmbstr name, uint versions ) -{ - const entity* np; - assert( name && name[0] == '&' ); - - /* numeric entitity: name = "&#" followed by number */ - if ( name[1] == '#' ) - { - uint c = 0; /* zero on missing/bad number */ - Bool isXml = ( (versions & VERS_XML) == VERS_XML ); - - /* 'x' prefix denotes hexadecimal number format */ - if ( name[2] == 'x' || (!isXml && name[2] == 'X') ) - sscanf( name+3, "%x", &c ); - else - sscanf( name+2, "%u", &c ); - - return (uint) c; - } - - /* Named entity: name ="&" followed by a name */ - if ( NULL != (np = entitiesLookup(name+1)) ) - { - /* Only recognize entity name if version supports it. */ - if ( np->versions & versions ) - return np->code; - } - - return 0; /* zero signifies unknown entity name */ -} -#endif - Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions ) { const entity* np; diff --git a/src/lexer.c b/src/lexer.c index 447a8f0..50e055f 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -238,11 +238,6 @@ static struct _doctypes { 20, HT50, 500, no, "HTML5", NULL, NULL }, { 21, XH50, 500, yes, "XHTML5", NULL, NULL }, - /* reminder to add XHTML Print 1.0 support, see http://www.w3.org/TR/xhtml-print */ -#if 0 - { 14, XP10, 100, yes, "XHTML Print 1.0", "-//W3C//DTD XHTML-Print 1.0//EN", "http://www.w3.org/MarkUp/DTD/xhtml-print10.dtd" }, - { 14, XP10, 100, yes, "XHTML Print 1.0", "-//PWG//DTD XHTML-Print 1.0//EN", "http://www.xhtml-print.org/xhtml-print/xhtml-print10.dtd" }, -#endif /* final entry */ { 0, 0, 0, no, NULL, NULL, NULL } }; @@ -825,15 +820,6 @@ Bool TY_(IsXMLNamechar)(uint c) (c >= 0x30fc && c <= 0x30fe)); } -#if 0 -Bool IsLower(uint c) -{ - uint map = MAP(c); - - return (map & lowercase)!=0; -} -#endif - Bool TY_(IsUpper)(uint c) { uint map = MAP(c); @@ -861,24 +847,6 @@ uint TY_(ToUpper)(uint c) return c; } -#if 0 -char FoldCase( TidyDocImpl* doc, tmbchar c, Bool tocaps ) -{ - if ( !cfgBool(doc, TidyXmlTags) ) - { - if ( tocaps ) - { - c = (tmbchar) ToUpper(c); - } - else /* force to lower case */ - { - c = (tmbchar) ToLower(c); - } - } - return c; -} -#endif - /* return last character in string this is useful when trailing quotemark @@ -1002,9 +970,6 @@ void TY_(AddCharToLexer)( Lexer *lexer, uint c ) err = TY_(EncodeCharToUTF8Bytes)( c, buf, NULL, &count ); if (err) { -#if 0 && defined(_DEBUG) - fprintf( stderr, "lexer UTF-8 encoding error for U+%x : ", c ); -#endif /* replacement character 0xFFFD encoded as UTF-8 */ buf[0] = (byte) 0xEF; buf[1] = (byte) 0xBF; @@ -2481,15 +2446,7 @@ static Node *GetCDATA( TidyDocImpl* doc, Node *container ) if (c == EndOfStream) TY_(Report)(doc, container, NULL, MISSING_ENDTAG_FOR ); -/* this was disabled for some reason... */ -#if 0 - if (lexer->txtend > lexer->txtstart) - return TextToken(lexer); - else - return NULL; -#else return TY_(TextToken)(lexer); -#endif } void TY_(UngetToken)( TidyDocImpl* doc ) diff --git a/src/lexer.h b/src/lexer.h index 1d3d9cd..a93ef2c 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -332,18 +332,6 @@ struct _Node struct _Lexer { -#if 0 /* Move to TidyDocImpl */ - StreamIn* in; /* document content input */ - StreamOut* errout; /* error output stream */ - - uint badAccess; /* for accessibility errors */ - uint badLayout; /* for bad style errors */ - uint badChars; /* for bad character encodings */ - uint badForm; /* for mismatched/mispositioned form tags */ - uint warnings; /* count of warnings in this document */ - uint errors; /* count of errors */ -#endif - uint lines; /* lines seen */ uint columns; /* at start of current token */ Bool waswhite; /* used to collapse contiguous white space */ @@ -392,10 +380,6 @@ struct _Lexer TagStyle *styles; /* used for cleaning up presentation markup */ TidyAllocator* allocator; /* allocator */ - -#if 0 - TidyDocImpl* doc; /* Pointer back to doc for error reporting */ -#endif }; diff --git a/src/parser.c b/src/parser.c index 9e6fab6..c873d22 100644 --- a/src/parser.c +++ b/src/parser.c @@ -434,41 +434,6 @@ static void TrimTrailingSpace( TidyDocImpl* doc, Node *element, Node *last ) } } -#if 0 -static Node *EscapeTag(Lexer *lexer, Node *element) -{ - Node *node = NewNode(lexer->allocator, lexer); - - node->start = lexer->lexsize; - AddByte(lexer, '<'); - - if (element->type == EndTag) - AddByte(lexer, '/'); - - if (element->element) - { - char *p; - for (p = element->element; *p != '\0'; ++p) - AddByte(lexer, *p); - } - else if (element->type == DocTypeTag) - { - uint i; - AddStringLiteral( lexer, "!DOCTYPE " ); - for (i = element->start; i < element->end; ++i) - AddByte(lexer, lexer->lexbuf[i]); - } - - if (element->type == StartEndTag) - AddByte(lexer, '/'); - - AddByte(lexer, '>'); - node->end = lexer->lexsize; - - return node; -} -#endif /* 0 */ - /* Only true for text nodes. */ Bool TY_(IsBlank)(Lexer *lexer, Node *node) { @@ -946,22 +911,6 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode) return; } -#if OBSOLETE /* Issue #380 Kill this code! But leave in src, just in case! */ - if ( nodeIsBODY( node ) && DescendantOf( element, TidyTag_HEAD )) - { - /* If we're in the HEAD, close it before proceeding. - This is an extremely rare occurance, but has been observed. - **************************************************************** - Issue #380 - This can cause an INFINITE loop! - This code was added to SF CVS Tidy - revision 1.121 by lpassey, Wed Jul 28 18:08:06 2004 UTC - **************************************************************** - */ - TY_(UngetToken)( doc ); - break; - } -#endif /* #if OBSOLETE */ - if ( nodeIsHTML(node) || nodeIsHEAD(node) || nodeIsBODY(node) ) { if ( TY_(nodeIsElement)(node) ) @@ -991,12 +940,6 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode) */ node->type = StartEndTag; node->implicit = yes; -#if OBSOLETE - TY_(CoerceNode)(doc, node, TidyTag_BR, no, no); - TY_(FreeAttrs)( doc, node ); /* discard align attribute etc. */ - TY_(InsertNodeAtEnd)( element, node ); - node = InferredTag(doc, TidyTag_BR); -#endif } else if (DescendantOf( element, node->tag->id )) { @@ -1006,32 +949,6 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode) */ TY_(UngetToken)( doc ); break; -#if OBSOLETE - Node *parent; - for ( parent = element->parent; - parent != NULL; - parent = parent->parent ) - { - if (node->tag == parent->tag) - { - if (!(element->tag->model & CM_OPT)) - TY_(Report)(doc, element, node, MISSING_ENDTAG_BEFORE ); - - TY_(UngetToken)( doc ); - - if (element->tag->model & CM_OBJECT) - { - /* pop inline stack */ - while (lexer->istacksize > lexer->istackbase) - TY_(PopInline)( doc, NULL ); - lexer->istackbase = istackbase; - } - - TrimSpaces( doc, element ); - return; - } - } -#endif } else { @@ -2365,11 +2282,6 @@ void TY_(ParseDefList)(TidyDocImpl* doc, Node *list, GetTokenMode mode) else /* trim empty dl list */ { TY_(InsertNodeBeforeElement)(list, node); - -/* #540296 tidy dumps with empty definition list */ -#if 0 - TY_(DiscardElement)(list); -#endif } /* #426885 - fix by Glenn Carroll 19 Apr 00, and @@ -4034,15 +3946,6 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode) if (InsertMisc(body, node)) continue; - /* #538536 Extra endtags not detected */ -#if 0 - if ( lexer->seenEndBody == 1 && !iswhitenode ) - { - ++lexer->seenEndBody; - TY_(Report)(doc, body, node, CONTENT_AFTER_BODY); - } -#endif - /* mixed content model permits text */ if (TY_(nodeIsText)(node)) { @@ -4167,12 +4070,6 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode) { node->type = StartEndTag; node->implicit = yes; -#if OBSOLETE - TY_(CoerceNode)(doc, node, TidyTag_BR, no, no); - FreeAttrs( doc, node ); /* discard align attribute etc. */ - TY_(InsertNodeAtEnd)(body, node); - node = TY_(InferredTag)(doc, TidyTag_BR); -#endif } else if ( TY_(nodeHasCM)(node, CM_INLINE) ) TY_(PopInline)( doc, node ); diff --git a/src/pprint.c b/src/pprint.c index 36d7c3f..e27c570 100644 --- a/src/pprint.c +++ b/src/pprint.c @@ -127,36 +127,6 @@ static struct _unicode4cat UnicodeCategory category; } const unicode4cat[] = { -#if 0 - { 0x037E, UCPO }, { 0x0387, UCPO }, { 0x055A, UCPO }, { 0x055B, UCPO }, - { 0x055C, UCPO }, { 0x055D, UCPO }, { 0x055E, UCPO }, { 0x055F, UCPO }, - { 0x0589, UCPO }, { 0x058A, UCPD }, { 0x05BE, UCPO }, { 0x05C0, UCPO }, - { 0x05C3, UCPO }, { 0x05F3, UCPO }, { 0x05F4, UCPO }, { 0x060C, UCPO }, - { 0x060D, UCPO }, { 0x061B, UCPO }, { 0x061F, UCPO }, { 0x066A, UCPO }, - { 0x066B, UCPO }, { 0x066C, UCPO }, { 0x066D, UCPO }, { 0x06D4, UCPO }, - { 0x0700, UCPO }, { 0x0701, UCPO }, { 0x0702, UCPO }, { 0x0703, UCPO }, - { 0x0704, UCPO }, { 0x0705, UCPO }, { 0x0706, UCPO }, { 0x0707, UCPO }, - { 0x0708, UCPO }, { 0x0709, UCPO }, { 0x070A, UCPO }, { 0x070B, UCPO }, - { 0x070C, UCPO }, { 0x070D, UCPO }, { 0x0964, UCPO }, { 0x0965, UCPO }, - { 0x0970, UCPO }, { 0x0DF4, UCPO }, { 0x0E4F, UCPO }, { 0x0E5A, UCPO }, - { 0x0E5B, UCPO }, { 0x0F04, UCPO }, { 0x0F05, UCPO }, { 0x0F06, UCPO }, - { 0x0F07, UCPO }, { 0x0F08, UCPO }, { 0x0F09, UCPO }, { 0x0F0A, UCPO }, - { 0x0F0B, UCPO }, { 0x0F0D, UCPO }, { 0x0F0E, UCPO }, { 0x0F0F, UCPO }, - { 0x0F10, UCPO }, { 0x0F11, UCPO }, { 0x0F12, UCPO }, { 0x0F3A, UCPS }, - { 0x0F3B, UCPE }, { 0x0F3C, UCPS }, { 0x0F3D, UCPE }, { 0x0F85, UCPO }, - { 0x104A, UCPO }, { 0x104B, UCPO }, { 0x104C, UCPO }, { 0x104D, UCPO }, - { 0x104E, UCPO }, { 0x104F, UCPO }, { 0x10FB, UCPO }, { 0x1361, UCPO }, - { 0x1362, UCPO }, { 0x1363, UCPO }, { 0x1364, UCPO }, { 0x1365, UCPO }, - { 0x1366, UCPO }, { 0x1367, UCPO }, { 0x1368, UCPO }, { 0x166D, UCPO }, - { 0x166E, UCPO }, { 0x1680, UCZS }, { 0x169B, UCPS }, { 0x169C, UCPE }, - { 0x16EB, UCPO }, { 0x16EC, UCPO }, { 0x16ED, UCPO }, { 0x1735, UCPO }, - { 0x1736, UCPO }, { 0x17D4, UCPO }, { 0x17D5, UCPO }, { 0x17D6, UCPO }, - { 0x17D8, UCPO }, { 0x17D9, UCPO }, { 0x17DA, UCPO }, { 0x1800, UCPO }, - { 0x1801, UCPO }, { 0x1802, UCPO }, { 0x1803, UCPO }, { 0x1804, UCPO }, - { 0x1805, UCPO }, { 0x1806, UCPD }, { 0x1807, UCPO }, { 0x1808, UCPO }, - { 0x1809, UCPO }, { 0x180A, UCPO }, { 0x180E, UCZS }, { 0x1944, UCPO }, - { 0x1945, UCPO }, -#endif { 0x2000, UCZS }, { 0x2001, UCZS }, { 0x2002, UCZS }, { 0x2003, UCZS }, { 0x2004, UCZS }, { 0x2005, UCZS }, { 0x2006, UCZS }, { 0x2008, UCZS }, { 0x2009, UCZS }, { 0x200A, UCZS }, { 0x2010, UCPD }, { 0x2012, UCPD }, @@ -1064,14 +1034,6 @@ static void PPrintText( TidyDocImpl* doc, uint mode, uint indent, } } -#if 0 -static void PPrintString( TidyDocImpl* doc, uint indent, ctmbstr str ) -{ - while ( *str != '\0' ) - AddChar( &doc->pprint, *str++ ); -} -#endif /* 0 */ - static void PPrintAttrValue( TidyDocImpl* doc, uint indent, ctmbstr value, uint delim, Bool wrappable, Bool scriptAttr ) @@ -1270,15 +1232,6 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent, ++name; } -/* fix for bug 732038 */ -#if 0 - /* If not indenting attributes, bump up indent for - ** value after putting out name. - */ - if ( !indAttrs ) - indent += xtra; -#endif - CheckWrapIndent( doc, indent ); if ( attr->value == NULL ) @@ -1550,17 +1503,6 @@ static void PPrintEndTag( TidyDocImpl* doc, uint ARG_UNUSED(mode), tmbstr s = node->element; tchar c; - /* - Netscape ignores SGML standard by not ignoring a - line break before or etc. To avoid rendering - this as an underlined space, I disable line wrapping - before inline end tags by the #if 0 ... #endif - */ -#if 0 - if ( !(mode & NOWRAP) ) - SetWrap( doc, indent ); -#endif - AddString( pprint, "' ); if ( node->linebreak && node->next ) @@ -1742,9 +1675,6 @@ static void PPrintAsp( TidyDocImpl* doc, uint indent, Node *node ) Bool wrapJste = cfgBool( doc, TidyWrapJste ); uint saveWrap = WrapOffCond( doc, !wrapAsp || !wrapJste ); -#if 0 - SetWrap( doc, indent ); -#endif AddString( pprint, "<%" ); PPrintText( doc, (wrapAsp ? CDATA : COMMENT), indent, node ); AddString( pprint, "%>" ); @@ -1775,9 +1705,6 @@ static void PPrintPhp( TidyDocImpl* doc, uint indent, Node *node ) TidyPrintImpl* pprint = &doc->pprint; Bool wrapPhp = cfgBool( doc, TidyWrapPhp ); uint saveWrap = WrapOffCond( doc, !wrapPhp ); -#if 0 - SetWrap( doc, indent ); -#endif AddString( pprint, "pprint; Bool wrapSect = cfgBool( doc, TidyWrapSection ); uint saveWrap = WrapOffCond( doc, !wrapSect ); -#if 0 - SetWrap( doc, indent ); -#endif AddString( pprint, " -** VBScript: -** ' -** CSS: -** / ** / -** other: -** -*/ -#endif - static ctmbstr CDATA_START = ""; static ctmbstr JS_COMMENT_START = "//"; diff --git a/src/pprint.h b/src/pprint.h index ec5255b..6ae36df 100644 --- a/src/pprint.h +++ b/src/pprint.h @@ -60,11 +60,6 @@ typedef struct _TidyPrintImpl } TidyPrintImpl; -#if 0 -/* #431953 - start RJ Wraplen adjusted for smooth international ride */ -uint CWrapLen( TidyDocImpl* doc, uint ind ); -#endif - void TY_(InitPrintBuf)( TidyDocImpl* doc ); void TY_(FreePrintBuf)( TidyDocImpl* doc ); diff --git a/src/streamio.c b/src/streamio.c index 00ed3ba..b2727cf 100644 --- a/src/streamio.c +++ b/src/streamio.c @@ -80,15 +80,6 @@ StreamOut* TY_(StdErrOutput)(void) return &stderrStreamOut; } -#if 0 -StreamOut* TY_(StdOutOutput)(void) -{ - if ( stdoutStreamOut.sink.sinkData == 0 ) - stdoutStreamOut.sink.sinkData = stdout; - return &stdoutStreamOut; -} -#endif - void TY_(ReleaseStreamOut)( TidyDocImpl *doc, StreamOut* out ) { if ( out && out != &stderrStreamOut && out != &stdoutStreamOut ) @@ -918,78 +909,6 @@ static void EncodeLatin0( uint c, StreamOut* out ) PutByte(c, out); } -#if 0 /* 000000000000000000000000000000000000000 */ - -/* - Table to map symbol font characters to Unicode; undefined - characters are mapped to 0x0000 and characters without any - Unicode equivalent are mapped to '?'. Is this appropriate? -*/ - -static const uint Symbol2Unicode[] = -{ - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - - 0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220D, - 0x0028, 0x0029, 0x2217, 0x002B, 0x002C, 0x2212, 0x002E, 0x002F, - - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - - 0x2245, 0x0391, 0x0392, 0x03A7, 0x0394, 0x0395, 0x03A6, 0x0393, - 0x0397, 0x0399, 0x03D1, 0x039A, 0x039B, 0x039C, 0x039D, 0x039F, - - 0x03A0, 0x0398, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03C2, 0x03A9, - 0x039E, 0x03A8, 0x0396, 0x005B, 0x2234, 0x005D, 0x22A5, 0x005F, - - 0x00AF, 0x03B1, 0x03B2, 0x03C7, 0x03B4, 0x03B5, 0x03C6, 0x03B3, - 0x03B7, 0x03B9, 0x03D5, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BF, - - 0x03C0, 0x03B8, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03D6, 0x03C9, - 0x03BE, 0x03C8, 0x03B6, 0x007B, 0x007C, 0x007D, 0x223C, 0x003F, - - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - - 0x00A0, 0x03D2, 0x2032, 0x2264, 0x2044, 0x221E, 0x0192, 0x2663, - 0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193, - - 0x00B0, 0x00B1, 0x2033, 0x2265, 0x00D7, 0x221D, 0x2202, 0x00B7, - 0x00F7, 0x2260, 0x2261, 0x2248, 0x2026, 0x003F, 0x003F, 0x21B5, - - 0x2135, 0x2111, 0x211C, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229, - 0x222A, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209, - - 0x2220, 0x2207, 0x00AE, 0x00A9, 0x2122, 0x220F, 0x221A, 0x22C5, - 0x00AC, 0x2227, 0x2228, 0x21D4, 0x21D0, 0x21D1, 0x21D2, 0x21D3, - - 0x25CA, 0x2329, 0x00AE, 0x00A9, 0x2122, 0x2211, 0x003F, 0x003F, - 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, - - 0x20AC, 0x232A, 0x222B, 0x2320, 0x003F, 0x2321, 0x003F, 0x003F, - 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x003F -}; - -/* Function to convert from Symbol Font chars to Unicode */ -uint DecodeSymbolFont(uint c) -{ - if (c > 255) - return c; - - /* todo: add some error message */ - - return Symbol2Unicode[c]; -} -#endif /* #if 0 000000000000000000000000000000000000000 */ - - /* Facilitates user defined source by providing ** an entry point to marshal pointers-to-functions. ** Needed by .NET and possibly other language bindings. @@ -1065,54 +984,6 @@ static void PutByte( uint byteValue, StreamOut* out ) tidyPutByte( &out->sink, byteValue ); } -#if 0 -static void UngetRawBytesToStream( StreamIn *in, byte* buf, int *count ) -{ - int i; - - for (i = 0; i < *count; i++) - { - /* should never get here; testing for 0xFF, a valid char, is not a good idea */ - if ( in && TY_(IsEOF)(in) ) - { - /* fprintf(stderr,"Attempt to unget EOF in UngetRawBytesToStream\n"); */ - *count = -i; - return; - } - - in->source.ungetByte( in->source.sourceData, buf[i] ); - } -} - -/* - Read raw bytes from stream, return <= 0 if EOF; or if - "unget" is true, Unget the bytes to re-synchronize the input stream - Normally UTF-8 successor bytes are read using this routine. -*/ -static void ReadRawBytesFromStream( StreamIn *in, byte* buf, int *count ) -{ - int ix; - for ( ix=0; ix < *count; ++ix ) - { - if ( in->rawPushed ) - { - buf[ix] = in->rawBytebuf[ --in->rawBufpos ]; - if ( in->rawBufpos == 0 ) - in->rawPushed = no; - } - else - { - if ( in->source.eof(in->source.sourceData) ) - { - *count = -i; - break; - } - buf[ix] = in->source.getByte( in->source.sourceData ); - } - } -} -#endif /* 0 */ - /* read char from stream */ static uint ReadCharFromStream( StreamIn* in ) { diff --git a/src/tags.c b/src/tags.c index 6eb4bb8..d6ea040 100644 --- a/src/tags.c +++ b/src/tags.c @@ -1056,18 +1056,6 @@ Bool TY_(nodeIsElement)( Node* node ) (node->type == StartTag || node->type == StartEndTag) ); } -#if 0 -/* Compare & result to operand. If equal, then all bits -** requested are set. -*/ -Bool nodeMatchCM( Node* node, uint contentModel ) -{ - return ( node && node->tag && - (node->tag->model & contentModel) == contentModel ); -} -#endif - - Bool TY_(elementIsAutonomousCustomFormat)( ctmbstr element ) { if ( element ) diff --git a/src/tags.h b/src/tags.h index ba746ed..78d6f67 100644 --- a/src/tags.h +++ b/src/tags.h @@ -126,14 +126,6 @@ Bool TY_(nodeIsElement)( Node* node ); Bool TY_(nodeHasText)( TidyDocImpl* doc, Node* node ); -#if 0 -/* Compare & result to operand. If equal, then all bits -** requested are set. -*/ -Bool nodeMatchCM( Node* node, uint contentModel ); -#endif - - /* True if the element looks like it's an autonomous custom element tag. */ Bool TY_(elementIsAutonomousCustomFormat)( ctmbstr element ); diff --git a/src/tidy-int.h b/src/tidy-int.h index 6edb2ec..eaa9a74 100644 --- a/src/tidy-int.h +++ b/src/tidy-int.h @@ -131,21 +131,6 @@ struct _TidyMessageImpl }; -/* Twizzle internal/external types */ -#ifdef NEVER -TidyDocImpl* tidyDocToImpl( TidyDoc tdoc ); -TidyDoc tidyImplToDoc( TidyDocImpl* impl ); - -Node* tidyNodeToImpl( TidyNode tnod ); -TidyNode tidyImplToNode( Node* node ); - -AttVal* tidyAttrToImpl( TidyAttr tattr ); -TidyAttr tidyImplToAttr( AttVal* attval ); - -const TidyOptionImpl* tidyOptionToImpl( TidyOption topt ); -TidyOption tidyImplToOption( const TidyOptionImpl* option ); -#else - #define tidyDocToImpl( tdoc ) ((TidyDocImpl*)(tdoc)) #define tidyImplToDoc( doc ) ((TidyDoc)(doc)) @@ -161,7 +146,6 @@ TidyOption tidyImplToOption( const TidyOptionImpl* option ); #define tidyOptionToImpl( topt ) ((const TidyOptionImpl*)(topt)) #define tidyImplToOption( option ) ((TidyOption)(option)) -#endif /** Wrappers for easy memory allocation using the document's allocator */ #define TidyDocAlloc(doc, size) TidyAlloc((doc)->allocator, size) diff --git a/src/tidylib.c b/src/tidylib.c index da1cb89..50c6335 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -73,43 +73,6 @@ static int tidyDocSaveBuffer( TidyDocImpl* impl, TidyBuffer* outbuf ); static int tidyDocSaveSink( TidyDocImpl* impl, TidyOutputSink* docOut ); static int tidyDocSaveStream( TidyDocImpl* impl, StreamOut* out ); -#ifdef NEVER -TidyDocImpl* tidyDocToImpl( TidyDoc tdoc ) -{ - return (TidyDocImpl*) tdoc; -} -TidyDoc tidyImplToDoc( TidyDocImpl* impl ) -{ - return (TidyDoc) impl; -} - -Node* tidyNodeToImpl( TidyNode tnod ) -{ - return (Node*) tnod; -} -TidyNode tidyImplToNode( Node* node ) -{ - return (TidyNode) node; -} - -AttVal* tidyAttrToImpl( TidyAttr tattr ) -{ - return (AttVal*) tattr; -} -TidyAttr tidyImplToAttr( AttVal* attval ) -{ - return (TidyAttr) attval; -} - -const TidyOptionImpl* tidyOptionToImpl( TidyOption topt ) -{ - return (const TidyOptionImpl*) topt; -} -TidyOption tidyImplToOption( const TidyOptionImpl* option ) -{ - return (TidyOption) option; -} -#endif /* Tidy public interface ** @@ -869,44 +832,6 @@ double TIDY_CALL tidyGetArgValueDouble( TidyMessage tmessage, TidyMessageArgumen } - - -#if 0 /* Not yet */ -int tidySetContentOutputSink( TidyDoc tdoc, TidyOutputSink* outp ) -{ - TidyDocImpl* impl = tidyDocToImpl( tdoc ); - if ( impl ) - { - impl->docOut = outp; - return 0; - } - return -EINVAL; -} -int tidySetDiagnosticOutputSink( TidyDoc tdoc, TidyOutputSink* outp ) -{ - TidyDocImpl* impl = tidyDocToImpl( tdoc ); - if ( impl ) - { - impl->msgOut = outp; - return 0; - } - return -EINVAL; -} - - -/* Library helpers -*/ -cmbstr tidyLookupMessage( TidyDoc tdoc, int errorNo ) -{ - TidyDocImpl* impl = tidyDocToImpl( tdoc ); - cmbstr mssg = NULL; - if ( impl ) - mssg = tidyMessage_Lookup( impl->messages, errorNo ); - return mssg; -} -#endif - - FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam ) { TidyDocImpl* impl = tidyDocToImpl( tdoc ); @@ -2056,14 +1981,6 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc ) if ( gdoc ) TY_(CleanGoogleDocument)( doc ); - /* Move terminating
tags from out of paragraphs */ - /*! Do we want to do this for all block-level elements? */ - - /* This is disabled due to http://tidy.sf.net/bug/681116 */ -#if 0 - FixBrakes( doc, TY_(FindBody)( doc )); -#endif - /* Reconcile http-equiv meta element with output encoding */ TY_(TidyMetaCharset)(doc); diff --git a/src/tmbstr.c b/src/tmbstr.c index f070f7a..cb49266 100644 --- a/src/tmbstr.c +++ b/src/tmbstr.c @@ -177,25 +177,6 @@ int TY_(tmbstrncasecmp)( ctmbstr s1, ctmbstr s2, uint n ) return (*s1 > *s2 ? 1 : -1); } -#if 0 -/* return offset of cc from beginning of s1, -** -1 if not found. -*/ -int TY_(tmbstrnchr)( ctmbstr s1, uint maxlen, tmbchar cc ) -{ - int i; - ctmbstr cp = s1; - - for ( i = 0; (uint)i < maxlen; ++i, ++cp ) - { - if ( *cp == cc ) - return i; - } - - return -1; -} -#endif - ctmbstr TY_(tmbsubstrn)( ctmbstr s1, uint len1, ctmbstr s2 ) { uint len2 = TY_(tmbstrlen)(s2); @@ -209,21 +190,6 @@ ctmbstr TY_(tmbsubstrn)( ctmbstr s1, uint len1, ctmbstr s2 ) return NULL; } -#if 0 -ctmbstr TY_(tmbsubstrncase)( ctmbstr s1, uint len1, ctmbstr s2 ) -{ - uint len2 = TY_(tmbstrlen)(s2); - int ix, diff = len1 - len2; - - for ( ix = 0; ix <= diff; ++ix ) - { - if ( TY_(tmbstrncasecmp)(s1+ix, s2, len2) == 0 ) - return (ctmbstr) s1+ix; - } - return NULL; -} -#endif - ctmbstr TY_(tmbsubstr)( ctmbstr s1, ctmbstr s2 ) { uint len1 = TY_(tmbstrlen)(s1), len2 = TY_(tmbstrlen)(s2); @@ -257,17 +223,6 @@ tmbstr TY_(tmbstrtoupper)(tmbstr s) return s; } -#if 0 -Bool TY_(tmbsamefile)( ctmbstr filename1, ctmbstr filename2 ) -{ -#if FILENAMES_CASE_SENSITIVE - return ( TY_(tmbstrcmp)( filename1, filename2 ) == 0 ); -#else - return ( TY_(tmbstrcasecmp)( filename1, filename2 ) == 0 ); -#endif -} -#endif - int TY_(tmbvsnprintf)(tmbstr buffer, size_t count, ctmbstr format, va_list args) { int retval; diff --git a/src/utf8.c b/src/utf8.c index a23d888..1ed423e 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -273,12 +273,6 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes, if (!hasError && (n > kMaxUTF8FromUCS4)) hasError = yes; -#if 0 /* Breaks Big5 D8 - DF */ - if (!hasError && (n >= kUTF16LowSurrogateBegin) && (n <= kUTF16HighSurrogateEnd)) - /* unpaired surrogates not allowed */ - hasError = yes; -#endif - if (!hasError) { int lo, hi; @@ -364,11 +358,6 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf, bytes = 3; if ( c == kUTF8ByteSwapNotAChar || c == kUTF8NotAChar ) hasError = yes; -#if 0 /* Breaks Big5 D8 - DF */ - else if ( c >= kUTF16LowSurrogateBegin && c <= kUTF16HighSurrogateEnd ) - /* unpaired surrogates not allowed */ - hasError = yes; -#endif } else if (c <= 0x1FFFFF) /* 1111 0XXX four bytes */ { diff --git a/src/win32tc.c b/src/win32tc.c index 6d9cd44..b615206 100644 --- a/src/win32tc.c +++ b/src/win32tc.c @@ -576,63 +576,6 @@ void TY_(Win32MLangUninitInputTranscoder)(StreamIn * in) CoUninitialize(); } -#if 0 -Bool Win32MLangInitOutputTranscoder(TidyAllocator *allocator, StreamOut * out, tmbstr encoding) -{ - IMLangConvertCharset * p = NULL; - HRESULT hr; - uint wincp; - - assert( out != NULL ); - - CoInitialize(NULL); - - wincp = TY_(Win32MLangGetCPFromName)(allocator, encoding); - if (wincp == 0) - { - /* no codepage found for this encoding */ - return no; - } - - hr = CreateMLangObject(p); - - if (hr != S_OK || !p) - { - /* MLang not supported */ - return no; - } - - IMLangConvertCharset_Initialize(p, 1200, wincp, MLCONVCHARF_NOBESTFITCHARS); - - if (hr != S_OK) - { - /* encoding not supported, insufficient memory, etc. */ - return no; - } - - out->mlang = p; - - return yes; -} - -void Win32MLangUninitOutputTranscoder(StreamOut * out) -{ - IMLangConvertCharset * p; - - assert( out != NULL ); - - p = (IMLangConvertCharset *)out->mlang; - if (p) - { - IMLangConvertCharset_Release(p); - p = NULL; - out->mlang = NULL; - } - - CoUninitialize(); -} -#endif - int TY_(Win32MLangGetChar)(byte firstByte, StreamIn * in, uint * bytesRead) { IMLangConvertCharset * p;