mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-12-27 05:48:20 +01:00
Fix LGTM issues.
This commit is contained in:
parent
895738682e
commit
8dfc2c6045
@ -448,7 +448,7 @@ InvShiftRows(state_t *state)
|
|||||||
static void
|
static void
|
||||||
Cipher(state_t *state, const _pdfio_aes_t *ctx)
|
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.
|
// Add the First round key to the state before starting the rounds.
|
||||||
AddRoundKey(0, state, ctx->round_key);
|
AddRoundKey(0, state, ctx->round_key);
|
||||||
|
@ -1255,17 +1255,17 @@ stream_write(pdfio_stream_t *st, // I - Stream
|
|||||||
if (st->flate.avail_out < (sizeof(st->cbuffer) / 8))
|
if (st->flate.avail_out < (sizeof(st->cbuffer) / 8))
|
||||||
{
|
{
|
||||||
// Flush the compression buffer...
|
// 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;
|
outbytes;
|
||||||
|
|
||||||
if (st->crypto_cb)
|
if (st->crypto_cb)
|
||||||
{
|
{
|
||||||
// Encrypt it first...
|
// 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
|
else
|
||||||
{
|
{
|
||||||
outbytes = bytes;
|
outbytes = cbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fprintf(stderr, "stream_write: bytes=%u, outbytes=%u\n", (unsigned)bytes, (unsigned)outbytes);
|
// 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))
|
if (!_pdfioFileWrite(st->pdf, st->cbuffer, outbytes))
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
if (bytes > outbytes)
|
if (cbytes > outbytes)
|
||||||
{
|
{
|
||||||
bytes -= outbytes;
|
cbytes -= outbytes;
|
||||||
memmove(st->cbuffer, st->cbuffer + outbytes, bytes);
|
memmove(st->cbuffer, st->cbuffer + outbytes, cbytes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bytes = 0;
|
cbytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
st->flate.next_out = (Bytef *)st->cbuffer + bytes;
|
st->flate.next_out = (Bytef *)st->cbuffer + cbytes;
|
||||||
st->flate.avail_out = sizeof(st->cbuffer) - bytes;
|
st->flate.avail_out = sizeof(st->cbuffer) - cbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deflate what we can this time...
|
// Deflate what we can this time...
|
||||||
|
Loading…
Reference in New Issue
Block a user