ref: 6fec84b78e354c10ba5aab8da6e0c260d28d9857
parent: 6254bf0c75c87d68dc61d6333009ac4f85744cc1
author: Sebastian Rasmussen <sebras@gmail.com>
date: Wed May 23 23:18:04 EDT 2018
jbig2dec: Rephrase error messages.
--- a/jbig2.c
+++ b/jbig2.c
@@ -111,7 +111,7 @@
result = (Jbig2Ctx *) jbig2_alloc(allocator, sizeof(Jbig2Ctx), 1);
if (result == NULL) {
- error_callback(error_callback_data, "initial context allocation failed!", JBIG2_SEVERITY_FATAL, -1);
+ error_callback(error_callback_data, "initial context allocation failed", JBIG2_SEVERITY_FATAL, -1);
return result;
}
@@ -129,7 +129,7 @@
result->n_segments_max = 16;
result->segments = jbig2_new(result, Jbig2Segment *, result->n_segments_max);
if (result->segments == NULL) {
- error_callback(error_callback_data, "initial segments allocation failed!", JBIG2_SEVERITY_FATAL, -1);
+ error_callback(error_callback_data, "initial segments allocation failed", JBIG2_SEVERITY_FATAL, -1);
jbig2_free(allocator, result);
return result;
}
@@ -139,7 +139,7 @@
result->max_page_index = 4;
result->pages = jbig2_new(result, Jbig2Page, result->max_page_index);
if (result->pages == NULL) {
- error_callback(error_callback_data, "initial pages allocation failed!", JBIG2_SEVERITY_FATAL, -1);
+ error_callback(error_callback_data, "initial pages allocation failed", JBIG2_SEVERITY_FATAL, -1);
jbig2_free(allocator, result->segments);
jbig2_free(allocator, result);
return result;
@@ -256,7 +256,7 @@
if (ctx->buf_wr_ix - ctx->buf_rd_ix < 9)
return 0;
if (memcmp(ctx->buf + ctx->buf_rd_ix, jbig2_id_string, 8))
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "Not a JBIG2 file header");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "not a JBIG2 file header");
/* D.4.2 */
ctx->file_header_flags = ctx->buf[ctx->buf_rd_ix + 8];
if (ctx->file_header_flags & 0xFC) {
@@ -333,7 +333,7 @@
case JBIG2_FILE_EOF:
if (ctx->buf_rd_ix == ctx->buf_wr_ix)
return 0;
- return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "Garbage beyond end of file");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "garbage beyond end of file");
}
}
}
--- a/jbig2_arith_int.c
+++ b/jbig2_arith_int.c
@@ -70,30 +70,30 @@
bit = jbig2_arith_decode(as, &IAx[PREV], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx bit 0");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 0");
PREV = (PREV << 1) | bit;
if (bit) {
bit = jbig2_arith_decode(as, &IAx[PREV], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx bit 1");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 1");
PREV = (PREV << 1) | bit;
if (bit) {
bit = jbig2_arith_decode(as, &IAx[PREV], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx bit 2");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 2");
PREV = (PREV << 1) | bit;
if (bit) {
bit = jbig2_arith_decode(as, &IAx[PREV], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx bit 3");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 3");
PREV = (PREV << 1) | bit;
if (bit) {
bit = jbig2_arith_decode(as, &IAx[PREV], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx bit 4");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 4");
PREV = (PREV << 1) | bit;
if (bit) {
@@ -124,7 +124,7 @@
for (i = 0; i < n_tail; i++) {
bit = jbig2_arith_decode(as, &IAx[PREV], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx code 7");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx V bit %d", i);
PREV = ((PREV << 1) & 511) | (PREV & 256) | bit;
V = (V << 1) | bit;
}
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -768,7 +768,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);
@@ -783,7 +783,7 @@
if (!(seg_flags & 1)) {
gbat_bytes = (seg_flags & 6) ? 2 : 8;
if (18 + gbat_bytes > segment->data_length)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
memcpy(gbat, segment_data + 18, gbat_bytes);
jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "gbat: %d, %d", gbat[0], gbat[1]);
}
--- a/jbig2_halftone.c
+++ b/jbig2_halftone.c
@@ -135,7 +135,7 @@
/* allocate the collective image */
image = jbig2_image_new(ctx, params->HDPW * (params->GRAYMAX + 1), params->HDPH);
if (image == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate collective bitmap for halftone dict!");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate collective bitmap for halftone dict");
return NULL;
}
@@ -164,13 +164,13 @@
if (as != NULL) {
code = jbig2_decode_generic_region(ctx, segment, &rparams, as, image, GB_stats);
} else {
- code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for as in halftone dict!");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for as in halftone dict");
}
jbig2_free(ctx->allocator, as);
jbig2_word_stream_buf_free(ctx, ws);
} else {
- code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for ws in halftone dict!");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for ws in halftone dict");
}
}
@@ -194,7 +194,7 @@
/* 7.4.4.1 - Data header */
if (segment->data_length < 7) {
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
}
flags = segment_data[0];
params.HDMMR = flags & 1;
@@ -211,7 +211,7 @@
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "HDTEMPLATE is %d when HDMMR is %d, contrary to spec", params.HDTEMPLATE, params.HDMMR);
}
if (flags & 0xf8) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "Reserved flag bits non-zero");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "reserved flag bits non-zero");
}
/* 7.4.4.2 */
@@ -341,7 +341,7 @@
code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[j], GB_stats);
}
if (code != 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding GSPLANES for halftone image");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode GSPLANES for halftone image");
goto cleanup;
}
@@ -608,7 +608,7 @@
if (code < 0) {
jbig2_image_release(ctx, image);
jbig2_free(ctx->allocator, GB_stats);
- return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to decode halftone region");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode halftone region");
}
/* todo: retain GB_stats? */
@@ -627,5 +627,5 @@
return code;
too_short:
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
}
--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -559,12 +559,12 @@
/* allocate HuffmanParams & HuffmanLine */
params = jbig2_new(ctx, Jbig2HuffmanParams, 1);
if (params == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Could not allocate Huffman Table Parameter");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate Huffman Table Parameter");
goto error_exit;
}
line = jbig2_new(ctx, Jbig2HuffmanLine, lines_max);
if (line == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Could not allocate Huffman Table Lines");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate Huffman Table Lines");
goto error_exit;
}
/* B.2 5) */
@@ -611,7 +611,7 @@
Jbig2HuffmanLine, NTEMP);
if (new_line == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Could not reallocate Huffman Table Lines");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not reallocate Huffman Table Lines");
goto error_exit;
}
line = new_line;
@@ -636,7 +636,7 @@
return 0;
too_short:
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
error_exit:
if (line != NULL) {
jbig2_free(ctx->allocator, line);
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -119,7 +119,7 @@
/* use the same stride, just change the length */
image->data = jbig2_renew(ctx, image->data, uint8_t, (int)check);
if (image->data == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "could not resize image buffer!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "could not resize image buffer");
return NULL;
}
if (height > image->height) {
--- a/jbig2_image_png.c
+++ b/jbig2_image_png.c
@@ -59,7 +59,7 @@
check = fwrite(data, 1, length, f);
if (check != length) {
- png_error(png_ptr, "Write Error");
+ png_error(png_ptr, "write error");
}
}
--- a/jbig2_mmr.c
+++ b/jbig2_mmr.c
@@ -863,7 +863,7 @@
if (a2 > mmr->width)
a2 = mmr->width;
if (a1 == MINUS1 || a2 < a1)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative black run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white H run");
jbig2_set_bits(dst, a1, a2);
a0 = a2;
/* printf ("H %d %d\n", white_run, black_run); */
@@ -877,7 +877,7 @@
if (a2 > mmr->width)
a2 = mmr->width;
if (a0 == MINUS1 || a1 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative black H run");
jbig2_set_bits(dst, a0, a1);
a0 = a2;
/* printf ("H %d %d\n", black_run, white_run); */
@@ -891,7 +891,7 @@
b2 = jbig2_find_changing_element(ref, b1, mmr->width);
if (c) {
if (a0 == MINUS1 || b2 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative P run");
jbig2_set_bits(dst, a0, b2);
}
a0 = b2;
@@ -903,7 +903,7 @@
b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c);
if (c) {
if (a0 == MINUS1 || b1 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative V(0) run");
jbig2_set_bits(dst, a0, b1);
}
a0 = b1;
@@ -918,7 +918,7 @@
break;
if (c) {
if (a0 == MINUS1 || b1 + 1 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative VR(1) run");
jbig2_set_bits(dst, a0, b1 + 1);
}
a0 = b1 + 1;
@@ -933,7 +933,7 @@
break;
if (c) {
if (a0 == MINUS1 || b1 + 2 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative VR(2) run");
jbig2_set_bits(dst, a0, b1 + 2);
}
a0 = b1 + 2;
@@ -948,7 +948,7 @@
break;
if (c) {
if (a0 == MINUS1 || b1 + 3 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative VR(3) run");
jbig2_set_bits(dst, a0, b1 + 3);
}
a0 = b1 + 3;
@@ -963,7 +963,7 @@
break;
if (c) {
if (a0 == MINUS1 || b1 - 1 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative VL(1) run");
jbig2_set_bits(dst, a0, b1 - 1);
}
a0 = b1 - 1;
@@ -978,7 +978,7 @@
break;
if (c) {
if (a0 == MINUS1 || b1 - 2 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative VL(2) run");
jbig2_set_bits(dst, a0, b1 - 2);
}
a0 = b1 - 2;
@@ -993,7 +993,7 @@
break;
if (c) {
if (a0 == MINUS1 || b1 - 3 < a0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative white run");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "negative VL(3) run");
jbig2_set_bits(dst, a0, b1 - 3);
}
a0 = b1 - 3;
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -161,7 +161,7 @@
uint32_t end_row;
if (segment->data_length < 4)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
end_row = jbig2_get_uint32(segment_data);
if (end_row < page.end_row) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
@@ -196,7 +196,7 @@
with the segment data length field of the last segment
set to -1. Try to cope with this here. */
if ((segment->data_length & 0xffffffff) == 0xffffffff) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "File has an invalid segment data length!" " Trying to decode using the available data.");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "file has an invalid segment data length; trying to decode using the available data");
segment->data_length = ctx->buf_wr_ix - ctx->buf_rd_ix;
code = jbig2_parse_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix);
ctx->buf_rd_ix += segment->data_length;
--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -408,7 +408,7 @@
/* 7.4.7 */
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);
@@ -426,7 +426,7 @@
/* 7.4.7.3 */
if (!params.GRTEMPLATE) {
if (segment->data_length < 22)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
params.grat[0] = segment_data[offset + 0];
params.grat[1] = segment_data[offset + 1];
params.grat[2] = segment_data[offset + 2];
@@ -442,7 +442,7 @@
ref = jbig2_region_find_referred(ctx, segment);
if (ref == NULL)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not find reference bitmap!");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not find reference bitmap");
/* the reference bitmap is the result of a previous
intermediate region segment; the reference selection
rules say to use the first one available, and not to
@@ -456,7 +456,7 @@
/* the reference is just (a subset of) the page buffer */
params.reference = jbig2_image_clone(ctx, ctx->pages[ctx->current_page].image);
if (params.reference == NULL)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not clone reference bitmap!");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not clone reference bitmap");
/* TODO: subset the image if appropriate */
}
@@ -499,7 +499,7 @@
code = jbig2_decode_refinement_region(ctx, segment, ¶ms, as, image, GR_stats);
if (code < 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "unable to decode refinement region");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode refinement region");
goto cleanup;
}
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -204,7 +204,7 @@
bool necessary;
if (segment->data_length < 4)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
type = jbig2_get_uint32(segment_data);
reserved = type & 0x20000000;
@@ -234,7 +234,7 @@
jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
{
jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number,
- "Segment %d, flags=%x, type=%d, data_length=%d", segment->number, segment->flags, segment->flags & 63, segment->data_length);
+ "segment %d, flags=%x, type=%d, data_length=%d", segment->number, segment->flags, segment->flags & 63, segment->data_length);
switch (segment->flags & 63) {
case 0:
return jbig2_symbol_dictionary(ctx, segment, segment_data);
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -340,7 +340,7 @@
HCFIRSTSYM = NSYMSDECODED;
if ((int32_t) HCHEIGHT < 0) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Invalid HCHEIGHT value");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid HCHEIGHT value");
goto cleanup2;
}
#ifdef JBIG2_DEBUG
@@ -366,7 +366,7 @@
/* check for broken symbol table */
if (NSYMSDECODED >= params->SDNUMNEWSYMS) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "No OOB signaling end of height class %d", HCHEIGHT);
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "no OOB signaling end of height class %d", HCHEIGHT);
goto cleanup4;
}
@@ -373,7 +373,7 @@
SYMWIDTH = SYMWIDTH + DW;
TOTWIDTH = TOTWIDTH + SYMWIDTH;
if ((int32_t) SYMWIDTH < 0) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Invalid SYMWIDTH value (%d) at symbol %d", SYMWIDTH, NSYMSDECODED + 1);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid SYMWIDTH value (%d) at symbol %d", SYMWIDTH, NSYMSDECODED + 1);
goto cleanup4;
}
#ifdef JBIG2_DEBUG
@@ -437,12 +437,12 @@
/* as well as the text region parameters structure */
refagg_dicts = jbig2_new(ctx, Jbig2SymbolDict *, n_refagg_dicts);
if (refagg_dicts == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory allocating dictionary array");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "out of memory allocating dictionary array");
goto cleanup4;
}
refagg_dicts[0] = jbig2_sd_new(ctx, params->SDNUMINSYMS + params->SDNUMNEWSYMS);
if (refagg_dicts[0] == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory allocating symbol dictionary");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "out of memory allocating symbol dictionary");
goto cleanup4;
}
for (i = 0; i < params->SDNUMINSYMS; i++) {
@@ -451,7 +451,7 @@
tparams = jbig2_new(ctx, Jbig2TextRegionParams, 1);
if (tparams == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory creating text region params");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "out of memory creating text region params");
goto cleanup4;
}
if (!params->SDHUFF) {
@@ -506,7 +506,7 @@
image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
if (image == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory creating symbol image");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "out of memory creating symbol image");
goto cleanup4;
}
@@ -562,7 +562,7 @@
image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
if (image == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory creating symbol image");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "out of memory creating symbol image");
goto cleanup4;
}
@@ -571,7 +571,7 @@
rparams.reference = (ID < ninsyms) ? params->SDINSYMS->glyphs[ID] : SDNEWSYMS->glyphs[ID - ninsyms];
/* SumatraPDF: fail on missing glyphs */
if (rparams.reference == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "missing glyph %d/%d!", ID, ninsyms);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "missing glyph %d/%d", ID, ninsyms);
jbig2_image_release(ctx, image);
goto cleanup4;
}
@@ -634,7 +634,7 @@
int x;
if (code) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding size of collective bitmap!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding size of collective bitmap");
goto cleanup4;
}
@@ -643,7 +643,7 @@
image = jbig2_image_new(ctx, TOTWIDTH, HCHEIGHT);
if (image == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate collective bitmap image!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate collective bitmap image");
goto cleanup4;
}
@@ -686,7 +686,7 @@
rparams.MMR = 1;
code = jbig2_decode_generic_mmr(ctx, segment, &rparams, data + jbig2_huffman_offset(hs), BMSIZE, image);
if (code) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding MMR bitmap image!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode MMR-coded generic region");
jbig2_image_release(ctx, image);
goto cleanup4;
}
@@ -859,7 +859,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom DH huffman table not found (%d)", table_index);
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom DH huffman table not found (%d)", table_index);
}
params.SDHUFFDH = jbig2_build_huffman_table(ctx, huffman_params);
++table_index;
@@ -883,7 +883,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom DW huffman table not found (%d)", table_index);
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom DW huffman table not found (%d)", table_index);
break;
}
params.SDHUFFDW = jbig2_build_huffman_table(ctx, huffman_params);
@@ -903,7 +903,7 @@
/* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom BMSIZE huffman table not found (%d)", table_index);
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom BMSIZE huffman table not found (%d)", table_index);
} else {
params.SDHUFFBMSIZE = jbig2_build_huffman_table(ctx, huffman_params);
++table_index;
@@ -921,7 +921,7 @@
/* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom REFAGG huffman table not found (%d)", table_index);
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom REFAGG huffman table not found (%d)", table_index);
} else {
params.SDHUFFAGGINST = jbig2_build_huffman_table(ctx, huffman_params);
++table_index;
@@ -1062,5 +1062,5 @@
jbig2_release_huffman_table(ctx, params.SDHUFFBMSIZE);
jbig2_release_huffman_table(ctx, params.SDHUFFAGGINST);
}
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short");
}
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -117,7 +117,7 @@
runcodeparams.n_lines = 35;
runcodes = jbig2_build_huffman_table(ctx, &runcodeparams);
if (runcodes == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error constructing symbol id runcode table!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error constructing symbol id runcode table");
code = -1;
goto cleanup1;
}
@@ -125,7 +125,7 @@
/* decode the symbol id code lengths using the runlength table */
symcodelengths = jbig2_new(ctx, Jbig2HuffmanLine, SBNUMSYMS);
if (symcodelengths == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "memory allocation failure reading symbol ID huffman table!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "memory allocation failure reading symbol ID huffman table");
code = -1;
goto cleanup1;
}
@@ -133,7 +133,7 @@
while (index < SBNUMSYMS) {
code = jbig2_huffman_get(hs, runcodes, &err);
if (err != 0 || code < 0 || code >= 35) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error reading symbol ID huffman table!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error reading symbol ID huffman table");
code = err ? err : -1;
goto cleanup1;
}
@@ -144,7 +144,7 @@
} else {
if (code == 32) {
if (index < 1) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding symbol id table: run length with no antecedent!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding symbol id table: run length with no antecedent");
code = -1;
goto cleanup1;
}
@@ -165,7 +165,7 @@
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, " read runcode%d at index %d (length %d range %d)", code, index, len, range);
if (index + range > SBNUMSYMS) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
- "runlength extends %d entries beyond the end of symbol id table!", index + range - SBNUMSYMS);
+ "runlength extends %d entries beyond the end of symbol id table", index + range - SBNUMSYMS);
range = SBNUMSYMS - index;
}
for (r = 0; r < range; r++) {
@@ -194,7 +194,7 @@
jbig2_release_huffman_table(ctx, runcodes);
if (SBSYMCODES == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not construct Symbol ID huffman table!");
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not construct Symbol ID huffman table");
jbig2_huffman_free(ctx, hs);
return ((code != 0) ? code : -1);
}
@@ -210,7 +210,7 @@
code = jbig2_arith_int_decode(ctx, params->IADT, as, &STRIPT);
}
if (code < 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to obtain strip T");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode strip T");
goto cleanup2;
}
@@ -228,7 +228,7 @@
code = jbig2_arith_int_decode(ctx, params->IADT, as, &DT);
}
if (code < 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to obtain delta T");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode delta T");
goto cleanup2;
}
DT *= params->SBSTRIPS;
@@ -246,7 +246,7 @@
code = jbig2_arith_int_decode(ctx, params->IAFS, as, &DFS);
}
if (code < 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to obtain strip symbol S-difference");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode strip symbol S-difference");
goto cleanup2;
}
FIRSTS += DFS;
@@ -279,7 +279,7 @@
code = jbig2_arith_int_decode(ctx, params->IAIT, as, &CURT);
}
if (code < 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to obtain symbol instance T coordinate");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode symbol instance T coordinate");
goto cleanup2;
}
T = STRIPT + CURT;
@@ -309,7 +309,7 @@
IB = jbig2_image_clone(ctx, dicts[index]->glyphs[id]);
/* SumatraPDF: fail on missing glyphs */
if (!IB) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "missing glyph %d/%d!", index, id);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "missing glyph %d/%d", index, id);
goto cleanup2;
}
}
@@ -320,7 +320,7 @@
code = jbig2_arith_int_decode(ctx, params->IARI, as, &RI);
}
if (code < 0) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to obtain symbol bitmap refinement indicator");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode symbol bitmap refinement indicator");
goto cleanup2;
}
} else {
@@ -590,7 +590,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom FS huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom FS huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFFS = jbig2_build_huffman_table(ctx, huffman_params);
@@ -620,7 +620,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom DS huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom DS huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFDS = jbig2_build_huffman_table(ctx, huffman_params);
@@ -645,7 +645,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom DT huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom DT huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFDT = jbig2_build_huffman_table(ctx, huffman_params);
@@ -667,7 +667,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom RDW huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom RDW huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFRDW = jbig2_build_huffman_table(ctx, huffman_params);
@@ -694,7 +694,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom RDH huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom RDH huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFRDH = jbig2_build_huffman_table(ctx, huffman_params);
@@ -721,7 +721,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom RDX huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom RDX huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFRDX = jbig2_build_huffman_table(ctx, huffman_params);
@@ -748,7 +748,7 @@
case 3: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom RDY huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom RDY huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFRDY = jbig2_build_huffman_table(ctx, huffman_params);
@@ -772,7 +772,7 @@
case 1: /* Custom table from referred segment */
huffman_params = jbig2_find_table(ctx, segment, table_index);
if (huffman_params == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Custom RSIZE huffman table not found (%d)", table_index);
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "custom RSIZE huffman table not found (%d)", table_index);
goto cleanup1;
}
params.SBHUFFRSIZE = jbig2_build_huffman_table(ctx, huffman_params);
@@ -800,7 +800,7 @@
if (n_dicts != 0) {
dicts = jbig2_sd_list_referred(ctx, segment);
} else {
- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region refers to no symbol dictionaries!");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region refers to no symbol dictionaries");
goto cleanup1;
}
if (dicts == NULL) {
@@ -810,12 +810,12 @@
uint32_t index;
if (dicts[0] == NULL) {
- code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find first referenced symbol dictionary!");
+ code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find first referenced symbol dictionary");
goto cleanup1;
}
for (index = 1; index < n_dicts; index++)
if (dicts[index] == NULL) {
- jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find all referenced symbol dictionaries!");
+ jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find all referenced symbol dictionaries");
n_dicts = index;
}
}