Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Mon, Dec 24, 2012 at 8:59 AM, julien2412 <serval2412@yahoo.fr> wrote:
Hello,

In sal/osl/unx/security.c, I noticed these:
    278 sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString
**pustrDirectory)
    279 {
    280     sal_Bool bRet=sal_False;
    281     sal_Char pszDirectory[PATH_MAX];
    282
    283     pszDirectory[0] = '\0';

    373 sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString
**pustrDirectory)
    374 {
    375     sal_Bool bRet = sal_False;
    376     sal_Char pszDirectory[PATH_MAX];
    377
    378     pszDirectory[0] = '\0';

I'm not sure but I think it doesn't put the rest of the array to 0.
Would memsetting to 0 the whole array be right (and possibly useful)?

What issue are you trying to solve ? i'm not sure as to the purpose of
memsetting 512-1024 bytes

What about this too ?
sal_Char pszDirectory[PATH_MAX] = "";
It compiles but I wonder if it would be ok for every env

blanc-bonnet et bonnet-blanc :-)
although I don't know if the compiler is smart enough to avoid having
an actual literal string of len 0 rather than just putting 0 in the
first byte of the local variable.

iow it would not change anything 'functionally' and at best it would
be  a wash as far as generated code.

Norbert

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.