W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 1999

Tidy coding questions

From: Andy Quick <ac.quick@sympatico.ca>
Date: Sat, 12 Jun 1999 15:29:46 -0400
Message-ID: <001701beb509$eeee99a0$85fbacce@quick>
To: <html-tidy@w3.org>
Dave,

This report is to draw your attention to a couple of coding oddities that I found with Tidy in translating it to the more strongly-typed Java.

(1) In parser.c ParseBody (line 2227) there is the following if statement:

                if (!node->tag->model & (CM_ROW | CM_FIELD))

    In C, the operator '!' has higher precedence than '&', furthermore,
    according to K & R, '!' converts a non-zero operand to 0 and 0 to 1.
    So, I doubt that this is what you intended.  Did you intend the following?

                if (!(node->tag->model & (CM_ROW | CM_FIELD)))

(2) In parser.c ParseDocument (line 2715) there is this function call:

        ParseHTML(lexer, html, no);

    But the prototype of ParseHTML is as follows:

        void ParseHTML(Lexer *lexer, Node *html, uint mode)

    Did you intend to pass IgnoreWhitespace (0) as the mode (since 'no' is
    the first element of the enum Bool).

Regards,

Andy Quick
Received on Saturday, 12 June 1999 15:30:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT