[compiz] Just another ini patch

Mike Dransfield mike at blueroot.co.uk
Fri Apr 13 08:19:25 PDT 2007


Patrick Niklaus wrote:
> 2007/4/13, Mike Dransfield <mike at blueroot.co.uk>:
>> Patrick Niklaus wrote:
>> > Hi,
>> >
>> > ok I hope this patches are now ok for you to commit.
>>
>> Thanks.
>>
>> The part which worries me is this
>>
>> -    for (i=0; i<len; i++)
>> -    {
>> -    if (filename[i] == '-')
>> -    {
>> -        if (!pluginSep)
>> -        pluginSep = i-1;
>> -        else
>> -        return NULL; /*found a second dash */
>> -    }
>> -    else if (filename[i] == '.')
>> -    {
>> -        if (!screenSep)
>> -        screenSep = i-1;
>> -        else
>> -        return NULL; /*found a second dot */
>> -    }
>> -    }
>> +    /* the split point for the plugin name */
>> +    pluginSep = strrchr(filename, '-');
>> +    if (!pluginSep)
>> +    return NULL;
>> +
>> +    /* the split point for the screen name */
>> +    screenSep = strrchr(filename, '.');
>> +    if (!screenSep)
>> +    return NULL;
>>
>> It is in a patch marked minor cleanup but it is actually changing
>> the functionality slightly.
>>
>> In the original version I was keen to reject bad files as early as
>> possible so they couldn't cause any damage later.  Thats why I was
>> checking the entire filename.
>>
>> Can you explain why you changed this bit (other than a slight speed
>> increase)?
>>
>>
>>
>>
>
> First point is, as you mentioned, a speed increase. Second point is
> that it takes less space and looks much cleaner. But if you are
> worried about files with names like "foo.bla-hehe" (which would be
> invalid) I could add a check for that of course.

I think its easier to keep the original in the end otherwise you will
end up with lots of special cases.  I thought that solution would cover
99% weirdly formatted filenames.

I am also interested in .blah-blo.screen0.conf and --blah-screen0.conf
as well as .-.-.-.-.-.-.-.-.-.-.-.-.conf.  These files could also 
contain binary
data so we should check by copying random files into the options dir
with valid (and invalid) names (I haven't checked that yet, but it should
reject everything as early as possible).

The rest seems fine (although I don't personally see the advantage of
fnLen over len :))

>
> Regards,
> Patrick



More information about the compiz mailing list