From a0707809f5aaa6a72d719845831fc1d33372aef1 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 30 Nov 2014 18:46:56 +0100 Subject: [PATCH] Moved Natural String Sort functions into MUtils library. --- MUtilities_VS2013.vcxproj | 14 +- MUtilities_VS2013.vcxproj.filters | 15 ++ include/MUtils/Global.h | 3 + include/MUtils/KeccakHash.h | 63 +++--- src/3rd_party/keccak/LICENSE.txt | 27 +++ .../{ => keccak/include}/keccak_impl.h | 2 + src/3rd_party/strnatcmp/include/strnatcmp.h | 40 ++++ src/3rd_party/strnatcmp/readme.htm | 196 ++++++++++++++++ src/3rd_party/strnatcmp/src/strnatcmp.cpp | 214 ++++++++++++++++++ src/Global.cpp | 22 ++ src/KeccakHash.cpp | 16 +- src/Startup.cpp | 2 +- src/Version.cpp | 1 + 13 files changed, 572 insertions(+), 43 deletions(-) create mode 100644 src/3rd_party/keccak/LICENSE.txt rename src/3rd_party/{ => keccak/include}/keccak_impl.h (99%) create mode 100644 src/3rd_party/strnatcmp/include/strnatcmp.h create mode 100644 src/3rd_party/strnatcmp/readme.htm create mode 100644 src/3rd_party/strnatcmp/src/strnatcmp.cpp diff --git a/MUtilities_VS2013.vcxproj b/MUtilities_VS2013.vcxproj index 77f48a3..793709f 100644 --- a/MUtilities_VS2013.vcxproj +++ b/MUtilities_VS2013.vcxproj @@ -15,6 +15,7 @@ + @@ -38,6 +39,8 @@ + + @@ -118,7 +121,7 @@ WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions) MultiThreadedDebugDLL NoExtensions - $(ProjectDir)\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\include;%(AdditionalIncludeDirectories) true @@ -145,8 +148,9 @@ false Fast false - $(ProjectDir)\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\include;%(AdditionalIncludeDirectories) true + false Windows @@ -154,7 +158,7 @@ true $(QTDIR)\lib QtCore4.lib;QtGui4.lib;Psapi.lib;Sensapi.lib;%(AdditionalDependencies) - false + true @@ -174,8 +178,10 @@ false Fast false - $(ProjectDir)\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\include;%(AdditionalIncludeDirectories) true + false + None Windows diff --git a/MUtilities_VS2013.vcxproj.filters b/MUtilities_VS2013.vcxproj.filters index 2c07910..ef79cac 100644 --- a/MUtilities_VS2013.vcxproj.filters +++ b/MUtilities_VS2013.vcxproj.filters @@ -19,6 +19,12 @@ {458f07b7-5414-4e9c-a599-222196e8d2e8} + + {d5bcdb46-27a3-4772-86b4-1b30e02a30cc} + + + {6261ec8d-8041-495b-bddf-6fe07c11c952} + @@ -57,6 +63,9 @@ Source Files + + Source Files\3rd Party + @@ -98,6 +107,12 @@ Header Files + + Header Files\3rd Party + + + Header Files\3rd Party + diff --git a/include/MUtils/Global.h b/include/MUtils/Global.h index 4debf73..f44cec3 100644 --- a/include/MUtils/Global.h +++ b/include/MUtils/Global.h @@ -88,6 +88,9 @@ namespace MUtils MUTILS_API bool remove_file(const QString &fileName); MUTILS_API bool remove_directory(const QString &folderPath); + //String sorting + MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase); + //Internal namespace Internal { diff --git a/include/MUtils/KeccakHash.h b/include/MUtils/KeccakHash.h index d634a01..42ebd52 100644 --- a/include/MUtils/KeccakHash.h +++ b/include/MUtils/KeccakHash.h @@ -56,39 +56,42 @@ namespace MUtils { - // Section from KeccakSponge.h - // needed here, since hashState needs to be explicitly 32-byte aligned and therefore can't be - // transformed into a class (in order to forward declarate) like in the other hash wrappers. - namespace KeccakImpl + namespace Internal { - #define KeccakPermutationSize 1600 - #define KeccakPermutationSizeInBytes (KeccakPermutationSize/8) - #define KeccakMaximumRate 1536 - #define KeccakMaximumRateInBytes (KeccakMaximumRate/8) - - #if defined(__GNUC__) - #define ALIGN __attribute__ ((aligned(32))) - #elif defined(_MSC_VER) - #define ALIGN __declspec(align(32)) - #else - #define ALIGN - #endif - - ALIGN typedef struct spongeStateStruct + // Section from KeccakSponge.h + // needed here, since hashState needs to be explicitly 32-byte aligned and therefore can't be + // transformed into a class (in order to forward declarate) like in the other hash wrappers. + namespace KeccakImpl { - ALIGN unsigned char state[KeccakPermutationSizeInBytes]; - ALIGN unsigned char dataQueue[KeccakMaximumRateInBytes]; - unsigned int rate; - unsigned int capacity; - unsigned int bitsInQueue; - unsigned int fixedOutputLength; - int squeezing; - unsigned int bitsAvailableForSqueezing; + #define KeccakPermutationSize 1600 + #define KeccakPermutationSizeInBytes (KeccakPermutationSize/8) + #define KeccakMaximumRate 1536 + #define KeccakMaximumRateInBytes (KeccakMaximumRate/8) + + #if defined(__GNUC__) + #define ALIGN __attribute__ ((aligned(32))) + #elif defined(_MSC_VER) + #define ALIGN __declspec(align(32)) + #else + #define ALIGN + #endif + + ALIGN typedef struct spongeStateStruct + { + ALIGN unsigned char state[KeccakPermutationSizeInBytes]; + ALIGN unsigned char dataQueue[KeccakMaximumRateInBytes]; + unsigned int rate; + unsigned int capacity; + unsigned int bitsInQueue; + unsigned int fixedOutputLength; + int squeezing; + unsigned int bitsAvailableForSqueezing; + } + spongeState; + typedef spongeState hashState; } - spongeState; - typedef spongeState hashState; + // End Section from KeccakSponge.h } - // End Section from KeccakSponge.h class MUTILS_API KeccakHash { @@ -107,7 +110,7 @@ namespace MUtils protected: bool m_initialized; - KeccakImpl::hashState *m_state; + Internal::KeccakImpl::hashState *m_state; QByteArray m_hashResult; }; }; diff --git a/src/3rd_party/keccak/LICENSE.txt b/src/3rd_party/keccak/LICENSE.txt new file mode 100644 index 0000000..f2b6226 --- /dev/null +++ b/src/3rd_party/keccak/LICENSE.txt @@ -0,0 +1,27 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The redistribution and use of this software (with or without changes) + is allowed without the payment of fees or royalties provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 + Changes for ARM 9/9/2010 +*/ diff --git a/src/3rd_party/keccak_impl.h b/src/3rd_party/keccak/include/keccak_impl.h similarity index 99% rename from src/3rd_party/keccak_impl.h rename to src/3rd_party/keccak/include/keccak_impl.h index 7155ede..84bd6bc 100644 --- a/src/3rd_party/keccak_impl.h +++ b/src/3rd_party/keccak/include/keccak_impl.h @@ -19,6 +19,7 @@ ***************************************************************************/ namespace MUtils { +namespace Internal { namespace KeccakImpl { typedef unsigned char UINT8; @@ -1997,5 +1998,6 @@ HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, } // end of namespace KeccakImpl +} // end of namespace Internal } // end of namespace MUtils diff --git a/src/3rd_party/strnatcmp/include/strnatcmp.h b/src/3rd_party/strnatcmp/include/strnatcmp.h new file mode 100644 index 0000000..cbda35d --- /dev/null +++ b/src/3rd_party/strnatcmp/include/strnatcmp.h @@ -0,0 +1,40 @@ +/* -*- mode: c; c-file-style: "k&r" -*- + + strnatcmp.c -- Perform 'natural order' comparisons of strings in C. + Copyright (C) 2000, 2004 by Martin Pool + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + + +namespace MUtils +{ + namespace Internal + { + namespace NaturalSort + { + /* CUSTOMIZATION SECTION + * + * You can change this typedef, but must then also change the inline + * functions in strnatcmp.c */ + typedef wchar_t nat_char; + + int strnatcmp(nat_char const *a, nat_char const *b); + int strnatcasecmp(nat_char const *a, nat_char const *b); + } + } +} diff --git a/src/3rd_party/strnatcmp/readme.htm b/src/3rd_party/strnatcmp/readme.htm new file mode 100644 index 0000000..c443f36 --- /dev/null +++ b/src/3rd_party/strnatcmp/readme.htm @@ -0,0 +1,196 @@ + + + + Natural Order String Comparison + + + +

