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

Lubomir I. Ivanov neolit123 at gmail.com
Tue Oct 6 07:42:49 PDT 2015


On 6 October 2015 at 17:33, Dirk Hohndel <dirk at hohndel.org> wrote:
> 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 :-)
>

yeah, it used to be called that.

>> +     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.
>

oops.

lubomir
--


More information about the subsurface mailing list