I noticed an elegancy bug in ichiparm.h:DetectInputINChIFileType. In addition to the inelgancy of having non-inline function implementation in a header file, there's code which looks like this:
static char szPlnVersion[NUM_VERSIONS][LEN_VERSIONS]; /* = "INChI:1.1Beta/";
...
static int bInitilized = 0;
...
if ( !bInitilized ) {
lenPlnVersion[0] = sprintf( szPlnVersion[0], "%s=%s/",
INCHI_NAME, INCHI_VERSION );
lenPlnVersion[1] = sprintf( szPlnVersion[1], "INChI=1.12Beta/" );
lenPlnVersion[2] = sprintf( szPlnVersion[2], "INChI=1.0RC/" );
lenPlnVersion[3] = sprintf( szPlnVersion[3], "InChI=1.0RC/" );
The bInitilized flag should at some point be set to 1. It's currently left unchanged, so the initialization is done for every step.
A cleaner way is to use string concatenation and write this all in the static initializer (so no need for bInitilized)
static char *szPlnVersion[] = {
INCHI_NAME "=" INCHI_VERSION "/",
"INChI=1.12Beta/",
...
and the part concerning
static char szXmlStruct[LEN_VERSIONS] = "<structure";
static char szXmlMsgFatal[LEN_VERSIONS]= "<message type=\"fatal (aborted)\""
static int lenXmlStruct;
static int lenXmlMsgError = 0;
...
lenXmlStruct = strlen(szXmlStruct);
lenXmlMsgFatal = strlen(szXmlMsgFatal);
replaced with
static char szXmlStruct[] = "<structure";
static char szXmlMsgFatal[]= "<message type=\"fatal (aborted)\""
static int lenXmlStruct = sizeof(szXmlStruct)-1;
static int lenXmlMsgError = sizeof(lenXmlMsgError)-1;