groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Re: still get core dump using grohtml


From: Gaius Mulley
Subject: [Groff] Re: still get core dump using grohtml
Date: 23 Aug 2000 16:32:46 +0100

Hi Lester,

many thanks for the mime encoded tar gziped test file.
I've run it on my system using the latest groff and
it doesn't create a core dump sadly. I'm sure a bug
exists somewhere - just that I cannot recreate it on
my GNU/Linux boxes..

Certainly the last two pages are not rendered correctly
as png images (within html) and that might be related
to the core dump..

Hi Andrej,

thanks for the sendmail file and this time grohtml
dumped core on my machine too.

Below is the fix. Werner, any chance you can apply
it to the repository? Thanks.

Many thanks to you all for reporting bugs and example
input

cheers Gaius


*** groff-cvs/src/devices/grohtml/html.cc       Sun Jun 18 11:09:09 2000
--- groff-html/src/devices/grohtml/html.cc      Wed Aug 23 16:05:32 2000
***************
*** 1663,1668 ****
--- 1663,1706 ----
  }
  
  /*
+  *  char_translate_to_html - convert a single non escaped character
+  *                           into the appropriate html character.
+  */
+ 
+ int char_translate_to_html (font *f, char *buf, int buflen, char ch, int b, 
int and_single)
+ {
+   if (and_single) {
+     int    t, l;
+     char  *translation;
+     char   name[2];
+ 
+     name[0] = ch;
+     name[1] = (char)0;
+     translation = get_html_translation(f, name);
+     if (translation) {
+       l = strlen(translation);
+       t = max(0, min(l, buflen-b));
+       strncpy(&buf[b], translation, t);
+       b += t;
+     } else {
+       if (b<buflen) {
+       buf[b] = ch;
+       b++;
+       }
+     }
+   } else {
+     /*
+      *  do not attempt to encode single characters
+      */
+     if (b<buflen) {
+       buf[b] = ch;
+       b++;
+     }
+   }
+   return( b );
+ }
+ 
+ /*
   *  str_translate_to_html - converts a string, str, into html text. It places
   *                          the output input buffer, buf. It truncates 
string, str, if
   *                          there is not enough space in buf.
***************
*** 1672,1687 ****
  
  void str_translate_to_html (font *f, char *buf, int buflen, char *str, int 
len, int and_single)
  {
-   int         l;
    char       *translation;
    int         e;
    char        escaped_char[MAX_STRING_LENGTH];
    int         i=0;
    int         b=0;
    int         t=0;
  
  #if 0
!   if (strcmp(str, "\\(\\\\-\\)") == 0) {
      stop();
    }
  #endif
--- 1710,1725 ----
  
  void str_translate_to_html (font *f, char *buf, int buflen, char *str, int 
len, int and_single)
  {
    char       *translation;
    int         e;
    char        escaped_char[MAX_STRING_LENGTH];
+   int         l;
    int         i=0;
    int         b=0;
    int         t=0;
  
  #if 0
!   if (strcmp(str, "``@,;:\\\\()[]''") == 0) {
      stop();
    }
  #endif
***************
*** 1721,1754 ****
            }
          }
        }
-       }
-     } else {
-       if (and_single) {
-       char name[2];
- 
-       name[0] = str[i];
-       name[1] = (char)0;
-       translation = get_html_translation(f, name);
-       if (translation) {
-         l = strlen(translation);
-         t = max(0, min(l, buflen-b));
-         strncpy(&buf[b], translation, t);
-         b += t;
-       } else {
-         if (b<buflen) {
-           buf[b] = str[i];
-           b++;
-         }
-       }
        } else {
!       /*
!        *  do not attempt to encode single characters
!        */
!       if (b<buflen) {
!         buf[b] = str[i];
!         b++;
!       }
        }
        i++;
      }
    }
--- 1759,1770 ----
            }
          }
        }
        } else {
!       b = char_translate_to_html(f, buf, buflen, str[i], b, and_single);
!       i++;
        }
+     } else {
+       b = char_translate_to_html(f, buf, buflen, str[i], b, and_single);
        i++;
      }
    }


---
Gaius Mulley       University of Glamorgan     address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]