From fc37cc4a02ed13d1a73b941a9f80975600fd1b99 Mon Sep 17 00:00:00 2001 From: David Foerster Date: Tue, 10 May 2016 20:20:14 +0200 Subject: Normalize all line terminators --- src/Common/Dictionary.c | 174 ++++++++++++++++++++++++------------------------ 1 file changed, 87 insertions(+), 87 deletions(-) (limited to 'src/Common/Dictionary.c') diff --git a/src/Common/Dictionary.c b/src/Common/Dictionary.c index 41f447c2..34741951 100644 --- a/src/Common/Dictionary.c +++ b/src/Common/Dictionary.c @@ -1,88 +1,88 @@ -/* - Derived from source code of TrueCrypt 7.1a, which is - Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed - by the TrueCrypt License 3.0. - - Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX - and are governed by the Apache License 2.0 the full text of which is - contained in the file License.txt included in VeraCrypt binary and source - code distribution packages. -*/ - -#include "../Common/Dictionary.h" -#include -#include -#include - -using namespace std; - -static map StringKeyMap; -static map IntKeyMap; - -static void *DataPool = NULL; -static size_t DataPoolSize = 0; - - -void AddDictionaryEntry (char *key, int intKey, void *value) -{ - try - { - if (key) - StringKeyMap[key] = value; - - if (intKey != 0) - IntKeyMap[intKey] = value; - } - catch (exception&) {} -} - - -void *GetDictionaryValue (const char *key) -{ - map ::const_iterator i = StringKeyMap.find (key); - - if (i == StringKeyMap.end()) - return NULL; - - return i->second; -} - - -void *GetDictionaryValueByInt (int intKey) -{ - map ::const_iterator i = IntKeyMap.find (intKey); - - if (i == IntKeyMap.end()) - return NULL; - - return i->second; -} - - -void *AddPoolData (void *data, size_t dataSize) -{ - if (DataPoolSize + dataSize > DATA_POOL_CAPACITY) return NULL; - - if (DataPool == NULL) - { - DataPool = malloc (DATA_POOL_CAPACITY); - if (DataPool == NULL) return NULL; - } - - memcpy ((BYTE *)DataPool + DataPoolSize, data, dataSize); - - // Ensure 32-bit alignment for next entries - dataSize = (dataSize + 3) & (~(size_t)3); - - DataPoolSize += dataSize; - return (BYTE *)DataPool + DataPoolSize - dataSize; -} - - -void ClearDictionaryPool () -{ - DataPoolSize = 0; - StringKeyMap.clear(); - IntKeyMap.clear(); +/* + Derived from source code of TrueCrypt 7.1a, which is + Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed + by the TrueCrypt License 3.0. + + Modifications and additions to the original source code (contained in this file) + and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and are governed by the Apache License 2.0 the full text of which is + contained in the file License.txt included in VeraCrypt binary and source + code distribution packages. +*/ + +#include "../Common/Dictionary.h" +#include +#include +#include + +using namespace std; + +static map StringKeyMap; +static map IntKeyMap; + +static void *DataPool = NULL; +static size_t DataPoolSize = 0; + + +void AddDictionaryEntry (char *key, int intKey, void *value) +{ + try + { + if (key) + StringKeyMap[key] = value; + + if (intKey != 0) + IntKeyMap[intKey] = value; + } + catch (exception&) {} +} + + +void *GetDictionaryValue (const char *key) +{ + map ::const_iterator i = StringKeyMap.find (key); + + if (i == StringKeyMap.end()) + return NULL; + + return i->second; +} + + +void *GetDictionaryValueByInt (int intKey) +{ + map ::const_iterator i = IntKeyMap.find (intKey); + + if (i == IntKeyMap.end()) + return NULL; + + return i->second; +} + + +void *AddPoolData (void *data, size_t dataSize) +{ + if (DataPoolSize + dataSize > DATA_POOL_CAPACITY) return NULL; + + if (DataPool == NULL) + { + DataPool = malloc (DATA_POOL_CAPACITY); + if (DataPool == NULL) return NULL; + } + + memcpy ((BYTE *)DataPool + DataPoolSize, data, dataSize); + + // Ensure 32-bit alignment for next entries + dataSize = (dataSize + 3) & (~(size_t)3); + + DataPoolSize += dataSize; + return (BYTE *)DataPool + DataPoolSize - dataSize; +} + + +void ClearDictionaryPool () +{ + DataPoolSize = 0; + StringKeyMap.clear(); + IntKeyMap.clear(); } \ No newline at end of file -- cgit v1.2.3 From 11716ed2dacbb104f8f59867fe66f2c0a6984291 Mon Sep 17 00:00:00 2001 From: David Foerster Date: Tue, 10 May 2016 22:16:32 +0200 Subject: Remove trailing whitespace --- src/Common/Dictionary.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Common/Dictionary.c') diff --git a/src/Common/Dictionary.c b/src/Common/Dictionary.c index 34741951..c6135e3e 100644 --- a/src/Common/Dictionary.c +++ b/src/Common/Dictionary.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. - Modifications and additions to the original source code (contained in this file) + Modifications and additions to the original source code (contained in this file) and all other portions of this file are Copyright (c) 2013-2016 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source @@ -41,7 +41,7 @@ void AddDictionaryEntry (char *key, int intKey, void *value) void *GetDictionaryValue (const char *key) { map ::const_iterator i = StringKeyMap.find (key); - + if (i == StringKeyMap.end()) return NULL; -- cgit v1.2.3