|
@@ -47,10 +47,10 @@ static int py_is_sha(PyObject *sha)
|
|
|
}
|
|
|
|
|
|
|
|
|
-static size_t get_delta_header_size(uint8_t *delta, int *index, int length)
|
|
|
+static size_t get_delta_header_size(uint8_t *delta, size_t *index, size_t length)
|
|
|
{
|
|
|
size_t size = 0;
|
|
|
- int i = 0;
|
|
|
+ size_t i = 0;
|
|
|
while ((*index) < length) {
|
|
|
uint8_t cmd = delta[*index];
|
|
|
(*index)++;
|
|
@@ -89,10 +89,10 @@ static PyObject *py_chunked_as_string(PyObject *py_buf)
|
|
|
static PyObject *py_apply_delta(PyObject *self, PyObject *args)
|
|
|
{
|
|
|
uint8_t *src_buf, *delta;
|
|
|
- int src_buf_len, delta_len;
|
|
|
+ size_t src_buf_len, delta_len;
|
|
|
size_t src_size, dest_size;
|
|
|
size_t outindex = 0;
|
|
|
- int index;
|
|
|
+ size_t index;
|
|
|
uint8_t *out;
|
|
|
PyObject *ret, *py_src_buf, *py_delta, *ret_list;
|
|
|
|
|
@@ -110,16 +110,16 @@ static PyObject *py_apply_delta(PyObject *self, PyObject *args)
|
|
|
}
|
|
|
|
|
|
src_buf = (uint8_t *)PyString_AS_STRING(py_src_buf);
|
|
|
- src_buf_len = PyString_GET_SIZE(py_src_buf);
|
|
|
+ src_buf_len = (size_t)PyString_GET_SIZE(py_src_buf);
|
|
|
|
|
|
delta = (uint8_t *)PyString_AS_STRING(py_delta);
|
|
|
- delta_len = PyString_GET_SIZE(py_delta);
|
|
|
+ delta_len = (size_t)PyString_GET_SIZE(py_delta);
|
|
|
|
|
|
index = 0;
|
|
|
src_size = get_delta_header_size(delta, &index, delta_len);
|
|
|
if (src_size != src_buf_len) {
|
|
|
PyErr_Format(PyExc_ApplyDeltaError,
|
|
|
- "Unexpected source buffer size: %lu vs %d", src_size, src_buf_len);
|
|
|
+ "Unexpected source buffer size: %lu vs %ld", src_size, src_buf_len);
|
|
|
Py_DECREF(py_src_buf);
|
|
|
Py_DECREF(py_delta);
|
|
|
return NULL;
|
|
@@ -134,7 +134,7 @@ static PyObject *py_apply_delta(PyObject *self, PyObject *args)
|
|
|
}
|
|
|
out = (uint8_t *)PyString_AsString(ret);
|
|
|
while (index < delta_len) {
|
|
|
- char cmd = delta[index];
|
|
|
+ uint8_t cmd = delta[index];
|
|
|
index++;
|
|
|
if (cmd & 0x80) {
|
|
|
size_t cp_off = 0, cp_size = 0;
|