about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-03-20 00:46:50 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-03-20 00:46:50 +0000
commitdf95942b93d3ce512391b4c1e6cdfc66a897f98c (patch)
tree48d7c86903919f14071d3c1b3195e8b03ec14426
parent7c693525f2e51e7ac4089dd95f5d1210d86bfbc8 (diff)
downloadnetpbm-mirror-df95942b93d3ce512391b4c1e6cdfc66a897f98c.tar.gz
netpbm-mirror-df95942b93d3ce512391b4c1e6cdfc66a897f98c.tar.xz
netpbm-mirror-df95942b93d3ce512391b4c1e6cdfc66a897f98c.zip
Remove arbitrary restriction on size of image with -hilbert
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3762 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY3
-rw-r--r--editor/pamditherbw.c10
2 files changed, 8 insertions, 5 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 6942d2aa..b66118da 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -8,6 +8,9 @@ not yet  BJH  Release 10.90.00
 
               pamundice: Add -listfile.
 
+              pamditherbw: Remove restriction to 2^18 pixels width and height
+              for -hilbert .
+
               pamundice: Add error and warning messages for insane file name
               pattern.
 
diff --git a/editor/pamditherbw.c b/editor/pamditherbw.c
index 6ec2511a..1943aa14 100644
--- a/editor/pamditherbw.c
+++ b/editor/pamditherbw.c
@@ -190,8 +190,6 @@ makeOutputPam(unsigned int const width,
 
 /* Hilbert curve tracer */
 
-#define MAXORD 18
-
 struct Hil {
     int order;
     int ord;
@@ -200,7 +198,10 @@ struct Hil {
     int dy;
     int x;
     int y;
-    int stage[MAXORD];
+    int stage[sizeof(unsigned int)*8];
+        /* One entry for every bit in the height or width, each of which
+           is an unsigned int
+        */
     int width;
     int height;
 };
@@ -217,8 +218,7 @@ initHilbert(int          const w,
     hilP->height = h;
     big = w > h ? w : h;
     for (ber = 2, hilP->order = 1; ber < big; ber <<= 1, hilP->order++);
-    if (hilP->order > MAXORD)
-        pm_error("Sorry, hilbert order is too large");
+    assert(hilP->order <= ARRAY_SIZE(hilP->stage));
     hilP->ord = hilP->order;
     hilP->order--;
 }