mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
mixed 4/8 tabs+spaces -> 4 spaces, additional bracing
This commit is contained in:
parent
5ecec7db10
commit
05cd72f4f0
|
@ -30,7 +30,6 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
ptr = buf;
|
ptr = buf;
|
||||||
|
|
||||||
if (!state->state) {
|
if (!state->state) {
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if (state->xsize <= 0 || state->ysize <= 0) {
|
if (state->xsize <= 0 || state->ysize <= 0) {
|
||||||
state->errcode = IMAGING_CODEC_END;
|
state->errcode = IMAGING_CODEC_END;
|
||||||
|
@ -42,7 +41,7 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;) {
|
||||||
|
|
||||||
switch (state->state) {
|
switch (state->state) {
|
||||||
case FETCH:
|
case FETCH:
|
||||||
|
@ -68,7 +67,6 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case ENCODE:
|
case ENCODE:
|
||||||
|
|
||||||
/* compress this line */
|
/* compress this line */
|
||||||
|
|
||||||
/* when we arrive here, "count" contains the number of
|
/* when we arrive here, "count" contains the number of
|
||||||
|
@ -78,7 +76,6 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
while (state->x < state->bytes) {
|
while (state->x < state->bytes) {
|
||||||
|
|
||||||
if (state->count == 63) {
|
if (state->count == 63) {
|
||||||
|
|
||||||
/* this run is full; flush it */
|
/* this run is full; flush it */
|
||||||
if (bytes < 2)
|
if (bytes < 2)
|
||||||
return ptr - buf;
|
return ptr - buf;
|
||||||
|
@ -93,7 +90,6 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
this = state->buffer[state->x];
|
this = state->buffer[state->x];
|
||||||
|
|
||||||
if (this == state->LAST) {
|
if (this == state->LAST) {
|
||||||
|
|
||||||
/* extend the current run */
|
/* extend the current run */
|
||||||
state->x++;
|
state->x++;
|
||||||
state->count++;
|
state->count++;
|
||||||
|
@ -102,14 +98,16 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
|
|
||||||
/* start a new run */
|
/* start a new run */
|
||||||
if (state->count == 1 && (state->LAST < 0xc0)) {
|
if (state->count == 1 && (state->LAST < 0xc0)) {
|
||||||
if (bytes < 1)
|
if (bytes < 1) {
|
||||||
return ptr - buf;
|
return ptr - buf;
|
||||||
|
}
|
||||||
*ptr++ = state->LAST;
|
*ptr++ = state->LAST;
|
||||||
bytes--;
|
bytes--;
|
||||||
} else {
|
} else {
|
||||||
if (state->count > 0) {
|
if (state->count > 0) {
|
||||||
if (bytes < 2)
|
if (bytes < 2) {
|
||||||
return ptr - buf;
|
return ptr - buf;
|
||||||
|
}
|
||||||
*ptr++ = 0xc0 | state->count;
|
*ptr++ = 0xc0 | state->count;
|
||||||
*ptr++ = state->LAST;
|
*ptr++ = state->LAST;
|
||||||
bytes -= 2;
|
bytes -= 2;
|
||||||
|
@ -126,14 +124,16 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
|
|
||||||
/* end of line; flush the current run */
|
/* end of line; flush the current run */
|
||||||
if (state->count == 1 && (state->LAST < 0xc0)) {
|
if (state->count == 1 && (state->LAST < 0xc0)) {
|
||||||
if (bytes < 1)
|
if (bytes < 1) {
|
||||||
return ptr - buf;
|
return ptr - buf;
|
||||||
|
}
|
||||||
*ptr++ = state->LAST;
|
*ptr++ = state->LAST;
|
||||||
bytes--;
|
bytes--;
|
||||||
} else {
|
} else {
|
||||||
if (state->count > 0) {
|
if (state->count > 0) {
|
||||||
if (bytes < 2)
|
if (bytes < 2) {
|
||||||
return ptr - buf;
|
return ptr - buf;
|
||||||
|
}
|
||||||
*ptr++ = 0xc0 | state->count;
|
*ptr++ = 0xc0 | state->count;
|
||||||
*ptr++ = state->LAST;
|
*ptr++ = state->LAST;
|
||||||
bytes -= 2;
|
bytes -= 2;
|
||||||
|
@ -143,6 +143,7 @@ ImagingPcxEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
/* read next line */
|
/* read next line */
|
||||||
state->state = FETCH;
|
state->state = FETCH;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user