diff -r 889dc38157ac -r c89e5edb8eae librazor/atomic-ktm.c --- a/librazor/atomic-ktm.c Mon Mar 05 20:35:27 2018 +0000 +++ b/librazor/atomic-ktm.c Thu Jun 07 18:36:20 2018 +0100 @@ -103,6 +103,30 @@ return 0; } +#if 0 +static char * +razor_wstr_contents(struct razor_wstr *wstr, int len) +{ + int n; + char *s; + + if (len < 0 || len > wstr->len) + len = wstr->len; + + n = WideCharToMultiByte(CP_UTF8, 0, wstr->str, len, NULL, 0, NULL, + NULL); + + s = malloc(n + 1); + + (void)WideCharToMultiByte(CP_UTF8, 0, wstr->str, wstr->len, s, n, NULL, + NULL); + + s[n] = '\0'; + + return s; +} +#endif + static void razor_wstr_destroy(struct razor_wstr *wstr) { @@ -194,9 +218,13 @@ razor_atomic_propagate_error(atomic, tmp_error, NULL); return -1; } - s = SKIP_DRIVE_LETTER(ru.path); + s = ru.path; if (*s == '/') - s++; + { + s = SKIP_DRIVE_LETTER(ru.path + 1); + if (s > ru.path + 1 && *s == '/') + s++; + } *s = '\0'; s = razor_uri_recompose(&ru); uri += strlen(s); @@ -207,7 +235,9 @@ razor_atomic_propagate_error(atomic, tmp_error, NULL); return -1; } - path = razor_path_from_uri(uri, &tmp_error); + s = razor_concat("file:", uri, NULL); + path = razor_path_from_uri(s, &tmp_error); + free(s); if (!path) { razor_atomic_propagate_error(atomic, tmp_error, NULL); free(root);