Module Name: src
Committed By: agc
Date: Sun Aug 15 16:10:56 UTC 2010
Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: bufgap.c compress.c
keyring.c netpgp.c packet-parse.c signature.c validate.c writer.c
Log Message:
fix some more amd64 lint
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c
cvs rdiff -u -r1.16 -r1.17 \
src/crypto/external/bsd/netpgp/dist/src/lib/compress.c
cvs rdiff -u -r1.42 -r1.43 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
cvs rdiff -u -r1.68 -r1.69 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.39 -r1.40 \
src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c
cvs rdiff -u -r1.30 -r1.31 \
src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
cvs rdiff -u -r1.37 -r1.38 \
src/crypto/external/bsd/netpgp/dist/src/lib/validate.c
cvs rdiff -u -r1.26 -r1.27 \
src/crypto/external/bsd/netpgp/dist/src/lib/writer.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c:1.3 src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c:1.4
--- src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c:1.3 Mon Dec 14 23:29:56 2009
+++ src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
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) {
Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.16 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.17
--- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.16 Sun Aug 15 07:52:26 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
/* 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;
Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.42 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.43
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.42 Sun Aug 15 07:52:26 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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);
}
Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.68 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.69
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.68 Sun Aug 15 07:52:27 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
(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);
Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.39 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.40
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.39 Fri Aug 13 18:29:40 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
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_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 @@
(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 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
&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 @@
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 @@
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:
Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.30 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.31
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.30 Sun Aug 15 07:52:27 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
/* - 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 @@
/* 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__)) {
Index: src/crypto/external/bsd/netpgp/dist/src/lib/validate.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.37 src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.38
--- src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.37 Sun Aug 15 07:52:27 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
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");
Index: src/crypto/external/bsd/netpgp/dist/src/lib/writer.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.26 src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.27
--- src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.26 Sun Aug 15 07:52:27 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c Sun Aug 15 16:10:56 2010
@@ -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 @@
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 @@
/* \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: 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,