Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: net/tools/transport_security_state_generator/trie/trie_writer.h

Issue 2681733008: Improve error handling of the transport security state generator. (Closed)
Patch Set: Remove ErrorList Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/tools/transport_security_state_generator/trie/trie_writer.h
diff --git a/net/tools/transport_security_state_generator/trie/trie_writer.h b/net/tools/transport_security_state_generator/trie/trie_writer.h
index 93fce3624f7193f8c5f281aaf643981d1b8372c3..b3d5d8865bab0d045ab648f0e0e45b7f87584d0b 100644
--- a/net/tools/transport_security_state_generator/trie/trie_writer.h
+++ b/net/tools/transport_security_state_generator/trie/trie_writer.h
@@ -39,8 +39,10 @@ class TrieWriter {
~TrieWriter();
// Constructs a trie containing all |entries|. The output is written to
- // |buffer_|. Returns the position of the trie root.
- uint32_t WriteEntries(const TransportSecurityStateEntries& entries);
+ // |buffer_| and |*position| is set to the position of the trie root. Returns
+ // true on success and false on failure.
+ bool WriteEntries(const TransportSecurityStateEntries& entries,
+ uint32_t* position);
// Returns the position |buffer_| is currently at. The returned value
// represents the number of bits.
@@ -54,11 +56,12 @@ class TrieWriter {
const std::vector<uint8_t>& bytes() const { return buffer_.bytes(); }
private:
- uint32_t WriteDispatchTables(ReversedEntries::iterator start,
- ReversedEntries::iterator end);
+ bool WriteDispatchTables(ReversedEntries::iterator start,
+ ReversedEntries::iterator end,
+ uint32_t* position);
// Serializes |*entry| and writes it to |*writer|.
- void WriteEntry(const TransportSecurityStateEntry* entry,
+ bool WriteEntry(const TransportSecurityStateEntry* entry,
TrieBitBuffer* writer);
// Removes the first |length| characters from all entries between |start| and
@@ -69,8 +72,9 @@ class TrieWriter {
// Searches for the longest common prefix for all entries between |start| and
// |end|.
- std::vector<uint8_t> LongestCommonPrefix(ReversedEntries::iterator start,
- ReversedEntries::iterator end) const;
+ std::vector<uint8_t> LongestCommonPrefix(
+ ReversedEntries::const_iterator start,
+ ReversedEntries::const_iterator end) const;
// Returns the reversed |hostname| as a vector of bytes. The reversed hostname
// will be terminated by |kTerminalValue|.

Powered by Google App Engine
This is Rietveld 408576698