Natural Order String Comparison

+

by Martin Pool + +

Computer string sorting algorithms generally don't order strings +containing numbers in the same way that a human would do. Consider: + +

rfc1.txt
+rfc2086.txt
+rfc822.txt
+
+

It would be more friendly if the program listed the files as + +

rfc1.txt
+rfc822.txt
+rfc2086.txt
+
+ +

Filenames sort properly if people insert leading zeros, but they +don't always do that. + +

I've written a subroutine that compares strings according to this +natural ordering. You can use this routine in your own software, or +download a patch to add it to your favourite Unix program. + + +

Sorting

+ +

Strings are sorted as usual, except that decimal integer substrings +are compared on their numeric value. For example, + +

+ a < a0 < a1 < a1a < a1b < a2 < a10 < a20 +
+ +

Strings can contain several number parts: + +

+ x2-g8 < x2-y7 < x2-y08 < x8-y8 +
+ +in which case numeric fields are separated by nonnumeric characters. +Leading spaces are ignored. This works very well for IP addresses +from log files, for example. + +

+Leading zeros are not ignored, which tends to give more +reasonable results on decimal fractions. +

+ +
+ 1.001 < 1.002 < 1.010 < 1.02 < 1.1 < 1.3 +
+ +

Some applications may wish to change this by modifying the test + that calls isspace. + + +

