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

Re: SVN Property 'character-set' or 'encoding' or something like

From: Kalle Olavi Niemitalo <kon_at_iki.fi>
Date: 2004-08-06 07:00:16 CEST

Ben Reser <ben@reser.org> writes:

> On Thu, Aug 05, 2004 at 08:36:23PM +0300, Kalle Olavi Niemitalo wrote:
>> The code seems wrong to me; it'll treat e.g. "image/x" as text.
>
> No it won't. Just image/x-xbitmap and image/x-xpixmaps which are
> textual descriptions of an image. In fact they're basically C arrays.

Yes it does; I tested it. Here is the function from revision 10126 of
<http://svn.collab.net/repos/svn/trunk/subversion/libsvn_subr/validate.c>,
with my comments marked with "//":

svn_boolean_t
svn_mime_type_is_binary (const char *mime_type)
{
// Imagine mime_type is "image/x".
  /* See comment in svn_mime_type_validate() above. */
  const apr_size_t len = strcspn (mime_type, "; ");
// strcspn("image/x", "; ") returns 7; len=7.
  return ((strncmp (mime_type, "text/", 5) != 0)
// strncmp("image/x", "text/", 5) returns -11, or something else negative.
          && (strncmp (mime_type, "image/x-xbitmap", len) != 0)
// strncmp("image/x", "image/x-xbitmap", 7) returns 0.
// svn_mime_type_is_binary("image/x") returns 0, which is wrong.
          && (strncmp (mime_type, "image/x-xpixmap", len) != 0)
          );
}

  • application/pgp-signature attachment: stored
Received on Fri Aug 6 07:00:47 2004

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