Skip to content
This repository
Browse code

Fixed some warnings when compiling using -O2

  • Loading branch information...
commit 5a80bfe363060ba4832fc85df483e89f23d244c2 1 parent 02b476b
authored August 17, 2013

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. 15  xbmc/interfaces/legacy/Alternative.h
15  xbmc/interfaces/legacy/Alternative.h
@@ -31,33 +31,36 @@ namespace XBMCAddon
31 31
   public:
32 32
   private:
33 33
     WhichAlternative pos;
34  
-    unsigned char data[sizeof(T1) > sizeof(T2) ? sizeof(T1) : sizeof(T2)];
  34
+    unsigned char m_data[sizeof(T1) > sizeof(T2) ? sizeof(T1) : sizeof(T2)];
35 35
 
36 36
   public:
37 37
     Alternative() : pos(none) {}
38 38
     Alternative(const Alternative& o)
39 39
     {
  40
+      unsigned char* data = m_data;
40 41
       pos = o.pos;
41 42
       if (pos == first)
42  
-        new(&data) T1(o.former());
  43
+        new(data) T1(o.former());
43 44
       else if (pos == second)
44  
-        new(&data) T2(o.later());
  45
+        new(data) T2(o.later());
45 46
     }
46 47
 
47 48
     inline WhichAlternative which() { return pos; }
48 49
 
49 50
     inline T1& former() throw (WrongTypeException)
50 51
     {
  52
+      unsigned char* data = m_data;
51 53
       if (pos == second)// first and none is ok
52 54
         throw WrongTypeException("Access of XBMCAddon::Alternative as incorrect type");
53 55
       if (pos == none)
54  
-        new(&data) T1();
  56
+        new(data) T1();
55 57
       pos = first;
56 58
       return *((T1*)data);
57 59
     }
58 60
 
59 61
     inline const T1& former() const throw (WrongTypeException)
60 62
     {
  63
+      const unsigned char* data = m_data;
61 64
       if (pos != first)
62 65
         throw WrongTypeException("Access of XBMCAddon::Alternative as incorrect type");
63 66
       return *((T1*)data);
@@ -65,16 +68,18 @@ namespace XBMCAddon
65 68
 
66 69
     inline T2& later() throw (WrongTypeException)
67 70
     {
  71
+      unsigned char* data = m_data;
68 72
       if (pos == first)
69 73
         throw WrongTypeException("Access of XBMCAddon::Alternative as incorrect type");
70 74
       if (pos == none)
71  
-        new(&data) T2();
  75
+        new(data) T2();
72 76
       pos = second;
73 77
       return *((T2*)data);
74 78
     }
75 79
 
76 80
     inline const T2& later() const throw (WrongTypeException)
77 81
     {
  82
+      const unsigned char* data = m_data;
78 83
       if (pos != second)
79 84
         throw WrongTypeException("Access of XBMCAddon::Alternative as incorrect type");
80 85
       return *((T2*)data);

0 notes on commit 5a80bfe

Please sign in to comment.
Something went wrong with that request. Please try again.