summaryrefslogtreecommitdiff
path: root/app/tools/halibut
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2024-11-14 19:35:45 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2024-11-14 19:35:45 +0100
commitdf5520aa2dae5b3ce7abf8733dcdd152898af163 (patch)
tree00d3047bfb14f682bfb5a21010c731ed649bfed7 /app/tools/halibut
parentdf247efec654e512242e4f4f1b0212034f9e01fe (diff)
parentec3c0f6f6e7153fa797dc57a0e95779cbc63a23b (diff)
Merge branch 'release/debian/1_5.3.0GA-1'HEADdebian/1_5.3.0GA-1master
Diffstat (limited to 'app/tools/halibut')
-rw-r--r--app/tools/halibut/CMakeLists.txt15
-rw-r--r--app/tools/halibut/bk_html.c8
-rw-r--r--app/tools/halibut/bk_paper.c67
-rw-r--r--app/tools/halibut/charset/CMakeLists.txt16
-rw-r--r--app/tools/halibut/charset/fromucs.c6
-rw-r--r--app/tools/halibut/charset/iso2022.c6
-rw-r--r--app/tools/halibut/charset/test.c2
-rw-r--r--app/tools/halibut/charset/toucs.c6
-rw-r--r--app/tools/halibut/deflate.c13
-rw-r--r--app/tools/halibut/in_afm.c22
-rw-r--r--app/tools/halibut/in_pf.c20
-rw-r--r--app/tools/halibut/input.c2
-rw-r--r--app/tools/halibut/malloc.c2
-rw-r--r--app/tools/halibut/misc.c6
-rw-r--r--app/tools/halibut/paper.h4
-rw-r--r--app/tools/halibut/tree234.c2
-rw-r--r--app/tools/halibut/ustring.c16
-rw-r--r--app/tools/halibut/wcwidth.c7
18 files changed, 117 insertions, 103 deletions
diff --git a/app/tools/halibut/CMakeLists.txt b/app/tools/halibut/CMakeLists.txt
index ec7d74b..a4ddc75 100644
--- a/app/tools/halibut/CMakeLists.txt
+++ b/app/tools/halibut/CMakeLists.txt
@@ -1,4 +1,5 @@
-SET(SOURCES
+
+add_executable(halibut
biblio.c
bk_html.c
contents.c
@@ -22,11 +23,13 @@ SET(SOURCES
ustring.c
version.c
wcwidth.c
- )
+)
-INCLUDE_DIRECTORIES(charset)
-ADD_EXECUTABLE(halibut ${SOURCES})
-TARGET_LINK_LIBRARIES(halibut xtrkcad-charset)
+set_target_properties(
+ halibut
+ PROPERTIES FOLDER HelpDocs
+)
+target_link_libraries(halibut xtrkcad-charset)
-ADD_SUBDIRECTORY(charset)
+add_subdirectory(charset)
diff --git a/app/tools/halibut/bk_html.c b/app/tools/halibut/bk_html.c
index b01d035..3e937c5 100644
--- a/app/tools/halibut/bk_html.c
+++ b/app/tools/halibut/bk_html.c
@@ -1611,8 +1611,8 @@ void html_backend(paragraph *sourceform, keywordlist *keywords,
*/
if (conf.appletoc_filename) {
- htmlsect *s, *top;
- htmlfile *f;
+ htmlsect *s;// , *top;
+// htmlfile *f;
htmloutput ho;
ho.charset = conf.output_charset;
ho.restrict_charset = conf.restrict_charset;
@@ -2728,7 +2728,7 @@ static char *html_sanitise_fragment(htmlfilelist *files, htmlfile *file,
while (add234(files->frags, frag) != frag) {
if (!len) {
- len = strlen(text);
+ len = (int)strlen(text);
frag->fragment = text = sresize(text, len+20, char);
}
@@ -2781,7 +2781,7 @@ static char *html_sanitise_filename(htmlfilelist *files, char *text)
while (find234(files->files, text, NULL)) {
if (!p) {
- len = strlen(text);
+ len = (int)strlen(text);
p = text;
text = snewn(len+20, char);
diff --git a/app/tools/halibut/bk_paper.c b/app/tools/halibut/bk_paper.c
index 2e0289c..8c244b8 100644
--- a/app/tools/halibut/bk_paper.c
+++ b/app/tools/halibut/bk_paper.c
@@ -316,70 +316,70 @@ static paper_conf paper_configure(paragraph *source, font_list *fontlist) {
ret.bullet = uadv(p->keyword);
} else if (!ustricmp(p->keyword, L"paper-page-width")) {
ret.paper_width =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-page-height")) {
ret.paper_height =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-left-margin")) {
ret.left_margin =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-top-margin")) {
ret.top_margin =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-right-margin")) {
ret.right_margin =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-bottom-margin")) {
ret.bottom_margin =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-list-indent")) {
ret.indent_list_bullet =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-listitem-indent")) {
ret.indent_list =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-quote-indent")) {
ret.indent_quote =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-base-leading")) {
ret.base_leading =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-base-para-spacing")) {
ret.base_para_spacing =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-chapter-top-space")) {
ret.chapter_top_space =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-sect-num-left-space")) {
ret.sect_num_left_space =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-chapter-underline-depth")) {
ret.chapter_underline_depth =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-chapter-underline-thickness")) {
ret.chapter_underline_thickness =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-rule-thickness")) {
ret.rule_thickness =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-contents-indent-step")) {
ret.contents_indent_step =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-contents-margin")) {
ret.contents_margin =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-leader-separation")) {
ret.leader_separation =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-index-gutter")) {
ret.index_gutter =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-index-minsep")) {
ret.index_minsep =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-footer-distance")) {
ret.footer_distance =
- (int) 0.5 + FUNITS_PER_PT * utof(uadv(p->keyword));
+ (int) (0.5 + FUNITS_PER_PT * utof(uadv(p->keyword)));
} else if (!ustricmp(p->keyword, L"paper-base-font-size")) {
ret.fbase.font_size = utoi(uadv(p->keyword));
} else if (!ustricmp(p->keyword, L"paper-index-columns")) {
@@ -514,7 +514,7 @@ void *paper_pre_backend(paragraph *sourceform, keywordlist *keywords,
int has_index;
int pagenum;
paragraph index_placeholder_para;
- page_data *first_index_page;
+ page_data *first_index_page = NULL;
init_std_fonts();
fontlist = snew(font_list);
@@ -1707,7 +1707,7 @@ static void wrap_paragraph(para_data *pdata, word *words,
for (p = wrapping; p; p = p->next) {
line_data *ldata;
- word *wd;
+// word *wd;
int len, wid, spaces;
ldata = snew(line_data);
@@ -1732,7 +1732,7 @@ static void wrap_paragraph(para_data *pdata, word *words,
spaces = 0;
len = paper_width_list(&ctx, ldata->first, ldata->end, &spaces);
wid = (p == wrapping ? w - i1 : w - i2);
- wd = ldata->first;
+// wd = ldata->first;
ldata->hshortfall = wid - len;
ldata->nspaces = spaces;
@@ -1846,8 +1846,8 @@ static page_data *page_breaks(line_data *first, line_data *last,
*/
if (m != last && m->next && !m->next->page_break)
{
- int x = (this_height - minheight) / FUNITS_PER_PT *
- 4096.0;
+ int x = (int)((this_height - minheight) / FUNITS_PER_PT *
+ 4096.0);
int xf;
xf = x & 0xFF;
@@ -1938,8 +1938,8 @@ static page_data *page_breaks(line_data *first, line_data *last,
l->page = page;
l->ypos = text + space + head;
if (page->first_line->space[n]) {
- l->ypos += space * (float)page->first_line->vshortfall[n] /
- page->first_line->space[n];
+ l->ypos += (int)(space * (float)page->first_line->vshortfall[n] /
+ page->first_line->space[n]);
}
if (l == page->last_line)
@@ -2296,7 +2296,7 @@ static int render_line(line_data *ldata, int left_x, int top_y,
xr = NULL;
{
- int extra_indent, shortfall, spaces;
+ int extra_indent = 0, shortfall = 0, spaces = 0;
int just = ldata->pdata->justification;
/*
@@ -2344,7 +2344,7 @@ static void render_para(para_data *pdata, paper_conf *conf,
keywordlist *keywords, indexdata *idx,
paragraph *index_placeholder, page_data *index_page)
{
- int last_x;
+ int last_x = 0;
xref *cxref;
page_data *cxref_page;
xref_dest dest;
@@ -2530,7 +2530,8 @@ static para_data *code_paragraph(int indent, word *words, paper_conf *conf)
w->alt = NULL;
w->type = (prev == 0 ? word_WeakCode :
prev == 1 ? word_Emph : word_Normal);
- w->text = snewn(t-start+1, wchar_t);
+ w->text = snewn((int)(t-start+1),
+ wchar_t);
memcpy(w->text, start, (t-start) * sizeof(wchar_t));
w->text[t-start] = '\0';
w->breaks = FALSE;
@@ -2740,7 +2741,7 @@ static word *fake_end_ref(void)
static word *prepare_contents_title(word *first, wchar_t *separator,
word *second)
{
- word *ret;
+ word *ret = NULL;
word **wptr, *w;
wptr = &ret;
diff --git a/app/tools/halibut/charset/CMakeLists.txt b/app/tools/halibut/charset/CMakeLists.txt
index 86521b8..684c70e 100644
--- a/app/tools/halibut/charset/CMakeLists.txt
+++ b/app/tools/halibut/charset/CMakeLists.txt
@@ -1,4 +1,7 @@
-SET(SOURCES
+#
+# Character set conversion library as required for halibut
+
+add_library(xtrkcad-charset
big5enc.c
big5set.c
charset.h
@@ -29,10 +32,11 @@ SET(SOURCES
utf16.c
utf7.c
utf8.c
- xenc.c
- )
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+ xenc.c)
-ADD_LIBRARY(xtrkcad-charset ${SOURCES})
+set_target_properties(
+ xtrkcad-charset
+ PROPERTIES FOLDER HelpDocs
+ )
+ target_include_directories(xtrkcad-charset PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/app/tools/halibut/charset/fromucs.c b/app/tools/halibut/charset/fromucs.c
index 8090c19..3faf48e 100644
--- a/app/tools/halibut/charset/fromucs.c
+++ b/app/tools/halibut/charset/fromucs.c
@@ -16,7 +16,7 @@ static void charset_emit(void *ctx, long int output)
struct charset_emit_param *param = (struct charset_emit_param *)ctx;
if (param->outlen > 0) {
- *param->output++ = output;
+ *param->output++ = (char)output;
param->outlen--;
} else {
param->stopped = 1;
@@ -47,7 +47,7 @@ int charset_from_unicode(const wchar_t **input, int *inlen,
*error = FALSE;
while (*inlen > 0) {
- int lenbefore = param.output - output;
+ int lenbefore = (int)(param.output - output);
int ret;
if (input)
@@ -78,5 +78,5 @@ int charset_from_unicode(const wchar_t **input, int *inlen,
(*input)++;
(*inlen)--;
}
- return param.output - output;
+ return (int)(param.output - output);
}
diff --git a/app/tools/halibut/charset/iso2022.c b/app/tools/halibut/charset/iso2022.c
index 8cf3c25..b0492d9 100644
--- a/app/tools/halibut/charset/iso2022.c
+++ b/app/tools/halibut/charset/iso2022.c
@@ -879,7 +879,7 @@ static void docs_char(charset_state *state,
emit(emitctx, '/');
emit(emitctx, '0' + ctext_encodings[curr_cset].octets_per_char);
len = currlen + datalen +
- strlen(ctext_encodings[curr_cset].name);
+ (int)strlen(ctext_encodings[curr_cset].name);
assert(len < (1 << 14));
emit(emitctx, 0x80 | ((len >> 7) & 0x7F));
emit(emitctx, 0x80 | ((len ) & 0x7F));
@@ -964,7 +964,7 @@ static void docs_char(charset_state *state,
static void write_to_pointer(void *ctx, long int output)
{
char **ptr = (char **)ctx;
- *(*ptr)++ = output;
+ *(*ptr)++ = (char)output;
}
/*
@@ -1195,7 +1195,7 @@ static int write_iso2022(charset_spec const *charset, long int input_chr,
}
if (cs != -2) {
- docs_char(state, emit, emitctx, cs, data, p - data);
+ docs_char(state, emit, emitctx, cs, data, (int)(p - data));
return TRUE;
}
}
diff --git a/app/tools/halibut/charset/test.c b/app/tools/halibut/charset/test.c
index fc5128e..54eab56 100644
--- a/app/tools/halibut/charset/test.c
+++ b/app/tools/halibut/charset/test.c
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
while (1) {
- rdret = fread(inbuf, 1, sizeof(inbuf), stdin);
+ rdret = (int)fread(inbuf, 1, sizeof(inbuf), stdin);
if (rdret <= 0)
break; /* EOF */
diff --git a/app/tools/halibut/charset/toucs.c b/app/tools/halibut/charset/toucs.c
index bee98ab..807001b 100644
--- a/app/tools/halibut/charset/toucs.c
+++ b/app/tools/halibut/charset/toucs.c
@@ -30,7 +30,7 @@ static void unicode_emit(void *ctx, long int output)
outlen = 1;
}
} else {
- outval = output;
+ outval = (wchar_t)output;
p = &outval;
outlen = 1;
}
@@ -65,7 +65,7 @@ int charset_to_unicode(const char **input, int *inlen,
localstate = *state; /* structure copy */
while (*inlen > 0) {
- int lenbefore = param.output - output;
+ int lenbefore = (int)(param.output - output);
spec->read(spec, (unsigned char)**input, &localstate,
unicode_emit, &param);
if (param.stopped) {
@@ -83,5 +83,5 @@ int charset_to_unicode(const char **input, int *inlen,
(*inlen)--;
}
- return param.output - output;
+ return (int)(param.output - output);
}
diff --git a/app/tools/halibut/deflate.c b/app/tools/halibut/deflate.c
index 685097b..6366708 100644
--- a/app/tools/halibut/deflate.c
+++ b/app/tools/halibut/deflate.c
@@ -266,6 +266,7 @@ static void lz77_compress(struct LZ77Context *ctx,
st->npending -= i;
defermatch.len = 0;
+ defermatch.distance = 0;
deferchr = '\0';
while (len > 0) {
@@ -1203,7 +1204,7 @@ static void outblock(deflate_compress_ctx *out,
*/
for (i = 0; i < 19; i++)
codelen[i] = len3[lenlenmap[i]];
- for (hclen = 19; hclen > 4 && codelen[hclen-1] == 0; hclen--);
+ for (hclen = 19; hclen > 4 && codelen[hclen-1] == 0; hclen--){};
/*
* Now work out the exact size of both the dynamic and the
@@ -1786,8 +1787,9 @@ static struct table *mkonetab(int *codes, unsigned char *lengths, int nsyms,
int pfxmask = (1 << pfxbits) - 1;
int nbits, i, j, code;
- tab->table = snewn(1 << bits, struct tableentry);
- tab->mask = (1 << bits) - 1;
+ int bit = 1 << bits;
+ tab->table = snewn(bit, struct tableentry);
+ tab->mask = bit - 1;
for (code = 0; code <= tab->mask; code++) {
tab->table[code].code = -1;
@@ -2041,7 +2043,8 @@ int deflate_decompress_data(deflate_decompress_ctx *dctx,
{
const coderecord *rec;
const unsigned char *block = (const unsigned char *)vblock;
- int code, bfinal, btype, rep, dist, nlen, header, cksum;
+ int code, bfinal, btype, rep, dist, header, cksum;
+// int nlen;
int error = 0;
if (len == 0) {
@@ -2440,7 +2443,7 @@ int deflate_decompress_data(deflate_decompress_ctx *dctx,
*/
if (dctx->nbits < 16)
goto finished;
- nlen = dctx->bits & 0xFFFF;
+// nlen = dctx->bits & 0xFFFF;
EATBITS(16);
if (dctx->uncomplen == 0)
dctx->state = OUTSIDEBLK; /* block is empty */
diff --git a/app/tools/halibut/in_afm.c b/app/tools/halibut/in_afm.c
index b2aacae..cb2b39c 100644
--- a/app/tools/halibut/in_afm.c
+++ b/app/tools/halibut/in_afm.c
@@ -100,56 +100,56 @@ void read_afm_file(input *in) {
error(err_afmval, &in->pos, key, 4);
goto giveup;
}
- fi->fontbbox[i] = atof(val);
+ fi->fontbbox[i] = (float)atof(val);
}
} else if (strcmp(key, "CapHeight") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->capheight = atof(val);
+ fi->capheight = (float)atof(val);
} else if (strcmp(key, "XHeight") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->xheight = atof(val);
+ fi->xheight = (float)atof(val);
} else if (strcmp(key, "Ascender") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->ascent = atof(val);
+ fi->ascent = (float)atof(val);
} else if (strcmp(key, "Descender") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->descent = atof(val);
+ fi->descent = (float)atof(val);
} else if (strcmp(key, "CapHeight") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->capheight = atof(val);
+ fi->capheight = (float)atof(val);
} else if (strcmp(key, "StdHW") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->stemh = atof(val);
+ fi->stemh = (float)atof(val);
} else if (strcmp(key, "StdVW") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->stemv = atof(val);
+ fi->stemv = (float)atof(val);
} else if (strcmp(key, "ItalicAngle") == 0) {
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
- fi->italicangle = atof(val);
+ fi->italicangle = (float)atof(val);
} else if (strcmp(key, "StartCharMetrics") == 0) {
int nglyphs, i;
if (!(val = strtok(NULL, " \t"))) {
@@ -229,14 +229,14 @@ void read_afm_file(input *in) {
} else if (strcmp(key, "StartKernPairs") == 0 ||
strcmp(key, "StartKernPairs0") == 0) {
int nkerns, i;
- kern_pair *kerns;
+// kern_pair *kerns;
if (!(val = strtok(NULL, " \t"))) {
error(err_afmval, &in->pos, key, 1);
goto giveup;
}
nkerns = atoi(val);
sfree(line);
- kerns = snewn(nkerns, kern_pair);
+// kerns = snewn(nkerns, kern_pair);
for (i = 0; i < nkerns; i++) {
line = afm_read_line(in);
if (line == NULL)
diff --git a/app/tools/halibut/in_pf.c b/app/tools/halibut/in_pf.c
index 3df6d37..a50dce0 100644
--- a/app/tools/halibut/in_pf.c
+++ b/app/tools/halibut/in_pf.c
@@ -22,6 +22,8 @@
typedef struct t1_font_Tag t1_font;
typedef struct t1_data_Tag t1_data;
+font_info *all_fonts;
+
struct t1_font_Tag {
t1_data *data;
size_t length1;
@@ -68,7 +70,7 @@ static t1_data *load_pfb_file(FILE *fp, filepos *pos) {
if (c == EOF) abort();
tail->length |= c << (8 * i);
}
- tail->data = snewn(tail->length, unsigned char);
+ tail->data = snewn((int)tail->length, unsigned char);
if (fread(tail->data, 1, tail->length, fp) != tail->length) abort();
}
}
@@ -80,15 +82,15 @@ static t1_data *load_pfa_file(FILE *fp, filepos *pos) {
pos->line = 0;
ret->type = PFB_ASCII;
len = 32768;
- ret->data = snewn(len, unsigned char);
+ ret->data = snewn((int)len, unsigned char);
for (;;) {
got = fread(ret->data + off, 1, len - off, fp);
off += got;
if (off != len) break;
len *= 2;
- ret->data = sresize(ret->data, len, unsigned char);
+ ret->data = sresize(ret->data, (int)len, unsigned char);
}
- ret->data = sresize(ret->data, off, unsigned char);
+ ret->data = sresize(ret->data, (int)off, unsigned char);
ret->length = off;
return ret;
}
@@ -189,7 +191,7 @@ static void pf_identify(t1_font *tf) {
p++;
p += strspn(p, " \t");
len = strcspn(p, " \t");
- fontname = snewn(len + 1, char);
+ fontname = snewn((int)len + 1, char);
memcpy(fontname, p, len);
fontname[len] = 0;
sfree(rsc.text);
@@ -283,11 +285,11 @@ static void pf_getascii(t1_font *tf, size_t off, size_t len,
while (td && len) {
blk = len < td->length ? len : td->length;
if (td->type == PFB_ASCII) {
- *bufp = sresize(*bufp, *lenp + blk, char);
+ *bufp = sresize(*bufp, (int)(*lenp + blk), char);
memcpy(*bufp + *lenp, td->data + off, blk);
*lenp += blk;
} else {
- *bufp = sresize(*bufp, *lenp + blk * 2 + blk / 39 + 3, char);
+ *bufp = sresize(*bufp, (int)(*lenp + blk * 2 + blk / 39 + 3), char);
p = *bufp + *lenp;
for (i = 0; i < blk; i++) {
if (i % 39 == 0) p += sprintf(p, "\n");
@@ -334,11 +336,11 @@ static void pf_getbinary(t1_font *tf, size_t off, size_t len,
while (td && len) {
blk = len < td->length ? len : td->length;
if (td->type == PFB_BINARY) {
- *bufp = sresize(*bufp, *lenp + blk, char);
+ *bufp = sresize(*bufp, (int)(*lenp + blk), char);
memcpy(*bufp + *lenp, td->data + off, blk);
*lenp += blk;
} else {
- *bufp = sresize(*bufp, *lenp + blk / 2 + 1, char);
+ *bufp = sresize(*bufp, (int)(*lenp + blk / 2 + 1), char);
p = *bufp + *lenp;
for (i = 0; i < blk; i++) {
if (pf_isspace(td->data[off + i])) continue;
diff --git a/app/tools/halibut/input.c b/app/tools/halibut/input.c
index 256d9c6..0f38569 100644
--- a/app/tools/halibut/input.c
+++ b/app/tools/halibut/input.c
@@ -831,7 +831,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
*/
par.type = para_Normal;
if (t.type == tok_cmd) {
- int needkw;
+ int needkw = -1;
int is_macro = FALSE;
par.fpos = t.pos;
diff --git a/app/tools/halibut/malloc.c b/app/tools/halibut/malloc.c
index 2ff22fd..32f286a 100644
--- a/app/tools/halibut/malloc.c
+++ b/app/tools/halibut/malloc.c
@@ -92,7 +92,7 @@ void *(srealloc)(LOGPARAMS void *p, int size) {
* of smalloc (and also reliably defined in all environments :-)
*/
char *dupstr(char *s) {
- char *r = smalloc(1+strlen(s));
+ char *r = smalloc(1+(int)strlen(s));
strcpy(r,s);
return r;
}
diff --git a/app/tools/halibut/misc.c b/app/tools/halibut/misc.c
index 3f2483c..c0e86e4 100644
--- a/app/tools/halibut/misc.c
+++ b/app/tools/halibut/misc.c
@@ -90,7 +90,7 @@ void rdaddc(rdstringc *rs, char c) {
rs->text[rs->pos] = 0;
}
void rdaddsc(rdstringc *rs, char const *p) {
- rdaddsn(rs, p, strlen(p));
+ rdaddsn(rs, p, (int)strlen(p));
}
void rdaddsn(rdstringc *rs, char const *p, int len) {
if (rs->pos >= rs->size - len) {
@@ -527,7 +527,7 @@ void cmdline_cfg_add(paragraph *cfg, char *string)
ulen += 1 + ustrlen(cfg->keyword+ulen);
len = 0;
while (cfg->origkeyword[len])
- len += 1 + strlen(cfg->origkeyword+len);
+ len += 1 + (int)strlen(cfg->origkeyword+len);
ustring = ufroma_locale_dup(string);
@@ -538,7 +538,7 @@ void cmdline_cfg_add(paragraph *cfg, char *string)
cfg->keyword[ulen-1] = L'\0';
pos = len;
- len += 2 + strlen(string);
+ len += 2 + (int)strlen(string);
cfg->origkeyword = sresize(cfg->origkeyword, len, char);
strcpy(cfg->origkeyword+pos, string);
cfg->origkeyword[len-1] = '\0';
diff --git a/app/tools/halibut/paper.h b/app/tools/halibut/paper.h
index 29d6407..959accd 100644
--- a/app/tools/halibut/paper.h
+++ b/app/tools/halibut/paper.h
@@ -78,8 +78,6 @@ struct ligature_Tag {
* metrics are read in.
*/
-font_info *all_fonts;
-
struct font_info_Tag {
font_info *next;
/*
@@ -118,6 +116,8 @@ struct font_info_Tag {
float italicangle;
};
+extern font_info *all_fonts;
+
/*
* This structure holds the information about how a font is used
* in a document.
diff --git a/app/tools/halibut/tree234.c b/app/tools/halibut/tree234.c
index 26d188e..e971453 100644
--- a/app/tools/halibut/tree234.c
+++ b/app/tools/halibut/tree234.c
@@ -1162,7 +1162,7 @@ tree234 *join234r(tree234 *t1, tree234 *t2) {
static node234 *split234_internal(tree234 *t, int index) {
node234 *halves[2], *n, *sib, *sub;
node234 *lparent, *rparent;
- int ki, pki, i, half, lcount, rcount;
+ int ki, pki = 0, i, half, lcount, rcount;
n = t->root;
LOG(("splitting tree %p at point %d\n", t, index));
diff --git a/app/tools/halibut/ustring.c b/app/tools/halibut/ustring.c
index 95477a5..99303ef 100644
--- a/app/tools/halibut/ustring.c
+++ b/app/tools/halibut/ustring.c
@@ -72,7 +72,7 @@ wchar_t *ustrfroma(char const *s, wchar_t *outbuf, int size, int charset) {
return outbuf;
}
- len = strlen(s);
+ len = (int)strlen(s);
size--; /* allow for terminating NUL */
*outbuf = L'\0';
while (len > 0) {
@@ -155,7 +155,7 @@ wchar_t *ufroma_dup(char const *s, int charset) {
int len;
wchar_t *buf = NULL;
- len = strlen(s) + 1;
+ len = (int)strlen(s) + 1;
do {
buf = sresize(buf, len, wchar_t);
ustrfroma(s, buf, len, charset);
@@ -184,7 +184,7 @@ char *utoa_locale_dup(wchar_t const *s)
if (siz) {
assert(siz <= (size_t)(MB_CUR_MAX * len));
ret[siz] = '\0';
- ret = sresize(ret, siz+1, char);
+ ret = sresize(ret, (int)siz+1, char);
return ret;
}
@@ -206,7 +206,7 @@ wchar_t *ufroma_locale_dup(char const *s)
int len;
size_t siz;
- len = strlen(s);
+ len = (int)strlen(s);
ret = snewn(1 + 2*len, wchar_t); /* be conservative */
@@ -215,7 +215,7 @@ wchar_t *ufroma_locale_dup(char const *s)
if (siz) {
assert(siz <= (size_t)(2 * len));
ret[siz] = L'\0';
- ret = sresize(ret, siz+1, wchar_t);
+ ret = sresize(ret, (int)siz+1, wchar_t);
return ret;
}
@@ -323,12 +323,12 @@ wchar_t *ustrlow(wchar_t *s) {
}
int utoi(wchar_t const *s) {
- int sign = +1;
+// int sign = +1;
int n;
if (*s == L'-') {
s++;
- sign = -1;
+// sign = -1;
}
n = 0;
@@ -429,7 +429,7 @@ wchar_t *ustrftime(const wchar_t *wfmt, const struct tm *timespec)
rdadd(&rs, L'%');
wfmt += 2;
} else if (wfmt[0] == L'%' && wfmt[1]) {
- ustrftime_internal(&rs, wfmt[1], timespec);
+ ustrftime_internal(&rs, (char)(wfmt[1]), timespec);
wfmt += 2;
} else {
rdadd(&rs, wfmt[0]);
diff --git a/app/tools/halibut/wcwidth.c b/app/tools/halibut/wcwidth.c
index 269359f..0ffe9dd 100644
--- a/app/tools/halibut/wcwidth.c
+++ b/app/tools/halibut/wcwidth.c
@@ -144,12 +144,13 @@ int ustrwid(wchar_t const *s, int charset)
wid = 0;
while (len > 0) {
- int err, ret;
+ int err;
+// int ret;
wchar_t const *s_orig;
err = 0;
s_orig = s;
- ret = charset_from_unicode(&s, &len, buf, lenof(buf),
+ /*ret =*/ charset_from_unicode(&s, &len, buf, lenof(buf),
charset, &state, &err);
wid += wcswidth(s_orig, s - s_orig);
if (err) {
@@ -165,7 +166,7 @@ int ustrwid(wchar_t const *s, int charset)
int strwid(char const *s, int charset)
{
wchar_t buf[256];
- int wid, len = strlen(s);
+ int wid, len = (int)strlen(s);
charset_state state = CHARSET_INIT_STATE;
wid = 0;