defensive about the check of the flag value for the C-based keyvals.
We would never have had a problem because of the specific input data,
but being defensive is good (and it makes the code a little less
subtle / easier to read).
Also add in more comments about exactly what is going on, since this
is complicated stuff. :-)
This commit was SVN r26000.