summaryrefslogtreecommitdiff
path: root/app/tools
diff options
context:
space:
mode:
Diffstat (limited to 'app/tools')
-rw-r--r--app/tools/dirent.c6
-rw-r--r--app/tools/halibut/bk_html.c8
-rw-r--r--app/tools/halibut/bk_paper.c55
-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.c5
-rw-r--r--app/tools/halibut/in_afm.c18
-rw-r--r--app/tools/halibut/in_pf.c20
-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/ustring.c12
-rw-r--r--app/tools/halibut/wcwidth.c2
15 files changed, 81 insertions, 77 deletions
diff --git a/app/tools/dirent.c b/app/tools/dirent.c
index 08ea800..bf6e7ff 100644
--- a/app/tools/dirent.c
+++ b/app/tools/dirent.c
@@ -21,7 +21,7 @@ extern "C"
struct DIR
{
- long handle; /* -1 for failed rewind */
+ intptr_t handle; /* -1 for failed rewind */
struct _finddata_t info;
struct dirent result; /* d_name null iff first time */
char *name; /* null-terminated char string */
@@ -42,7 +42,7 @@ DIR *opendir(const char *name)
{
strcat(strcpy(dir->name, name), all);
- if((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1)
+ if((dir->handle = _findfirst(dir->name, &dir->info)) != -1)
{
dir->result.d_name = 0;
}
@@ -116,7 +116,7 @@ void rewinddir(DIR *dir)
if(dir && dir->handle != -1)
{
_findclose(dir->handle);
- dir->handle = (long) _findfirst(dir->name, &dir->info);
+ dir->handle = _findfirst(dir->name, &dir->info);
dir->result.d_name = 0;
}
else
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..97f88b4 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")) {
@@ -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)
@@ -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;
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..6e4cc67 100644
--- a/app/tools/halibut/deflate.c
+++ b/app/tools/halibut/deflate.c
@@ -1786,8 +1786,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;
diff --git a/app/tools/halibut/in_afm.c b/app/tools/halibut/in_afm.c
index b2aacae..724bae7 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"))) {
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/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/ustring.c b/app/tools/halibut/ustring.c
index 95477a5..a5d1103 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;
}
@@ -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..f4abe23 100644
--- a/app/tools/halibut/wcwidth.c
+++ b/app/tools/halibut/wcwidth.c
@@ -165,7 +165,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;