Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(70)

Unified Diff: src/common/linux/guid_creator.cc

Issue 535002: Use stdint types everywhere. (Closed)
Patch Set: Renamed uint128_t to uint128_struct Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/common/linux/guid_creator.cc
===================================================================
--- a/src/common/linux/guid_creator.cc
+++ b/src/common/linux/guid_creator.cc
@@ -41,35 +41,35 @@
//
// This class is used to generate random GUID.
// Currently use random number to generate a GUID since Linux has
// no native GUID generator. This should be OK since we don't expect
// crash to happen very offen.
//
class GUIDGenerator {
public:
- static u_int32_t BytesToUInt32(const u_int8_t bytes[]) {
- return ((u_int32_t) bytes[0]
- | ((u_int32_t) bytes[1] << 8)
- | ((u_int32_t) bytes[2] << 16)
- | ((u_int32_t) bytes[3] << 24));
+ static uint32_t BytesToUInt32(const uint8_t bytes[]) {
+ return ((uint32_t) bytes[0]
+ | ((uint32_t) bytes[1] << 8)
+ | ((uint32_t) bytes[2] << 16)
+ | ((uint32_t) bytes[3] << 24));
}
- static void UInt32ToBytes(u_int8_t bytes[], u_int32_t n) {
+ static void UInt32ToBytes(uint8_t bytes[], uint32_t n) {
bytes[0] = n & 0xff;
bytes[1] = (n >> 8) & 0xff;
bytes[2] = (n >> 16) & 0xff;
bytes[3] = (n >> 24) & 0xff;
}
static bool CreateGUID(GUID *guid) {
InitOnce();
guid->data1 = random();
- guid->data2 = (u_int16_t)(random());
- guid->data3 = (u_int16_t)(random());
+ guid->data2 = (uint16_t)(random());
+ guid->data3 = (uint16_t)(random());
UInt32ToBytes(&guid->data4[0], random());
UInt32ToBytes(&guid->data4[4], random());
return true;
}
private:
static void InitOnce() {
pthread_once(&once_control, &InitOnceImpl);

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted