shf_getc{,har} need to return properly casted

This commit is contained in:
tg 2018-01-14 01:28:16 +00:00
parent 7977acbc72
commit f7b0277504
2 changed files with 6 additions and 6 deletions

6
sh.h
View File

@ -182,7 +182,7 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.855 2018/01/14 00:47:11 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.856 2018/01/14 01:28:15 tg Exp $");
#endif #endif
#define MKSH_VERSION "R56 2017/10/17" #define MKSH_VERSION "R56 2017/10/17"
@ -1481,7 +1481,7 @@ extern unsigned int eek_ord;
size_t ord_c = (c); \ size_t ord_c = (c); \
\ \
if (ord_c > (size_t)0xFFU) \ if (ord_c > (size_t)0xFFU) \
internal_errorf("%s:%d:ord(%zu)", \ internal_errorf("%s:%d:ord(%zX)", \
__FILE__, __LINE__, ord_c); \ __FILE__, __LINE__, ord_c); \
((unsigned int)(unsigned char)(ord_c)); \ ((unsigned int)(unsigned char)(ord_c)); \
})) }))
@ -1621,7 +1621,7 @@ EXTERN mksh_ari_t x_lins E_INIT(24);
#define shf_fileno(shf) ((shf)->fd) #define shf_fileno(shf) ((shf)->fd)
#define shf_setfileno(shf,nfd) ((shf)->fd = (nfd)) #define shf_setfileno(shf,nfd) ((shf)->fd = (nfd))
#define shf_getc_i(shf) ((shf)->rnleft > 0 ? \ #define shf_getc_i(shf) ((shf)->rnleft > 0 ? \
(shf)->rnleft--, *(shf)->rp++ : \ (shf)->rnleft--, (int)ord(*(shf)->rp++) : \
shf_getchar(shf)) shf_getchar(shf))
#define shf_putc_i(c, shf) ((shf)->wnleft == 0 ? \ #define shf_putc_i(c, shf) ((shf)->wnleft == 0 ? \
shf_putchar((uint8_t)(c), (shf)) : \ shf_putchar((uint8_t)(c), (shf)) : \

6
shf.c
View File

@ -2,7 +2,7 @@
/*- /*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
* 2012, 2013, 2015, 2016, 2017 * 2012, 2013, 2015, 2016, 2017, 2018
* mirabilos <m@mirbsd.org> * mirabilos <m@mirbsd.org>
* Copyright (c) 2015 * Copyright (c) 2015
* Daniel Richard G. <skunk@iSKUNK.ORG> * Daniel Richard G. <skunk@iSKUNK.ORG>
@ -27,7 +27,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.96 2018/01/13 23:55:14 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/shf.c,v 1.97 2018/01/14 01:28:16 tg Exp $");
/* flags to shf_emptybuf() */ /* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */ #define EB_READSW 0x01 /* about to switch to reading */
@ -554,7 +554,7 @@ shf_getchar(struct shf *shf)
if (shf->rnleft == 0 && (shf_fillbuf(shf) == -1 || shf->rnleft == 0)) if (shf->rnleft == 0 && (shf_fillbuf(shf) == -1 || shf->rnleft == 0))
return (-1); return (-1);
--shf->rnleft; --shf->rnleft;
return (*shf->rp++); return (ord(*shf->rp++));
} }
/* /*