|Re: [hatari-devel] SDL GUI file and directory selection|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] SDL GUI file and directory selection
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Wed, 19 Oct 2022 04:22:13 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1666153335; bh=zJylAW2Zws5bG8w7OKU+kAtfZWverG751x/38gJbxAA=; h=Date:From:To:Subject:From; b=HF0LOuDbkXio8SR7Qlo2u/Uo8ezqmncvHlaiXzsitZ5vXxFEJSEeFOJb6Va51Pnby gqkdNUyA/1FnIu7GS/i8gVeLignsrqXvN2/cv+g/if+xXyL2FMuL69fTQ/szLqqBA2 F199EiFSusp+8QCYq9cmaFgUdnJiYENLKw4nCkkSkE0Qgxz8UtVhhIrlEGBAAzhwc9 SGXaeqJiF+PSlgRKbROS0fMZMQvqpZgPd/kHUlNC/CsVDJbIMUa4vSXblVKBMIQIGG N0IwVSr5xhQeg2x1ZC9Pp6RUHKKzv8rOwt2zjge9Rh9LWK6Jmt8YpWr3aoUVDBoX2q R7aLTtuiuFtPw==
Am Tue, 18 Oct 2022 21:55:36 +0200
schrieb Andreas Grabher <andreas_g86@xxxxxxxxxx>:
> I got one last question:
> I noticed that File_MakeValidPathName() outputs just '\0‘ if the input is
> "/somefile" (some file selected in root directory). I think it should
> return "/" instead.
Sounds reasonable, yes!
> It seems that the if-statement "if (pPathName)“ is causing that issue.
> I tried removing it and didn’t see any regression yet. Does anyone have an
> idea why this if-statement exists? The explanation of the function tells
> that empty strings should be left as-is. What does this mean? At least it
> does not seem to work properly.
As far as I understand, the intention here is to avoid writing past the end
of a buffer of empty input strings, e.g. the calling code is doing
something like this:
char str = "";
But the check seems to be at the wrong location. It should be done at the
beginning of the function instead:
Thanks for the hint!