diff options
author | lloyd <[email protected]> | 2006-09-08 22:52:29 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-08 22:52:29 +0000 |
commit | 2d78c024c94d43bc7395325c601eae93acad99e6 (patch) | |
tree | 33fb4d7d8d2e2162d58ef4c2913bca62ef396078 /src | |
parent | 85e5003e112c63d78d984eb8c7c3e915505f4f58 (diff) |
Add a couple of static_casts to make it clear where a type conversion is
being performed.
Undefined the prototype creating macro in x509stat.cpp after use.
Avoid a possible type conversion in bigint_divop by storing high's top
bit in a word instead of a bool.
Diffstat (limited to 'src')
-rw-r--r-- | src/big_base.cpp | 2 | ||||
-rw-r--r-- | src/mp_misc.cpp | 2 | ||||
-rw-r--r-- | src/timers.cpp | 2 | ||||
-rw-r--r-- | src/x509stat.cpp | 22 |
4 files changed, 15 insertions, 13 deletions
diff --git a/src/big_base.cpp b/src/big_base.cpp index 595a9f3ae..3ecf71db8 100644 --- a/src/big_base.cpp +++ b/src/big_base.cpp @@ -182,7 +182,7 @@ u32bit BigInt::get_substring(u32bit offset, u32bit length) const u64bit mask = (1 << length) - 1; u32bit shift = (offset % 8); - return ((piece >> shift) & mask); + return static_cast<u32bit>((piece >> shift) & mask); } /************************************************* diff --git a/src/mp_misc.cpp b/src/mp_misc.cpp index 0ccb4314c..5f391f905 100644 --- a/src/mp_misc.cpp +++ b/src/mp_misc.cpp @@ -60,7 +60,7 @@ word bigint_divop(word n1, word n0, word d) for(u32bit j = 0; j != MP_WORD_BITS; ++j) { - const bool high_top_bit = (high & MP_WORD_TOP_BIT); + word high_top_bit = (high & MP_WORD_TOP_BIT); high <<= 1; high |= (n0 >> MP_WORD_BITS-1-j) & 1; diff --git a/src/timers.cpp b/src/timers.cpp index 1bed0e51d..89324712f 100644 --- a/src/timers.cpp +++ b/src/timers.cpp @@ -15,7 +15,7 @@ namespace Botan { *************************************************/ u64bit system_time() { - return std::time(0); + return static_cast<u64bit>(std::time(0)); } u64bit system_clock() diff --git a/src/x509stat.cpp b/src/x509stat.cpp index 692f39604..3ea431962 100644 --- a/src/x509stat.cpp +++ b/src/x509stat.cpp @@ -30,16 +30,6 @@ Certificate_Extension* X509_GlobalState::get_extension(const OID& oid) const } /************************************************* -* Destroy this global state object * -*************************************************/ -X509_GlobalState::~X509_GlobalState() - { - for(u32bit j = 0; j != prototypes.size(); ++j) - delete prototypes[j]; - prototypes.clear(); - } - -/************************************************* * Set up a new global state for X.509 * *************************************************/ X509_GlobalState::X509_GlobalState() @@ -65,6 +55,18 @@ X509_GlobalState::X509_GlobalState() CREATE_PROTOTYPE("X509v3.SubjectAlternativeName", Subject_Alternative_Name); CREATE_PROTOTYPE("X509v3.CRLNumber", CRL_Number); CREATE_PROTOTYPE("X509v3.CertificatePolicies", Certificate_Policies); + +#undef CREATE_PROTOTYPE + } + +/************************************************* +* Destroy this global state object * +*************************************************/ +X509_GlobalState::~X509_GlobalState() + { + for(u32bit j = 0; j != prototypes.size(); ++j) + delete prototypes[j]; + prototypes.clear(); } } |