~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff-delta.c

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
853
853
    free(index);
854
854
}
855
855
 
856
 
unsigned long
857
 
sizeof_delta_index(struct delta_index *index)
 
856
unsigned long sizeof_delta_index(struct delta_index *index)
858
857
{
859
858
    if (index)
860
859
        return index->memsize;
873
872
             const void *trg_buf, unsigned long trg_size,
874
873
             unsigned long *delta_size, unsigned long max_size)
875
874
{
876
 
    unsigned int i, outpos, outsize, moff, val;
877
 
    int msize;
 
875
    unsigned int i, outpos, outsize, moff, msize, val;
878
876
    const struct source_info *msource;
879
877
    int inscnt;
880
878
    const unsigned char *ref_data, *ref_top, *data, *top;
945
943
                 entry++) {
946
944
                const unsigned char *ref;
947
945
                const unsigned char *src;
948
 
                int ref_size;
 
946
                unsigned int ref_size;
949
947
                if (entry->val != val)
950
948
                    continue;
951
949
                ref = entry->ptr;
958
956
                 * match more bytes with this location that we have already
959
957
                 * matched.
960
958
                 */
961
 
                if (ref_size > (top - src))
 
959
                if (ref_size > top - src)
962
960
                    ref_size = top - src;
963
961
                if (ref_size <= msize)
964
962
                    break;
965
963
                /* See how many bytes actually match at this location. */
966
964
                while (ref_size-- && *src++ == *ref)
967
965
                    ref++;
968
 
                if (msize < (ref - entry->ptr)) {
 
966
                if (msize < ref - entry->ptr) {
969
967
                    /* this is our best match so far */
970
968
                    msize = ref - entry->ptr;
971
969
                    msource = entry->src;