fix some more amd64 lint
This commit is contained in:
parent
38cc1a8d45
commit
3f685a7839
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bufgap.c,v 1.3 2009/12/14 23:29:56 agc Exp $ */
|
||||
/* $NetBSD: bufgap.c,v 1.4 2010/08/15 16:10:56 agc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
|
||||
|
@ -117,7 +117,7 @@ strnsave(char *s, int n)
|
|||
char *cp;
|
||||
|
||||
if (n < 0) {
|
||||
n = strlen(s);
|
||||
n = (int)strlen(s);
|
||||
}
|
||||
NEWARRAY(char, cp, n + 1, "strnsave", return NULL);
|
||||
(void) memcpy(cp, s, (size_t)n);
|
||||
|
@ -413,7 +413,7 @@ bufgap_insert(bufgap_t *bp, const char *s, int n)
|
|||
int i;
|
||||
|
||||
if (n < 0) {
|
||||
n = strlen(s);
|
||||
n = (int)strlen(s);
|
||||
}
|
||||
for (i = 0 ; i < n ; i += rlen) {
|
||||
if (bp->bbc + bp->abc == bp->size) {
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: compress.c,v 1.16 2010/08/15 07:52:26 agc Exp $");
|
||||
__RCSID("$NetBSD: compress.c,v 1.17 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
|
@ -346,10 +346,12 @@ __ops_decompress(__ops_region_t *region, __ops_stream_t *stream,
|
|||
|
||||
switch (type) {
|
||||
case OPS_C_ZIP:
|
||||
/* LINTED */ /* this is a lint problem in zlib.h header */
|
||||
ret = (int)inflateInit2(&z.zstream, -15);
|
||||
break;
|
||||
|
||||
case OPS_C_ZLIB:
|
||||
/* LINTED */ /* this is a lint problem in zlib.h header */
|
||||
ret = (int)inflateInit(&z.zstream);
|
||||
break;
|
||||
|
||||
|
@ -434,6 +436,7 @@ __ops_writez(__ops_output_t *out, const uint8_t *data, const unsigned len)
|
|||
|
||||
/* all other fields set to zero by use of calloc */
|
||||
|
||||
/* LINTED */ /* this is a lint problem in zlib.h header */
|
||||
if ((int)deflateInit(&zip->stream, level) != Z_OK) {
|
||||
(void) fprintf(stderr, "__ops_writez: can't initialise\n");
|
||||
return 0;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: keyring.c,v 1.42 2010/08/15 07:52:26 agc Exp $");
|
||||
__RCSID("$NetBSD: keyring.c,v 1.43 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
|
@ -858,22 +858,22 @@ str2keyid(const char *userid, uint8_t *keyid, size_t len)
|
|||
size_t j;
|
||||
int i;
|
||||
|
||||
for (i = j = 0 ; j < len && userid[i] && userid[i + 1] ; i += 2, j++) {
|
||||
for (i = 0, j = 0 ; j < len && userid[i] && userid[i + 1] ; i += 2, j++) {
|
||||
if ((hi = strchr(uppers, userid[i])) == NULL) {
|
||||
if ((hi = strchr(lowers, userid[i])) == NULL) {
|
||||
break;
|
||||
}
|
||||
hichar = (hi - lowers);
|
||||
hichar = (uint8_t)(hi - lowers);
|
||||
} else {
|
||||
hichar = (hi - uppers);
|
||||
hichar = (uint8_t)(hi - uppers);
|
||||
}
|
||||
if ((lo = strchr(uppers, userid[i + 1])) == NULL) {
|
||||
if ((lo = strchr(lowers, userid[i + 1])) == NULL) {
|
||||
break;
|
||||
}
|
||||
lochar = (lo - lowers);
|
||||
lochar = (uint8_t)(lo - lowers);
|
||||
} else {
|
||||
lochar = (lo - uppers);
|
||||
lochar = (uint8_t)(lo - uppers);
|
||||
}
|
||||
keyid[j] = (hichar << 4) | (lochar);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: netpgp.c,v 1.68 2010/08/15 07:52:27 agc Exp $");
|
||||
__RCSID("$NetBSD: netpgp.c,v 1.69 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -367,7 +367,7 @@ get_duration(char *s)
|
|||
if (s == NULL) {
|
||||
return 0;
|
||||
}
|
||||
now = strtoull(s, NULL, 10);
|
||||
now = (uint64_t)strtoull(s, NULL, 10);
|
||||
if ((mult = strchr("hdwmy", s[strlen(s) - 1])) != NULL) {
|
||||
switch(*mult) {
|
||||
case 'h':
|
||||
|
@ -459,7 +459,7 @@ isarmoured(__ops_io_t *io, const char *f, const void *memory, const char *text)
|
|||
(void) fprintf(io->errs, "isarmoured: can't open '%s'\n", f);
|
||||
return 0;
|
||||
}
|
||||
if (fgets(buf, sizeof(buf), fp) != NULL) {
|
||||
if (fgets(buf, (int)sizeof(buf), fp) != NULL) {
|
||||
armoured = (strncmp(buf, text, strlen(text)) == 0);
|
||||
}
|
||||
(void) fclose(fp);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: packet-parse.c,v 1.39 2010/08/13 18:29:40 agc Exp $");
|
||||
__RCSID("$NetBSD: packet-parse.c,v 1.40 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CAST_H
|
||||
|
@ -254,7 +254,7 @@ sub_base_read(void *dest, size_t length, __ops_error_t **errors,
|
|||
if (readinfo->alength + n > readinfo->asize) {
|
||||
uint8_t *temp;
|
||||
|
||||
readinfo->asize = (readinfo->asize * 2) + n;
|
||||
readinfo->asize = (readinfo->asize * 2) + (unsigned)n;
|
||||
temp = realloc(readinfo->accumulated, readinfo->asize);
|
||||
if (temp == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
|
@ -271,11 +271,11 @@ sub_base_read(void *dest, size_t length, __ops_error_t **errors,
|
|||
n);
|
||||
}
|
||||
/* we track length anyway, because it is used for packet offsets */
|
||||
readinfo->alength += n;
|
||||
readinfo->alength += (unsigned)n;
|
||||
/* and also the position */
|
||||
readinfo->position += n;
|
||||
readinfo->position += (unsigned)n;
|
||||
|
||||
return n;
|
||||
return (int)n;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -415,9 +415,9 @@ __ops_limited_read(uint8_t *dest,
|
|||
OPS_ERROR(errors, OPS_E_R_READ_FAILED, "Read failed");
|
||||
return 0;
|
||||
}
|
||||
region->last_read = r;
|
||||
region->last_read = (unsigned)r;
|
||||
do {
|
||||
region->readc += r;
|
||||
region->readc += (unsigned)r;
|
||||
if (region->parent && region->length > region->parent->length) {
|
||||
(void) fprintf(stderr,
|
||||
"ops_limited_read: bad length\n");
|
||||
|
@ -1528,7 +1528,7 @@ parse_one_sig_subpacket(__ops_sig_t *sig,
|
|||
(void) fprintf(stderr, "parse_one_sig_subpacket: bad alloc\n");
|
||||
return 0;
|
||||
}
|
||||
if (!limread(pkt.u.ss_raw.raw, pkt.u.ss_raw.length,
|
||||
if (!limread(pkt.u.ss_raw.raw, (unsigned)pkt.u.ss_raw.length,
|
||||
&subregion, stream)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1643,12 +1643,12 @@ parse_one_sig_subpacket(__ops_sig_t *sig,
|
|||
return 0;
|
||||
}
|
||||
if (!limread_data(&pkt.u.ss_notation.name,
|
||||
pkt.u.ss_notation.name.len,
|
||||
(unsigned)pkt.u.ss_notation.name.len,
|
||||
&subregion, stream)) {
|
||||
return 0;
|
||||
}
|
||||
if (!limread_data(&pkt.u.ss_notation.value,
|
||||
pkt.u.ss_notation.value.len,
|
||||
(unsigned)pkt.u.ss_notation.value.len,
|
||||
&subregion, stream)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -2125,7 +2125,8 @@ parse_one_pass(__ops_region_t * region, __ops_stream_t * stream)
|
|||
pkt.u.one_pass_sig.key_alg = (__ops_pubkey_alg_t)c;
|
||||
|
||||
if (!limread(pkt.u.one_pass_sig.keyid,
|
||||
sizeof(pkt.u.one_pass_sig.keyid), region, stream)) {
|
||||
(unsigned)sizeof(pkt.u.one_pass_sig.keyid),
|
||||
region, stream)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2163,7 +2164,7 @@ parse_hash_data(__ops_stream_t *stream, const void *data,
|
|||
size_t n;
|
||||
|
||||
for (n = 0; n < stream->hashc; ++n) {
|
||||
stream->hashes[n].hash.add(&stream->hashes[n].hash, data, length);
|
||||
stream->hashes[n].hash.add(&stream->hashes[n].hash, data, (unsigned)length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2365,8 +2366,8 @@ parse_seckey(__ops_region_t *region, __ops_stream_t *stream)
|
|||
if (crypted) {
|
||||
__ops_packet_t seckey;
|
||||
__ops_hash_t hashes[(OPS_MAX_KEY_SIZE + OPS_MIN_HASH_SIZE - 1) / OPS_MIN_HASH_SIZE];
|
||||
unsigned passlen;
|
||||
uint8_t key[OPS_MAX_KEY_SIZE + OPS_MAX_HASH_SIZE];
|
||||
size_t passlen;
|
||||
char *passphrase;
|
||||
int hashsize;
|
||||
int keysize;
|
||||
|
@ -2447,7 +2448,7 @@ parse_seckey(__ops_region_t *region, __ops_stream_t *stream)
|
|||
/* FALLTHROUGH */
|
||||
case OPS_S2KS_SIMPLE:
|
||||
hashes[n].add(&hashes[n],
|
||||
(uint8_t *) passphrase, passlen);
|
||||
(uint8_t *)passphrase, (unsigned)passlen);
|
||||
break;
|
||||
|
||||
case OPS_S2KS_ITERATED_AND_SALTED:
|
||||
|
@ -2668,7 +2669,7 @@ parse_pk_sesskey(__ops_region_t *region,
|
|||
return 0;
|
||||
}
|
||||
if (!limread(pkt.u.pk_sesskey.key_id,
|
||||
sizeof(pkt.u.pk_sesskey.key_id), region, stream)) {
|
||||
(unsigned)sizeof(pkt.u.pk_sesskey.key_id), region, stream)) {
|
||||
return 0;
|
||||
}
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
|
@ -2718,8 +2719,8 @@ parse_pk_sesskey(__ops_region_t *region,
|
|||
&pkt);
|
||||
return 1;
|
||||
}
|
||||
n = __ops_decrypt_decode_mpi(unencoded_m_buf, sizeof(unencoded_m_buf),
|
||||
enc_m, secret);
|
||||
n = __ops_decrypt_decode_mpi(unencoded_m_buf,
|
||||
(unsigned)sizeof(unencoded_m_buf), enc_m, secret);
|
||||
if (n < 1) {
|
||||
ERRP(&stream->cbinfo, pkt, "decrypted message too short");
|
||||
return 0;
|
||||
|
@ -2797,11 +2798,9 @@ __ops_decrypt_se_data(__ops_content_enum tag, __ops_region_t *region,
|
|||
|
||||
decrypt = __ops_get_decrypt(stream);
|
||||
if (decrypt) {
|
||||
uint8_t buf[OPS_MAX_BLOCK_SIZE + 2] = "";
|
||||
size_t b = decrypt->blocksize;
|
||||
/* __ops_packet_t pkt; */
|
||||
__ops_region_t encregion;
|
||||
|
||||
__ops_region_t encregion;
|
||||
unsigned b = decrypt->blocksize;
|
||||
uint8_t buf[OPS_MAX_BLOCK_SIZE + 2] = "";
|
||||
|
||||
__ops_reader_push_decrypt(stream, decrypt, region);
|
||||
|
||||
|
@ -3057,7 +3056,7 @@ __ops_parse_packet(__ops_stream_t *stream, uint32_t *pktlen)
|
|||
|
||||
case OPS_PTAG_CT_PUBLIC_KEY:
|
||||
case OPS_PTAG_CT_PUBLIC_SUBKEY:
|
||||
ret = parse_pubkey(pkt.u.ptag.type, ®ion, stream);
|
||||
ret = parse_pubkey((__ops_content_enum)pkt.u.ptag.type, ®ion, stream);
|
||||
break;
|
||||
|
||||
case OPS_PTAG_CT_TRUST:
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: signature.c,v 1.30 2010/08/15 07:52:27 agc Exp $");
|
||||
__RCSID("$NetBSD: signature.c,v 1.31 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -834,13 +834,13 @@ __ops_write_sig(__ops_output_t *output,
|
|||
unsigned
|
||||
__ops_add_time(__ops_create_sig_t *sig, int64_t when, const char *type)
|
||||
{
|
||||
unsigned tag;
|
||||
__ops_content_enum tag;
|
||||
|
||||
tag = (strcmp(type, "birth") == 0) ?
|
||||
OPS_PTAG_SS_CREATION_TIME : OPS_PTAG_SS_EXPIRATION_TIME;
|
||||
/* just do 32-bit timestamps for just now - it's in the protocol */
|
||||
return __ops_write_ss_header(sig->output, 5, tag) &&
|
||||
__ops_write_scalar(sig->output, (int32_t)when, sizeof(int32_t));
|
||||
__ops_write_scalar(sig->output, (uint32_t)when, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1144,7 +1144,7 @@ __ops_sign_buf(__ops_io_t *io,
|
|||
/* - creation time */
|
||||
/* - key id */
|
||||
ret = __ops_writer_push_clearsigned(output, sig) &&
|
||||
__ops_write(output, input, insize) &&
|
||||
__ops_write(output, input, (unsigned)insize) &&
|
||||
__ops_writer_use_armored_sig(output) &&
|
||||
__ops_add_time(sig, from, "birth") &&
|
||||
__ops_add_time(sig, (int64_t)duration, "expiration");
|
||||
|
@ -1165,7 +1165,7 @@ __ops_sign_buf(__ops_io_t *io,
|
|||
|
||||
/* hash memory */
|
||||
hash = __ops_sig_get_hash(sig);
|
||||
hash->add(hash, input, insize);
|
||||
hash->add(hash, input, (unsigned)insize);
|
||||
|
||||
/* output file contents as Literal Data packet */
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: validate.c,v 1.37 2010/08/15 07:52:27 agc Exp $");
|
||||
__RCSID("$NetBSD: validate.c,v 1.38 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -519,7 +519,7 @@ validate_data_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
|
|||
sizeof(content->sig));
|
||||
}
|
||||
valid = check_binary_sig(__ops_mem_data(data->mem),
|
||||
__ops_mem_len(data->mem),
|
||||
(const unsigned)__ops_mem_len(data->mem),
|
||||
&content->sig,
|
||||
__ops_get_pubkey(signer));
|
||||
break;
|
||||
|
@ -881,10 +881,10 @@ __ops_validate_file(__ops_io_t *io,
|
|||
char *cp;
|
||||
int i;
|
||||
|
||||
len = __ops_mem_len(validation.mem);
|
||||
len = (unsigned)__ops_mem_len(validation.mem);
|
||||
cp = __ops_mem_data(validation.mem);
|
||||
for (i = 0 ; i < (int)len ; i += cc) {
|
||||
cc = write(outfd, &cp[i], len - i);
|
||||
cc = write(outfd, &cp[i], (unsigned)(len - i));
|
||||
if (cc < 0) {
|
||||
(void) fprintf(io->errs,
|
||||
"netpgp: short write\n");
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#if defined(__NetBSD__)
|
||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: writer.c,v 1.26 2010/08/15 07:52:27 agc Exp $");
|
||||
__RCSID("$NetBSD: writer.c,v 1.27 2010/08/15 16:10:56 agc Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -464,7 +464,7 @@ dash_esc_writer(const uint8_t *src,
|
|||
if (src[n] == ' ' || src[n] == '\t') {
|
||||
__ops_memory_add(dash->trailing, &src[n], 1);
|
||||
} else {
|
||||
if ((l = __ops_mem_len(dash->trailing)) != 0) {
|
||||
if ((l = (unsigned)__ops_mem_len(dash->trailing)) != 0) {
|
||||
if (!dash->seen_nl && !dash->seen_cr) {
|
||||
__ops_sig_add_data(dash->sig,
|
||||
__ops_mem_data(dash->trailing), l);
|
||||
|
@ -1532,8 +1532,8 @@ stream_write_litdata_first(__ops_output_t *output,
|
|||
/* \todo add date */
|
||||
/* \todo do we need to check text data for <cr><lf> line endings ? */
|
||||
|
||||
size_t sz_towrite;
|
||||
size_t sz_pd;
|
||||
unsigned sz_towrite;
|
||||
size_t sz_pd;
|
||||
|
||||
sz_towrite = 1 + 1 + 4 + len;
|
||||
sz_pd = (size_t)__ops_partial_data_len(sz_towrite);
|
||||
|
@ -1608,7 +1608,7 @@ stream_write_se_ip_first(__ops_output_t *output,
|
|||
"stream_write_se_ip_first: bad alloc\n");
|
||||
return 0;
|
||||
}
|
||||
sz_pd = (size_t)__ops_partial_data_len(sz_towrite);
|
||||
sz_pd = (size_t)__ops_partial_data_len((unsigned)sz_towrite);
|
||||
if (sz_pd < 512) {
|
||||
free(preamble);
|
||||
(void) fprintf(stderr,
|
||||
|
|
Loading…
Reference in New Issue