+ Performance is linear: each character of the string is scanned + at most once, and only as many characters as necessary to decide + are considered. +

+ +

Longer example of the results + + +

Licensing

+ +

This software is copyright by Martin Pool, and made available under +the same licence as zlib: + +

+

This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + +

Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + +

1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +

2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +

3. This notice may not be removed or altered from any source distribution. +

+ +

This licence applies only to the C implementation. You are free to +reimplement the idea fom scratch in any language. + +

Related Work

+ + +

+ POSIX sort(1) has the -n option to sort numbers, but this doesn't + work if there is a non-numeric prefix. +

+ +

+ GNU ls(1) has the --sort=version option, which works + the same way. +

+ +

+ The PHP scripting language now has a + strnatcmp + function based on this code. + The PHP wrapper was done by Andrei Zimievsky. +

+ +

+ Stuart + Cheshire has a Macintosh system extension to do natural ordering. + I indepdendently reinvented the algorithm, but Stuart had it + first. I borrowed the term natural sort from him. + +

+ +

+ Sort::Versions + in Perl. "The code has some special magic to deal with common +conventions in program version numbers, like the difference between +'decimal' versions (eg perl 5.005) and the Unix kind (eg perl 5.6.1)." + +

Sort::Naturally + is also in Perl, by Sean M. Burke. It uses locale-sensitive character classes to sort words and numeric substrings + in a way similar to natsort. + +

+ Ed Avis wrote something similar in Haskell. + + +

+ Pierre-Luc Paour wrote a NaturalOrderComparator + in Java + +

