Browse Source

pandatool: Make WindowsGuid class trivially copyable

Squelches compiler warning
rdb 1 month ago
parent
commit
cbbd3edc39
2 changed files with 5 additions and 31 deletions
  1. 0 24
      pandatool/src/xfile/windowsGuid.I
  2. 5 7
      pandatool/src/xfile/windowsGuid.h

+ 0 - 24
pandatool/src/xfile/windowsGuid.I

@@ -11,14 +11,6 @@
  * @date 2004-10-03
  */
 
-/**
- *
- */
-INLINE WindowsGuid::
-WindowsGuid() {
-  memset(this, 0, sizeof(WindowsGuid));
-}
-
 /**
  *
  */
@@ -42,22 +34,6 @@ WindowsGuid(unsigned long data1,
 {
 }
 
-/**
- *
- */
-INLINE WindowsGuid::
-WindowsGuid(const WindowsGuid &copy) {
-  (*this) = copy;
-}
-
-/**
- *
- */
-INLINE void WindowsGuid::
-operator = (const WindowsGuid &copy) {
-  memcpy(this, &copy, sizeof(WindowsGuid));
-}
-
 /**
  *
  */

+ 5 - 7
pandatool/src/xfile/windowsGuid.h

@@ -25,14 +25,12 @@
  */
 class WindowsGuid {
 public:
-  INLINE WindowsGuid();
+  constexpr WindowsGuid() = default;
   INLINE WindowsGuid(unsigned long data1,
                      unsigned short data2, unsigned short data3,
                      unsigned char b1, unsigned char b2, unsigned char b3,
                      unsigned char b4, unsigned char b5, unsigned char b6,
                      unsigned char b7, unsigned char b8);
-  INLINE WindowsGuid(const WindowsGuid &copy);
-  INLINE void operator = (const WindowsGuid &copy);
 
   INLINE bool operator == (const WindowsGuid &other) const;
   INLINE bool operator != (const WindowsGuid &other) const;
@@ -45,10 +43,10 @@ public:
   void output(std::ostream &out) const;
 
 private:
-  unsigned long _data1;
-  unsigned short _data2;
-  unsigned short _data3;
-  unsigned char _b1, _b2, _b3, _b4, _b5, _b6, _b7, _b8;
+  unsigned long _data1 = 0;
+  unsigned short _data2 = 0;
+  unsigned short _data3 = 0;
+  unsigned char _b1 = 0, _b2 = 0, _b3 = 0, _b4 = 0, _b5 = 0, _b6 = 0, _b7 = 0, _b8 = 0;
 };
 
 INLINE std::ostream &operator << (std::ostream &out, const WindowsGuid &guid);