× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I think I forgot to post this patch to scs2pdf.c to handle very large
spooled files (like around 18,000 pages).  A quick look at the archives
shows that I didn't post this.  The changes are against current cvs (head
- not 0.16).  Patch follows.

James Rich

--- tn5250/src/scs2pdf.c        2002-04-01 23:10:33.000000000 -0700
+++ tn5250-new/src/scs2pdf.c    2003-07-15 17:33:39.000000000 -0600
@@ -91,11 +91,11 @@
 {
   Tn5250CharMap *map;
   int pagewidth, pagelength;
-  int objcount = 0;
-  int filesize = 0;
-  int streamsize = 0;
-  int pagenumber;
-  int textobjects[10000];
+  unsigned long objcount = 0;
+  unsigned long filesize = 0;
+  unsigned long streamsize = 0;
+  unsigned int pagenumber;
+  expanding_array *textobjects;
   int pageparent, procsetobject, fontobject, boldfontobject, rootobject;
   int i;
   int newpage = 0;
@@ -105,6 +105,8 @@
   int fontsize = 10, newfontsize;
   int boldchars, do_bold;
   char text[255];
+
+  textobjects = array_new ();
   ObjectList = array_new ();

   /* This allows the user to select an output file other than stdout.
@@ -279,7 +281,7 @@
                 * put on this page.  We put one stream object on each
                 * page.
                 */
-               textobjects[pagenumber - 1] = objcount;
+               array_append_val (textobjects, objcount);

                streamsize += pdf_process_char ('\0', 1);
                filesize += streamsize;
@@ -355,7 +357,7 @@
        }

     }
-  textobjects[pagenumber - 1] = objcount;
+  array_append_val (textobjects, objcount);
   streamsize += pdf_process_char ('\0', 1);
   filesize += streamsize;
   filesize += pdf_end_stream ();
@@ -442,7 +444,8 @@
       objcount++;
       filesize += pdf_page (objcount,
                            pageparent,
-                           textobjects[i], procsetobject, fontobject,
+                           array_index (textobjects, i),
+                           procsetobject, fontobject,
                            boldfontobject, pagewidth, pagelength);
 #ifdef DEBUG
       fprintf (stderr, "page objcount = %d\n", objcount);
@@ -452,6 +455,7 @@
   pdf_xreftable (objcount);
   pdf_trailer (filesize, objcount + 1, rootobject);

+  array_free (textobjects);
   array_free (ObjectList);
   tn5250_char_map_destroy (map);
   return (0);

--- tn5250/ChangeLog    2003-04-27 19:37:20.000000000 -0600
+++ tn5250-new/ChangeLog        2003-07-21 14:03:11.000000000 -0600
@@ -1,3 +1,9 @@
+2003-07-21 James Rich <james@xxxxxxxxxxx>
+- Fixed scs2pdf.c to handle very large spooled files.  We were overflowing
+    an array (textobjects).  This is now changed to be an expanding array.
+    Also changed some integers to unsigned long that counted things like
+    the number of pages.
+
 2003-04-27 Scott Klement <klemscot@xxxxxxxxxxxx>
 - Added local print key support to the curses terminal.  Activate it by
     specifying +local_print_key in your config file.   The output is


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.