Use explicit casts for conversions losing integer precision

This commit is contained in:
Christian Göttsche 2020-04-07 21:47:00 +02:00
parent 1e63f69520
commit f5dc8abea4
3 changed files with 4 additions and 4 deletions

View file

@ -190,7 +190,7 @@ static int rstring_esc(char **dest, int *destlen) {
C(rfill1);
#define ap(c) if(*destlen > 1) { *((*dest)++) = c; (*destlen)--; }
#define ap(c) if(*destlen > 1) { *((*dest)++) = (char)(c); (*destlen)--; }
switch(*ctx->buf) {
case '"': ap('"'); con(1); break;
case '\\': ap('\\'); con(1); break;
@ -459,7 +459,7 @@ static int iteminfo(void) {
} else if(strcmp(ctx->val, "mode") == 0) { /* mode */
C(rint64(&iv, UINT16_MAX));
ctx->buf_dir->flags |= FF_EXT;
ctx->buf_ext->mode = iv;
ctx->buf_ext->mode = (unsigned short)iv;
} else if(strcmp(ctx->val, "mtime") == 0) { /* mtime */
C(rint64(&iv, UINT64_MAX));
ctx->buf_dir->flags |= FF_EXT;

View file

@ -74,7 +74,7 @@ static void stat_to_dir(struct stat *fs) {
buf_dir->asize = fs->st_size;
}
buf_ext->mode = fs->st_mode;
buf_ext->mode = (unsigned short)fs->st_mode;
buf_ext->mtime = fs->st_mtime;
buf_ext->uid = (int)fs->st_uid;
buf_ext->gid = (int)fs->st_gid;

View file

@ -265,7 +265,7 @@ void uic_init() {
use_default_colors();
for(i=0; i<sizeof(colors)/sizeof(*colors)-1; i++) {
j = i*2 + uic_theme;
init_pair(i+1, color_defs[j].fg, color_defs[j].bg);
init_pair((short)i+1, color_defs[j].fg, color_defs[j].bg);
colors[i] = color_defs[j].attr | COLOR_PAIR(i+1);
}
}