Changed iterator internal logic to use a one-based index instead of 0; an

index of 0 can be considered NULL.
This commit is contained in:
Jim Derry 2017-11-22 12:33:12 -05:00
parent 19e8796a5b
commit 2cc140355d

View file

@ -392,7 +392,7 @@ TidyMessageArgument TY_(getNextMessageArgument)( TidyMessageImpl message, TidyIt
if ( itemIndex >= 1 && itemIndex <= (size_t)message.argcount )
{
item = itemIndex - 1;
item = itemIndex;
itemIndex++;
}
@ -407,7 +407,7 @@ TidyMessageArgument TY_(getNextMessageArgument)( TidyMessageImpl message, TidyIt
TidyFormatParameterType TY_(getArgType)( TidyMessageImpl message, TidyMessageArgument* arg )
{
int argNum = (int)(size_t)*arg;
int argNum = (int)(size_t)*arg - 1;
assert( argNum <= message.argcount );
return message.arguments[argNum].type;
@ -416,7 +416,7 @@ TidyFormatParameterType TY_(getArgType)( TidyMessageImpl message, TidyMessageArg
ctmbstr TY_(getArgFormat)( TidyMessageImpl message, TidyMessageArgument* arg )
{
int argNum = (int)(size_t)*arg;
int argNum = (int)(size_t)*arg - 1;
assert( argNum <= message.argcount );
return message.arguments[argNum].format;
@ -425,7 +425,7 @@ ctmbstr TY_(getArgFormat)( TidyMessageImpl message, TidyMessageArgument* arg )
ctmbstr TY_(getArgValueString)( TidyMessageImpl message, TidyMessageArgument* arg )
{
int argNum = (int)(size_t)*arg;
int argNum = (int)(size_t)*arg - 1;
assert( argNum <= message.argcount );
assert( message.arguments[argNum].type == tidyFormatType_STRING);
@ -435,7 +435,7 @@ ctmbstr TY_(getArgValueString)( TidyMessageImpl message, TidyMessageArgument* ar
uint TY_(getArgValueUInt)( TidyMessageImpl message, TidyMessageArgument* arg )
{
int argNum = (int)(size_t)*arg;
int argNum = (int)(size_t)*arg - 1;
assert( argNum <= message.argcount );
assert( message.arguments[argNum].type == tidyFormatType_UINT);
@ -445,7 +445,7 @@ uint TY_(getArgValueUInt)( TidyMessageImpl message, TidyMessageArgument* arg )
int TY_(getArgValueInt)( TidyMessageImpl message, TidyMessageArgument* arg )
{
int argNum = (int)(size_t)*arg;
int argNum = (int)(size_t)*arg - 1;
assert( argNum <= message.argcount );
assert( message.arguments[argNum].type == tidyFormatType_INT);
@ -455,7 +455,7 @@ int TY_(getArgValueInt)( TidyMessageImpl message, TidyMessageArgument* arg )
double TY_(getArgValueDouble)( TidyMessageImpl message, TidyMessageArgument* arg )
{
int argNum = (int)(size_t)*arg;
int argNum = (int)(size_t)*arg - 1;
assert( argNum <= message.argcount );
assert( message.arguments[argNum].type == tidyFormatType_DOUBLE);