~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff-delta.c

  • Committer: Robert Collins
  • Date: 2010-06-28 02:41:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100628024122-g951fzp74f3u6wst
Sanity check that new_trace_file in pop_log_file is valid, and also fix a test that monkey patched get_terminal_encoding.

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;