Skip to content
Permalink
Browse files

Code Formatting & Lowercase Directories in src/ (#849)

* - Little bit of code cleanup
- Standard formatting applied across all files

* Changing to lowercase directories in src/

* Reformatting

* Style Settings for CLion

* Erroneously removed <space>

* Add .clang-format

* Add script to run clang-format for all files

* TODO: Change IndentPPDirectives to BeforeHash when in mainline

* Update formatting with clang-format

* Remove CLion formatting rules as it can use clang-format directly

* Fix build
  • Loading branch information...
brandonlehmann committed Jul 28, 2019
1 parent 69ef985 commit 26e395fadcaa1326dab595431526db3899e5df6e
Showing 1,072 changed files with 105,054 additions and 95,171 deletions.
@@ -0,0 +1,65 @@
---
AccessModifierOffset: '-2'
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Left
AlignOperands: 'true'
AlignTrailingComments: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: 'false'
BinPackParameters: 'false'
BreakAfterJavaFieldAnnotations: 'false'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: 'true'
ColumnLimit: '120'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
Cpp11BracedListStyle: 'true'
DerivePointerAlignment: 'false'
DisableFormat: 'false'
FixNamespaceComments: 'true'
IncludeBlocks: Regroup
IndentCaseLabels: 'true'
IndentPPDirectives: None
IndentWidth: '4'
IndentWrappedFunctionNames: 'true'
JavaScriptQuotes: Single
JavaScriptWrapImports: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
MaxEmptyLinesToKeep: '2'
NamespaceIndentation: All
PointerAlignment: Right
ReflowComments: 'true'
SortIncludes: 'true'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'true'
SpaceBeforeCtorInitializerColon: 'false'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '4'
UseTab: Never

...

Large diffs are not rendered by default.

@@ -8,24 +8,24 @@ add_subdirectory(cryptopp)
add_subdirectory(sqlite3)
add_subdirectory(lz4)

if(MSVC)
if (MSVC)
add_subdirectory(rocksDB EXCLUDE_FROM_ALL)
set_property(TARGET upnpc-static cryptopp-static rocksdb sqlite3 lz4 PROPERTY FOLDER "external")
elseif(NOT MSVC)
elseif (NOT MSVC)
set_property(TARGET upnpc-static cryptopp-static sqlite3 lz4 PROPERTY FOLDER "external")
add_custom_target(
rocksdb
COMMAND $(MAKE) rocksdb
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocksdb
rocksdb
COMMAND $(MAKE) rocksdb
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocksdb
)
add_library(rocksdblib STATIC IMPORTED GLOBAL)
set_target_properties(rocksdblib PROPERTIES IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/rocksdb/librocksdb.a)
add_dependencies(rocksdblib rocksdb)
endif()
endif ()

if(MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
elseif(NOT MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
endif()
if (MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
elseif (NOT MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
endif ()

193 include/BlockchainExplorerData.h 100755 → 100644
@@ -1,109 +1,102 @@
// Copyright (c) 2012-2017, The CryptoNote developers, The Bytecoin developers
// Copyright (c) 2018-2019, The TurtleCoin Developers
//
// This file is part of Bytecoin.
//
// Bytecoin is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Bytecoin is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.
// Please see the included LICENSE file for more information.

#pragma once

#include <array>
#include <string>
#include <vector>

#include "CryptoTypes.h"
#include "CryptoNote.h"
#include "CryptoTypes.h"

#include <array>
#include <boost/variant.hpp>
#include <string>
#include <vector>

namespace CryptoNote {

enum class TransactionRemoveReason : uint8_t
{
INCLUDED_IN_BLOCK = 0,
TIMEOUT = 1
};

struct TransactionOutputDetails {
TransactionOutput output;
uint64_t globalIndex;
};

struct TransactionOutputReferenceDetails {
Crypto::Hash transactionHash;
uint64_t number;
};

struct BaseInputDetails {
BaseInput input;
uint64_t amount;
};

struct KeyInputDetails {
KeyInput input;
uint64_t mixin;
TransactionOutputReferenceDetails output;
};


typedef boost::variant<BaseInputDetails, KeyInputDetails> TransactionInputDetails;

struct TransactionExtraDetails {
Crypto::PublicKey publicKey;
BinaryArray nonce;
BinaryArray raw;
};

struct TransactionDetails {
Crypto::Hash hash;
uint64_t size = 0;
uint64_t fee = 0;
uint64_t totalInputsAmount = 0;
uint64_t totalOutputsAmount = 0;
uint64_t mixin = 0;
uint64_t unlockTime = 0;
uint64_t timestamp = 0;
Crypto::Hash paymentId;
bool hasPaymentId = false;
bool inBlockchain = false;
Crypto::Hash blockHash;
uint32_t blockIndex = 0;
TransactionExtraDetails extra;
std::vector<std::vector<Crypto::Signature>> signatures;
std::vector<TransactionInputDetails> inputs;
std::vector<TransactionOutputDetails> outputs;
};

struct BlockDetails {
uint8_t majorVersion = 0;
uint8_t minorVersion = 0;
uint64_t timestamp = 0;
Crypto::Hash prevBlockHash;
uint32_t nonce = 0;
bool isAlternative = false;
uint32_t index = 0;
Crypto::Hash hash;
uint64_t difficulty = 0;
uint64_t reward = 0;
uint64_t baseReward = 0;
uint64_t blockSize = 0;
uint64_t transactionsCumulativeSize = 0;
uint64_t alreadyGeneratedCoins = 0;
uint64_t alreadyGeneratedTransactions = 0;
uint64_t sizeMedian = 0;
double penalty = 0.0;
uint64_t totalFeeAmount = 0;
std::vector<TransactionDetails> transactions;
};

}
namespace CryptoNote
{
enum class TransactionRemoveReason : uint8_t
{
INCLUDED_IN_BLOCK = 0,
TIMEOUT = 1
};

struct TransactionOutputDetails
{
TransactionOutput output;
uint64_t globalIndex;
};

struct TransactionOutputReferenceDetails
{
Crypto::Hash transactionHash;
uint64_t number;
};

struct BaseInputDetails
{
BaseInput input;
uint64_t amount;
};

struct KeyInputDetails
{
KeyInput input;
uint64_t mixin;
TransactionOutputReferenceDetails output;
};

typedef boost::variant<BaseInputDetails, KeyInputDetails> TransactionInputDetails;

struct TransactionExtraDetails
{
Crypto::PublicKey publicKey;
BinaryArray nonce;
BinaryArray raw;
};

struct TransactionDetails
{
Crypto::Hash hash;
uint64_t size = 0;
uint64_t fee = 0;
uint64_t totalInputsAmount = 0;
uint64_t totalOutputsAmount = 0;
uint64_t mixin = 0;
uint64_t unlockTime = 0;
uint64_t timestamp = 0;
Crypto::Hash paymentId;
bool hasPaymentId = false;
bool inBlockchain = false;
Crypto::Hash blockHash;
uint32_t blockIndex = 0;
TransactionExtraDetails extra;
std::vector<std::vector<Crypto::Signature>> signatures;
std::vector<TransactionInputDetails> inputs;
std::vector<TransactionOutputDetails> outputs;
};

struct BlockDetails
{
uint8_t majorVersion = 0;
uint8_t minorVersion = 0;
uint64_t timestamp = 0;
Crypto::Hash prevBlockHash;
uint32_t nonce = 0;
bool isAlternative = false;
uint32_t index = 0;
Crypto::Hash hash;
uint64_t difficulty = 0;
uint64_t reward = 0;
uint64_t baseReward = 0;
uint64_t blockSize = 0;
uint64_t transactionsCumulativeSize = 0;
uint64_t alreadyGeneratedCoins = 0;
uint64_t alreadyGeneratedTransactions = 0;
uint64_t sizeMedian = 0;
double penalty = 0.0;
uint64_t totalFeeAmount = 0;
std::vector<TransactionDetails> transactions;
};

} // namespace CryptoNote

0 comments on commit 26e395f

Please sign in to comment.
You can’t perform that action at this time.