Avoid problem with forward reference to const object

This commit is contained in:
James Clark 1997-12-10 14:19:33 +00:00
parent 8b6b5840ee
commit dc8aa626cc
2 changed files with 14 additions and 9 deletions

View File

@ -55,9 +55,7 @@ struct normal_encoding {
unsigned char type[256];
};
static const struct normal_encoding latin1_encoding;
#define latin1tab (latin1_encoding.type)
static int checkCharRefNumber(int);
#include "xmltok_impl.h"
@ -669,3 +667,15 @@ int XmlParseXmlDecl(int isGeneralTextEntity,
}
return 1;
}
static
int checkCharRefNumber(int result)
{
/* FIXME maybe exclude surrogates as well */
if ((result < 0x80 && latin1_encoding.type[result] == BT_NONXML)
|| result == 0xFFFE
|| result == 0xFFFF)
return -1;
return result;
}

View File

@ -1228,12 +1228,7 @@ int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
return -1;
}
}
/* FIXME maybe exclude surrogates as well */
if ((result < 0x80 && latin1tab[result] == BT_NONXML)
|| result == 0xFFFE
|| result == 0xFFFF)
return -1;
return result;
return checkCharRefNumber(result);
}
static