Monday, November 10, 2008

Major fix in Mychem

A major bug has been fixed into Mychem. Fredrik Wallner has posted the main patch.
In some case, the return value of Mychem functions was blank and no error were raised.
Fredrik Wallner has founded that setting a character at the end of the string to '\0' fixes this issue.

The old code:
const char *inputMol = args->args[0];

The new code:
char *inputMol = (char *) malloc(sizeof(char)*(args->lengths[0]+1));
strncpy(inputMol, args->args[0], args->lengths[0]);
inputMol[args->lengths[0]] = 0;

This indicates that the character string given by MySQL as parameter does not contains the '\0' character at the end.

Many thanks to Fredrik Wallner !

The road is now open to go to the next release (0.6.0)