Squelch some MSVC 2010 warnings, and reset indentation in tidy.c. No version bump.

This commit is contained in:
Jim Derry 2017-09-22 17:27:49 -04:00
parent c30f8537a7
commit cf6f47ca1c
3 changed files with 135 additions and 134 deletions

260
console/tidy.c Normal file → Executable file
View file

@ -2073,154 +2073,154 @@ int main( int argc, char** argv )
printf( "%s\n", tidyLocalizedString(TC_STRING_LANG_MUST_SPECIFY)); printf( "%s\n", tidyLocalizedString(TC_STRING_LANG_MUST_SPECIFY));
} }
else if ( strcasecmp(arg, "help") == 0 || else if ( strcasecmp(arg, "help") == 0 ||
strcasecmp(arg, "-help") == 0 || strcasecmp(arg, "-help") == 0 ||
strcasecmp(arg, "h") == 0 || *arg == '?' ) strcasecmp(arg, "h") == 0 || *arg == '?' )
{
help( tdoc, prog );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-help") == 0)
{
xml_help( );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-error-strings") == 0)
{
xml_error_strings( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-options-strings") == 0)
{
xml_options_strings( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-strings") == 0)
{
xml_strings( );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "help-config") == 0 )
{
optionhelp( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "help-option") == 0 )
{
if ( argc >= 3)
{ {
help( tdoc, prog ); optionDescribe( tdoc, argv[2] );
tidyRelease( tdoc );
return 0; /* success */
} }
else if ( strcasecmp(arg, "xml-help") == 0) else
{ {
xml_help( ); printf( "%s\n", tidyLocalizedString(TC_STRING_MUST_SPECIFY));
tidyRelease( tdoc );
return 0; /* success */
} }
else if ( strcasecmp(arg, "xml-error-strings") == 0) tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-config") == 0 )
{
XMLoptionhelp( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "show-config") == 0 )
{
optionvalues( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "config") == 0 )
{
if ( argc >= 3 )
{ {
xml_error_strings( tdoc ); ctmbstr post;
tidyRelease( tdoc );
return 0; /* success */ tidyLoadConfig( tdoc, argv[2] );
}
else if ( strcasecmp(arg, "xml-options-strings") == 0) /* Set new error output stream if setting changed */
{ post = tidyOptGetValue( tdoc, TidyErrFile );
xml_options_strings( tdoc ); if ( post && (!errfil || !samefile(errfil, post)) )
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-strings") == 0)
{
xml_strings( );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "help-config") == 0 )
{
optionhelp( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "help-option") == 0 )
{
if ( argc >= 3)
{ {
optionDescribe( tdoc, argv[2] ); errfil = post;
errout = tidySetErrorFile( tdoc, post );
} }
else
--argc;
++argv;
}
}
else if ( strcasecmp(arg, "output") == 0 ||
strcasecmp(arg, "-output-file") == 0 ||
strcasecmp(arg, "o") == 0 )
{
if ( argc >= 3 )
{
tidyOptSetValue( tdoc, TidyOutFile, argv[2] );
--argc;
++argv;
}
}
else if ( strcasecmp(arg, "file") == 0 ||
strcasecmp(arg, "-file") == 0 ||
strcasecmp(arg, "f") == 0 )
{
if ( argc >= 3 )
{
errfil = argv[2];
errout = tidySetErrorFile( tdoc, errfil );
--argc;
++argv;
}
}
else if ( strcasecmp(arg, "wrap") == 0 ||
strcasecmp(arg, "-wrap") == 0 ||
strcasecmp(arg, "w") == 0 )
{
if ( argc >= 3 )
{
uint wraplen = 0;
int nfields = sscanf( argv[2], "%u", &wraplen );
tidyOptSetInt( tdoc, TidyWrapLen, wraplen );
if (nfields > 0)
{ {
printf( "%s\n", tidyLocalizedString(TC_STRING_MUST_SPECIFY));
}
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "xml-config") == 0 )
{
XMLoptionhelp( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "show-config") == 0 )
{
optionvalues( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "config") == 0 )
{
if ( argc >= 3 )
{
ctmbstr post;
tidyLoadConfig( tdoc, argv[2] );
/* Set new error output stream if setting changed */
post = tidyOptGetValue( tdoc, TidyErrFile );
if ( post && (!errfil || !samefile(errfil, post)) )
{
errfil = post;
errout = tidySetErrorFile( tdoc, post );
}
--argc; --argc;
++argv; ++argv;
} }
} }
}
else if ( strcasecmp(arg, "version") == 0 ||
strcasecmp(arg, "-version") == 0 ||
strcasecmp(arg, "v") == 0 )
{
version( tdoc );
tidyRelease( tdoc );
return 0; /* success */
else if ( strcasecmp(arg, "output") == 0 || }
strcasecmp(arg, "-output-file") == 0 || else if ( strncmp(argv[1], "--", 2 ) == 0)
strcasecmp(arg, "o") == 0 ) {
if ( tidyOptParseValue(tdoc, argv[1]+2, argv[2]) )
{ {
if ( argc >= 3 ) /* Set new error output stream if setting changed */
ctmbstr post = tidyOptGetValue( tdoc, TidyErrFile );
if ( post && (!errfil || !samefile(errfil, post)) )
{ {
tidyOptSetValue( tdoc, TidyOutFile, argv[2] ); errfil = post;
--argc; errout = tidySetErrorFile( tdoc, post );
++argv;
} }
}
else if ( strcasecmp(arg, "file") == 0 ||
strcasecmp(arg, "-file") == 0 ||
strcasecmp(arg, "f") == 0 )
{
if ( argc >= 3 )
{
errfil = argv[2];
errout = tidySetErrorFile( tdoc, errfil );
--argc;
++argv;
}
}
else if ( strcasecmp(arg, "wrap") == 0 ||
strcasecmp(arg, "-wrap") == 0 ||
strcasecmp(arg, "w") == 0 )
{
if ( argc >= 3 )
{
uint wraplen = 0;
int nfields = sscanf( argv[2], "%u", &wraplen );
tidyOptSetInt( tdoc, TidyWrapLen, wraplen );
if (nfields > 0)
{
--argc;
++argv;
}
}
}
else if ( strcasecmp(arg, "version") == 0 ||
strcasecmp(arg, "-version") == 0 ||
strcasecmp(arg, "v") == 0 )
{
version( tdoc );
tidyRelease( tdoc );
return 0; /* success */
++argv;
--argc;
} }
else if ( strncmp(argv[1], "--", 2 ) == 0) }
{
if ( tidyOptParseValue(tdoc, argv[1]+2, argv[2]) )
{
/* Set new error output stream if setting changed */
ctmbstr post = tidyOptGetValue( tdoc, TidyErrFile );
if ( post && (!errfil || !samefile(errfil, post)) )
{
errfil = post;
errout = tidySetErrorFile( tdoc, post );
}
++argv;
--argc;
}
}
#if SUPPORT_ACCESSIBILITY_CHECKS #if SUPPORT_ACCESSIBILITY_CHECKS
else if ( strcasecmp(arg, "access") == 0 ) else if ( strcasecmp(arg, "access") == 0 )

View file

@ -1095,9 +1095,10 @@ void TY_(Dialogue)(TidyDocImpl* doc, uint code, ...)
{ {
if ( dialogueDispatchTable[i].code == code ) if ( dialogueDispatchTable[i].code == code )
{ {
TidyMessageImpl *message;
TidyReportLevel level = dialogueDispatchTable[i].level; TidyReportLevel level = dialogueDispatchTable[i].level;
va_start(args, code); va_start(args, code);
TidyMessageImpl *message = formatDialogue( doc, code, level, args ); message = formatDialogue( doc, code, level, args );
va_end(args); va_end(args);
messageOut( message ); messageOut( message );
break; break;

6
src/tmbstr.c Normal file → Executable file
View file

@ -126,15 +126,15 @@ int TY_(tmbstrcasecmp)( ctmbstr s1, ctmbstr s2 )
int TY_(tmbstrncmp)( ctmbstr s1, ctmbstr s2, uint n ) int TY_(tmbstrncmp)( ctmbstr s1, ctmbstr s2, uint n )
{ {
if (s1 == NULL || s2 == NULL) uint c;
if (s1 == NULL || s2 == NULL)
{ {
if (s1 == s2) if (s1 == s2)
return 0; return 0;
return (s1 == NULL ? -1 : 1); return (s1 == NULL ? -1 : 1);
} }
uint c;
while ((c = (byte)*s1) == (byte)*s2) while ((c = (byte)*s1) == (byte)*s2)
{ {
if (c == '\0') if (c == '\0')