From aec5e371b8785bfb1476aacf497002b329664f32 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 10 Oct 2019 11:48:35 -0400 Subject: [PATCH] Prefix versions with V to fix a Swift enum naming import issue. --- platform-darwin/Source/MPAlgorithmV0.m | 2 +- platform-darwin/Source/MPAlgorithmV1.m | 2 +- platform-darwin/Source/MPAlgorithmV2.m | 2 +- platform-darwin/Source/MPAlgorithmV3.m | 2 +- platform-darwin/Source/MPEntities.m | 4 +- .../c/core/src/mpw-algorithm.c | 48 +++++++++---------- .../c/core/src/mpw-algorithm.h | 14 +++--- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/platform-darwin/Source/MPAlgorithmV0.m b/platform-darwin/Source/MPAlgorithmV0.m index b35a0999..cde46b3f 100644 --- a/platform-darwin/Source/MPAlgorithmV0.m +++ b/platform-darwin/Source/MPAlgorithmV0.m @@ -50,7 +50,7 @@ static NSOperationQueue *_mpwQueue = nil; - (MPAlgorithmVersion)version { - return MPAlgorithmVersion0; + return MPAlgorithmVersionV0; } - (NSString *)description { diff --git a/platform-darwin/Source/MPAlgorithmV1.m b/platform-darwin/Source/MPAlgorithmV1.m index d1f341ca..a278959f 100644 --- a/platform-darwin/Source/MPAlgorithmV1.m +++ b/platform-darwin/Source/MPAlgorithmV1.m @@ -23,7 +23,7 @@ - (MPAlgorithmVersion)version { - return MPAlgorithmVersion1; + return MPAlgorithmVersionV1; } - (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit { diff --git a/platform-darwin/Source/MPAlgorithmV2.m b/platform-darwin/Source/MPAlgorithmV2.m index d9b7ff67..ff4d17a1 100644 --- a/platform-darwin/Source/MPAlgorithmV2.m +++ b/platform-darwin/Source/MPAlgorithmV2.m @@ -23,7 +23,7 @@ - (MPAlgorithmVersion)version { - return MPAlgorithmVersion2; + return MPAlgorithmVersionV2; } - (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit { diff --git a/platform-darwin/Source/MPAlgorithmV3.m b/platform-darwin/Source/MPAlgorithmV3.m index f8feea93..6db0c014 100644 --- a/platform-darwin/Source/MPAlgorithmV3.m +++ b/platform-darwin/Source/MPAlgorithmV3.m @@ -23,7 +23,7 @@ - (MPAlgorithmVersion)version { - return MPAlgorithmVersion3; + return MPAlgorithmVersionV3; } - (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit { diff --git a/platform-darwin/Source/MPEntities.m b/platform-darwin/Source/MPEntities.m index 9739a91d..b6a73777 100644 --- a/platform-darwin/Source/MPEntities.m +++ b/platform-darwin/Source/MPEntities.m @@ -136,7 +136,7 @@ return MPAlgorithmForVersion( MIN( MPAlgorithmVersionCurrent, - MAX( MPAlgorithmVersion0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) ); + MAX( MPAlgorithmVersionV0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) ); } - (void)setAlgorithm:(id)algorithm { @@ -368,7 +368,7 @@ return MPAlgorithmForVersion( MIN( MPAlgorithmVersionCurrent, - MAX( MPAlgorithmVersion0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) ); + MAX( MPAlgorithmVersionV0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) ); } - (void)setAlgorithm:(id)version { diff --git a/platform-independent/c/core/src/mpw-algorithm.c b/platform-independent/c/core/src/mpw-algorithm.c index ddb790e7..2e4f1804 100644 --- a/platform-independent/c/core/src/mpw-algorithm.c +++ b/platform-independent/c/core/src/mpw-algorithm.c @@ -47,13 +47,13 @@ const MPMasterKey mpw_master_key(const char *fullName, const char *masterPasswor } switch (algorithmVersion) { - case MPAlgorithmVersion0: + case MPAlgorithmVersionV0: return mpw_master_key_v0( fullName, masterPassword ); - case MPAlgorithmVersion1: + case MPAlgorithmVersionV1: return mpw_master_key_v1( fullName, masterPassword ); - case MPAlgorithmVersion2: + case MPAlgorithmVersionV2: return mpw_master_key_v2( fullName, masterPassword ); - case MPAlgorithmVersion3: + case MPAlgorithmVersionV3: return mpw_master_key_v3( fullName, masterPassword ); default: err( "Unsupported version: %d", algorithmVersion ); @@ -83,13 +83,13 @@ const MPSiteKey mpw_site_key( } switch (algorithmVersion) { - case MPAlgorithmVersion0: + case MPAlgorithmVersionV0: return mpw_site_key_v0( masterKey, siteName, siteCounter, keyPurpose, keyContext ); - case MPAlgorithmVersion1: + case MPAlgorithmVersionV1: return mpw_site_key_v1( masterKey, siteName, siteCounter, keyPurpose, keyContext ); - case MPAlgorithmVersion2: + case MPAlgorithmVersionV2: return mpw_site_key_v2( masterKey, siteName, siteCounter, keyPurpose, keyContext ); - case MPAlgorithmVersion3: + case MPAlgorithmVersionV3: return mpw_site_key_v3( masterKey, siteName, siteCounter, keyPurpose, keyContext ); default: err( "Unsupported version: %d", algorithmVersion ); @@ -125,13 +125,13 @@ const char *mpw_site_result( char *sitePassword = NULL; if (resultType & MPResultTypeClassTemplate) { switch (algorithmVersion) { - case MPAlgorithmVersion0: + case MPAlgorithmVersionV0: return mpw_site_template_password_v0( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion1: + case MPAlgorithmVersionV1: return mpw_site_template_password_v1( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion2: + case MPAlgorithmVersionV2: return mpw_site_template_password_v2( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion3: + case MPAlgorithmVersionV3: return mpw_site_template_password_v3( masterKey, siteKey, resultType, resultParam ); default: err( "Unsupported version: %d", algorithmVersion ); @@ -140,13 +140,13 @@ const char *mpw_site_result( } else if (resultType & MPResultTypeClassStateful) { switch (algorithmVersion) { - case MPAlgorithmVersion0: + case MPAlgorithmVersionV0: return mpw_site_crypted_password_v0( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion1: + case MPAlgorithmVersionV1: return mpw_site_crypted_password_v1( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion2: + case MPAlgorithmVersionV2: return mpw_site_crypted_password_v2( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion3: + case MPAlgorithmVersionV3: return mpw_site_crypted_password_v3( masterKey, siteKey, resultType, resultParam ); default: err( "Unsupported version: %d", algorithmVersion ); @@ -155,13 +155,13 @@ const char *mpw_site_result( } else if (resultType & MPResultTypeClassDerive) { switch (algorithmVersion) { - case MPAlgorithmVersion0: + case MPAlgorithmVersionV0: return mpw_site_derived_password_v0( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion1: + case MPAlgorithmVersionV1: return mpw_site_derived_password_v1( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion2: + case MPAlgorithmVersionV2: return mpw_site_derived_password_v2( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion3: + case MPAlgorithmVersionV3: return mpw_site_derived_password_v3( masterKey, siteKey, resultType, resultParam ); default: err( "Unsupported version: %d", algorithmVersion ); @@ -205,13 +205,13 @@ const char *mpw_site_state( } switch (algorithmVersion) { - case MPAlgorithmVersion0: + case MPAlgorithmVersionV0: return mpw_site_state_v0( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion1: + case MPAlgorithmVersionV1: return mpw_site_state_v1( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion2: + case MPAlgorithmVersionV2: return mpw_site_state_v2( masterKey, siteKey, resultType, resultParam ); - case MPAlgorithmVersion3: + case MPAlgorithmVersionV3: return mpw_site_state_v3( masterKey, siteKey, resultType, resultParam ); default: err( "Unsupported version: %d", algorithmVersion ); diff --git a/platform-independent/c/core/src/mpw-algorithm.h b/platform-independent/c/core/src/mpw-algorithm.h index f45efe61..4b300478 100644 --- a/platform-independent/c/core/src/mpw-algorithm.h +++ b/platform-independent/c/core/src/mpw-algorithm.h @@ -23,17 +23,17 @@ typedef mpw_enum( unsigned int, MPAlgorithmVersion ) { /** V0 did math with chars whose signedness was platform-dependent. */ - MPAlgorithmVersion0, + MPAlgorithmVersionV0, /** V1 miscounted the byte-length of multi-byte site names. */ - MPAlgorithmVersion1, + MPAlgorithmVersionV1, /** V2 miscounted the byte-length of multi-byte user names. */ - MPAlgorithmVersion2, + MPAlgorithmVersionV2, /** V3 is the current version. */ - MPAlgorithmVersion3, + MPAlgorithmVersionV3, - MPAlgorithmVersionCurrent = MPAlgorithmVersion3, - MPAlgorithmVersionFirst = MPAlgorithmVersion0, - MPAlgorithmVersionLast = MPAlgorithmVersion3, + MPAlgorithmVersionCurrent = MPAlgorithmVersionV3, + MPAlgorithmVersionFirst = MPAlgorithmVersionV0, + MPAlgorithmVersionLast = MPAlgorithmVersionV3, }; /** Derive the master key for a user based on their name and master password.