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

Re: [PATCH] mime-type detection "improvement"

From: Matthew Hambley <matthew_at_aether.demon.co.uk>
Date: 2003-07-11 20:26:34 CEST

In message <3F0D4475.9090605@slog.dk>
          SLOGEN <jensen@slog.dk> wrote:

> Matthew Hambley wrote:
> > It still fails two tests but I don't understand the system well enough
> > to spot what's going wrong.
> Maybe that would be something for me to look at?

Be my guest. The tests in question are and .

> > > - 1233 tries to work only on unix (it should work just fine on other
> > > platforms, only the paths for mime.types should be different)
> > Correction: It will work on other platforms which have mime.types
> > files. In other words, *nix. Windows, for instance, uses the registry
> > to store MIME type mappings. Risc OS (my own favourite) uses a
> > relocatable module to perform MIME type mapping. I tried to implement
> > things in a modular fashion so as to aid the addition of other
> > platforms mechanisms.
> This is an argument for adding functinality to the actual implementation
> of svn_io_detect_mimetype, where the WIN32 version could call the
> corresponding WIN32 detection functions in some way.

I envisaged having mime_win32 and mime_riscos files which did the work.
Each would contain a function called svn_mime_type_from_file_win32 or
svn_mime_type_from_file_riscos. These would be selected in svn_mime.c
using #ifdef's.

> Still, I would like to be able to create a mime.types file on my WIN32
> machine and have subversion use it. I don't see a reason to restrict the
> implementation to be included on *nix (as it happens, I have mime.types
> files on WIN32, they come with cygwin :)

I'm not against this.

> I also felt prompted to point out that there are no actual platform
> dependencies by the comment by Karl Fogel in:
> http://subversion.tigris.org/issues/show_bug.cgi?id=1233
> """Not that there's anything wrong with platform-specific code
> starting..."""

Well there is. It's dependent on there being a mime.types file which will
not be the case on other platforms. (Cygwin asside)

> > > * Making 1233 work on all platforms only requires minor changes
> > Making it work on all *nix platform only requires minor changes.
> > Making it work on other platforms will require some extra work although
> > hopefully not too much.
> I would be happy to accept that work.

And I would be happy for you to do so. I don't feel particularly possesive
towards this patch. What I really want is the functionality.

> BTW: how confident are you that your parse works? it seems a bit more
> complicated than what i'm doing. Your's might do a better job of
> rejecting invalid input? mine just tries to be as simple as possible.

It's a while since I wrote it but reasonably confident. The parser code is
a little verbose, it is that way because it helps me to think about the

(\/)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 Fri Jul 11 20:28:26 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.