+ // the idea of this code is straightforward: it converts a NUL-terminated
+ // chunk of the string during each iteration and updates the output buffer
+ // with the result
+ //
+ // all the complication come from the fact that this function, for
+ // historical reasons, must behave in 2 subtly different ways when it's
+ // called with a fixed number of characters and when it's called for the
+ // entire NUL-terminated string: in the former case (srcEnd == NULL) we
+ // must count all characters we convert, NUL or not; but in the latter we
+ // do not count the trailing NUL -- but still count all the NULs inside the
+ // string
+ //
+ // so for the (simple) former case we just always count the trailing NUL,
+ // but for the latter we need to wait until we see if there is going to be
+ // another loop iteration and only count it then