dthelp: compiler warning and coverity warning fixes

This commit is contained in:
Peter Howkins
2018-03-29 00:21:44 +01:00
parent 50a96959f0
commit e12e009eb5
14 changed files with 68 additions and 34 deletions

View File

@@ -24,6 +24,8 @@
/* Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co. */
/* Miscellaneous Procedures for HP Tag/TeX translator */
#include <stdint.h>
#include "userinc.h"
#include "globdec.h"
@@ -307,7 +309,7 @@ while (TRUE)
node[n] = current->next;
if (! id[n])
{
if ((int) current->data >= 0)
if ((intptr_t) current->data >= 0)
m_err1("No glossary definition for %s", id);
current = current->next;
while (! current)
@@ -2194,13 +2196,13 @@ if (vgloss(gloss) == GLOSS)
*(termp-1) = M_EOS;
}
idn = (int) m_lookfortrie(base ? base : dterm, &gtree);
idn = (intptr_t) m_lookfortrie(base ? base : dterm, &gtree);
if (idn < 0)
idn = -idn;
if (!idn)
{
idn = NextId();
m_ntrtrie(base ? base : dterm, &gtree, (void *) idn);
m_ntrtrie(base ? base : dterm, &gtree, (void *) (intptr_t) idn);
}
}

View File

@@ -241,4 +241,4 @@
248, "fraction 1/2", UNSUPP, NULL, 0,
251, "French double open quote", UNSUPP, NULL, 0,
252, "Solid square", UNSUPP, NULL, 0,
253, "French double close quote", UNSUPP, NULL, NULL
253, "French double close quote", UNSUPP, NULL, 0

View File

@@ -24,6 +24,8 @@
/* Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co. */
/* Miscellaneous Procedures for HP Tag/TeX translator */
#include <stdint.h>
#include "userinc.h"
#include "globdec.h"
@@ -306,7 +308,7 @@ while (TRUE)
node[n] = current->next;
if (! id[n])
{
if ((int) current->data >= 0)
if ((intptr_t) current->data >= 0)
m_err1("No glossary definition for %s", id);
current = current->next;
while (! current)
@@ -1612,6 +1614,8 @@ else
}
_DtLcxCloseDb(&myDb);
free(charset);
free(lang);
}
@@ -2192,13 +2196,13 @@ if (vgloss(gloss) == GLOSS)
*(termp-1) = M_EOS;
}
idn = (int) m_lookfortrie(base ? base : dterm, &gtree);
idn = (intptr_t) m_lookfortrie(base ? base : dterm, &gtree);
if (idn < 0)
idn = -idn;
if (!idn)
{
idn = NextId();
m_ntrtrie(base ? base : dterm, &gtree, (void *) idn);
m_ntrtrie(base ? base : dterm, &gtree, (void *) (intptr_t) idn);
}
}

View File

@@ -155,7 +155,10 @@ strcpy(helpext, ".xrh");
tex = fopen(helpbase, "w");
fprintf(tex, "\\gobble\001%s\002%%\n", m_signon);
fputs("% Generated Cross-Reference Macros (for a particular document)\n", tex);
if (! xtree.data) return;
if (! xtree.data) {
fclose(tex);
return;
}
n = 0;
current = xtree.data;

View File

@@ -544,6 +544,8 @@ void srefout(M_NOPAR)
fputs(ndif, dtd) ;
}
SUBONE
free(mapbysref);
}
/* Output one element block in a template */

View File

@@ -231,7 +231,7 @@ SEARCH *searchp;
char *mb_entcontent;
mb_entcontent = MakeMByteString(entcontent);
if (!*mb_entcontent) return NULL; /* null file name, don't open a directory */
if (!mb_entcontent || !*mb_entcontent) return NULL; /* null file name, don't open a directory */
open = fopen(mb_entcontent, "r");
if (open)

View File

@@ -424,8 +424,12 @@ if (loading) newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
if (! newtransit || (loading && ! newdlm))
{
trysize = NUMDELIM + 1;
free(newtransit);
newtransit = (int *) calloc(NUMCON * trysize, sizeof(int));
if (loading) newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
if (loading) {
free(newdlm);
newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
}
}
if (! newtransit || (loading && ! newdlm))
{

View File

@@ -144,6 +144,7 @@ void copyfile(pfile1,pfile2)
ret = system(pcmd);
ret = snprintf(pcmd, slen, "touch %s",pfile2);
ret = system(pcmd);
free(pcmd);
}
int nextchar(file, data)

View File

@@ -84,16 +84,13 @@ void *m_wctrace(
#endif
) ;
void m_free(block, msg)
void *block ;
char *msg ;
void m_free(void *block, char *msg)
{
char buffer[32] ;
#if defined(MSDOS)
if (m_heapchk) m_heapdump() ;
#endif
free(block) ;
if (m_malftrace) {
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
snprintf(buffer, 32, "%5x:%5x",
@@ -107,6 +104,7 @@ void m_free(block, msg)
m_trace(msg) ;
m_trace("\n") ;
}
free(block) ;
#if defined(MSDOS)
if (m_heapchk) m_heapdump() ;
#endif