librazor/atomic-ktm.c
changeset 501 850be6a6885c
parent 494 889dc38157ac
     1.1 --- a/librazor/atomic-ktm.c	Mon Mar 05 20:35:27 2018 +0000
     1.2 +++ b/librazor/atomic-ktm.c	Fri Jun 08 18:02:49 2018 +0100
     1.3 @@ -103,6 +103,30 @@
     1.4  	return 0;
     1.5  }
     1.6  
     1.7 +#if 0
     1.8 +static char *
     1.9 +razor_wstr_contents(struct razor_wstr *wstr, int len)
    1.10 +{
    1.11 +	int n;
    1.12 +	char *s;
    1.13 +
    1.14 +	if (len < 0 || len > wstr->len)
    1.15 +		len = wstr->len;
    1.16 +
    1.17 +	n = WideCharToMultiByte(CP_UTF8, 0, wstr->str, len, NULL, 0, NULL,
    1.18 +				NULL);
    1.19 +
    1.20 +	s = malloc(n + 1);
    1.21 +
    1.22 +	(void)WideCharToMultiByte(CP_UTF8, 0, wstr->str, wstr->len, s, n, NULL,
    1.23 +				  NULL);
    1.24 +
    1.25 +	s[n] = '\0';
    1.26 +
    1.27 +	return s;
    1.28 +}
    1.29 +#endif
    1.30 +
    1.31  static void
    1.32  razor_wstr_destroy(struct razor_wstr *wstr)
    1.33  {
    1.34 @@ -194,9 +218,13 @@
    1.35  			razor_atomic_propagate_error(atomic, tmp_error, NULL);
    1.36  			return -1;
    1.37  		}
    1.38 -		s = SKIP_DRIVE_LETTER(ru.path);
    1.39 +		s = ru.path;
    1.40  		if (*s == '/')
    1.41 -			s++;
    1.42 +		{
    1.43 +			s = SKIP_DRIVE_LETTER(ru.path + 1);
    1.44 +			if (s > ru.path + 1 && *s == '/')
    1.45 +				s++;
    1.46 +		}
    1.47  		*s = '\0';
    1.48  		s = razor_uri_recompose(&ru);
    1.49  		uri += strlen(s);
    1.50 @@ -207,7 +235,9 @@
    1.51  			razor_atomic_propagate_error(atomic, tmp_error, NULL);
    1.52  			return -1;
    1.53  		}
    1.54 -		path = razor_path_from_uri(uri, &tmp_error);
    1.55 +		s = razor_concat("file:", uri, NULL);
    1.56 +		path = razor_path_from_uri(s, &tmp_error);
    1.57 +		free(s);
    1.58  		if (!path) {
    1.59  			razor_atomic_propagate_error(atomic, tmp_error, NULL);
    1.60  			free(root);