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

Re: A new look at the apr_off_t problem

From: Tobias Ringström <tobias_at_ringstrom.mine.nu>
Date: 2004-01-23 23:56:53 CET

Greg Hudson wrote:
> So, we need to think about targeted solutions. There are three areas
> of the API in play here:
>
> 1. The blame callback uses an apr_off_t for the line number. It is
> easy to change this to use an apr_uint64_t instead. (The current
> #1710 patch does this.)
>
> 2. The diff library uses apr_off_t all over the place. We can fix
> that by introducing svn_offset_t, and also introducing pool
> parameters all over the place. This is a good change, but it's
> also a big change, and not necessarily appropriate for 0.37.
> (The current #1710 does this.)

It's interesting to note that 1 and 2 only use apr_off_t in callback
prototypes. The following patch is a simplified solution that takes
advantage of that. The code still uses apr_off_t internally, and as long
as sizeof(apr_off_t) <= 8, everything works fine (and I don't think we
need to consider more than 64 but apr_off_t). Would this one be easier
to swallow?

(I've not updated any bindings in this patch.)

/Tobias

Index: include/svn_diff.h
===================================================================
--- include/svn_diff.h (revision 8466)
+++ include/svn_diff.h (working copy)
@@ -206,12 +206,12 @@
     * the range @a modified_start, @a modified_length in the modified data.
     */
    svn_error_t *(*output_common)(void *output_baton,
- apr_off_t original_start,
- apr_off_t original_length,
- apr_off_t modified_start,
- apr_off_t modified_length,
- apr_off_t latest_start,
- apr_off_t latest_length);
+ apr_int64_t original_start,
+ apr_int64_t original_length,
+ apr_int64_t modified_start,
+ apr_int64_t modified_length,
+ apr_int64_t latest_start,
+ apr_int64_t latest_length);

    /**
     * If doing a two-way diff, then an *conflicting* data range was found
@@ -225,12 +225,12 @@
     * a range in the "modified" datasource.
     */
    svn_error_t *(*output_diff_modified)(void *output_baton,
- apr_off_t original_start,
- apr_off_t original_length,
- apr_off_t modified_start,
- apr_off_t modified_length,
- apr_off_t latest_start,
- apr_off_t latest_length);
+ apr_int64_t original_start,
+ apr_int64_t original_length,
+ apr_int64_t modified_start,
+ apr_int64_t modified_length,
+ apr_int64_t latest_start,
+ apr_int64_t latest_length);

    /* ------ The following callbacks are used by three-way diffs only
--- */

@@ -239,24 +239,24 @@
     * "latest" datasource.
     */
    svn_error_t *(*output_diff_latest)(void *output_baton,
- apr_off_t original_start,
- apr_off_t original_length,
- apr_off_t modified_start,
- apr_off_t modified_length,
- apr_off_t latest_start,
- apr_off_t latest_length);
+ apr_int64_t original_start,
+ apr_int64_t original_length,
+ apr_int64_t modified_start,
+ apr_int64_t modified_length,
+ apr_int64_t latest_start,
+ apr_int64_t latest_length);

    /** An identical data range was discovered between the "modified" and
     * "latest" datasources, but this conflicts with a range in the
     * "original" datasource.
     */
    svn_error_t *(*output_diff_common)(void *output_baton,
- apr_off_t original_start,
- apr_off_t original_length,
- apr_off_t modified_start,
- apr_off_t modified_length,
- apr_off_t latest_start,
- apr_off_t latest_length);
+ apr_int64_t original_start,
+ apr_int64_t original_length,
+ apr_int64_t modified_start,
+ apr_int64_t modified_length,
+ apr_int64_t latest_start,
+ apr_int64_t latest_length);

    /** All three datasources have conflicting data ranges. The range
     * @a latest_start, @a latest_length in the "latest" datasource
conflicts
@@ -268,12 +268,12 @@
     * which can be used to retrieve the common and conflicting ranges.
     */
    svn_error_t *(*output_conflict)(void *output_baton,
- apr_off_t original_start,
- apr_off_t original_length,
- apr_off_t modified_start,
- apr_off_t modified_length,
- apr_off_t latest_start,
- apr_off_t latest_length,
+ apr_int64_t original_start,
+ apr_int64_t original_length,
+ apr_int64_t modified_start,
+ apr_int64_t modified_length,
+ apr_int64_t latest_start,
+ apr_int64_t latest_length,
                                    svn_diff_t *resolved_diff);
  } svn_diff_output_fns_t;

