|
Ok, I got it right this time. Belows is the patch for the head branch. James Rich diff -ur tn5250/ChangeLog tn5250-new/ChangeLog --- tn5250/ChangeLog 2003-07-18 17:43:08.000000000 -0600 +++ tn5250-new/ChangeLog 2003-07-22 12:26:32.000000000 -0600 @@ -1,3 +1,9 @@ +2003-07-22 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 a + GArray. Also changed some integers to unsigned long that counted + things like the number of pages. + 2003-07-18 Scott Klement <klemscot@xxxxxxxxxxxx> - Fixed NDEBUG support (again) - Applied patch from Marc-Antoine Ruel which fixes a bug in terminal.c diff -ur tn5250/src/scs2pdf.c tn5250-new/src/scs2pdf.c --- tn5250/src/scs2pdf.c 2002-03-20 17:00:08.000000000 -0700 +++ tn5250-new/src/scs2pdf.c 2003-07-22 12:17:38.000000000 -0600 @@ -79,11 +79,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; + GArray *textobjects; int pageparent, procsetobject, fontobject, boldfontobject, rootobject; int i; int newpage = 0; @@ -93,7 +93,9 @@ int fontsize = 10, newfontsize; int boldchars, do_bold; char text[255]; + ObjectList = g_array_new (FALSE, FALSE, sizeof (int)); + textobjects = g_array_new (FALSE, FALSE, sizeof (int)); /* This allows the user to select an output file other than stdout. * I don't know that this will ever be useful since you do pretty much @@ -267,7 +269,7 @@ * put on this page. We put one stream object on each * page. */ - textobjects[pagenumber - 1] = objcount; + g_array_append_val (textobjects, objcount); streamsize += pdf_process_char ('\0', 1); filesize += streamsize; @@ -343,7 +345,7 @@ } } - textobjects[pagenumber - 1] = objcount; + g_array_append_val (textobjects, objcount); streamsize += pdf_process_char ('\0', 1); filesize += streamsize; filesize += pdf_end_stream (); @@ -430,7 +432,8 @@ objcount++; filesize += pdf_page (objcount, pageparent, - textobjects[i], procsetobject, fontobject, + g_array_index (textobjects, int, i), + procsetobject, fontobject, boldfontobject, pagewidth, pagelength); #ifdef DEBUG fprintf (stderr, "page objcount = %d\n", objcount); @@ -440,6 +443,7 @@ pdf_xreftable (objcount); pdf_trailer (filesize, objcount + 1, rootobject); + g_array_free (textobjects, TRUE); g_array_free (ObjectList, TRUE); tn5250_char_map_destroy (map); return (0);
As an Amazon Associate we earn from qualifying purchases.
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.