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

Re: apr_off_t is of an ambiguous size.

From: Ben Reser <ben_at_reser.org>
Date: 2004-01-17 02:46:18 CET

On Fri, Jan 16, 2004 at 08:40:43PM -0500, Russell Yanofsky wrote:
> Ben Reser wrote:
> > min = (long long) (sizeof(long long) - 1) << (sizeof(long long)*8-1);
>
> Looks like something was added in translation there. The (sizeof(long
> long) - 1) should be replaced with just 1. Either one will work, because any
> odd number will work, but 1 makes more sense:
>
> min = (long long) 1 << (sizeof(long long)*8-1);

Here we go again... and with this I'm stopping for the day. It's
Friday.

svn_error_t *
svn_io_file_seek (apr_file_t *file, apr_seek_where_t where,
                  svn_offset_t *offset, apr_pool_t *pool)
{
  const apr_off_t min = (apr_off_t) 1 << ((sizeof (apr_off_t)*8)-1);
  const apr_off_t max = ~min;

  if (sizeof (apr_off_t) >= sizeof (svn_offset_t) ||
      (*offset > min && *offset < max))
    {
      apr_off_t apr_offset = *offset;
      return do_io_file_wrapper_cleanup
        (file, apr_file_seek (file, where, &apr_offset),
         "set psoition pointer in", pool);
    }
  else
    {
      return svn_error_create (SVN_ERR_IO_OFFSET_SIZE, NULL,
                               "Cannot seek file");
    }
}

-- 
Ben Reser <ben@reser.org>
http://ben.reser.org
"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jan 17 02:46:45 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.