@@ -51,8 +51,8 @@ static_assert(sizeof(UUID) == 16, "Guid size mismatch");
51
51
52
52
namespace Firebird {
53
53
54
- const int GUID_BUFF_SIZE = 39 ;
55
- const int GUID_BODY_SIZE = 36 ;
54
+ inline constexpr int GUID_BUFF_SIZE = 39 ;
55
+ inline constexpr int GUID_BODY_SIZE = 36 ;
56
56
57
57
void GenerateRandomBytes (void * buffer, FB_SIZE_T size);
58
58
@@ -69,24 +69,21 @@ class Guid
69
69
" {%08X-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}" ;
70
70
static constexpr int GUID_FORMAT_ARGS = 11 ;
71
71
72
- Guid ()
73
- {
74
- memset (&m_data, 0 , SIZE);
75
- }
72
+ Guid () noexcept {}
76
73
77
74
public:
78
75
static constexpr ULONG SIZE = sizeof (UUID);
79
76
80
- static Guid empty ()
77
+ static Guid empty () noexcept
81
78
{
82
79
return Guid ();
83
80
}
84
81
85
- Guid (const Guid& other)
82
+ Guid (const Guid& other) noexcept
86
83
: m_data(other.m_data)
87
84
{}
88
85
89
- Guid (const UUID& uuid)
86
+ Guid (const UUID& uuid) noexcept
90
87
: m_data(uuid)
91
88
{}
92
89
@@ -95,7 +92,7 @@ class Guid
95
92
memcpy (&m_data, data, SIZE);
96
93
}
97
94
98
- Guid& operator =(const Guid& other)
95
+ Guid& operator =(const Guid& other) noexcept
99
96
{
100
97
m_data = other.m_data ; // copy struct by value
101
98
return *this ;
@@ -111,7 +108,7 @@ class Guid
111
108
return !(*this == other);
112
109
}
113
110
114
- const UCHAR* getData () const
111
+ const UCHAR* getData () const noexcept
115
112
{
116
113
return reinterpret_cast <const UCHAR*>(&m_data);
117
114
}
@@ -163,7 +160,7 @@ class Guid
163
160
return fromString (str.nullStr ());
164
161
}
165
162
166
- void copyTo (UUID& ptr) const
163
+ void copyTo (UUID& ptr) const noexcept
167
164
{
168
165
ptr = m_data; // copy struct by value
169
166
}
@@ -175,7 +172,7 @@ class Guid
175
172
176
173
// Convert platform-dependent GUID into platform-independent form according to RFC 4122
177
174
178
- void convert (UCHAR* data) const
175
+ void convert (UCHAR* data) const noexcept
179
176
{
180
177
data[0 ] = (m_data.Data1 >> 24 ) & 0xFF ;
181
178
data[1 ] = (m_data.Data1 >> 16 ) & 0xFF ;
@@ -205,7 +202,7 @@ class Guid
205
202
}
206
203
207
204
private:
208
- UUID m_data;
205
+ UUID m_data{} ;
209
206
};
210
207
211
208
} // namespace
0 commit comments