[PATCH 1/6] windows.c: sanitize the backend for path retrieval

Dirk Hohndel dirk at hohndel.org
Tue Oct 6 07:33:25 PDT 2015


I'm not the Windows expert, you are. With that in mind (and without having
tested this on Windows, yet), a couple of comments...

On Tue, Oct 06, 2015 at 01:10:16PM +0300, Lubomir I. Ivanov wrote:

> +/* this function returns the Win32 Roaming path for the current user as UTF-8.
> + * it never returns NULL but fallsback to .\ instead!
> + * the append argument will append a wchar_t string to the end of the path.
> + */
> +static const char *system_default_path_append(const wchar_t *append)
> +{
> +	wchar_t wpath[MAX_PATH] = { 0 };
> +	const char *fname = "system_default_path()";

Hehe - that's actually not the correct function name :-)

> +	fallback:
> +		fprintf(stderr, "%s: cannot obtain path as UTF-8!\n", fname);
> +		const char *local = ".\\Subsurface";
> +		const int len = strlen(local) + 1;
> +		path = (char *)realloc(path, len);
> +		memset(path, 0, len);
> +		strcat(path, local);
> +		return path;

Coding style... the label goes to column 1 and everything moves one indent
to the left.

Other than that it looks good.

These two changes are so trivial, I can just make them when applying the
patch.

/D


More information about the subsurface mailing list