ソースを参照

use appropriate integer types

Mainly found with clang -Wconversion -Wshorten-64-to-32.
pull/75/head
Leah Neukirchen 5年前
コミット
5f45b7d533
  1. 2
      mgenmid.c
  2. 3
      mlist.c
  3. 7
      mmime.c
  4. 8
      mscan.c
  5. 6
      mshow.c
  6. 4
      pipeto.c
  7. 2
      rfc2045.c
  8. 2
      rfc2047.c
  9. 4
      rfc2231.c
  10. 6
      seq.c

2
mgenmid.c

@ -103,7 +103,7 @@ fallback:
rnd = ((uint64_t)lrand48() << 32) + lrand48();
}
rnd |= (1LL << 63); // set highest bit to force full width
rnd |= (1ULL << 63); // set highest bit to force full width
putchar('<');
printb36(((uint64_t)tp.tv_sec * 1000000LL + tp.tv_usec));

3
mlist.c

@ -109,7 +109,8 @@ struct linux_dirent64 {
void
listdir(char *dir)
{
int fd, nread;
int fd;
ssize_t nread;
char buf[BUF_SIZE];
struct linux_dirent64 *d;
int bpos;

7
mmime.c

@ -57,7 +57,8 @@ int gen_b64(uint8_t *s, off_t size)
return 0;
}
int gen_qp(uint8_t *s, off_t size, int maxlinelen, int linelen)
size_t
gen_qp(uint8_t *s, off_t size, size_t maxlinelen, size_t linelen)
{
off_t i;
int header = linelen > 0;
@ -298,7 +299,7 @@ print_header(char *line) {
int prevq = 0; // was the previous word encoded as qp?
int linelen = s - line;
size_t linelen = s - line;
while (*s) {
size_t highbit = 0;
@ -365,7 +366,7 @@ gen_build()
int intext = 0;
while (1) {
int read = getdelim(&line, &linelen, '\n', stdin);
ssize_t read = getdelim(&line, &linelen, '\n', stdin);
if (read == -1) {
if (feof(stdin))
break;

8
mscan.c

@ -33,7 +33,7 @@ static time_t now;
static char default_fflag[] = "%c%u%r %-3n %10d %17f %t %2i%s";
static char *fflag = default_fflag;
int
ssize_t
u8putstr(FILE *out, char *s, ssize_t l, int pad)
{
ssize_t ol = l;
@ -109,7 +109,7 @@ numline(char *file)
}
static char *
fmt_date(struct message *msg, int w, int iso)
fmt_date(struct message *msg, long w, int iso)
{
static char date[32];
char *v;
@ -244,7 +244,7 @@ fmt_to_flag(struct message *msg)
}
static ssize_t
print_human(intmax_t i, int w)
print_human(intmax_t i, long w)
{
double d = i / 1024.0;
const char *u = "\0\0M\0G\0T\0P\0E\0Z\0Y\0";
@ -310,7 +310,7 @@ oneline(char *file)
}
f++;
int w = 0;
long w = 0;
if ((*f >= '0' && *f <= '9') || *f == '-') {
errno = 0;
char *e;

6
mshow.c

@ -45,7 +45,7 @@ printable(int c)
return (unsigned)c-0x20 < 0x5f;
}
int
size_t
print_ascii(char *body, size_t bodylen)
{
if (safe_output) {
@ -567,7 +567,7 @@ print_date_header(char *v)
printf(" (");
time_t d = t < now ? now - t : t - now;
int l;
char l;
if (d > 60*60*24*7*52) l = 'y';
else if (d > 60*60*24*7) l = 'w';
else if (d > 60*60*24) l = 'd';
@ -576,7 +576,7 @@ print_date_header(char *v)
else l = 's';
int p = 3;
int z;
long z;
switch (l) {
case 'y':
z = d / (60*60*24*7*52);

4
pipeto.c

@ -57,14 +57,14 @@ pipeto(const char *cmdline)
errno = EINVAL;
// execvp failed, write errno to parent
long e = errno;
int e = errno;
if (write(pipe1[1], &e, sizeof e) < 0)
exit(111); // do a magic dance for gcc -Wunused-result
exit(111);
} else { // in parent
close(pipe1[1]);
long e;
int e;
ssize_t n = read(pipe1[0], &e, sizeof e);
if (n < 0)
e = errno;

2
rfc2045.c

@ -129,7 +129,7 @@ blaze822_multipart(struct message *msg, struct message **imsg)
if (!blaze822_mime_parameter(s, "boundary", &boundary, &boundaryend))
return 0;
char mboundary[256];
int boundarylen = boundaryend-boundary+2;
size_t boundarylen = boundaryend-boundary+2;
if (boundarylen >= 256)
return 0;

2
rfc2047.c

@ -215,7 +215,7 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
}
decchunk = dec;
int r = iconv(ic, &dec, &declen, &dst, &dlen);
ssize_t r = iconv(ic, &dec, &declen, &dst, &dlen);
if (r < 0) {
if (errno == E2BIG) {
break;

4
rfc2231.c

@ -111,8 +111,8 @@ found_plain:
size_t dstlen = dst - dststart;
dst = dststart;
int r = iconv(ic, &dst, &dstlen, &tmpend, &tmplen);
if (r < 0) {
size_t r = iconv(ic, &dst, &dstlen, &tmpend, &tmplen);
if (r == (size_t)-1) {
free(tmp);
return 1;
}

6
seq.c

@ -142,7 +142,7 @@ blaze822_seq_cur(void)
if (!curlink)
curlink = blaze822_home_file("cur");
int r = readlink(curlink, b, sizeof b - 1);
ssize_t r = readlink(curlink, b, sizeof b - 1);
if (r < 0)
return 0;
b[r] = 0;
@ -308,14 +308,14 @@ parse_parent(char *map, long *starto, long *stopo)
char *s, *t;
long line;
int previndent[256] = { 0 };
long previndent[256] = { 0 };
for (s = map, line = 0; s; s = t+1) {
t = strchr(s, '\n');
if (!t)
break;
line++;
int indent = 0;
long indent = 0;
while (*s && iswsp(*s)) {
s++;
indent++;

読み込み中…
キャンセル
保存