Skip to content

Commit

Permalink
Fix a couple of compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag authored and jelmer committed Feb 9, 2016
1 parent 74e1975 commit a5d6568
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dulwich/_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)++;
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit a5d6568

Please sign in to comment.