[Ffmpeg-devel] [PATCH] Wildcard and catalog image sequences

Måns Rullgård mru
Mon Sep 4 12:46:05 CEST 2006


Michel Bardiaux said:
> M?ns Rullg?rd wrote:
>> Michael Niedermayer said:
>>> Hi
>>>
>>> On Wed, Aug 30, 2006 at 02:28:57PM +0200, Michel Bardiaux wrote:
>>>> Michael Niedermayer wrote:
>>>>> looking at for example:
>>>>>
>>>>>>> +int filename_catalog_test(const char *filename)
>>>>>>> +{
>>>>>>> +    if(!filename)
>>>>>>> +        return (-1);
>>>>>>> +    else if(filename[0]=='@')
>>>>>>> +        return 0;
>>>>>>> +    else
>>>>>>> +        return (-1);
>>>>> versus
>>>>>
>>>>>> return filename && filename[0]=='@';
>>>>> i cant see how the later is more obfuscated, additionally
>>>> I dont mean all one-liners are obfuscated, only that they quickly become
>>>> so. Esp. since the correct one is
>>>>
>>>> return (filename && filename[0]=='@')?0:-1; // justified below.
>>>>
>>>> Still reasonable, but the one about wildcards is even bigger. If one has
>>>> to code for multiple levels of conditions, nested ?: become quite
>>>> unreadable. So there is a limit to one-liners, and where it is is a
>>>> matter of taste, isnt it?
>>> sure but my suggestion wouldnt need the ?: and without that the one liner
>>> really seems to be the better solution
>>
>> return -(filename && filename[0] == '@');
>
> That gives -1 for OK and 0 for KO, the opposite of what is wanted!

Darn.  OK, these two should give the right result:

return -!(filename && filename[0] == '@');

return (filename && filename[0] == '@')-1;

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list