shithub: jbig2

Download patch

ref: 1ded2e2e2dea3fbe03fa9e416d55629816ec3aaa
parent: 47216296566071537275ccee682b9d08959ce893
author: Sebastian Rasmussen <sebras@gmail.com>
date: Fri Apr 6 20:12:15 EDT 2018

jbig2dec: Fix some cosmetic typos in code/headers/tests.

--- a/jbig2.h
+++ b/jbig2.h
@@ -71,7 +71,7 @@
 Jbig2Image *jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, uint32_t width, uint32_t height);
 
 /* errors are returned from the library via a callback. If no callback
-   is provided (a NULL argument is passed ot jbig2_ctx_new) a default
+   is provided (a NULL argument is passed to jbig2_ctx_new) a default
    handler is used which prints fatal errors to the stderr stream. */
 
 /* error callback */
@@ -79,7 +79,7 @@
 
 /* memory allocation is likewise done via a set of callbacks so that
    clients can better control memory usage. If a NULL is passed for
-   this argumennt of jbig2_ctx_new, a default allocator based on malloc()
+   this argument of jbig2_ctx_new, a default allocator based on malloc()
    is used. */
 
 /* dynamic memory callbacks */
--- a/jbig2_halftone.c
+++ b/jbig2_halftone.c
@@ -72,7 +72,7 @@
                 return NULL;
             }
             /* compose with the REPLACE operator; the source
-               will be clipped to the destintion, selecting the
+               will be clipped to the destination, selecting the
                proper sub image */
             jbig2_image_compose(ctx, new->patterns[i], image, -i * HPW, 0, JBIG2_COMPOSE_REPLACE);
         }
@@ -108,9 +108,9 @@
  * @params: parameters from the pattern dictionary header
  * @data: pointer to text region data to be decoded
  * @size: length of text region data
- * @GB_stats: artimetic coding context to use
+ * @GB_stats: arithmetic coding context to use
  *
- * Implements the patten dictionary decoding proceedure
+ * Implements the pattern dictionary decoding procedure
  * described in section 6.7 of the JBIG2 spec.
  *
  * returns: a pointer to the resulting dictionary on success
@@ -241,7 +241,7 @@
  * @GSBPP: number of bitplanes/Jbig2Images to use
  * @GSKIP: mask indicating which values should be skipped
  * @GSTEMPLATE: template used to code the gray-scale bitplanes
- * @GB_stats: artimetic coding context to use
+ * @GB_stats: arithmetic coding context to use
  *
  * Implements the decoding a gray-scale image described in
  * annex C.5. This is part of the halftone region decoding.
@@ -431,9 +431,9 @@
  * @params: parameters
  * @data: pointer to halftone region data to be decoded
  * @size: length of halftone region data
- * @GB_stats: artimetic coding context to use
+ * @GB_stats: arithmetic coding context to use
  *
- * Implements the halftone region decoding proceedure
+ * Implements the halftone region decoding procedure
  * described in section 6.6.5 of the JBIG2 spec.
  *
  * returns: 0 on success
@@ -495,7 +495,7 @@
             gray_val = GI[ng][mg];
             if (gray_val >= HNUMPATS) {
                 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "gray-scale image uses value %d which larger than pattern dictionary", gray_val);
-                /* use highest aviable pattern */
+                /* use highest available pattern */
                 gray_val = HNUMPATS - 1;
             }
             jbig2_image_compose(ctx, image, HPATS->patterns[gray_val], x, y, params->op);
--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -132,7 +132,7 @@
     int i;
     int table_size = (1 << table->log_table_size);
 
