-
- length=u_strlen(myPath);
- if(length>=sizeof(path)) {
- *status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- } else if(uprv_isInvariantUString(myPath, length)) {
- /*
- * the invariant converter is sufficient for package and tree names
- * and is more efficient
- */
- u_UCharsToChars(myPath, path, length+1); /* length+1 to include the NUL */
- } else {
-#if !UCONFIG_NO_CONVERSION
- /* use the default converter to support variant-character paths */
- UConverter *cnv=u_getDefaultConverter(status);
- if(U_FAILURE(*status)) {
- return NULL;
- }
-
- length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(path), myPath, length, status);
- u_releaseDefaultConverter(cnv);
- if(U_FAILURE(*status)) {
- return NULL;
- }
- if(length>=sizeof(path)) {
- /* not NUL-terminated - path too long */