Skip to content

Commit

Permalink
use int, not char, for single chars that might be EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
elliefm committed Feb 26, 2016
1 parent ea97417 commit f507861
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion imap/cyr_dbtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void batch_commands(struct db *db)
struct protstream *in = prot_new(0, 0); // stdin
struct protstream *out = prot_new(1, 1); // stdout
int line = 0;
char c = '-';
int c = '-';
int r = 0;

while (c != EOF) {
Expand Down
8 changes: 4 additions & 4 deletions imap/dlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ static char next_nonspace(struct protstream *in, char c)
return c;
}

EXPORTED char dlist_parse(struct dlist **dlp, int parsekey,
EXPORTED int dlist_parse(struct dlist **dlp, int parsekey,
struct protstream *in, const char *alt_reserve_base)
{
struct dlist *dl = NULL;
Expand Down Expand Up @@ -1111,10 +1111,10 @@ EXPORTED char dlist_parse(struct dlist **dlp, int parsekey,
return EOF;
}

EXPORTED char dlist_parse_asatomlist(struct dlist **dlp, int parsekey,
EXPORTED int dlist_parse_asatomlist(struct dlist **dlp, int parsekey,
struct protstream *in)
{
char c = dlist_parse(dlp, parsekey, in, NULL);
int c = dlist_parse(dlp, parsekey, in, NULL);

/* make a list with one item */
if (*dlp && !dlist_isatomlist(*dlp)) {
Expand All @@ -1130,7 +1130,7 @@ EXPORTED int dlist_parsemap(struct dlist **dlp, int parsekey,
const char *base, unsigned len)
{
struct protstream *stream;
char c;
int c;
struct dlist *dl = NULL;

stream = prot_readmap(base, len);
Expand Down
4 changes: 2 additions & 2 deletions imap/dlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ void dlist_print(const struct dlist *dl, int printkeys,
struct protstream *out);
void dlist_printbuf(const struct dlist *dl, int printkeys,
struct buf *outbuf);
char dlist_parse(struct dlist **dlp, int parsekeys,
int dlist_parse(struct dlist **dlp, int parsekeys,
struct protstream *in, const char *alt_reserve_base);
char dlist_parse_asatomlist(struct dlist **dlp, int parsekey,
int dlist_parse_asatomlist(struct dlist **dlp, int parsekey,
struct protstream *in);
int dlist_parsemap(struct dlist **dlp, int parsekeys,
const char *base, unsigned len);
Expand Down
4 changes: 2 additions & 2 deletions imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2545,7 +2545,7 @@ static void cmd_login(char *tag, char *user)
unsigned userlen;
const char *canon_user = userbuf;
const void *val;
char c;
int c;
struct buf passwdbuf;
char *passwd;
const char *reply = NULL;
Expand Down Expand Up @@ -5038,7 +5038,7 @@ static void do_xconvmeta(const char *tag,
void cmd_xconvmeta(const char *tag)
{
int r;
char c = ' ';
int c = ' ';
struct conversations_state *state = NULL;
struct dlist *cidlist = NULL;
struct dlist *itemlist = NULL;
Expand Down
8 changes: 4 additions & 4 deletions imap/imapparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ EXPORTED int getxstring(struct protstream *pin, struct protstream *pout,
EXPORTED int getint32(struct protstream *pin, int32_t *num)
{
int32_t result = 0;
char c;
int c;
int gotchar = 0;

/* INT_MAX == 2147483647 */
Expand Down Expand Up @@ -287,7 +287,7 @@ EXPORTED int getsint32(struct protstream *pin, int32_t *num)
EXPORTED int getuint32(struct protstream *pin, uint32_t *num)
{
uint32_t result = 0;
char c;
int c;
int gotchar = 0;

/* UINT_MAX == 4294967295U */
Expand All @@ -309,7 +309,7 @@ EXPORTED int getuint32(struct protstream *pin, uint32_t *num)
EXPORTED int getint64(struct protstream *pin, int64_t *num)
{
int64_t result = 0;
char c;
int c;
int gotchar = 0;

/* LLONG_MAX == 9223372036854775807LL */
Expand Down Expand Up @@ -360,7 +360,7 @@ EXPORTED int getsint64(struct protstream *pin, int64_t *num)
EXPORTED int getuint64(struct protstream *pin, uint64_t *num)
{
uint64_t result = 0;
char c;
int c;
int gotchar = 0;

/* ULLONG_MAX == 18446744073709551615ULL */
Expand Down
4 changes: 2 additions & 2 deletions imap/mbdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static int dump_file(int first, int sync,
const char *base;
size_t len;
struct stat sbuf;
char c;
int c;

/* map file */
syslog(LOG_DEBUG, "wanting to dump %s", filename);
Expand Down Expand Up @@ -826,7 +826,7 @@ EXPORTED int undump_mailbox(const char *mbname,
struct auth_state *auth_state __attribute((unused)))
{
struct buf file, data;
char c;
int c;
int r = 0;
int curfile = -1;
struct mailbox *mailbox = NULL;
Expand Down
2 changes: 1 addition & 1 deletion imap/sync_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ void sync_send_restart(struct protstream *out)
struct dlist *sync_parseline(struct protstream *in)
{
struct dlist *dl = NULL;
char c;
int c;

c = dlist_parse(&dl, 1, in, NULL);

Expand Down
4 changes: 2 additions & 2 deletions imtest/imtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1736,8 +1736,8 @@ static int imap_pipe_oneline(char *buf, int len, void *rock) {
}

if(!text->inLiteral) {
char c, *tag, *cmd, *tmp, *sparebuf = (char *)xstrdup(buf);
int i;
char *tag, *cmd, *tmp, *sparebuf = (char *)xstrdup(buf);
int c, i;
tmp = sparebuf;

if(len > 4 &&
Expand Down
2 changes: 1 addition & 1 deletion netnews/remotepurge.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ int main(int argc, char **argv)

int maxssf = 128;
int minssf = 0;
char c;
int c;

char *tls_keyfile="";(void)tls_keyfile;
char *port = "imap";
Expand Down
2 changes: 1 addition & 1 deletion sieve/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef enum {

static int parseheader(FILE *f, char **headname, char **contents)
{
char c;
int c;
static struct buf name = BUF_INITIALIZER;
static struct buf body = BUF_INITIALIZER;
state s = HDR_NAME_START;
Expand Down

0 comments on commit f507861

Please sign in to comment.