# # # patch "ChangeLog" # from [b7922281f68bf2b7c18f816c9e0ae1001f355ff4] # to [fa4e057b6804d8ab1c19757668bdff3d71d0049c] # # patch "diff_patch.cc" # from [62b598d468407c93c6b573a1e7eb97bdd52644c8] # to [f29007e22f47cba1649cb511c7e0b1eaf950d6fb] # ============================================================ --- ChangeLog b7922281f68bf2b7c18f816c9e0ae1001f355ff4 +++ ChangeLog fa4e057b6804d8ab1c19757668bdff3d71d0049c @@ -1,3 +1,10 @@ +2006-03-15 Richard Levitte + + * diff_patch.cc (unidiff_hunk_writer::advance_to, + cxtdiff_hunk_writer::advance_to): Because ctx is a size_t, make + everything dealing with it a size_t as well. Keeps the compiler + quiet... + 2006-03-13 Richard Levitte * tests/t_serve_ignores_mt_options.at: New test to check that ============================================================ --- diff_patch.cc 62b598d468407c93c6b573a1e7eb97bdd52644c8 +++ diff_patch.cc f29007e22f47cba1649cb511c7e0b1eaf950d6fb @@ -1,3 +1,5 @@ +// -*- mode: C++; c-file-style: "gnu"; indent-tabs-mode: nil -*- +// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s: // copyright (C) 2002, 2003 graydon hoare // all rights reserved. // licensed to the public under the terms of the GNU GPL (>= 2) @@ -898,9 +900,12 @@ // insert new leading context if (newpos - ctx < a.size()) { - for (int i = ctx; i > 0; --i) + for (size_t i = ctx; i > 0; --i) { - if (newpos - i < 0) + // The original test was (newpos - i < 0), but since newpos + // is size_t (unsigned), it will never go negative. Testing + // that newpos is smaller than i is the same test, really. + if (newpos < i) continue; hunk.push_back(string(" ") + a[newpos - i]); a_begin--; a_len++; @@ -1056,9 +1061,12 @@ // insert new leading context if (newpos - ctx < a.size()) { - for (int i = ctx; i > 0; --i) + for (size_t i = ctx; i > 0; --i) { - if (newpos - i < 0) + // The original test was (newpos - i < 0), but since newpos + // is size_t (unsigned), it will never go negative. Testing + // that newpos is smaller than i is the same test, really. + if (newpos < i) continue; // note that context diffs prefix common text with two