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

Re: svn commit: r10521 - trunk/subversion/libsvn_subr

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2004-08-08 23:49:10 CEST

brane@tigris.org writes:

> Author: brane
> Date: Sat Aug 7 03:20:16 2004
> New Revision: 10521
>
> --- trunk/subversion/libsvn_subr/validate.c (original)
> +++ trunk/subversion/libsvn_subr/validate.c Sat Aug 7 03:20:16 2004
> @@ -70,7 +70,7 @@
> /* See comment in svn_mime_type_validate() above. */
> const apr_size_t len = strcspn (mime_type, "; ");
> return ((strncmp (mime_type, "text/", 5) != 0)
> - && (strncmp (mime_type, "image/x-xbitmap", len) != 0)
> - && (strncmp (mime_type, "image/x-xpixmap", len) != 0)
> + && (len != 15 || strncmp (mime_type, "image/x-xbitmap", len) != 0)
> + && (len != 15 || strncmp (mime_type, "image/x-xpixmap", len) != 0)

That 15 looks prone to error, particularly if/when more types get
added. How about something like

#define LEN_STRNCMP(s) (len != sizeof(s) - 1 \
                        || strncmp (mime_type, s, sizeof(s) - 1) != 0)

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Aug 8 23:49:19 2004

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.