From 1fdc150116cad39aae5c5da407c3312b47a59e3a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Fri, 17 Dec 2021 07:06:30 -0500 Subject: New upstream version 3.3.3+dfsg1. --- SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'SQLiteStudio3/coreSQLiteStudio/rsa') diff --git a/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp b/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp index 0579add..3fbe83c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp @@ -568,17 +568,18 @@ digitCount(rightNumber.digitCount), positive(rightNumber.positive) //make sure we have just enough space if (length <= digitCount + 2 || length > (digitCount << 2)) length = (unsigned long int) (digitCount * BigInt::FACTOR + 1); - try - { - digits = new unsigned char[length]; - } - catch (...) - { - delete[] digits; - throw "Error BIGINT08: BigInt creation error (out of memory?)."; - } - std::copy(rightNumber.digits, rightNumber.digits + digitCount, digits); + try + { + digits = new unsigned char[length]; + } + catch (...) + { + delete[] digits; + throw "Error BIGINT08: BigInt creation error (out of memory?)."; + } + + std::copy(rightNumber.digits, rightNumber.digits + digitCount, digits); } BigInt::operator std::string() const @@ -627,12 +628,13 @@ BigInt &BigInt::operator =(const BigInt &rightNumber) std::ostream &operator <<(std::ostream &cout, const BigInt &number) { - if (!number.positive) - cout << '-'; + if (!number.positive) + cout << '-'; + for (int i = number.digitCount - 1; i >= 0; i--) cout << (int(number.digits[i])); - return cout; + return cout; } std::istream &operator >>(std::istream &cin, BigInt &number) -- cgit v1.2.3