summaryrefslogtreecommitdiff
path: root/integer.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-08-22 16:36:05 -0400
committerJeffrey Walton <noloader@gmail.com>2018-08-22 16:36:05 -0400
commit8c450a9f7a98800b6e08358454e9d35c0832a24f (patch)
treeff75c06fcf8f48ab9ea696779ff57bedae3af2e9 /integer.cpp
parent0ba3687c3957ee33d040e3fa38ea84d6fd8b819e (diff)
downloadcryptopp-git-8c450a9f7a98800b6e08358454e9d35c0832a24f.tar.gz
Avoid Singleton when possible (GH #708)
Also clear several sign conversion warnings
Diffstat (limited to 'integer.cpp')
-rw-r--r--integer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/integer.cpp b/integer.cpp
index 2d7f41dc..ff807547 100644
--- a/integer.cpp
+++ b/integer.cpp
@@ -4813,7 +4813,7 @@ public:
// if init priorities are available. Dynamic initialization will be used if
// init priorities are not available.
-#if HAVE_GCC_INIT_PRIORITY
+#if defined(HAVE_GCC_INIT_PRIORITY)
const InitInteger s_init __attribute__ ((init_priority (CRYPTOPP_INIT_PRIORITY + 10))) = InitInteger();
const Integer g_zero __attribute__ ((init_priority (CRYPTOPP_INIT_PRIORITY + 11))) = Integer(0L);
const Integer g_one __attribute__ ((init_priority (CRYPTOPP_INIT_PRIORITY + 12))) = Integer(1L);
@@ -4837,7 +4837,7 @@ const Integer &Integer::Zero()
#if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY)
return g_zero;
#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
- static Integer s_zero(0L);
+ static const Integer s_zero(0L);
return s_zero;
#else // Potential memory leak. Avoid if possible.
return Singleton<Integer, NewInteger<0L> >().Ref();
@@ -4849,7 +4849,7 @@ const Integer &Integer::One()
#if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY)
return g_one;
#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
- static Integer s_one(1L);
+ static const Integer s_one(1L);
return s_one;
#else // Potential memory leak. Avoid if possible.
return Singleton<Integer, NewInteger<1L> >().Ref();
@@ -4861,7 +4861,7 @@ const Integer &Integer::Two()
#if defined(HAVE_GCC_INIT_PRIORITY) || defined(HAVE_MSC_INIT_PRIORITY)
return g_two;
#elif defined(CRYPTOPP_CXX11_DYNAMIC_INIT)
- static Integer s_two(2L);
+ static const Integer s_two(2L);
return s_two;
#else // Potential memory leak. Avoid if possible.
return Singleton<Integer, NewInteger<2L> >().Ref();