[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: MIME types, peer review

From: Matthew Hambley <matthew_at_aether.demon.co.uk>
Date: 2003-03-12 19:38:22 CET

In message <3E6D089F.6060806@xbc.nu>
          Branko ibej <brane@xbc.nu> wrote:

> Matthew Hambley wrote:
>
> > I have also attached libsvn_subr/svn_mime.c which holds the
> > statistical scanner which used to live in io.c and the function
> > svn_mime_guess_type_from_file which is where the #ifdef's live to
> > decide which platform specific call to make.
>
> You don't really want that. What you do is, you declare a (private)
> interface that the platform-specific implementations must provide; then
> you fiddle with the build, or with #ifdefs in the implementation files
> themselves, so that only one of those symbols actually gets compiled
> into the library.

That seems more open to confusion than my method. It also contradicts what
is done in libsvn_subr/config.c which I was pointed at as an example.

> > So how did I do?
>
> You want a 1..10 score?

No, I want feedback. That's why I was soliciting it.

[snip]

> >#define PARSE_BUFFER_SIZE 10
> >
> Isn't that a bit small? Usually, the first thing I'd try is mmap the
> whole file; then if that doesn't work, read it in SVN_STREAM_CHUNK_SIZE
> pieces.

It may not be necessary or useful, I'll check.

[snip]
> > extension = strrchr(filename, '.');
> >
> Um. I'd suggest getting the basename first (I expect 'filename' can
> actually be a path), otherwise guess what happens when you get
> "foo.txt/bar"? :-)

In which case the test further down spots that the index of '.' is before
the index of '/' and therefore not an extension. However if there are
functions to extract leafnames from paths already in APR then that would be
better still.

-- 
(\/)atthew )-(ambley ---------------\ If something's worth doing it's worth
E-mail : matthew@aether.demon.co.uk  \ doing badly until you can learn to
Public key : C991137B                 \ do it well.
Web : http://www.aether.demon.co.uk/   \-----------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 12 19:39:52 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.