# HG changeset patch # User J. Ali Harlow # Date 1528193273 -3600 # Node ID 5a49f274ab2dea9ddfb6d8eb8256c23e9dfdeadd # Parent 6fbb686d919fd1d892a03659cdd558fdbc81a75e Fix bug with handling empty root in KTM version of make_dirs diff -r 6fbb686d919f -r 5a49f274ab2d librazor/atomic-ktm.c --- a/librazor/atomic-ktm.c Tue Apr 24 19:27:53 2018 +0100 +++ b/librazor/atomic-ktm.c Tue Jun 05 11:07:53 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); diff -r 6fbb686d919f -r 5a49f274ab2d librazor/razor-internal.h --- a/librazor/razor-internal.h Tue Apr 24 19:27:53 2018 +0100 +++ b/librazor/razor-internal.h Tue Jun 05 11:07:53 2018 +0100 @@ -418,7 +418,7 @@ #ifdef MSWIN_API #define SKIP_DRIVE_LETTER(path) \ - ((RAZOR_ASCII_ISALPHA(path[0]) && (path)[1] == ':') ? \ + ((RAZOR_ASCII_ISALPHA((path)[0]) && (path)[1] == ':') ? \ (path) + 2 : (path)) #else #define SKIP_DRIVE_LETTER(path) (path)