Index: include/svn_client.h
===================================================================
--- include/svn_client.h (revision 8466)
+++ include/svn_client.h (working copy)
@@ -327,7 +327,7 @@
   */
  typedef svn_error_t *
  (*svn_client_blame_receiver_t) (void *baton,
- apr_off_t line_no,
+ apr_int64_t line_no,
                                  svn_revnum_t revision,
                                  const char *author,
                                  const char *date,
Index: libsvn_diff/diff_file.c
===================================================================
--- libsvn_diff/diff_file.c (revision 8466)
+++ libsvn_diff/diff_file.c (working copy)
@@ -745,9 +745,9 @@
  static
  svn_error_t *
  svn_diff__file_output_unified_diff_modified(void *baton,
- apr_off_t original_start, apr_off_t original_length,
- apr_off_t modified_start, apr_off_t modified_length,
- apr_off_t latest_start, apr_off_t latest_length)
+ apr_int64_t original_start, apr_int64_t original_length,
+ apr_int64_t modified_start, apr_int64_t modified_length,
+ apr_int64_t latest_start, apr_int64_t latest_length)
  {
    svn_diff__file_output_baton_t *output_baton = baton;
    apr_off_t target_line[2];
@@ -1000,9 +1000,9 @@
  static
  svn_error_t *
  svn_diff3__file_output_common(void *baton,
- apr_off_t original_start, apr_off_t original_length,
- apr_off_t modified_start, apr_off_t modified_length,
- apr_off_t latest_start, apr_off_t latest_length)
+ apr_int64_t original_start, apr_int64_t original_length,
+ apr_int64_t modified_start, apr_int64_t modified_length,
+ apr_int64_t latest_start, apr_int64_t latest_length)
  {
    return svn_diff3__file_output_hunk(baton, 0,
             original_start, original_length);
@@ -1011,9 +1011,9 @@
  static
  svn_error_t *
  svn_diff3__file_output_diff_modified(void *baton,
- apr_off_t original_start, apr_off_t original_length,
- apr_off_t modified_start, apr_off_t modified_length,
- apr_off_t latest_start, apr_off_t latest_length)
+ apr_int64_t original_start, apr_int64_t original_length,
+ apr_int64_t modified_start, apr_int64_t modified_length,
+ apr_int64_t latest_start, apr_int64_t latest_length)
  {
    return svn_diff3__file_output_hunk(baton, 1,
             modified_start, modified_length);
@@ -1022,9 +1022,9 @@
  static
  svn_error_t *
  svn_diff3__file_output_diff_latest(void *baton,
- apr_off_t original_start, apr_off_t original_length,
- apr_off_t modified_start, apr_off_t modified_length,
- apr_off_t latest_start, apr_off_t latest_length)
+ apr_int64_t original_start, apr_int64_t original_length,
+ apr_int64_t modified_start, apr_int64_t modified_length,
+ apr_int64_t latest_start, apr_int64_t latest_length)
  {
    return svn_diff3__file_output_hunk(baton, 2,
             latest_start, latest_length);
@@ -1033,9 +1033,9 @@
  static
  svn_error_t *
  svn_diff3__file_output_conflict(void *baton,
- apr_off_t original_start, apr_off_t original_length,
- apr_off_t modified_start, apr_off_t modified_length,
- apr_off_t latest_start, apr_off_t latest_length,
+ apr_int64_t original_start, apr_int64_t original_length,
+ apr_int64_t modified_start, apr_int64_t modified_length,
+ apr_int64_t latest_start, apr_int64_t latest_length,
    svn_diff_t *diff);

  static const svn_diff_output_fns_t svn_diff3__file_output_vtable =
@@ -1050,9 +1050,9 @@
  static
  svn_error_t *
  svn_diff3__file_output_conflict(void *baton,
- apr_off_t original_start, apr_off_t original_length,
- apr_off_t modified_start, apr_off_t modified_length,
- apr_off_t latest_start, apr_off_t latest_length,
+ apr_int64_t original_start, apr_int64_t original_length,
+ apr_int64_t modified_start, apr_int64_t modified_length,
+ apr_int64_t latest_start, apr_int64_t latest_length,
    svn_diff_t *diff)
  {
    svn_diff3__file_output_baton_t *file_baton = baton;
Index: libsvn_diff/util.c
===================================================================
--- libsvn_diff/util.c (revision 8466)
+++ libsvn_diff/util.c (working copy)
@@ -127,9 +127,9 @@
                  const svn_diff_output_fns_t *vtable)
  {
    svn_error_t *(*output_fn)(void *,
- apr_off_t, apr_off_t,
- apr_off_t, apr_off_t,
- apr_off_t, apr_off_t);
+ apr_int64_t, apr_int64_t,
+ apr_int64_t, apr_int64_t,
+ apr_int64_t, apr_int64_t);

    while (diff != NULL)
      {
Index: libsvn_client/blame.c
===================================================================
--- libsvn_client/blame.c (revision 8466)
+++ libsvn_client/blame.c (working copy)
@@ -188,12 +188,12 @@
  /* Callback for diff between subsequent revisions */
  static svn_error_t *
  output_diff_modified (void *baton,
- apr_off_t original_start,
- apr_off_t original_length,
- apr_off_t modified_start,
- apr_off_t modified_length,
- apr_off_t latest_start,
- apr_off_t latest_length)
+ apr_int64_t original_start,
+ apr_int64_t original_length,
+ apr_int64_t modified_start,
+ apr_int64_t modified_length,
+ apr_int64_t latest_start,
+ apr_int64_t latest_length)
  {
    struct diff_baton *db = baton;

Index: clients/cmdline/blame-cmd.c
===================================================================
--- clients/cmdline/blame-cmd.c (revision 8466)
+++ clients/cmdline/blame-cmd.c (working copy)
@@ -28,7 +28,7 @@
  /*** Code. ***/
  static svn_error_t *
  blame_receiver (void *baton,
- apr_off_t line_no,
+ apr_int64_t line_no,
                  svn_revnum_t revision,
                  const char *author,
                  const char *date,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jan 23 23:57:25 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.