"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "htmldoc/htmllib.cxx" between
htmldoc-1.9.11-source.tar.gz and htmldoc-1.9.12-source.tar.gz

About: HTMLDOC converts HTML and Markdown source files into indexed HTML, EPUB, PostScript, or PDF files (but doesn’t support CSS).

htmllib.cxx  (htmldoc-1.9.11-source):htmllib.cxx  (htmldoc-1.9.12-source)
/* /*
* HTML parsing routines for HTMLDOC, a HTML document processing program. * HTML parsing routines for HTMLDOC, a HTML document processing program.
* *
* Copyright 2011-2020 by Michael R Sweet. * Copyright 2011-2021 by Michael R Sweet.
* Copyright 1997-2010 by Easy Software Products. All rights reserved. * Copyright 1997-2010 by Easy Software Products. All rights reserved.
* *
* This program is free software. Distribution and use rights are outlined in * This program is free software. Distribution and use rights are outlined in
* the file "COPYING". * the file "COPYING".
*/ */
/* /*
* Include necessary headers. * Include necessary headers.
*/ */
skipping to change at line 1598 skipping to change at line 1598
while (t != NULL) while (t != NULL)
{ {
if (t->markup == MARKUP_NONE) if (t->markup == MARKUP_NONE)
{ {
if (t->preformatted) if (t->preformatted)
{ {
for (ptr = t->data; *ptr != '\0'; ptr ++) for (ptr = t->data; *ptr != '\0'; ptr ++)
fputs((char *)iso8859(*ptr), fp); fputs((char *)iso8859(*ptr), fp);
if (t->data[strlen((char *)t->data) - 1] == '\n') if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
col = 0; col = 0;
else else
col += strlen((char *)t->data); col += strlen((char *)t->data);
} }
else else
{ {
if ((col + (int)strlen((char *)t->data)) > 72 && col > 0) if ((col + (int)strlen((char *)t->data)) > 72 && col > 0)
{ {
putc('\n', fp); putc('\n', fp);
col = 0; col = 0;
skipping to change at line 2097 skipping to change at line 2097
slen = 0; slen = 0;
s = NULL; s = NULL;
while (t != NULL) while (t != NULL)
{ {
if (t->child) if (t->child)
tdata = talloc = htmlGetText(t->child); tdata = talloc = htmlGetText(t->child);
else else
tdata = t->data; tdata = t->data;
if (tdata != NULL) tlen = tdata ? strlen((char *)tdata) : 0;
if (tdata != NULL && tlen > 0)
{ {
// Add the text to this string... // Add the text to this string...
tlen = strlen((char *)tdata);
if (s) if (s)
s2 = (uchar *)realloc(s, 1 + slen + tlen); s2 = (uchar *)realloc(s, 1 + slen + tlen);
else else
s2 = (uchar *)malloc(1 + tlen); s2 = (uchar *)malloc(1 + tlen);
if (!s2) if (!s2)
break; break;
s = s2; s = s2;
memcpy((char *)s + slen, (char *)tdata, tlen); memcpy((char *)s + slen, (char *)tdata, tlen);
slen += tlen; slen += tlen;
}
if (talloc) if (talloc)
{ {
free(talloc); free(talloc);
talloc = NULL; talloc = NULL;
}
} }
t = t->next; t = t->next;
} }
if (slen) if (slen)
s[slen] = '\0'; s[slen] = '\0';
if (talloc) if (talloc)
free(talloc); free(talloc);
skipping to change at line 3403 skipping to change at line 3403
/* /*
* 'fix_filename()' - Fix a filename to be relative to the base directory. * 'fix_filename()' - Fix a filename to be relative to the base directory.
*/ */
static const char * /* O - Fixed filename */ static const char * /* O - Fixed filename */
fix_filename(char *filename, /* I - Original filename */ fix_filename(char *filename, /* I - Original filename */
char *base) /* I - Base directory */ char *base) /* I - Base directory */
{ {
char *slash; /* Location of slash */ char *slash; /* Location of slash */
char temp[1024], /* Temporary filename */ char *tempptr; /* Pointer into filename */
*tempptr; /* Pointer into filename */ static char temp[1024]; /* Temporary filename */
static char newfilename[1024]; /* New filename */ static char newfilename[1024]; /* New filename */
// printf("fix_filename(filename=\"%s\", base=\"%s\")\n", filename, base); // printf("fix_filename(filename=\"%s\", base=\"%s\")\n", filename, base);
if (filename == NULL) if (filename == NULL)
return (NULL); return (NULL);
#ifdef DEBUG // to silence Clang static analyzer, totally unnecessary #ifdef DEBUG // to silence Clang static analyzer, totally unnecessary
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
#endif // DEBUG #endif // DEBUG
 End of changes. 7 change blocks. 
12 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)