Kristof Coomans wrote a natural sort comparison in Javascript

+ +

Alan Davies wrote + natcmp.rb, + an implementation in Ruby. + +

Numacomp + - similar thing in Python. + +

as3natcompare + implementation in Flash ActionScript 3. + +

Get It!

+ + + + +

To Do

+ +

+ Comparison of characters is purely numeric, without taking + character set or locale into account. So it is only correct for + ASCII. This should probably be a separate function because doing + the comparisons will probably introduce a dependency on the OS + mechanism for finding the locale and comparing characters. + + +

+ It might be good to support multibyte character sets too. + +

+ If you fix either of these, please mail me. They should not be + very hard. + + + +

\ No newline at end of file diff --git a/src/3rd_party/strnatcmp/src/strnatcmp.cpp b/src/3rd_party/strnatcmp/src/strnatcmp.cpp new file mode 100644 index 0000000..60ca371 --- /dev/null +++ b/src/3rd_party/strnatcmp/src/strnatcmp.cpp @@ -0,0 +1,214 @@ +/* -*- mode: c; c-file-style: "k&r" -*- + +strnatcmp.c -- Perform 'natural order' comparisons of strings in C. +Copyright (C) 2000, 2004 by Martin Pool + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + + +/* partial change history: +* +* 2004-10-10 mbp: Lift out character type dependencies into macros. +* +* Eric Sosman pointed out that ctype functions take a parameter whose +* value must be that of an unsigned int, even on platforms that have +* negative chars in their default char type. +*/ + +/* +* 2013-08-23: Skip leading zero's for any run of digits, except +* when a decimal point was seen immediatley before. +* Patch by LoRd_MuldeR +*/ + +#include +#include +#include +#include + +#include "../include/strnatcmp.h" + +/* These are defined as macros to make it easier to adapt this code to +* different characters types or comparison functions. */ +static inline int nat_isdigit(MUtils::Internal::NaturalSort::nat_char a) +{ + return iswdigit(a); +} + +static inline int nat_isspace(MUtils::Internal::NaturalSort::nat_char a) +{ + return iswspace(a); +} + +static inline MUtils::Internal::NaturalSort::nat_char nat_isdecpoint(MUtils::Internal::NaturalSort::nat_char a) +{ + return (a == L'.') || (a == L','); +} + +static inline MUtils::Internal::NaturalSort::nat_char nat_toupper(MUtils::Internal::NaturalSort::nat_char a) +{ + return towupper(a); +} + +static int compare_right(MUtils::Internal::NaturalSort::nat_char const *a, MUtils::Internal::NaturalSort::nat_char const *b) +{ + int bias = 0; + + /* The longest run of digits wins. That aside, the greatest + value wins, but we can't know that it will until we've scanned + both numbers to know that they have the same magnitude, so we + remember it in BIAS. */ + for (;; a++, b++) + { + if (!nat_isdigit(*a) && !nat_isdigit(*b)) + return bias; + else if (!nat_isdigit(*a)) + return -1; + else if (!nat_isdigit(*b)) + return +1; + else if (*a < *b) + { + if (!bias) + bias = -1; + } + else if (*a > *b) + { + if (!bias) + bias = +1; + } + else if (!*a && !*b) + return bias; + } + + return 0; +} + +static int compare_left(MUtils::Internal::NaturalSort::nat_char const *a, MUtils::Internal::NaturalSort::nat_char const *b) +{ + /* Compare two left-aligned numbers: the first to have a + different value wins. */ + for (;; a++, b++) + { + if (!nat_isdigit(*a) && !nat_isdigit(*b)) + return 0; + else if (!nat_isdigit(*a)) + return -1; + else if (!nat_isdigit(*b)) + return +1; + else if (*a < *b) + return -1; + else if (*a > *b) + return +1; + } + + return 0; +} + +static int strnatcmp0(MUtils::Internal::NaturalSort::nat_char const *a, MUtils::Internal::NaturalSort::nat_char const *b, const bool fold_case) +{ + int ai, bi; + MUtils::Internal::NaturalSort::nat_char ca, cb; + int result; + bool fractional; + int sa, sb; + + assert(a && b); + ai = bi = 0; + fractional = false; + + while (1) + { + ca = a[ai]; cb = b[bi]; + + /* skip over leading spaces or zeros */ + while (nat_isspace(ca)) + ca = a[++ai]; + + while (nat_isspace(cb)) + cb = b[++bi]; + + /* process run of digits */ + if (nat_isdigit(ca) && nat_isdigit(cb)) + { + sa = sb = 0; + + if(!fractional) + { + while (ca == L'0') + { + ca = a[++ai]; sa++; + } + while (cb == L'0') + { + cb = b[++bi]; sb++; + } + } + + if (fractional) + { + if ((result = compare_left(a+ai, b+bi)) != 0) + return result; + } + else + { + if ((result = compare_right(a+ai, b+bi)) != 0) + return result; + } + + /* on tie, the string with the longer leading zero's sequence wins */ + if(sa < sb) + return -1; + else if(sa > sb) + return +1; + } + + if (!ca && !cb) + { + /* The strings compare the same. Perhaps the caller + will want to call strcmp to break the tie. */ + return (fold_case) ? _wcsicmp(a, b) : wcscmp(a, b); + } + + if (fold_case) + { + ca = nat_toupper(ca); + cb = nat_toupper(cb); + } + + if (ca < cb) + return -1; + else if (ca > cb) + return +1; + + /* skipp leading zero's, unless previously seen char was a decimal point */ + fractional = nat_isdecpoint(ca) && nat_isdecpoint(cb); + + ++ai; ++bi; + } +} + +int MUtils::Internal::NaturalSort::strnatcmp(nat_char const *a, nat_char const *b) +{ + return strnatcmp0(a, b, false); +} + +/* Compare, recognizing numeric string and ignoring case. */ +int MUtils::Internal::NaturalSort::strnatcasecmp(nat_char const *a, nat_char const *b) +{ + return strnatcmp0(a, b, true); +} diff --git a/src/Global.cpp b/src/Global.cpp index e94c440..2676603 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -26,7 +26,10 @@ //MUtils #include #include + +//Internal #include "DirLocker.h" +#include "3rd_party/strnatcmp/include/strnatcmp.h" //Qt #include @@ -301,6 +304,25 @@ void MUtils::init_process(QProcess &process, const QString &wokringDir, const bo process.setProcessEnvironment(env); } +/////////////////////////////////////////////////////////////////////////////// +// NATURAL ORDER STRING COMPARISON +/////////////////////////////////////////////////////////////////////////////// + +static bool natural_string_sort_helper(const QString &str1, const QString &str2) +{ + return (MUtils::Internal::NaturalSort::strnatcmp(MUTILS_WCHR(str1), MUTILS_WCHR(str2)) < 0); +} + +static bool natural_string_sort_helper_fold_case(const QString &str1, const QString &str2) +{ + return (MUtils::Internal::NaturalSort::strnatcasecmp(MUTILS_WCHR(str1), MUTILS_WCHR(str2)) < 0); +} + +void MUtils::natural_string_sort(QStringList &list, const bool bIgnoreCase) +{ + qSort(list.begin(), list.end(), bIgnoreCase ? natural_string_sort_helper_fold_case : natural_string_sort_helper); +} + /////////////////////////////////////////////////////////////////////////////// // SELF-TEST /////////////////////////////////////////////////////////////////////////////// diff --git a/src/KeccakHash.cpp b/src/KeccakHash.cpp index 1023a05..ae88817 100644 --- a/src/KeccakHash.cpp +++ b/src/KeccakHash.cpp @@ -21,7 +21,7 @@ /*************************************************************************** ** ** -** MUtils::KeccakHash, an API wrapper bringing the optimized implementation of ** +** QKeccakHash, an API wrapper bringing the optimized implementation of ** ** Keccak (http://keccak.noekeon.org/) to Qt. ** ** Copyright (C) 2013 Emanuel Eichhammer ** ** ** @@ -47,17 +47,17 @@ #include #include -#include "3rd_party/keccak_impl.h" +#include "3rd_party/keccak/include/keccak_impl.h" MUtils::KeccakHash::KeccakHash() { m_initialized = false; - m_state = (MUtils::KeccakImpl::hashState*) _aligned_malloc(sizeof(MUtils::KeccakImpl::hashState), 32); + m_state = (MUtils::Internal::KeccakImpl::hashState*) _aligned_malloc(sizeof(MUtils::Internal::KeccakImpl::hashState), 32); if(!m_state) { throw "[MUtils::KeccakHash] Error: _aligned_malloc() has failed, probably out of heap space!"; } - memset(m_state, 0, sizeof(MUtils::KeccakImpl::hashState)); + memset(m_state, 0, sizeof(MUtils::Internal::KeccakImpl::hashState)); m_hashResult.clear(); } @@ -81,7 +81,7 @@ bool MUtils::KeccakHash::init(HashBits hashBits) } m_hashResult.clear(); - memset(m_state, 0, sizeof(MUtils::KeccakImpl::hashState)); + memset(m_state, 0, sizeof(MUtils::Internal::KeccakImpl::hashState)); int hashBitLength = 0; switch (hashBits) @@ -93,7 +93,7 @@ bool MUtils::KeccakHash::init(HashBits hashBits) default: throw "Invalid hash length!!"; } - if(MUtils::KeccakImpl::Init(m_state, hashBitLength) != MUtils::KeccakImpl::SUCCESS) + if(MUtils::Internal::KeccakImpl::Init(m_state, hashBitLength) != MUtils::Internal::KeccakImpl::SUCCESS) { qWarning("KeccakImpl::Init() has failed unexpectedly!"); return false; @@ -118,7 +118,7 @@ bool MUtils::KeccakHash::addData(const char *data, int size) return false; } - if(MUtils::KeccakImpl::Update(m_state, (MUtils::KeccakImpl::BitSequence*)data, size*8) != MUtils::KeccakImpl::SUCCESS) + if(MUtils::Internal::KeccakImpl::Update(m_state, (MUtils::Internal::KeccakImpl::BitSequence*)data, size*8) != MUtils::Internal::KeccakImpl::SUCCESS) { qWarning("KeccakImpl::Update() has failed unexpectedly!"); m_hashResult.clear(); @@ -138,7 +138,7 @@ const QByteArray &MUtils::KeccakHash::finalize() return m_hashResult; } - if(MUtils::KeccakImpl::Final(m_state, (MUtils::KeccakImpl::BitSequence*)m_hashResult.data()) != MUtils::KeccakImpl::SUCCESS) + if(MUtils::Internal::KeccakImpl::Final(m_state, (MUtils::Internal::KeccakImpl::BitSequence*)m_hashResult.data()) != MUtils::Internal::KeccakImpl::SUCCESS) { qWarning("KeccakImpl::Final() has failed unexpectedly!"); m_hashResult.clear(); diff --git a/src/Startup.cpp b/src/Startup.cpp index de8d6b3..3fe6dd1 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -94,7 +94,7 @@ static int startup_helper(int &argc, char **argv, MUtils::Startup::main_function int MUtils::Startup::startup(int &argc, char **argv, main_function_t *const entry_point) { int iResult = -1; -#if(MUTILS_DEBUG) +#if 1||(MUTILS_DEBUG) iResult = startup_main(argc, argv, entry_point); #else //MUTILS_DEBUG #ifdef _MSC_VER diff --git a/src/Version.cpp b/src/Version.cpp index 34a3061..2544bd7 100644 --- a/src/Version.cpp +++ b/src/Version.cpp @@ -26,6 +26,7 @@ //Internal #include #include +#include #include "Config.h" #ifdef _MSC_VER