Re: [widgets] P&C simplifying some rules (editorial)

Le 06/01/2010 11:22, Scott Wilson a écrit :
> On 6 Jan 2010, at 08:56, Cyril Concolato wrote:
>> [snip] 1 fails because we don't implement SNIFF. I don't know if we
>> will. [snip]
> Actually you don't need to implement SNIFF to pass that particular test,
> as it only requires you do the extension-processing part of the algorithm.
Thanks for the info, but I'm not sure I understand. If you take the algorithm:
1. nothing to do
2. content-type = empty
3. extension = empty
4. name = 'fail'
5. Not applicable (not starting with a full stop)
6. Not applicable (no full stop in the name)
7. Not applicable (no full stop in the name)
8. extension is empty so you go to 10.
10. Process the file according to SNIFF.

Am I wrong?

> See, e.g.:
> As you can see we've put a TODO for SNIFF but the code as it stands
> passes the test fine.
Your algorithm returns null even if the file is of a supported media type. In this case, it's fine, it gives the right result but if the 'fail' file did not contain garbage data but say real PNG data, your algorithm would give the wrong result.

Anyway, thanks. I did not want to give the impression that I passed this test since SNIFF was not implemented but I will probably do something similar to you because I can actually give the right result for this test, which is what's needed for the report. However, the test suite should include one test really checking SNIFF support to see how many implementations do implement it.


PS: In your code I noticed that line:
"if (filename.startsWith(",") && filename.lastIndexOf(".")==0) return null;"
Are you sure the "," shouldn't be a "." ?

Cyril Concolato
Maître de Conférences/Associate Professor
Groupe Mutimedia/Multimedia Group
Telecom ParisTech
46 rue Barrault
75 013 Paris, France

Received on Wednesday, 6 January 2010 12:10:08 UTC