From 0c8f684a4b47a5e87c38ea360727824ae8ae3f05 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sat, 2 Sep 2017 18:00:46 -0400 Subject: [PATCH] Migrated messages using formatter formatBadArgument to new message system. All tests passing. --- src/message.c | 29 ++++++++++++----------------- src/message.h | 3 +-- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/message.c b/src/message.c index 7b172aa..62bc85e 100755 --- a/src/message.c +++ b/src/message.c @@ -448,8 +448,12 @@ TidyMessageImpl *formatBadArgument(TidyDocImpl* doc, Node *element, Node *node, { ctmbstr option; - if ( (option = va_arg( args, ctmbstr)) ) - return TY_(tidyMessageCreate)( doc, code, level, option ); + switch ( code ) + { + case STRING_MISSING_MALFORMED: + if ( (option = va_arg( args, ctmbstr)) ) + return TY_(tidyMessageCreate)( doc, code, level, option ); + } return NULL; } @@ -713,11 +717,12 @@ void TY_(ReportAttrError)(TidyDocImpl* doc, Node *node, AttVal *av, uint code) TY_(Report)(doc, NULL, node, code, av); } -//void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option ) -//{ -// assert( option != NULL ); -// TY_(Report)(doc, NULL, NULL, STRING_MISSING_MALFORMED, option); -//} + +void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option ) +{ + assert( option != NULL ); + TY_(Report)(doc, NULL, NULL, STRING_MISSING_MALFORMED, option); +} /********************************************************************* @@ -906,16 +911,6 @@ void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level, uint } -/* lexer is not defined when this is called */ -void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option ) -{ - TidyMessageImpl *message; - assert( option != NULL ); - message = TY_(tidyMessageCreate)( doc, STRING_MISSING_MALFORMED, TidyConfig, option ); - messageOut( message ); -} - - void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded) { TidyMessageImpl *message = NULL; diff --git a/src/message.h b/src/message.h index 61d3579..5a042a6 100644 --- a/src/message.h +++ b/src/message.h @@ -57,6 +57,7 @@ void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code); void TY_(ReportAttrError)(TidyDocImpl* doc, Node *node, AttVal *av, uint code); +void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option ); /** @} */ @@ -65,8 +66,6 @@ void TY_(ReportAttrError)(TidyDocImpl* doc, Node *node, AttVal *av, uint code); void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level, uint code ); -//void TY_(ReportAttrError)( TidyDocImpl* doc, Node* node, AttVal* av, uint code ); -void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option ); void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded); void TY_(ReportEncodingWarning)(TidyDocImpl* doc, uint code, uint encoding); void TY_(ReportEntityError)( TidyDocImpl* doc, uint code, ctmbstr entity, int c );