This routine can never return 0, as if there is no case mapping, the
input is used instead. The code point for that input has already been
derived earlier in the function, so it doesn't have to be recalculated.
And, rearrange the order of things slightly.
}
}
- if (!len) { /* There was no mapping defined, which means that the code
- point maps to itself */
+ if (len) {
+ if (lenp) {
+ *lenp = len;
+ }
+ return valid_utf8_to_uvchr(ustrp, 0);
+ }
+
+ /* Here, there was no mapping defined, which means that the code point maps
+ * to itself. Return the inputs */
len = UTF8SKIP(p);
Copy(p, ustrp, len, U8);
- }
if (lenp)
*lenp = len;
- return len ? valid_utf8_to_uvchr(ustrp, 0) : 0;
+ return uv0;
+
}
STATIC UV