@@ -45,15 +45,15 @@ static int64_t offtin(uint8_t *buf)
45
45
return y ;
46
46
}
47
47
48
- int bspatch (const uint8_t * old , int64_t oldsize , uint8_t * new , int64_t newsize , struct bspatch_stream * stream )
48
+ int bspatch (const uint8_t * source , int64_t sourcesize , uint8_t * target , int64_t targetsize , struct bspatch_stream * stream )
49
49
{
50
50
uint8_t buf [8 ];
51
51
int64_t oldpos ,newpos ;
52
52
int64_t ctrl [3 ];
53
53
int64_t i ;
54
54
55
55
oldpos = 0 ;newpos = 0 ;
56
- while (newpos < newsize ) {
56
+ while (newpos < targetsize ) {
57
57
/* Read control data */
58
58
for (i = 0 ;i <=2 ;i ++ ) {
59
59
if (stream -> read (stream , buf , 8 ))
@@ -62,28 +62,28 @@ int bspatch(const uint8_t* old, int64_t oldsize, uint8_t* new, int64_t newsize,
62
62
};
63
63
64
64
/* Sanity-check */
65
- if (newpos + ctrl [0 ]> newsize )
65
+ if (newpos + ctrl [0 ]> targetsize )
66
66
return -1 ;
67
67
68
68
/* Read diff string */
69
- if (stream -> read (stream , new + newpos , ctrl [0 ]))
69
+ if (stream -> read (stream , target + newpos , ctrl [0 ]))
70
70
return -1 ;
71
71
72
72
/* Add old data to diff string */
73
73
for (i = 0 ;i < ctrl [0 ];i ++ )
74
- if ((oldpos + i >=0 ) && (oldpos + i < oldsize ))
75
- new [newpos + i ]+= old [oldpos + i ];
74
+ if ((oldpos + i >=0 ) && (oldpos + i < sourcesize ))
75
+ target [newpos + i ]+= source [oldpos + i ];
76
76
77
77
/* Adjust pointers */
78
78
newpos += ctrl [0 ];
79
79
oldpos += ctrl [0 ];
80
80
81
81
/* Sanity-check */
82
- if (newpos + ctrl [1 ]> newsize )
82
+ if (newpos + ctrl [1 ]> targetsize )
83
83
return -1 ;
84
84
85
85
/* Read extra string */
86
- if (stream -> read (stream , new + newpos , ctrl [1 ]))
86
+ if (stream -> read (stream , target + newpos , ctrl [1 ]))
87
87
return -1 ;
88
88
89
89
/* Adjust pointers */
0 commit comments