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

Unified Diff: util/misc/uuid.h

Issue 436933002: Fix the UUID structure (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | util/misc/uuid.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/misc/uuid.h
diff --git a/util/misc/uuid.h b/util/misc/uuid.h
index 260d8db95777538b071f03d008a980ddcaf12f31..25b2dbb1c93789b0280855ab225565133c579bdb 100644
--- a/util/misc/uuid.h
+++ b/util/misc/uuid.h
@@ -27,25 +27,34 @@ namespace crashpad {
//! primarily by Microsoft.
//!
//! A %UUID is a unique 128-bit number specified by RFC 4122.
-//!
-//! This is a standard-layout structure, and it is acceptable to use `memcpy()`
-//! to set its value.
struct UUID {
//! \brief Initializes the %UUID to zero.
UUID();
+ //! \copydoc InitializeFromBytes()
+ explicit UUID(const uint8_t* bytes);
+
//! \brief Initializes the %UUID from a sequence of bytes.
//!
+ //! \a bytes is taken as a %UUID laid out in big-endian format in memory. On
+ //! little-endian machines, appropriate byte-swapping will be performed to
+ //! initialize an object’s data members.
+ //!
//! \param[in] bytes A buffer of exactly 16 bytes that will be assigned to the
//! %UUID.
- explicit UUID(const uint8_t* bytes);
+ void InitializeFromBytes(const uint8_t* bytes);
//! \brief Formats the %UUID per RFC 4122 §3.
//!
//! \return A string of the form `"00112233-4455-6677-8899-aabbccddeeff"`.
std::string ToString() const;
- uint8_t data[16];
+ // These fields are laid out according to RFC 4122 §4.1.2.
+ uint32_t data_1;
+ uint16_t data_2;
+ uint16_t data_3;
+ uint8_t data_4[2];
+ uint8_t data_5[6];
};
} // namespace crashpad
« no previous file with comments | « no previous file | util/misc/uuid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698