> tridge, you're sure of what you're doing here ? no, and thats why I have reverted the patch until I get it sorted out.
I do know that nearly all the existing uses of init_unistr2() are incorrect for many non-ascii charsets. I also am sure that it should not be the caller that determines the length of the string as determining the character length of a string is actually quite expensive and very error prone so it should be done as part of the push_*(). I'm currently thinking of having a 'flags' parameter, allowing the caller to specify whether the string should be null terminated or not. This will be similar to (or even idential to) the STR_TERMINATE flag we already use. The 2nd major problem is the unihdr stuff. In all our init_*() routines we tend to init the header before we init the unistr2. This follows the order that the string is on the wire, but it is the wrong order from a string handling point of view. We really should init the header after initialising the unistr2, because the lengths in the header are determined by the lengths in the unistr2, and we don't know those till after we've done the push_*(). Cheers, Tridge