aboutsummaryrefslogtreecommitdiff
path: root/src/streams.h
Commit message (Collapse)AuthorAgeFilesLines
* net: CAddress & CAddrMan: (un)serialize as ADDRv2Vasil Dimov2020-10-091-0/+1
| | | | | | | | | | Change the serialization of `CAddrMan` to serialize its addresses in ADDRv2/BIP155 format by default. Introduce a new `CAddrMan` format version (3). Add support for ADDRv2 format in `CAddress` (un)serialization. Co-authored-by: Carl Dong <[email protected]>
* refactor: Drop unused CBufferedFile::Seek()Hennadii Stepanov2020-07-261-12/+0
|
* scripted-diff: Bump copyright of files changed in 2019MarcoFalke2019-12-301-1/+1
| | | | | | -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
* Remove unused includespracticalswift2019-10-151-2/+0
|
* util: CBufferedFile fixesLarry Ruane2019-09-101-11/+13
|
* Trivial: Doxygenize existing CBufferedFile and VectorReader commentsBen Woosley2019-01-251-16/+16
|
* Merge #14357: streams: Fix broken streams_vector_reader test. Remove unused ↵MarcoFalke2019-01-051-16/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | seek(size_t). 4f4993fe2a Remove UBSan suppression (practicalswift) 958e1a307e streams: Remove unused seek(size_t) (practicalswift) Pull request description: Fix broken `streams_vector_reader` test. Remove unused `seek(size_t)`. Before this change the test `streams_vector_reader` triggered an unintended unsigned integer wraparound. It tried so seek using a negative value in `reader.seek(-6)`. Changes in this PR: * Fix broken `VectorReader::seek(size_t)` test case * Remove unused `seek(size_t)` Tree-SHA512: 6c6affd680626363eef9e496748f2f86a522325abab9d6b13161f41125cdc29ceb36c2c1509c90b8ff108d606df7629e55e094cc2b6253b05a892b81ce176b71
| * streams: Remove unused seek(size_t)practicalswift2018-11-231-16/+4
| |
* | Merge #14855: test: Correct ineffectual WithOrVersion from transactions_testsMarcoFalke2019-01-041-6/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 75778a0724 test: Correct ineffectual WithOrVersion from transactions_tests (Ben Woosley) Pull request description: `WithOrVersion` uses `|` to combine the versions, and `|` with 0 is a no-op. NicolasDorier / sipa do you recall why the version is being overridden here? Introduced in ab48c5e72156b34300db4a6521cb3c9969be3937 Last updated 81e3228fcb33e8ed32d8b9fbe917444ba080073a Tree-SHA512: 2aea925497bab2da973f17752410a6759d67181a57c3b12a685d184fbfcca2984c45b702ab0bd641d75e086696a0424f1bf77c5578ca765d6882dc03b42d5f9a
| * | test: Correct ineffectual WithOrVersion from transactions_testsBen Woosley2019-01-031-6/+0
| |/ | | | | | | | | | | | | | | | | | | | | WithOrVersion uses | to combine the versions, and | with 0 is a no-op. Instead I run it with PROTOCOL_VERSION and 0 separately, as the original code only tested PROTOCOL_VERSION but apparently only intended to test version 0. Introduced in ab48c5e72156b34300db4a6521cb3c9969be3937 Last updated 81e3228fcb33e8ed32d8b9fbe917444ba080073a
* / Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1practicalswift2018-12-041-2/+2
|/
* Fix typos reported by codespellpracticalswift2018-09-041-1/+1
|
* streams: Implement BitStreamReader/Writer classes.Jim Posen2018-08-251-0/+93
| | | | | | Golomb-Rice coding, as specified in BIP 158, involves operations on individual bits. These classes will be used to implement the encoding/decoding operations.
* streams: Create VectorReader stream interface for vectors.Jim Posen2018-08-251-0/+74
| | | | This is a read analogue for the existing CVectorWriter.
* Fix PSBT deserialization of 0-input transactionsAndrew Chow2018-08-131-0/+1
| | | | | | | | | | 0-input transactions can be ambiguously deserialized as being witness transactions. Since the unsigned transaction is never serialized as a witness transaction as it has no witnesses, we should always deserialize it as a non-witness transaction and set the serialization flags as such. Also always serialize the unsigned transaction as a non-witness transaction.
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* scripted-diff: Remove trailing whitespacesJoão Barbosa2018-07-241-2/+2
| | | | | | | | -BEGIN VERIFY SCRIPT- sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue') -END VERIFY SCRIPT-
* Support deserializing into temporariesPieter Wuille2018-03-131-4/+4
| | | | | | | | | | | | | | | | Currently, the READWRITE macro cannot be passed any non-const temporaries, as the SerReadWrite function only accepts lvalue references. Deserializing into a temporary is very common, however. See for example things like 's >> VARINT(n)'. The VARINT macro produces a temporary wrapper that holds a reference to n. Fix this by accepting non-const rvalue references instead of lvalue references. We don't propagate the rvalue-ness down, as there are no useful optimizations that only apply to temporaries. Then use this new functionality to get rid of many (but not all) uses of the 'REF' macro (which casts away constness).
* Fix typospracticalswift2018-01-281-1/+1
|
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* Merge #10839: Don't use pass by reference to const for cheaply-copied types ↵Wladimir J. van der Laan2017-12-141-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | (bool, char, etc.) 99ba0c3 Don't use pass by reference to const for cheaply-copied types (bool, char, etc.). (practicalswift) Pull request description: Don't use pass by reference to const for cheaply-copied types (`bool`, `char`, etc.). Tree-SHA512: ccad5e2695dff0b3d6de3e713ff3448f2981168cdac72d73bee10ad346b9919d8d4d588933369e54657a244b8b222fa0bef919bc56d983e1fa64b2004e51b225
| * Don't use pass by reference to const for cheaply-copied types (bool, char, ↵practicalswift2017-08-141-2/+2
| | | | | | | | etc.).
* | scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* | Merge #11221: Refactor: simpler readWladimir J. van der Laan2017-11-091-7/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | 9db9d62 Refactor: make the read function simpler (gnuser) Pull request description: Tree-SHA512: 5a80cc1b841488323d421e6a40b245d149cab1988247aed6cc7468dcc042d3df15b6711f25e40ff16e03ac21de36adbaa1d8da61ccdb94f97c8b70c24a5eedc5
| * | Refactor: make the read function simplergnuser2017-09-021-7/+5
| | |
* | | Refactor: Modernize disallowed copy constructors/assignmentDan Raviv2017-09-161-8/+8
| | | | | | | | | | | | Use C++11's better capability of expressing an interface of a non-copyable class by publicly deleting its copy ctor and assignment operator instead of just declaring them private.
* | | Trivial: Documentation fixes for CVectorWriter ctorsdanra2017-08-261-2/+2
| | |
* | | Merge #9964: Add const to methods that do not modify the object for which it ↵MarcoFalke2017-08-161-2/+2
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | is called 6e8c48dc5 Add const to methods that do not modify the object for which it is called (practicalswift) Pull request description: Tree-SHA512: a6888111ba16fb796e320e60806e1a77d36f545989b5405dc7319992291800109eab0b8e8c286b784778f41f1ff5289e7cb6b4afd7aec77f385fbcafc02cffc1
| * | Add const to methods that do not modify the object for which it is calledpracticalswift2017-07-251-2/+2
| | |
* | | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-10/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* / Fix subscript[0] in streams.hJeremy Rubin2017-07-081-1/+1
|/
* Fix some empty vector referencesPieter Wuille2017-04-211-2/+6
| | | | | streams.h has some methods that can be tricked into dereferencing null pointers or end() iterators. Fix this.
* Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1.Pavel Janík2017-03-181-2/+2
|
* Merge #8808: Do not shadow variables (gcc set)Wladimir J. van der Laan2017-03-031-3/+3
|\ | | | | | | | | | | | | ad1ae7a Check and enable -Wshadow by default. (Pavel Janík) 9de90bb Do not shadow variables (gcc set) (Pavel Janík) Tree-SHA512: 9517feb423dc8ddd63896016b25324673bfbe0bffa97f22996f59d7a3fcbdc2ebf2e43ac02bc067546f54e293e9b2f2514be145f867321e9031f895c063d9fb8
| * Do not shadow variables (gcc set)Pavel Janík2016-12-051-3/+3
| |
* | Merge #9353: Add data() method to CDataStream (and use it)Pieter Wuille2017-01-091-4/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | 5113474 wallet: Use CDataStream.data() (Wladimir J. van der Laan) e2300ff bench: Use CDataStream.data() (Wladimir J. van der Laan) adff950 dbwrapper: Use new .data() method of CDataStream (Wladimir J. van der Laan) a2141e4 streams: Remove special cases for ancient MSVC (Wladimir J. van der Laan) af4c44c streams: Add data() method to CDataStream (Wladimir J. van der Laan)
| * | streams: Remove special cases for ancient MSVCWladimir J. van der Laan2016-12-151-4/+0
| | | | | | | | | | | | | | | Quite sure that we haven't supported MSVC 6.0 for ages (MSC_VER 1300 is >= MSVC++ 7.0) but with the C++11 switch we can be sure.
| * | streams: Add data() method to CDataStreamWladimir J. van der Laan2016-12-151-0/+2
| |/ | | | | | | Analogous to c++11 vector data().
* / Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
|/ | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* net: add CVectorWriter and CNetMsgMakerCory Fields2016-11-251-0/+69
| | | | | | | CVectorWriter is useful for overwriting or appending an existing byte vector. CNetMsgMaker is a shortcut for creating messages on-the-fly which are suitable for pushing to CConnman.
* Get rid of nType and nVersionPieter Wuille2016-11-071-9/+25
| | | | | | | | | | | Remove the nType and nVersion as parameters to all serialization methods and functions. There is only one place where it's read and has an impact (in CAddress), and even there it does not impact any of the recursively invoked serializers. Instead, the few places that need nType or nVersion are changed to read it directly from the stream object, through GetType() and GetVersion() methods which are added to all stream classes.
* Make GetSerializeSize a wrapper on top of CSizeComputerPieter Wuille2016-11-071-14/+0
| | | | | | | | | | | Given that in default GetSerializeSize implementations created by ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid of the specialized GetSerializeSize methods everywhere, and just use CSizeComputer. This removes a lot of code which isn't actually used anywhere. For CCompactSize and CVarInt this actually removes a more efficient size computing algorithm, which is brought back in a later commit.
* Make nType and nVersion private and sometimes constPieter Wuille2016-11-071-19/+15
| | | | | Make the various stream implementations' nType and nVersion private and const (except in CDataStream where we really need a setter).
* Make streams' read and write return voidPieter Wuille2016-11-071-16/+9
| | | | | | | | The stream implementations had two cascading layers (the upper one with operator<< and operator>>, and a lower one with read and write). The lower layer's functions are never cascaded (nor should they, as they should only be used from the higher layer), so make them return void instead.
* Remove unused ReadVersion and WriteVersionPieter Wuille2016-11-071-4/+0
| | | | | CDataStream and CAutoFile had a ReadVersion and WriteVersion method that was never used. Remove them.
* serialization: teach serializers variadicsCory Fields2016-11-031-0/+7
| | | | Also add a variadic CDataStream ctor for ease-of-use.
* BIP144: Serialization, hashes, relay (sender side)Pieter Wuille2016-06-221-0/+33
| | | | | | Contains refactorings by Eric Lombrozo. Contains fixup by Nicolas Dorier. Contains cleanup of CInv::GetCommand by Alex Morcos
* Fix OOM bug: UTXO entries with invalid script lengthPieter Wuille2016-04-251-0/+14
|
* CDataStream::ignore Throw exception instead of assert on negative nSize.Patrick Strateman2016-04-251-1/+3
| | | | Previously disk corruption would cause an assert instead of an exception.
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|