-    fprintf(stderr, "huffman table %p (log_table_size=%d, %d entries, entryies=%p):\n", table, table->log_table_size, table_size, table->entries);
+    fprintf(stderr, "huffman table %p (log_table_size=%d, %d entries, entries=%p):\n", table, table->log_table_size, table_size, table->entries);
     for (i = 0; i < table_size; i++) {
         fprintf(stderr, "%6d: PREFLEN=%d, RANGELEN=%d, ", i, table->entries[i].PREFLEN, table->entries[i].RANGELEN);
         if (table->entries[i].flags & JBIG2_HUFFMAN_FLAGS_ISEXT) {
@@ -532,11 +532,11 @@
         /* B.2 2) (B.2.2) The lower bound of the first table line in the encoded table */
         const int32_t HTLOW = jbig2_get_int32(segment_data + 1);
 
-        /* B.2 3) (B.2.3) One larger than the upeer bound of
+        /* B.2 3) (B.2.3) One larger than the upper bound of
            the last normal table line in the encoded table */
         const int32_t HTHIGH = jbig2_get_int32(segment_data + 5);
 
-        /* estimated number of lines int this table, used for alloacting memory for lines */
+        /* estimated number of lines int this table, used for allocating memory for lines */
         const size_t lines_max = (segment->data_length * 8 - HTPS * (HTOOB ? 3 : 2)) / (HTPS + HTRS) + (HTOOB ? 3 : 2);
 
         /* points to a first table line data */
@@ -718,7 +718,7 @@
     ws.get_next_word = test_get_word;
     hs = jbig2_huffman_new(ctx, &ws);
 
-    printf("testing jbig2 huffmann decoding...");
+    printf("testing jbig2 huffman decoding...");
     printf("\t(should be 8 5 (oob) 8)\n");
 
     {
--- a/jbig2_image_png.c
+++ b/jbig2_image_png.c
@@ -117,7 +117,7 @@
     png_set_IHDR(png, info, image->width, image->height, 1, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
     png_write_info(png, info);
 
-    /* png natively treates 0 as black. This will convert for us */
+    /* png natively treats 0 as black. This will convert for us */
     png_set_invert_mono(png);
 
     /* write out each row in turn */
--- a/jbig2_metadata.c
+++ b/jbig2_metadata.c
@@ -153,7 +153,7 @@
     return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unexpected end of comment segment");
 }
 
-/* decode a UCS-16 comment segement 7.4.15.2 */
+/* decode a UCS-16 comment segment 7.4.15.2 */
 int
 jbig2_comment_unicode(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
 {
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -118,7 +118,7 @@
         }
     }
     if (page->height == 0xFFFFFFFF && page->striped == FALSE) {
-        jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "height is unspecified but page is not markes as striped");
+        jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "height is unspecified but page is not marks as striped");
         page->striped = TRUE;
     }
     page->end_row = 0;
@@ -129,7 +129,7 @@
 
     dump_page_info(ctx, segment, page);
 
-    /* allocate an approprate page image buffer */
+    /* allocate an appropriate page image buffer */
     /* 7.4.8.2 */
     if (page->height == 0xFFFFFFFF) {
         page->image = jbig2_image_new(ctx, page->width, page->stripe_size);
@@ -246,7 +246,7 @@
         return 0;
     }
 
-    /* grow the page to accomodate a new stripe if necessary */
+    /* grow the page to accommodate a new stripe if necessary */
     if (page->striped && page->height == 0xFFFFFFFF) {
         uint32_t new_height = y + image->height + page->end_row;
 
--- a/jbig2_priv.h
+++ b/jbig2_priv.h
@@ -114,7 +114,7 @@
 
 /* the page structure handles decoded page
    results. it's allocated by a 'page info'
-   segement and marked complete by an 'end of page'
+   segment and marked complete by an 'end of page'
    segment.
 */
 typedef enum {
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -206,7 +206,7 @@
     bool necessary = type & 0x80000000;
 
     if (necessary && !reserved) {
-        jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "extension segment is marked 'necessary' but " "not 'reservered' contrary to spec");
+        jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "extension segment is marked 'necessary' but " "not 'reserved' contrary to spec");
     }
 
     switch (type) {
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -58,7 +58,7 @@
                          const Jbig2SymbolDict *const *dicts, const uint32_t n_dicts,
                          Jbig2Image *image, const byte *data, const size_t size, Jbig2ArithCx *GR_stats, Jbig2ArithState *as, Jbig2WordStream *ws)
 {
-    /* relevent bits of 6.4.4 */
+    /* relevant bits of 6.4.4 */
     uint32_t NINSTANCES;
     uint32_t ID;
     int32_t STRIPT;
@@ -122,7 +122,7 @@
             goto cleanup1;
         }
 
-        /* decode the symbol id codelengths using the runlength table */
+        /* 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!");
@@ -783,7 +783,7 @@
         goto cleanup1;
     }
     if (dicts == NULL) {
-        code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unable to retrive symbol dictionaries! previous parsing error?");
+        code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unable to retrieve symbol dictionaries! previous parsing error?");
         goto cleanup1;
     } else {
         uint32_t index;
--- a/jbig2dec.c
+++ b/jbig2dec.c
@@ -248,23 +248,23 @@
         if (params->verbose < 3)
             return 0;
         type = "DEBUG";
-        break;;
+        break;
     case JBIG2_SEVERITY_INFO:
         if (params->verbose < 2)
             return 0;
         type = "info";
-        break;;
+        break;
     case JBIG2_SEVERITY_WARNING:
         if (params->verbose < 1)
             return 0;
         type = "WARNING";
-        break;;
+        break;
     case JBIG2_SEVERITY_FATAL:
         type = "FATAL ERROR";
-        break;;
+        break;
     default:
         type = "unknown message";
-        break;;
+        break;
     }
     if (seg_idx == -1)
         segment[0] = '\0';
--- a/memento.c
+++ b/memento.c
@@ -102,7 +102,7 @@
 /* When we list leaked blocks at the end of execution, we search for pointers
  * between blocks in order to be able to give a nice nested view.
  * Unfortunately, if you have are running your own allocator (such as
- * ghostscripts chunk allocator) you can often find that the header of the
+ * Ghostscript's chunk allocator) you can often find that the header of the
  * block always contains pointers to next or previous blocks. This tends to
  * mean the nesting displayed is "uninteresting" at best :)
  *
@@ -740,7 +740,7 @@
 /* MacOSX has 10240, Ubuntu seems to have 256 */
 #define OPEN_MAX 10240
 
-/* stashed_map[j] = i means that filedescriptor i-1 was duplicated to j */
+/* stashed_map[j] = i means that file descriptor i-1 was duplicated to j */
 int stashed_map[OPEN_MAX];
 
 extern size_t backtrace(void **, int);
--- a/test_jbig2dec.py
+++ b/test_jbig2dec.py
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 
-# this is the testtest script for jbig2dec
+# this is the test script for jbig2dec
 
 import os, re
 import sys, time