You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/05/09 18:36:28 UTC

svn commit: r1101102 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c

Author: stefan2
Date: Mon May  9 16:36:28 2011
New Revision: 1101102

URL: http://svn.apache.org/viewvc?rev=1101102&view=rev
Log:
Fix conversion and signedness comparison warnings concerning the "fuzz"
factor. That value is non-negative, thus we can use the same type as for
the values that we combine or compare it with.

* subversion/include/svn_wc.h
  (svn_wc_notify_t): make hunk_fuzz a "number of lines"
* subversion/libsvn_client/patch.c
  (hunk_info_t, match_hunk, scan_for_match, get_hunk_info, apply_one_patch):
   make all fuzz values a "number of lines"
* subversion/svn/notify.c
  (notify): adapt format strings

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/patch.c
    subversion/trunk/subversion/svn/notify.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1101102&r1=1101101&r2=1101102&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon May  9 16:36:28 2011
@@ -1358,7 +1358,7 @@ typedef struct svn_wc_notify_t {
 
   /** The fuzz factor the hunk was applied with.
    * @since New in 1.7 */
-  int hunk_fuzz;
+  svn_linenum_t hunk_fuzz;
 
   /* NOTE: Add new fields at the end to preserve binary compatibility.
      Also, if you add fields here, you have to update svn_wc_create_notify

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1101102&r1=1101101&r2=1101102&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon May  9 16:36:28 2011
@@ -63,7 +63,7 @@ typedef struct hunk_info_t {
 
   /* The fuzz factor used when matching this hunk, i.e. how many
    * lines of leading and trailing context to ignore during matching. */
-  int fuzz;
+  svn_linenum_t fuzz;
 } hunk_info_t;
 
 /* A struct carrying the information related to the content of a target, be it
@@ -835,7 +835,7 @@ seek_to_line(target_content_info_t *cont
  * Do temporary allocations in POOL. */
 static svn_error_t *
 match_hunk(svn_boolean_t *matched, target_content_info_t *content_info,
-           svn_diff_hunk_t *hunk, int fuzz,
+           svn_diff_hunk_t *hunk, svn_linenum_t fuzz,
            svn_boolean_t ignore_whitespace,
            svn_boolean_t match_modified, apr_pool_t *pool)
 {
@@ -952,7 +952,7 @@ static svn_error_t *
 scan_for_match(svn_linenum_t *matched_line,
                target_content_info_t *content_info,
                svn_diff_hunk_t *hunk, svn_boolean_t match_first,
-               svn_linenum_t upper_line, int fuzz,
+               svn_linenum_t upper_line, svn_linenum_t fuzz,
                svn_boolean_t ignore_whitespace,
                svn_boolean_t match_modified,
                svn_cancel_func_t cancel_func, void *cancel_baton,
@@ -1088,7 +1088,7 @@ match_existing_target(svn_boolean_t *mat
 static svn_error_t *
 get_hunk_info(hunk_info_t **hi, patch_target_t *target,
               target_content_info_t *content_info,
-              svn_diff_hunk_t *hunk, int fuzz,
+              svn_diff_hunk_t *hunk, svn_linenum_t fuzz,
               svn_boolean_t ignore_whitespace,
               svn_boolean_t is_prop_hunk,
               svn_cancel_func_t cancel_func, void *cancel_baton,
@@ -1640,7 +1640,7 @@ apply_one_patch(patch_target_t **patch_t
   patch_target_t *target;
   apr_pool_t *iterpool;
   int i;
-  static const int MAX_FUZZ = 2;
+  static const svn_linenum_t MAX_FUZZ = 2;
   apr_hash_index_t *hash_index;
   target_content_info_t *prop_content_info;
 
@@ -1671,7 +1671,7 @@ apply_one_patch(patch_target_t **patch_t
     {
       svn_diff_hunk_t *hunk;
       hunk_info_t *hi;
-      int fuzz = 0;
+      svn_linenum_t fuzz = 0;
 
       svn_pool_clear(iterpool);
 
@@ -1755,7 +1755,7 @@ apply_one_patch(patch_target_t **patch_t
         {
           svn_diff_hunk_t *hunk;
           hunk_info_t *hi;
-          int fuzz = 0;
+          svn_linenum_t fuzz = 0;
 
           svn_pool_clear(iterpool);
 

Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1101102&r1=1101101&r2=1101102&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Mon May  9 16:36:28 2011
@@ -346,7 +346,7 @@ notify(void *baton, const svn_wc_notify_
                   err = svn_cmdline_printf(pool,
                                            apr_pstrcat(pool, s,
                                                        "%"APR_UINT64_T_FMT
-                                                       " and fuzz %d (%s)\n",
+                                                       " and fuzz %lu (%s)\n",
                                                        (char *)NULL),
                                            n->hunk_original_start,
                                            n->hunk_original_length,
@@ -363,7 +363,7 @@ notify(void *baton, const svn_wc_notify_
                   err = svn_cmdline_printf(pool,
                                            apr_pstrcat(pool, s,
                                                        "%"APR_UINT64_T_FMT
-                                                       " and fuzz %d\n",
+                                                       " and fuzz %lu\n",
                                                        (char *)NULL),
                                            n->hunk_original_start,
                                            n->hunk_original_length,
@@ -416,7 +416,7 @@ notify(void *baton, const svn_wc_notify_
           if (n->prop_name)
             err = svn_cmdline_printf(pool,
                           _(">         applied hunk ## -%lu,%lu +%lu,%lu ## "
-                                        "with fuzz %d (%s)\n"),
+                                        "with fuzz %lu (%s)\n"),
                                         n->hunk_original_start,
                                         n->hunk_original_length,
                                         n->hunk_modified_start,
@@ -426,7 +426,7 @@ notify(void *baton, const svn_wc_notify_
           else
             err = svn_cmdline_printf(pool,
                           _(">         applied hunk @@ -%lu,%lu +%lu,%lu @@ "
-                                        "with fuzz %d\n"),
+                                        "with fuzz %lu\n"),
                                         n->hunk_original_start,
                                         n->hunk_original_length,
                                         n->hunk_modified_start,



Re: svn commit: r1101102 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c

Posted by Greg Stein <gs...@gmail.com>.
On May 10, 2011 4:39 AM, "Stefan Fuhrmann" <eq...@web.de> wrote:
>
> On 09.05.2011 19:58, Greg Stein wrote:
>>
>> On May 9, 2011 12:36 PM,<st...@apache.org>  wrote:
>>>
>>> Author: stefan2
>>> Date: Mon May  9 16:36:28 2011
>>> New Revision: 1101102
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1101102&view=rev
>>> Log:
>>> Fix conversion and signedness comparison warnings concerning the "fuzz"
>>> factor. That value is non-negative, thus we can use the same type as for
>>> the values that we combine or compare it with.
>>>
>>> * subversion/include/svn_wc.h
>>>  (svn_wc_notify_t): make hunk_fuzz a "number of lines"
>>> * subversion/libsvn_client/patch.c
>>>  (hunk_info_t, match_hunk, scan_for_match, get_hunk_info,
>>
>> apply_one_patch):
>>>
>>>   make all fuzz values a "number of lines"
>>> * subversion/svn/notify.c
>>>  (notify): adapt format strings
>>
>> Isn't this kinda like using a time type to hold duration? :-P
>>
> It's at least close to it and I noticed that when I wrote the code ;)
> Now that I think of it, the real solution would be introducing a
> svn_linefuzz_t that is equivalent to svn_linenum_t. Please note
> that svn_linediff_t would be wrong since the "fuzz" value cannot
> be negative.

Don't get me wrong... I'm having fun, rather than being pedantic :-)

Cheers,
-g

Re: svn commit: r1101102 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c

Posted by Stefan Fuhrmann <eq...@web.de>.
On 09.05.2011 19:58, Greg Stein wrote:
> On May 9, 2011 12:36 PM,<st...@apache.org>  wrote:
>> Author: stefan2
>> Date: Mon May  9 16:36:28 2011
>> New Revision: 1101102
>>
>> URL: http://svn.apache.org/viewvc?rev=1101102&view=rev
>> Log:
>> Fix conversion and signedness comparison warnings concerning the "fuzz"
>> factor. That value is non-negative, thus we can use the same type as for
>> the values that we combine or compare it with.
>>
>> * subversion/include/svn_wc.h
>>   (svn_wc_notify_t): make hunk_fuzz a "number of lines"
>> * subversion/libsvn_client/patch.c
>>   (hunk_info_t, match_hunk, scan_for_match, get_hunk_info,
> apply_one_patch):
>>    make all fuzz values a "number of lines"
>> * subversion/svn/notify.c
>>   (notify): adapt format strings
> Isn't this kinda like using a time type to hold duration? :-P
>
It's at least close to it and I noticed that when I wrote the code ;)
Now that I think of it, the real solution would be introducing a
svn_linefuzz_t that is equivalent to svn_linenum_t. Please note
that svn_linediff_t would be wrong since the "fuzz" value cannot
be negative.

-- Stefan^2.

Re: svn commit: r1101102 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c

Posted by Greg Stein <gs...@gmail.com>.
On May 9, 2011 12:36 PM, <st...@apache.org> wrote:
>
> Author: stefan2
> Date: Mon May  9 16:36:28 2011
> New Revision: 1101102
>
> URL: http://svn.apache.org/viewvc?rev=1101102&view=rev
> Log:
> Fix conversion and signedness comparison warnings concerning the "fuzz"
> factor. That value is non-negative, thus we can use the same type as for
> the values that we combine or compare it with.
>
> * subversion/include/svn_wc.h
>  (svn_wc_notify_t): make hunk_fuzz a "number of lines"
> * subversion/libsvn_client/patch.c
>  (hunk_info_t, match_hunk, scan_for_match, get_hunk_info,
apply_one_patch):
>   make all fuzz values a "number of lines"
> * subversion/svn/notify.c
>  (notify): adapt format strings

Isn't this kinda like using a time type to hold duration? :-P

Cheers,
-g