diff --git a/pdfio-aes.c b/pdfio-aes.c index 2f504c5..dbc8912 100644 --- a/pdfio-aes.c +++ b/pdfio-aes.c @@ -448,7 +448,7 @@ InvShiftRows(state_t *state) static void Cipher(state_t *state, const _pdfio_aes_t *ctx) { - uint8_t round = 0; + size_t round = 0; // Add the First round key to the state before starting the rounds. AddRoundKey(0, state, ctx->round_key); diff --git a/pdfio-stream.c b/pdfio-stream.c index 1cd56e7..de77031 100644 --- a/pdfio-stream.c +++ b/pdfio-stream.c @@ -1255,17 +1255,17 @@ stream_write(pdfio_stream_t *st, // I - Stream if (st->flate.avail_out < (sizeof(st->cbuffer) / 8)) { // Flush the compression buffer... - size_t bytes = sizeof(st->cbuffer) - st->flate.avail_out, + size_t cbytes = sizeof(st->cbuffer) - st->flate.avail_out, outbytes; if (st->crypto_cb) { // Encrypt it first... - outbytes = (st->crypto_cb)(&st->crypto_ctx, st->cbuffer, st->cbuffer, bytes & ~15); + outbytes = (st->crypto_cb)(&st->crypto_ctx, st->cbuffer, st->cbuffer, cbytes & ~15); } else { - outbytes = bytes; + outbytes = cbytes; } // fprintf(stderr, "stream_write: bytes=%u, outbytes=%u\n", (unsigned)bytes, (unsigned)outbytes); @@ -1273,18 +1273,18 @@ stream_write(pdfio_stream_t *st, // I - Stream if (!_pdfioFileWrite(st->pdf, st->cbuffer, outbytes)) return (false); - if (bytes > outbytes) + if (cbytes > outbytes) { - bytes -= outbytes; - memmove(st->cbuffer, st->cbuffer + outbytes, bytes); + cbytes -= outbytes; + memmove(st->cbuffer, st->cbuffer + outbytes, cbytes); } else { - bytes = 0; + cbytes = 0; } - st->flate.next_out = (Bytef *)st->cbuffer + bytes; - st->flate.avail_out = sizeof(st->cbuffer) - bytes; + st->flate.next_out = (Bytef *)st->cbuffer + cbytes; + st->flate.avail_out = sizeof(st->cbuffer) - cbytes; } // Deflate what we can this time...