[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 23:39:03 CET

On Sat, Jan 17, 2004 at 02:28:20PM -0800, (Mr Hyde) Ben Reser wrote:
> Any objections to this implementation?

Yes you forgot to typecast the assignments.

svn_error_t *
svn_io_file_seek (apr_file_t *file, apr_seek_where_t where,
                  svn_offset_t *offset, apr_pool_t *pool)
{
  /* Because apr_off_t may not be the same size as svn_offset_t we need
   * to do bounds checking to make sure it will fit. The typecasted
   * comparisions do that for us. */
  if ((apr_off_t) *offset == *offset )
    {
      apr_off_t apr_offset = (apr_off_t) *offset;
      apr_status_t status;

      status = apr_file_seek (file, where, &apr_offset);

      if ((svn_offset_t) apr_offset == apr_offset)
        {
          *offset = (svn_offset_t) apr_offset;
          return do_io_file_wrapper_cleanup (file, status,
                                             "set position pointer in",
                                             pool);
        }
    }

    return svn_error_create (SVN_ERR_IO_OFFSET_SIZE, NULL,
                             "Cannot seek file");
}

-- 
Ben Reser (Dr. Jekyll) <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 23:39:30 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.