ref: 47216296566071537275ccee682b9d08959ce893
parent: 58e7c65dfc9ccce4f01a0e49d12d9d1c060a1192
author: Sebastian Rasmussen <[email protected]>
date: Mon Mar 26 17:57:33 EDT 2018
jbig2dec: Remove unnecessary whitespace.
--- a/jbig2.c
+++ b/jbig2.c
@@ -158,9 +158,9 @@
}
#define get_uint16(bptr)\
- (((bptr)[0] << 8) | (bptr)[1])
+ (((bptr)[0] << 8) | (bptr)[1])
#define get_int16(bptr)\
- (((int)get_uint16(bptr) ^ 0x8000) - 0x8000)
+ (((int)get_uint16(bptr) ^ 0x8000) - 0x8000)
int16_t
jbig2_get_int16(const byte *bptr)
@@ -273,7 +273,6 @@
else
jbig2_error(ctx, JBIG2_SEVERITY_INFO, -1, "file header indicates a %d page document", ctx->n_pages);
} else { /* number of pages not known */
-
ctx->n_pages = 0;
ctx->buf_rd_ix += 9;
}
@@ -316,7 +315,6 @@
if (ctx->segment_index == ctx->n_segments)
ctx->state = JBIG2_FILE_EOF;
} else { /* JBIG2_FILE_SEQUENCIAL_BODY */
-
ctx->state = JBIG2_FILE_SEQUENTIAL_HEADER;
}
if (code < 0) {
--- a/jbig2_arith.c
+++ b/jbig2_arith.c
@@ -255,7 +255,7 @@
/* Figure E.18 */
do {
if (as->CT == 0)
- jbig2_arith_bytein(as);
+ jbig2_arith_bytein(as);
as->A <<= 1;
as->C <<= 1;
as->CT--;
@@ -342,7 +342,7 @@
*word = 0;
else
*word = (stream[offset] << 24) | (stream[offset + 1] << 16) |
- (stream[offset + 2] << 8) | stream[offset + 3];
+ (stream[offset + 2] << 8) | stream[offset + 3];
return 0;
}
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -46,13 +46,14 @@
{
int stats_size = template == 0 ? 1 << 16 : template == 1 ? 1 << 1 << 13 : 1 << 10;
- return stats_size;
+ return stats_size;
}
- static int
- jbig2_decode_generic_template0(Jbig2Ctx *ctx,
- Jbig2Segment *segment,
- const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats)
+static int
+jbig2_decode_generic_template0(Jbig2Ctx *ctx,
+ Jbig2Segment *segment,
+ const Jbig2GenericRegionParams *params, Jbig2ArithState *as,
+ Jbig2Image *image, Jbig2ArithCx *GB_stats)
{
const int GBW = image->width;
const int GBH = image->height;
@@ -68,7 +69,7 @@
#endif
if (GBW <= 0)
- return 0;
+ return 0;
for (y = 0; y < GBH; y++) {
uint32_t CONTEXT;
@@ -78,9 +79,9 @@
line_m1 = (y >= 1) ? gbreg_line[-rowstride] : 0;
line_m2 = (y >= 2) ? gbreg_line[-(rowstride << 1)] << 6 : 0;
- CONTEXT = (line_m1 & 0x7f0) | (line_m2 & 0xf800);
+ CONTEXT = (line_m1 & 0x7f0) | (line_m2 & 0xf800);
- /* 6.2.5.7 3d */
+ /* 6.2.5.7 3d */
for (x = 0; x < padded_width; x += 8) {
byte result = 0;
int x_minor;
@@ -92,7 +93,7 @@
if (y >= 2)
line_m2 = (line_m2 << 8) | (x + 8 < GBW ? gbreg_line[-(rowstride << 1) + (x >> 3) + 1] << 6 : 0);
- /* This is the speed-critical inner loop. */
+ /* This is the speed-critical inner loop. */
for (x_minor = 0; x_minor < minor_width; x_minor++) {
bool bit;
@@ -179,7 +180,7 @@
#endif
if (GBW <= 0)
- return 0;
+ return 0;
for (y = 0; y < GBH; y++) {
uint32_t CONTEXT;
@@ -189,7 +190,7 @@
line_m1 = (y >= 1) ? gbreg_line[-rowstride] : 0;
line_m2 = (y >= 2) ? gbreg_line[-(rowstride << 1)] << 5 : 0;
- CONTEXT = ((line_m1 >> 1) & 0x1f8) | ((line_m2 >> 1) & 0x1e00);
+ CONTEXT = ((line_m1 >> 1) & 0x1f8) | ((line_m2 >> 1) & 0x1e00);
/* 6.2.5.7 3d */
for (x = 0; x < padded_width; x += 8) {
@@ -203,7 +204,7 @@
if (y >= 2)
line_m2 = (line_m2 << 8) | (x + 8 < GBW ? gbreg_line[-(rowstride << 1) + (x >> 3) + 1] << 5 : 0);
- /* This is the speed-critical inner loop. */
+ /* This is the speed-critical inner loop. */
for (x_minor = 0; x_minor < minor_width; x_minor++) {
bool bit;
@@ -241,7 +242,7 @@
#endif
if (GBW <= 0)
- return 0;
+ return 0;
for (y = 0; y < GBH; y++) {
uint32_t CONTEXT;
@@ -251,7 +252,7 @@
line_m1 = (y >= 1) ? gbreg_line[-rowstride] : 0;
line_m2 = (y >= 2) ? gbreg_line[-(rowstride << 1)] << 4 : 0;
- CONTEXT = ((line_m1 >> 3) & 0x7c) | ((line_m2 >> 3) & 0x380);
+ CONTEXT = ((line_m1 >> 3) & 0x7c) | ((line_m2 >> 3) & 0x380);
/* 6.2.5.7 3d */
for (x = 0; x < padded_width; x += 8) {
@@ -265,7 +266,7 @@
if (y >= 2)
line_m2 = (line_m2 << 8) | (x + 8 < GBW ? gbreg_line[-(rowstride << 1) + (x >> 3) + 1] << 4 : 0);
- /* This is the speed-critical inner loop. */
+ /* This is the speed-critical inner loop. */
for (x_minor = 0; x_minor < minor_width; x_minor++) {
bool bit;
@@ -302,7 +303,7 @@
#endif
if (GBW <= 0)
- return 0;
+ return 0;
for (y = 0; y < GBH; y++) {
uint32_t CONTEXT;
@@ -312,7 +313,7 @@
line_m1 = (y >= 1) ? gbreg_line[-rowstride] : 0;
line_m2 = (y >= 2) ? gbreg_line[-(rowstride << 1)] << 4 : 0;
- CONTEXT = ((line_m1 >> 3) & 0x78) | ((line_m1 >> 2) & 0x4) | ((line_m2 >> 3) & 0x380);
+ CONTEXT = ((line_m1 >> 3) & 0x78) | ((line_m1 >> 2) & 0x4) | ((line_m2 >> 3) & 0x380);
/* 6.2.5.7 3d */
for (x = 0; x < padded_width; x += 8) {
@@ -326,7 +327,7 @@
if (y >= 2)
line_m2 = (line_m2 << 8) | (x + 8 < GBW ? gbreg_line[-(rowstride << 1) + (x >> 3) + 1] << 4 : 0);
- /* This is the speed-critical inner loop. */
+ /* This is the speed-critical inner loop. */
for (x_minor = 0; x_minor < minor_width; x_minor++) {
bool bit;
@@ -333,7 +334,7 @@
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT]);
result |= bit << (7 - x_minor);
CONTEXT = ((CONTEXT & 0x1b9) << 1) | bit |
- ((line_m1 >> (10 - x_minor)) & 0x8) | ((line_m1 >> (9 - x_minor)) & 0x4) | ((line_m2 >> (10 - x_minor)) & 0x80);
+ ((line_m1 >> (10 - x_minor)) & 0x8) | ((line_m1 >> (9 - x_minor)) & 0x4) | ((line_m2 >> (10 - x_minor)) & 0x80);
}
gbreg_line[x >> 3] = result;
}
@@ -365,7 +366,7 @@
#endif
if (GBW <= 0)
- return 0;
+ return 0;
for (y = 0; y < GBH; y++) {
uint32_t CONTEXT;
@@ -704,7 +705,7 @@
int i;
for (i = 0; i < 8; i++)
- jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "gbat[%d] = %d", i, params->gbat[i]);
+ jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "gbat[%d] = %d", i, params->gbat[i]);
}
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "decode_generic_region: MMR=%d, GBTEMPLATE=%d NYI", params->MMR, params->GBTEMPLATE);
return -1;
@@ -730,7 +731,7 @@
/* 7.4.6 */
if (segment->data_length < 18)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
jbig2_get_region_segment_info(&rsi, segment_data);
jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "generic region: %d x %d @ (%d, %d), flags = %02x", rsi.width, rsi.height, rsi.x, rsi.y, rsi.flags);
--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -608,7 +608,7 @@
}
if (NTEMP != lines_max) {
Jbig2HuffmanLine *new_line = jbig2_renew(ctx, line,
- Jbig2HuffmanLine, NTEMP);
+ Jbig2HuffmanLine, NTEMP);
if (new_line == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Could not reallocate Huffman Table Lines");
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -147,7 +147,7 @@
for (index = 0; index < segment->referred_to_segment_count; index++) {
rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]);
if (rsegment && ((rsegment->flags & 63) == 0) &&
- rsegment->result && (((Jbig2SymbolDict *) rsegment->result)->n_symbols > 0) && ((*((Jbig2SymbolDict *) rsegment->result)->glyphs) != NULL))
+ rsegment->result && (((Jbig2SymbolDict *) rsegment->result)->n_symbols > 0) && ((*((Jbig2SymbolDict *) rsegment->result)->glyphs) != NULL))
n_dicts++;
}
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -856,7 +856,7 @@
params.IARDX = jbig2_arith_int_ctx_new(ctx);
params.IARDY = jbig2_arith_int_ctx_new(ctx);
if ((params.IAID == NULL) || (params.IARI == NULL) ||
- (params.IARDW == NULL) || (params.IARDH == NULL) || (params.IARDX == NULL) || (params.IARDY == NULL)) {
+ (params.IARDW == NULL) || (params.IARDH == NULL) || (params.IARDX == NULL) || (params.IARDY == NULL)) {
code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "couldn't allocate text region image data");
goto cleanup4;
}
--- a/test_jbig2dec.py
+++ b/test_jbig2dec.py
@@ -45,11 +45,11 @@
self.stream.write("%s\n" % test.result)
stoptime = time.time()
self.stream.write('-'*72 + '\n')
- self.stream.write('ran %d tests in %.3f seconds\n\n' %
- (len(self.tests), stoptime - starttime))
+ self.stream.write('ran %d tests in %.3f seconds\n\n' %
+ (len(self.tests), stoptime - starttime))
if len(self.fails):
- self.stream.write('FAILED %d of %d tests\n' %
- (len(self.fails),len(self.tests)))
+ self.stream.write('FAILED %d of %d tests\n' %
+ (len(self.fails),len(self.tests)))
return False
else:
self.stream.write('PASSED all %d tests\n' % len(self.tests))