Skip to content

Commit

Permalink
Initialize UUID to null.
Browse files Browse the repository at this point in the history
Close #3483
  • Loading branch information
abellgithub committed Jun 24, 2021
1 parent 8e25bb6 commit 3aee37f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pdal/util/Uuid.hpp
Expand Up @@ -70,6 +70,9 @@ namespace pdal
#pragma pack(1)
struct uuid
{
uuid() : time_low(0), time_mid(0), time_hi_and_version(0), clock_seq(0), node {}
{}

uint32_t time_low;
uint16_t time_mid;
uint16_t time_hi_and_version;
Expand Down Expand Up @@ -97,7 +100,7 @@ class PDAL_DLL Uuid
friend inline bool operator < (const Uuid& u1, const Uuid& u2);
public:
Uuid()
{ clear(); }
{}
Uuid(const char *c)
{ unpack(c); }
Uuid(const std::string& s)
Expand Down
10 changes: 10 additions & 0 deletions test/unit/UuidTest.cpp
Expand Up @@ -52,3 +52,13 @@ TEST(UuidTest, test)
for (size_t i = 0; i < 16; ++i)
EXPECT_EQ(id[i], buf[i]);
}

TEST(UuidTest, initialization)
{
Uuid uuid;

EXPECT_TRUE(uuid.isNull());

Uuid uuid2(std::string("foo"));
EXPECT_TRUE(uuid2.isNull());
}

0 comments on commit 3aee37f

Please sign in to comment.