2
0

Remove __unused since it's non-standard.

1. It breaks compilers without support for __attribute__
2. It breaks system headers that declare variables named __unused (eg. musl libc).
This commit is contained in:
Maarten Billemont 2018-06-05 21:22:40 -04:00
parent c7425be681
commit c3017069b1
5 changed files with 15 additions and 19 deletions

View File

@ -494,7 +494,7 @@ Blowfish_expandstate(blf_ctx *c, const uint8_t *data, uint16_t databytes,
} }
void void
__unused blf_key(blf_ctx *c, const uint8_t *k, uint16_t len) blf_key(blf_ctx *c, const uint8_t *k, uint16_t len)
{ {
/* Initialize S-boxes and subkeys with Pi */ /* Initialize S-boxes and subkeys with Pi */
Blowfish_initstate(c); Blowfish_initstate(c);
@ -517,7 +517,7 @@ blf_enc(blf_ctx *c, uint32_t *data, uint16_t blocks)
} }
void void
__unused blf_dec(blf_ctx *c, uint32_t *data, uint16_t blocks) blf_dec(blf_ctx *c, uint32_t *data, uint16_t blocks)
{ {
uint32_t *d; uint32_t *d;
uint16_t i; uint16_t i;
@ -530,7 +530,7 @@ __unused blf_dec(blf_ctx *c, uint32_t *data, uint16_t blocks)
} }
void void
__unused blf_ecb_encrypt(blf_ctx *c, uint8_t *data, uint32_t len) blf_ecb_encrypt(blf_ctx *c, uint8_t *data, uint32_t len)
{ {
uint32_t l, r; uint32_t l, r;
uint32_t i; uint32_t i;
@ -552,7 +552,7 @@ __unused blf_ecb_encrypt(blf_ctx *c, uint8_t *data, uint32_t len)
} }
void void
__unused blf_ecb_decrypt(blf_ctx *c, uint8_t *data, uint32_t len) blf_ecb_decrypt(blf_ctx *c, uint8_t *data, uint32_t len)
{ {
uint32_t l, r; uint32_t l, r;
uint32_t i; uint32_t i;
@ -574,7 +574,7 @@ __unused blf_ecb_decrypt(blf_ctx *c, uint8_t *data, uint32_t len)
} }
void void
__unused blf_cbc_encrypt(blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len) blf_cbc_encrypt(blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len)
{ {
uint32_t l, r; uint32_t l, r;
uint32_t i, j; uint32_t i, j;
@ -599,7 +599,7 @@ __unused blf_cbc_encrypt(blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len)
} }
void void
__unused blf_cbc_decrypt(blf_ctx *c, uint8_t *iva, uint8_t *data, uint32_t len) blf_cbc_decrypt(blf_ctx *c, uint8_t *iva, uint8_t *data, uint32_t len)
{ {
uint32_t l, r; uint32_t l, r;
uint8_t *iv; uint8_t *iv;

View File

@ -530,7 +530,7 @@ void cli_user(Arguments *args, Operation *operation) {
operation->fullName, operation->masterPassword, MPAlgorithmVersionCurrent ); operation->fullName, operation->masterPassword, MPAlgorithmVersionCurrent );
} }
void cli_site(Arguments __unused *args, Operation *operation) { void cli_site(Arguments *args, Operation *operation) {
if (!operation->siteName) if (!operation->siteName)
abort(); abort();
@ -546,7 +546,7 @@ void cli_site(Arguments __unused *args, Operation *operation) {
operation->user, operation->siteName, operation->user->defaultType, MPCounterValueDefault, operation->user->algorithm ); operation->user, operation->siteName, operation->user->defaultType, MPCounterValueDefault, operation->user->algorithm );
} }
void cli_question(Arguments __unused *args, Operation *operation) { void cli_question(Arguments *args, Operation *operation) {
if (!operation->site) if (!operation->site)
abort(); abort();
@ -569,7 +569,7 @@ void cli_question(Arguments __unused *args, Operation *operation) {
} }
} }
void cli_operation(Arguments __unused *args, Operation *operation) { void cli_operation(Arguments *args, Operation *operation) {
mpw_free_string( &operation->identicon ); mpw_free_string( &operation->identicon );
operation->identicon = mpw_identicon_str( mpw_identicon( operation->user->fullName, operation->user->masterPassword ) ); operation->identicon = mpw_identicon_str( mpw_identicon( operation->user->fullName, operation->user->masterPassword ) );
@ -770,7 +770,7 @@ void cli_mpw(Arguments *args, Operation *operation) {
operation->site->uses++; operation->site->uses++;
} }
void cli_save(Arguments __unused *args, Operation *operation) { void cli_save(Arguments *args, Operation *operation) {
if (operation->sitesFormat == MPMarshalFormatNone) if (operation->sitesFormat == MPMarshalFormatNone)
return; return;

View File

@ -127,7 +127,7 @@ static MPSiteKey mpw_siteKey_v0(
} }
static const char *mpw_sitePasswordFromTemplate_v0( static const char *mpw_sitePasswordFromTemplate_v0(
MPMasterKey __unused masterKey, MPSiteKey siteKey, MPResultType resultType, const char __unused *resultParam) { MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
const char *_siteKey = (const char *)siteKey; const char *_siteKey = (const char *)siteKey;
@ -157,7 +157,7 @@ static const char *mpw_sitePasswordFromTemplate_v0(
} }
static const char *mpw_sitePasswordFromCrypt_v0( static const char *mpw_sitePasswordFromCrypt_v0(
MPMasterKey masterKey, MPSiteKey __unused siteKey, MPResultType __unused resultType, const char *cipherText) { MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText) {
if (!cipherText) { if (!cipherText) {
err( "Missing encrypted state." ); err( "Missing encrypted state." );
@ -187,7 +187,7 @@ static const char *mpw_sitePasswordFromCrypt_v0(
} }
static const char *mpw_sitePasswordFromDerive_v0( static const char *mpw_sitePasswordFromDerive_v0(
MPMasterKey __unused masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) { MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
switch (resultType) { switch (resultType) {
case MPResultTypeDeriveKey: { case MPResultTypeDeriveKey: {
@ -232,7 +232,7 @@ static const char *mpw_sitePasswordFromDerive_v0(
} }
static const char *mpw_siteState_v0( static const char *mpw_siteState_v0(
MPMasterKey masterKey, MPSiteKey __unused siteKey, MPResultType __unused resultType, const char *plainText) { MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *plainText) {
// Encrypt // Encrypt
size_t bufSize = strlen( plainText ); size_t bufSize = strlen( plainText );

View File

@ -53,7 +53,7 @@ static MPSiteKey mpw_siteKey_v1(
} }
static const char *mpw_sitePasswordFromTemplate_v1( static const char *mpw_sitePasswordFromTemplate_v1(
MPMasterKey __unused masterKey, MPSiteKey siteKey, MPResultType resultType, const char __unused *resultParam) { MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
// Determine the template. // Determine the template.
uint8_t seedByte = siteKey[0]; uint8_t seedByte = siteKey[0];

View File

@ -29,10 +29,6 @@
#define mpw_enum(_type, _name) _type _name; enum #define mpw_enum(_type, _name) _type _name; enum
#endif #endif
#ifndef __unused
#define __unused __attribute__((unused))
#endif
//// Types. //// Types.
extern const size_t MPMasterKeySize, MPSiteKeySize; /* bytes */ extern const size_t MPMasterKeySize, MPSiteKeySize; /* bytes */